Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Best practices for serverless sizing

How to start with sizing for serverless services like BigQuery and CloudRun ?

0 2 350
2 REPLIES 2

Hi @avindia,

Cloud Run automatically adjusts the number of instances based on factors like CPU usage and request volume. To get the best performance and stable concurrency for your service, you can follow these steps:

  1. Optimize your service performance.
  2. Set your expected concurrency level in your code (if your tech stack supports it). Not every stack needs this setting.
  3. Deploy your service.
  4. Set Cloud Run concurrency for your service to match or be lower than your code-level setting. If you don’t have a code-level config, just use your expected concurrency.
  5. Run load tests that allow you to control concurrency. Make sure your service stays stable under the expected load.
  6. Adjust as needed. If the service doesn't perform well, go back to step 1 to improve performance or step 2 to reduce concurrency. If it performs well, try increasing the concurrency in step 2.

Keep iterating until you find the max stable concurrency.

For more on managing Cloud Run instances, check out Setting a maximum number of instances. To adjust the number of requests handled per instance, see Setting concurrency. For tips on fine-tuning concurrency, visit development tips for tuning concurrency. If you want to keep an idle instance running to minimize latency or avoid cold starts, see Using min-instance to enable idle instances.

Hope this helps!

Thanks however I am looking for some Sizing guideline like below I found 

 

Recommended preset Total DAGs Max concurrent DAG runs Max concurrent tasks
Small501518
Medium25060100
Large1000250400

For example, an environment must run 40 DAGs. All DAGs must run at the same time with one active task each. This environment would then use a Medium preset, because the maximum number of concurrent DAG runs and tasks exceed the recommended estimates for the Small preset.

https://cloud.google.com/composer/docs/composer-2/optimize-environments