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

Cloud Functions parallel executions

Hello everyone,

I'm having a strange behaviour with parallel execution of the cloud functions :

My function receives a first  request, before finishing processing this latter, another request is coming. So it creates a different instance to handle it. 

Screenshot 2022-11-14 at 16.45.59.png
 
Th problem I have is that the first instance logs finished with status ok finished, even though the request was not finished.

1. Did I missed something in the configuration maybe ?

2. Can I set up a delay between function's invocations ( in order to have more logs) ? 

3. Any thoughts  about this ? 

Thanks in advance,


 

Solved Solved
0 1 854
1 ACCEPTED SOLUTION

Hi @Joseph95,

Cloud Functions handle incoming requests by assigning it to an instance, in case the volume of requests increases, the Cloud Functions will start new instances to handle the requests.

Note: An extremely rapid increase in inbound traffic can intermittently cause some requests to fail with an HTTP code of 500. This is because the requests time out in the pending queue while waiting for new instances to be created. Configuring your workload so that it ramps traffic up gradually over the course of a minute can help with this issue. Also see Troubleshooting Cloud Functions for more information.

You may want to check about Using Pub/Sub to trigger a Cloud Function

 

Thanks

Christian

View solution in original post

1 REPLY 1

Hi @Joseph95,

Cloud Functions handle incoming requests by assigning it to an instance, in case the volume of requests increases, the Cloud Functions will start new instances to handle the requests.

Note: An extremely rapid increase in inbound traffic can intermittently cause some requests to fail with an HTTP code of 500. This is because the requests time out in the pending queue while waiting for new instances to be created. Configuring your workload so that it ramps traffic up gradually over the course of a minute can help with this issue. Also see Troubleshooting Cloud Functions for more information.

You may want to check about Using Pub/Sub to trigger a Cloud Function

 

Thanks

Christian