GC

Google Cloud Run

Serverless containers, concurrency, and port binding

Details

Language / Topic
gcpGoogle Cloud Platform
Category
Infrastructure

Rules

balanced
- Optimize container images for fast boot times (e.g., distroless base images).
- Listen strictly on the port defined by the `PORT` environment variable (defaults to 8080).
- Scale concurrency settings based on your application's profiling data.
- Listen strictly on the `PORT` environment variable (defaults to 8080) and bind to `0.0.0.0`.
- Optimize container images for rapid startup. Use multi-stage builds and distroless images to reduce cold starts.
- Tune the maximum concurrency (default 80) based on load testing instead of guessing. CPU-bound apps should lower concurrency to 1.
- Log structures strictly in JSON format to leverage native Cloud Logging integration.