4 ms·
I don't fully understand how cold starts would manifest in Cloud Run, but in any case they should be MUCH less of an issue than in Cold Functions. Cloud Run ha
by hn_throwaway_99 8y ago
I don't fully understand how cold starts would manifest in Cloud Run, but in any case they should be MUCH less of an issue than in Cold Functions.
Cloud Run has a default (and max) concurrency threshold of 80 requests per container. Thus, for example, if you are running Node, you could conceivably be handling 80 concurrent requests before needing to start another container.
Cloud Functions have no concurrent requests (each instance can only handle 1 request at a time) so every concurrent request results in a cold start if additional instances are needed to scale up.
Note, though, that this means you can't put per-request state in the global scope in Cloud Run, but this is safe to do in Cloud Functions because you know there that each instance is only handling one request at a time.
- reaktivo 8y agoI'm not sure this is actually the case, Cloud Functions instances might be handling one request at a time, but they call also share a global scope, as you can see in their Tips & Tricks document[1] [1] https://cloud.google.com/functions/docs/bestpractices/tips#use_global_variables_to_reuse_objects_in_future_invocations https://cloud.google.com/functions/docs/bestpractices/tips#u...
- hn_throwaway_99 8y agoNo, what I meant was that it is safe to keep request-scoped data in global scope without needing to worry that a concurrently running request will interfere with the state there. Normally in a Node server you cannot do this. Cloud Functions will reuse instances for subsequent invocations (that's what "being warm" means), but separate instances do not share global scope.