Managed Service for Apache Spark cluster caching lets you accelerate job execution by storing frequently accessed Cloud Storage data locally on cluster nodes. This local cache reduces read latency and minimizes Cloud Storage API requests for repetitive workloads.
When you enable Managed Service for Apache Spark cluster caching, the cluster caches Cloud Storage data frequently accessed by your Spark jobs.
Benefits
- Improved performance: Caching can improve job performance by reducing the amount of time spent retrieving data from storage.
- Reduced storage costs: Since hot data is cached on local disk, fewer API calls are made to storage to retrieve data.
- Spark job applicability: When cluster caching is enabled on a cluster, it applies to all Spark jobs run on the cluster, whether submitted to the Managed Service for Apache Spark or run independently on the cluster.
Limitations and requirements
- Caching applies to Managed Service for Apache Spark jobs only.
- Only Cloud Storage data is cached.
- Caching only applies to clusters that meet the following requirements:
- The cluster has one master and
nworkers (High Availability (HA) and single node clusters are not supported). - This feature is available in Managed Service for Apache Spark
image versions
2.0.72+,2.1.20+, and2.2.0+. - Each cluster node must have local SSDs attached with the NVME (Non-Volatile Memory Express) interface (Persistent Disks (PDs) are not supported). Data is cached on NVME local SSDs only.
- The cluster uses the default VM service account for authentication. Custom VM service accounts are not supported.
- The cluster has one master and
Enable cluster caching
You can enable cluster caching when you create a Managed Service for Apache Spark cluster using the Google Cloud console, Google Cloud CLI, or the Dataproc API.
Google Cloud console
- Open the Google Cloud console Create cluster page.
- Click Additional configuration to expand that section.
- Edit Customization & Other.
- In the panel that opens, in the Cluster properties section, click + Add properties.
- Select dataproc in the Prefix list, then add the key
dataproc.cluster.caching.enabledand valuetrue.
gcloud CLI
Run the gcloud dataproc clusters create
command locally in a terminal window or in
Cloud Shell
using the dataproc:dataproc.cluster.caching.enabled=true
cluster property.
Example:
gcloud dataproc clusters create CLUSTER_NAME \ --region=REGION \ --properties dataproc:dataproc.cluster.caching.enabled=true \ --num-master-local-ssds=2 \ --master-local-ssd-interface=NVME \ --num-worker-local-ssds=2 \ --worker-local-ssd-interface=NVME \ other args ...
REST API
Set SoftwareConfig.properties
to include the "dataproc:dataproc.cluster.caching.enabled": "true"
cluster property
as part of a
clusters.create
request.