“Glueing” systems together • Simple API Bad fit for: • Stateful systems • Large, complex APIs • Require a high level of control • Need custom runtimes or binaries
Rapidly developing CRUD-heavy applications • App composed of a few services • Deploying complex APIs Bad fit for: • Stateful systems • Slow startup time • Require protocol other than HTTP
are easily containerized • Event-driven applications • Require custom dependencies Bad fit for: • Highly stateful systems • Require protocols other than HTTP
Listen on the port defined by PORT environment variable ▷ Remove reliance on local filesystem for persistent storage ▷ Add a Dockerfile ▷ Send logs to stdout, stderr, or /var/log
base image (exp: alpine, scratch) ◦ Multi stage build image ▷ Minimize entrypoint execution time ▷ Use dependency wisely ▷ Use lazy initialization for global variables
◦ Set expected_concurrency value ◦ Load test your system ◦ If poorly, reduce expected_concurrency ◦ If well, increase expected_concurrency ◦ Continue iterating until you find the maximum stable concurrency ▷ Also increase memory_limit when increasing expected_concurrency
Cloud Run 38 ▷ Create Python Hello World application ▷ Create Dockerfile ▷ Build and push image using Cloud Build ▷ Deploy to Cloud Run ▷ Access your production-ready live app on provided domain
▷ Set max instance = 1 ▷ Load test with 2500 concurrent users ▷ See number of users vs response time, it’s not stable ▷ Set max instance = 1000 ▷ Load test with 2500 concurrent users ▷ See number of users vs response time, it’s stable