Google recently announced the public preview of the second generation of Cloud Functions, the functions as a service platform on Google Cloud. The new version introduces more controls over functions runtime, provides better performances and scalability and supports triggers from more than 90 event sources.
One of the major changes is a longer processing time for HTTP functions, up to 60 minutes, supporting use cases that involve large streams of data, such as data processing pipelines or machine learning. Forrest Brazeal, head of content at Google Cloud, tweets:
This version is built on top of Google Cloud Run (...) Google Cloud is taking an opinionated stance here, a worldview, on what FaaS is and when it should be used. Some will love it, others will disagree.
The new version reduces cold starts and latency, increases concurrency to up to 1000 requests per function instance, and supports larger instances, up to 16 GB memory and 4 vCPUs. Paul Johnston, ServerlessDays co-founder, tweets:
16GB 4vCPU Cloud Functions that can run for 60 minutes? Not entirely certain why but...!!!
Built using open-source buildpacks and Functions Frameworks, the second generation uses Eventarc for event delivery, supporting triggers from different sources. Vinod Ramachandran and Jaisen Mathai, product managers at Google, explain:
Second generation cloud functions now include native support for Eventarc, which brings over 90+ event sources from direct sources and Cloud Audit logs (e.g., BigQuery, Cloud SQL, Cloud Storage, Firebase...). And of course, Cloud Functions still supports events from custom sources by publishing to Pub/Sub directly. These event-driven functions adhere to industry-standard CloudEvents, regardless of the source, to ensure a consistent developer experience.
The new version supports traffic splitting between multiple revisions of a function, with the ability to rollback, and pre-warmed instances to reduce cold starts, a feature recently introduced in the first generation and covered separately on InfoQ.
Google Cloud is not the only cloud provider offering a serverless computing platform but the characteristics of the services differ on the major providers, with Amazon and Microsoft not supporting 60 minute execution time or 16GB memory allocation. For example, AWS Lambda functions can be configured to run up to 15 minutes per execution, while Azure Functions support up to the maximum memory size of 1536 MB.
The second generation of Cloud Functions is currently available as a public preview in a subset of regions with the pricing based on Cloud Run pricing.