Soru

Zorluk: OrtaPlanning Serverless Compute Options (Cloud Run and Cloud Functions)

An architecture team is evaluating Google Cloud serverless compute options for a real-time notification dashboard. The workload requires handling persistent WebSocket connections from web clients and deploying a specialized custom runtime binary that listens on an assigned container port without adapting the code to a cloud function signature.

Which TWO features or constraints mandate choosing Cloud Run instead of Cloud Functions for this service? (Select TWO.)

  1. Native support for persistent WebSocket connections and bidirectional streamingCevap
  2. Ability to package and deploy any custom container image listening on an environment-defined port without framework wrappingCevap
  3. C
    Automatic scale-to-zero capability during periods of inactivity
  4. D
    Direct native event triggering from Cloud Storage object creation without external event routing infrastructure

Cevap

The two correct choices are native support for persistent WebSocket connections and bidirectional streaming, and the ability to package and deploy any custom container image listening on an environment-defined port without framework wrapping.
Cloud Run accepts arbitrary OCI container images listening on the PORT environment variable, supporting full HTTP/2, WebSockets, and custom runtimes. Cloud Functions is constrained to supported function runtimes and request-response HTTP or event invocation patterns.

Adım Adım Çözüm

1
Analyze protocol requirements
WebSockets require persistent long-lived TCP/HTTP-2 streaming connections.
Cloud Run natively supports WebSockets and streaming traffic, while Cloud Functions is designed strictly for request-response HTTP invocations or event handlers.
2
Evaluate runtime and container flexibility requirements
The application relies on a custom binary that listens on a specified port.
Cloud Run allows deploying any custom container image that listens on the PORT environment variable without rewriting code for specific function signatures.
3
Evaluate scale-to-zero and event trigger features
Scale-to-zero is supported by both services, while direct Cloud Storage event triggers are native to Cloud Functions.
Scale-to-zero does not favor Cloud Run over Cloud Functions, and native Storage triggers are a Cloud Functions strength.

Anahtar Kavram

Selecting Cloud Run versus Cloud Functions based on container runtime freedom, WebSockets support, and event integration patterns.
Bu soruyu puanla