Question

Difficulty: Very hardPlanning Serverless Compute Options (Cloud Run and Cloud Functions)

A enterprise architecture team is designing a serverless solution on Google Cloud for two distinct backend services:

1. Service A: A legacy C++ application that processes incoming REST HTTP requests. It requires custom OS-level system packages, must handle up to 250 concurrent requests per container instance to minimize cost, and needs an execution timeout configured for up to 45 minutes to process batch operations.
2. Service B: A lightweight Node.js event handler that responds to real-time object finalized events in Cloud Storage and completes execution in less than 3 seconds per trigger.

Which TWO architectural decisions correctly align with Google Cloud serverless best practices for these workloads? (Select TWO.)

  1. Deploy Service A to Cloud Run, because Cloud Run supports custom container images with system binaries, allows configurable request concurrency per instance, and supports execution timeouts up to 60 minutes for HTTP-triggered workloads.Answer
  2. Deploy Service B to Cloud Functions (2nd gen) or Cloud Run, using Eventarc or Cloud Storage event triggers to process event payloads with minimal cold-start overhead.Answer
  3. C
    Deploy Service A to Cloud Functions (1st gen), because Cloud Functions automatically compiles custom OS-level C++ binaries and supports high multi-request concurrency per function instance.
  4. D
    Deploy Service B to a Compute Engine Managed Instance Group using Spot VMs to ensure zero cold starts for asynchronous file upload events.

Answer

Deploy Service A to Cloud Run due to custom container environment support, multi-concurrency capabilities, and 60-minute execution timeouts. Deploy Service B to Cloud Functions (2nd gen) or Cloud Run to efficiently process Cloud Storage events using Eventarc integration.
Cloud Run is the optimal choice for Service A because it runs arbitrary Docker containers (supporting custom C++ system libraries), handles up to 1000 concurrent requests per container instance, and allows timeouts up to 60 minutes for HTTP services. Cloud Functions (2nd gen) or Cloud Run is the optimal choice for Service B because both natively integrate with Eventarc to process Cloud Storage events with automatic scaling.

Step-by-Step Solution

1
Analyze the requirements for Service A
Service A requires custom C++ OS binaries, 250 concurrent requests per instance, and a 45-minute request timeout.
Cloud Run natively supports custom container images (allowing custom C++ libraries), concurrency up to 1000 requests per container, and an execution timeout of up to 60 minutes for HTTP services.
2
Analyze the requirements for Service B
Service B is a lightweight event-driven function processing Cloud Storage triggers in under 3 seconds.
Cloud Functions (2nd gen) or Cloud Run with Eventarc provide native event-driven triggers for Cloud Storage, scaling to zero when idle and processing short bursts efficiently.
3
Evaluate and eliminate incorrect architectural choices
Cloud Functions (1st gen) lacks custom container OS support, cannot handle multiple concurrent requests per instance, and caps timeouts at 9 minutes. Spot VMs add unnecessary infrastructure management for simple event handling.
Matching workload requirements to appropriate serverless execution paradigms ensures operational efficiency and adherence to Google Cloud recommended practices.

Key Concept

Selecting between Cloud Run and Cloud Functions based on containerization, concurrency, timeout, and event-trigger constraints.
Rate this question