I write for somebody can help me or say me how resolve a problem of bottleneck between google cloud function and PHP web service of external server. We are developing mobile app that upload json document (key-value) to firebase and we are using one cloud function listening oncreate event from collection of documents. This cloud function send this json to external server for save, but when multiple app in different mobile or tablet devices insert multiple documents in firebase our server response with error HTTP 429, this meaning that our server cant process many request same time sent from cloud function.
what alternatives is there for manage this situation or others solutions?
You can limit the number of instances [1], effectively controlling the degree to which their functions will scale in response to incoming requests. If no instances are available, the request will fail with 429 Too Many Requests.
Also, while handling traffic spikes in some cases, such as rapid traffic surges, Cloud Functions might, for a short period of time, create more instances than the specified maximum instances limit. If your function cannot tolerate this temporary behavior, you might want to factor in a safety margin and set a lower maximum instances value than your function can tolerate.
[1] https://cloud.google.com/functions/docs/configuring/max-instances