Automation framework for analysis, tuning, routing, and migration of Apache Spark workloads from CPU to GPU.
NVIDIA cuDF Router
NVIDIA cuDF Router helps teams evaluate and migrate Apache Spark workloads from CPU to GPU with cuDF for Apache Spark. It analyzes Spark event logs, recommends Spark and cluster configuration, records job history, validates CPU/GPU results, and makes CPU/GPU routing decisions from accumulated evidence.
NVIDIA cuDF Router has two primary usage options:
| Option | Use Case(s) | Primary Interface |
|---|---|---|
| 1. Active Router with Spark Connect | Platforms that can run Spark Connect jobs and want transparent inline CPU/GPU routing. | Standalone Router with gRPC proxy |
| 2. API integration with capture and replay | Platforms that own job submission and want to interface with the cuDF Router at job lifecycle boundaries. | cuDF Router REST APIs |
Common Setup
The cuDF Router NGC collection provides the following:
- Resource bundle (
cudf-router) with the Python wheel, install script, and all runtime artifacts - Container images and a Helm chart for Kubernetes deployments will be available in the next release
For example, install the cuDF Router from the resource bundle and initialize configuration:
bash cudf-router_v<version>/install-<version>.sh \
-w cudf-router_v<version>/nvidia_aether-<version>-py3-none-any.whl \
-p <platform>
source venv-aether/bin/activate
aether config init
aether config set core.selected_platform <platform>
aether migrate apply
GPU execution requires a Spark runtime with the cuDF for Apache Spark plugin jar installed on the target GPU nodes. The cuDF Router also needs read access to Spark event logs and write access to its output, cache, and any platform artifact locations.
For local single-user usage, SQLite is the default job-history database. For shared REST or router deployments, use PostgreSQL and run the cuDF Router REST service and workers from the same durable database.
aether config set database.job_history_db_type postgresql
aether config set database.job_history_connection <postgres-connection>
aether migrate apply
Use aether config list for the full configuration surface.
Supported platforms:
| Platform | <platform> value |
|---|---|
| On-premises | onprem (default) |
| Amazon EMR | emr |
| Google Cloud Dataproc | dataproc |
| Google Kubernetes Engine | gke |
| Databricks on AWS | databricks.aws |
Spark and sandbox support differs by integration path:
| Area | Current Guidance |
|---|---|
| Active Router | Spark 4.0+ Spark Connect environments |
| Capture and replay | Spark 3.5+ capture hosts and Spark Connect replay targets |
| Sandbox replay | Iceberg sandboxing on Spark 3.5+; Delta sandboxing on Spark 4.0+ where Delta is on the classpath |
Platform support for sandbox replay is separate from Spark version support. Check the platform guide
before enabling shadowRun.requiresSandbox=true or enable_runtime_sandbox=true.
1. Active Router With Spark Connect
Use the Active Router when Spark clients can connect through a Spark Connect proxy. The Smart Router sits between the client and CPU/GPU Spark Connect servers. It asks the cuDF Router REST service for routing decisions, injects recommended Spark configuration into sessions, records CPU sessions, and can run background GPU shadow replay after a CPU run completes.
This path requires Spark Connect protocol compatibility between clients, the router, and upstream Spark Connect servers. The active inline router path is intended for Spark 4.0+ environments. Capture and replay support for non-inline flows can cover Spark 3.5+ environments; see API integration with capture and replay.
Deployment
-
Deploy the cuDF Router REST service. For local development:
aether rest runProduction-style router deployments should use PostgreSQL and durable workers. To enable interactive API docs at
http://<host>:8000/docs, runaether config set rest.enable_docs true. -
Deploy the Smart Router. The Smart Router jars are included in the
nvidia_aetherwheel under theaether/resources/smart-router/package directory.Choose a local runtime directory for the router and set
ROUTER_HOMEto that path; the examples below use/opt/cudf-router/smart-router, but any directory readable by the router process is fine. Copy bothcom.nvidia.grpc-proxy-*.jarandaether-connect-*.jarfrom the installed wheel'saether/resources/smart-router/directory intoROUTER_HOME. -
Provide TLS material for the router. For production, use a certificate and key issued by the deployment environment. For local testing, a self-signed certificate is sufficient:
openssl req -x509 -newkey rsa:4096 -nodes -days 365 \ -keyout "$ROUTER_HOME/server.key" \ -out "$ROUTER_HOME/server.crt" \ -subj "/CN=<router-host>" \ -addext "subjectAltName=DNS:<router-host>,IP:<router-ip>" -
Create a Smart Router config:
proxy: port: 15002 certChainPath: /path/to/server.crt privateKeyPath: /path/to/server.key aether: apiUrl: http://localhost:8000 cluster: cpu: # Use one of sparkConnectUri, clusterId, or configFile. configFile: /path/to/cpu-cluster.yaml gpu: configFile: /path/to/gpu-cluster.yaml # Optional target cluster file with enforced Spark properties: # targetClusterFile: /path/to/gpu-target-cluster.yaml shadowRun: enabled: true requiresSandbox: falsesparkConnectUriconnects to a pre-existing Spark Connect server,clusterIduses an existing platform cluster and lets the cuDF Router start/stop Spark Connect, andconfigFilelets the cuDF Router provision the cluster and Spark Connect server. Platform support varies:Platform Active Router Support On-premises Existing clusters only EMR Existing clusters or clusters created by the cuDF Router Dataproc Existing clusters or clusters created by the cuDF Router -
Start the router with Java 17 or newer:
export ROUTER_CP="$(ls "$ROUTER_HOME"/com.nvidia.grpc-proxy-*.jar):$(ls "$ROUTER_HOME"/aether-connect-*.jar)" java -Dconfig.file=/path/to/smart-router.yaml \ -cp "$ROUTER_CP" \ com.nvidia.smartrouter.GrpcGatewayIn production, run this command as a managed service, container entrypoint, or Kubernetes workload. Expose the configured gRPC port, and mount the YAML file plus TLS cert/key into the paths referenced by the config.
-
Ensure network access:
- Spark clients can reach the Smart Router gRPC port.
- Smart Router can reach the cuDF Router REST service.
- Smart Router can reach the CPU/GPU Spark Connect servers.
- Spark event logs are written to storage the cuDF Router can read.
Usage
Point the Spark client at the Smart Router and use a stable connect_id for repeated runs of the
same logical job:
export GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=/path/to/server.crt
export SPARK_REMOTE="sc://<router-host>:15002/;use_ssl=true;token=spark-secret-token;connect_id=<job-id>"
spark-submit your_job.py
The first run normally routes to CPU while the cuDF Router collects evidence. When the client calls
spark.stop(), the router releases the primary endpoint, sends the completed event log to the cuDF Router,
and, when shadow runs are enabled, replays the recorded session on GPU. If the GPU shadow run
profiles successfully, validates successfully, and satisfies the cuDF Router routing policy, later runs with
the same connect_id can route to GPU.
When replay could mutate production data, enable sandbox replay only on platforms where runtime sandboxing is configured and supported:
shadowRun:
enabled: true
requiresSandbox: true
With sandbox replay, the cuDF Router starts sandbox-aware GPU Spark Connect servers for staging and workload
phases so GPU validation does not write to production tables. Configure
platform.<platform>.cluster.sandbox.warehouse_path and the required sandbox artifacts for the
platform before enabling this mode.
2. API Integration With Capture And Replay
Use API integration when the platform owns job submission and cannot, or should not, put the Smart Router in the live Spark Connect path. The platform calls the cuDF Router before a job starts and after it finishes. The cuDF Router owns the routing decision and evidence processing; the platform owns execution, isolation policy, quotas, and job lifecycle controls.
The two required lifecycle calls are:
| Boundary | Endpoint | Purpose |
|---|---|---|
| Before execution | GET /api/v2/route_job | Decide CPU vs GPU and return Spark configuration to apply. |
| After completion | POST /api/v2/process_completed_job | Record the run, process the event log, and trigger shadow replay when needed. |
Deployment
-
Deploy the cuDF Router REST service:
aether rest runFor production, run the REST service and worker processes from a managed service or container deployment using the same durable database.
Set
rest.enable_docs=truewhen interactive API docs should be available athttp://<aether-host>:8000/docs. -
Configure the platform and event-log access along with shadow run iteration settings:
aether config set core.selected_platform <platform> aether config set platform.<platform>.spark_event_log_dir <event-log-dir-uri> aether config set migration.min_shadow_runs 1 aether config set migration.max_shadow_runs 2 -
Enable capture handoff when the cuDF Router should return Spark Workload Replay capture properties from
route_job:aether config set platform.<platform>.provide_capture_plugin true aether config set platform.<platform>.set_capture_on_unknown true aether config set platform.<platform>.spark_workload_capture_dir <capture-output-dir-uri> aether config set platform.<platform>.workload_replay_capture_jar_uri <capture-plugin-jar-uri>Leave
workload_replay_capture_jar_uriunset only when the platform prepares the capture plugin through another mechanism, such as bootstrap or a preinstalled runtime. -
Provide a GPU shadow execution path. Replay driven by the cuDF Router uses Spark Connect server lifecycle APIs and the Spark Workload Replay client:
POST /api/v2/clusterorPOST /api/v2/cluster/registerPOST /api/v2/spark_connect_serverPOST /api/v2/spark_connect_server/spark_workload_replayDELETE /api/v2/spark_connect_serverDELETE /api/v2/clusterwhen the cuDF Router created the cluster
If replay can mutate data, configure an isolated GPU sandbox with read-only production access, a writable sandbox warehouse, and platform policy for authentication, authorization, network isolation, quota, and cost controls.
Usage
Call route_job before each logical job run:
curl -sS \
"http://<aether-host>:8000/api/v2/route_job?aether_job_id=<job-id>&custom_job_run_id=<run-id>" \
| python3 -m json.tool
Apply the response as follows:
| Response | Platform Action |
|---|---|
next_run_type=CAPTURE | Run on CPU and merge the returned recommended_spark_configuration into the job's Spark config to enable capture. |
next_spark_runtime=SPARK | Run on CPU. If capture properties are present, apply them on top of the platform's normal Spark config. |
next_spark_runtime=SPARK_RAPIDS | Run on GPU and apply the returned recommended Spark configuration. |
404 | No routing evidence exists and capture-on-unknown is not enabled; run the normal CPU path and report completion. |
After the job finishes, call process_completed_job with the event log or the platform job ID:
curl -sS -X POST "http://<aether-host>:8000/api/v2/process_completed_job" \
-H "Content-Type: application/json" \
-d '{
"aether_job_id": "<job-id>",
"custom_job_run_id": "<run-id>",
"job_status": "finished",
"event_log": "<event-log-uri>",
"enable_shadow_run": true
}'
Poll completion status:
curl -sS \
"http://<aether-host>:8000/api/v2/process_completed_job/status?aether_job_id=<job-id>" \
| python3 -m json.tool
When a CPU run has a replay capture and the cuDF Router policy requires a shadow run, the cuDF Router replays the captured workload on a GPU Spark Connect server, profiles the GPU event log, validates against the CPU run, and updates the next routing decision. The platform can inspect readiness and the latest issued route:
curl -sS "http://<aether-host>:8000/api/v2/job_migration_readiness?aether_job_id=<job-id>"
curl -sS "http://<aether-host>:8000/api/v2/route_decision?aether_job_id=<job-id>"
Supporting Capabilities
| Capability | Purpose |
|---|---|
| Qualification | Analyze CPU event logs to estimate GPU acceleration potential and generate initial recommendations. |
| Profiling | Analyze GPU event logs, identify bottlenecks, and generate updated recommendations. |
| Tuning | Run iterative GPU trials to optimize Spark configuration and, optionally, cluster shape. |
| Validation | Compare CPU and GPU outputs or event-log metrics to confirm correctness. |
| Routing | Decide CPU vs GPU from qualification, profiling, validation, cost, SLA, and shadow-run evidence. |
| Reporting | Show job history, performance, cost, and migration status through CLI output and the report UI. |
| Sandbox | Redirect supported table reads/writes during replay so GPU evaluation does not mutate production data. |
What's Included
The cuDF Router NGC collection includes the following artifacts:
| Artifact | Type | Description |
|---|---|---|
cudf-router | Resource | nvidia_aether Python wheel, offline wheelhouses (Python 3.10–3.12), install script, and bundled runtime JARs (Smart Router, sandbox plugin, workload-replay capture and replay). |
Appendix
CLI Commands
| Command | Purpose |
|---|---|
aether config | Manage cuDF Router configuration, selected platform, and runtime settings. |
aether qualify | Analyze CPU Spark event logs or platform jobs to estimate GPU acceleration potential and generate initial recommendations. |
aether profile | Analyze GPU Spark event logs or platform jobs to identify bottlenecks and generate updated recommendations. |
aether submit | Submit a GPU-accelerated Spark job using a stored job ID or Spark configuration ID. |
aether run | Run the end-to-end CLI workflow: qualify a CPU job, provision or reuse a GPU cluster, submit GPU trials, tune, and validate. |
aether validate | Compare CPU and GPU job outputs or event-log-derived metrics to verify correctness. |
aether tune | Iteratively submit and profile GPU runs to optimize Spark configuration and optional cluster shape. |
aether report | Generate job, performance, and cost reports, or launch the report UI. |
aether cluster | Create, register, inspect, resize, list, and delete platform clusters. |
aether rest | Run the cuDF Router REST API server or durable REST worker pools. |
aether diagnose | Diagnose paired CPU/GPU event logs with query matching and performance comparison. |
aether database | Inspect and manage the job-history database. |
aether train | Train a custom QualX model from validated CPU/GPU job pairs. |
aether migrate | Apply, list, or roll back job-history database schema migrations. |
aether version | Display cuDF Router version and build information. |
Core REST APIs
| API | Purpose | Function |
|---|---|---|
GET /api/v2/route_job | Return the next CPU/GPU route and Spark configuration for a logical job. | Pre-run integration boundary for platforms and the Smart Router. |
GET /api/v2/route_decision | Read the current persisted routing decision without recalculating it. | Lets UIs and operators inspect the last recorded route state. |
GET /api/v2/job_recommendations | Return recommended Spark configuration and cluster shape for a job. | Supplies either tool-generated TUNING config or BEST_TESTED historical config. |
GET /api/v2/job_migration_readiness | Return qualification, profile, validation, and next-run readiness state. | Explains whether the next run should be CPU, GPU, or shadow run. |
POST /api/v2/process_completed_job | Asynchronously process a completed Spark job. | Post-run integration boundary; records success/failure, runs qualify/profile, and can trigger shadow replay. |
GET /api/v2/process_completed_job/status | Poll process_completed_job state by aether_job_id. | Lets callers wait for asynchronous evidence processing to finish. |
POST /api/v2/qualify | Qualify CPU workload event logs or platform jobs. | Produces initial GPU suitability, cost, cluster, and Spark configuration recommendations. |
GET /api/v2/qualify/status | Poll asynchronous qualification state by aether_job_id. | Used when POST /qualify is submitted with async preference. |
POST /api/v2/profile | Profile GPU workload event logs or platform jobs. | Produces GPU performance analysis and updated Spark configuration recommendations. |
GET /api/v2/profile/status | Poll asynchronous profiling state by aether_job_id. | Used when POST /profile is submitted with async preference. |
POST /api/v2/validate | Validate a GPU job against the corresponding CPU job. | Confirms whether CPU and GPU results match before GPU routing is trusted. |
GET /api/v2/cluster | Get details for one cluster tracked by the cuDF Router. | Inspect platform cluster state and metadata. |
GET /api/v2/clusters | List clusters tracked by the cuDF Router. | Inventory managed and registered compute resources. |
POST /api/v2/cluster | Create a cluster in the selected platform. | Provision CPU, GPU, sandbox, or Spark Connect-ready clusters when the cuDF Router owns lifecycle. |
POST /api/v2/cluster/register | Register an externally created cluster. | Let the cuDF Router use an existing cluster without taking ownership of its lifecycle. |
DELETE /api/v2/cluster | Delete a cluster created by the cuDF Router. | Clean up platform resources that the cuDF Router owns. |
POST /api/v2/spark_connect_server | Start a Spark Connect server on a cluster tracked by the cuDF Router. | Create an endpoint for router traffic or workload replay. |
DELETE /api/v2/spark_connect_server | Stop a Spark Connect server started by the cuDF Router. | Release the Spark Connect process and related lifecycle record. |
POST /api/v2/spark_connect_server/spark_workload_replay | Replay a captured workload through Spark Connect. | Run GPU shadow replay from a Spark Workload Replay capture file or captured job tracked by the cuDF Router. |
GET /api/v2/spark_config | Retrieve the latest recommended Spark configuration by platform or custom job-run ID. | Resolve recommended Spark properties for a job run. |
POST /api/v2/spark_config | Register a Spark configuration and return its ID. | Deduplicate and reference Spark properties from cluster/server lifecycle calls. |
GET /api/v2/job_routing_list | View routing allowlist and denylist entries. | Inspect routing policy overrides. |
POST /api/v2/job_routing_list | Add or update routing allowlist and denylist entries. | Control whether specific jobs are eligible for routed execution. |
DELETE /api/v2/job_routing_list/{aether_job_id} | Remove one routing list entry. | Return a job to the default routing policy. |
GET /healthz | Return REST readiness and database connectivity. | Database-aware readiness. |
GET /live | Return REST process liveness. | REST API availability. |
GET /version | Return cuDF Router version information. | Runtime compatibility and support diagnostics. |
License
This project requires, and may download and install, additional third-party open source software projects. Review the license terms of these open source projects before use.