Foundry can automatically optimize Spark profiles for jobs based on historical resource usage. When enabled, Foundry analyzes the resource consumption of recent job runs and recommends a profile configuration that right-sizes driver and executor resources, reducing unnecessary resource allocation while maintaining job reliability.
For Foundry to apply a managed profile recommendation, the following conditions must all be met:
MANAGED_PROFILE profile applied.If any of these conditions are not met, the job will run with the original profile configuration.
When a job meets the eligibility criteria, Foundry calculates a recommended profile based on the resource usage patterns from the last 5 successful runs.
For each resource dimension (executor memory, executor cores, driver memory, driver cores, and number of executors), Foundry takes the maximum observed usage across the last 5 runs, capped at the original request value. This prevents scaling up a job beyond its initial resource allocation.
For jobs with low parallelism requirements, Foundry may recommend running the job in local mode for improved efficiency. This optimization applies when:
numExecutors * executorCores <= 4
When local mode is recommended, the driver resources are adjusted to accommodate the workload that would have been distributed across executors:
numExecutors * executorMemoryGb).numExecutors * executorCores).This consolidation eliminates the overhead of distributed execution for small jobs while ensuring sufficient resources are available on the driver.
Jobs using the default Spark profile are automatically eligible for managed profile recommendations. No additional configuration is required.
To enable managed profiles on a job that uses custom Spark profiles, add the MANAGED_PROFILE profile to your existing profile configuration. This signals to Foundry that the job should be considered for automatic profile optimization.
Learn how to apply Spark profiles to your transforms in the Apply Spark profiles documentation.