Dataproc
Google Cloud Dataproc is a fully managed service for running Apache Spark , Hadoop , Hive , Presto , and other open source tools. It differs from on pre...
What makes Dataproc different from a traditional on-prem Hadoop or Spark setup?
Google Cloud Dataproc is a fully managed service for running Apache Spark , Hadoop , Hive , Presto , and other open source tools. It differs from on prem deployments in several fundamental ways: Rapid provisioning : Clusters spin up in under 90 seconds , compared to hours or days for on prem hardware procurement and configuration. Per second billing : You pay only for the time workers are running. On prem clusters run 24/7 regardless of utilization. Separation of compute and storage : Data lives
Scenario: You have a Spark job that needs to run every 4 hours. How would you orchestrate it on Dataproc?
For a recurring Spark job on a 4 hour schedule, the recommended approach depends on the complexity of your workflow: Option 1 Dataproc Workflow Templates + Cloud Scheduler (simple): A Workflow Template defines the cluster configuration and job steps in a single declarative resource. Cloud Scheduler sends a message every 4 hours, a Cloud Function receives it and instantiates the workflow template. The cluster is created, the job runs, and the cluster is deleted automatically. Option 2 Cloud Compo
How do initialization actions work in Dataproc clusters, and what are they used for?
Initialization actions are shell scripts that run automatically on every node (master and workers) during cluster startup, after the base image is provisioned but before the cluster is marked as ready. How they work: 1. Scripts are stored in GCS and referenced at cluster creation time. 2. Dataproc downloads and executes them as root on each node. 3. If any script exits with a non zero status, the cluster creation fails . 4. Scripts run in parallel across nodes by default. Example initialization
Scenario: Your PySpark job uses pandas UDFs and fails intermittently. What is the likely cause?
Intermittent failures with pandas UDFs (also called Vectorized UDFs ) on Dataproc almost always stem from dependency mismatches between the driver and worker nodes. Root causes and fixes: 1. Missing or mismatched PyArrow version: Pandas UDFs use Apache Arrow for data serialization between the JVM and Python. If pyarrow is missing or its version is incompatible with the installed pandas , you get intermittent ArrowInvalid or serialization errors. 2. Python interpreter mismatch: If the driver uses
What is the recommended way to store and access data for Dataproc jobs: HDFS or GCS?
Google Cloud Storage (GCS) is the recommended default for Dataproc workloads. Use HDFS only when specific workload characteristics require it. Why GCS is preferred: Factor GCS HDFS Durability 99.999999999% (eleven 9s) Depends on replication factor Persistence Data survives cluster deletion Data is lost when cluster is deleted Cost Pay for storage only Pay for attached disks on every node Scalability Virtually unlimited Limited by disk capacity Access control IAM + signed URLs HDFS permissions (l
How can Dataproc clusters be automatically deleted after job completion?
Dataproc provides several mechanisms to ensure clusters do not run (and accrue charges) longer than needed: 1. Max idle time ( max idle ): The cluster auto deletes after a period of no running jobs. 2. Max age ( max age ): The cluster auto deletes after a fixed lifetime, regardless of activity. 3. Workflow Templates (ephemeral clusters): Workflow Templates create a managed cluster that is automatically deleted when all job steps complete. 4. Orchestrator managed deletion: When using Cloud Compos
Scenario: You have a Hive job that requires the Hive Metastore to persist across clusters. What approach would you use?
The default Hive Metastore runs on the cluster's master node and is lost when the cluster is deleted. To persist metadata across ephemeral clusters, externalize the metastore to a managed database. Approach 1 Dataproc Metastore Service (recommended): A fully managed, serverless Hive Metastore compatible service. Approach 2 External Cloud SQL (MySQL) metastore: Host the Hive Metastore database on Cloud SQL and configure each cluster to connect to it. Key considerations: Table data should be store
What are the key performance tuning areas when running Spark on Dataproc?
Performance tuning Spark on Dataproc spans cluster sizing, Spark configuration, data layout, and GCS connector settings. 1. Executor sizing: Balance executor count, cores, and memory to maximize YARN utilization. Rule of thumb: Leave 1 core and ~1 GB per node for YARN NodeManager overhead. 2. Shuffle and partitioning: 3. GCS connector tuning: 4. Local SSDs for shuffle: Use local SSDs to avoid spilling shuffle data over the network. 5. Data format and compression: Use Parquet or ORC for columnar