Reputation: 508
I am using Cloud Run to run a java application and the concurrency for this cloud run service is set to 1. Whenever it receives a message through a http end point, applications get triggered runs for X amount of time and returns the result.
I would like to understand the below items:
Thank you
Upvotes: 2
Views: 409
Reputation: 2217
I will start by answering the second question:
Given you already have set concurrency
(Maximum requests per container
in the console) to 1.
the concurrency for this cloud run service is set to 1.
You will get an error code 429 for the new request, only if you have set max-instances
( Maximum number of instances
in the console).
Ref: https://cloud.google.com/run/docs/troubleshooting#429
Otherwise and back to your first question: if max-instances
> 1 a new Cloud Run instance will be created and the second request will suffer the container/application startup time.
This being said, if you are using Cloud Run, you are using a webserver like springboot and/or tomcat behind. Such server will be setup to handle concurrent requests with a thread-per-connection model and a default value of 200 for server.tomcat.max-threads
. So why not profit from this model, and increase concurrency
, if your request are not dealing with shared resources. Of course try to use non-blocking reactive programming model to reduce the number of threads and their memory footprint.
But if, for your requirement, you need to keep concurrency at 1, in this case Cloud Function will be a better choice, for these reasons:
Upvotes: 4