Cloud Functions 2nd gen features
2 min readJun 1, 2023
Connect me on LinkedIn
The 2nd generation of cloud functions come with below features.
Long Processing time
- Default timeout value for http based cloud functions is increased to 60 minutes from earlier 9 minutes.
- Default timeout value of event driven cloud functions is increased to 10 minutes from earlier 9 minutes.
More Processing Power
- Cloud functions now supports upto 4 vcpu from earlier 2 vcpu.
- Cloud functions now supports upto 16 GB memory from earlier 8 GB of memory.
Traffic Splitting
- The 2nd generation of cloud function uses cloud run under the hood.
- Each new deployment of a cloud function create a new revision of corresponding cloud run instance.
- Once we have more than 1 revisions of cloud run instance, traffic splitting can be implemented between them.
- The traffic splitting is available at cloud run instance level and not at cloud function level.
- Use below gcloud commands to list various revisions for a cloud run service and then update traffic to split it between different revisions.
gcloud run revisions list ......
gcloud run services update-traffic ......
Concurrency & minimum instances
- The 2nd generation of cloud function supports concurrency while the 1st generation could handle only 1 request / instance (supporting no concurrency).
- This means that with 2nd generation, 1 instance can handle multiple requests.
- The concurrency is supported at underlying cloud run instance level and can be set in there.
- Since cloud functions supports setting min instances, we can save money by reducing min instances and adding concurrency.
- Below command will set concurrency to 8.
gcloud run services update <service_name> --concurrency 8 .....
Event Integrations
- Cloud function is now integrated with 90+ services using event arc and can be triggered from events generated from these services.
- For example, we can write cloud function to send email after a query execution is completed in big query.
This is all for now. Hope you will find it useful to understand key features of cloud functions 2nd gen.