14 Mar Google Cloud Functions: serverless, NoOps solutions.
So what is Cloud Functions and what problems might it solve? We at Fourcast had been given alpha access to Cloud Functions so we had some experience with it before we came to Google Cloud Next 2017.
When talking about Cloud Functions it’s useful to involve microservices. Most applications are the opposite of microservices, namely monoliths. In a monolithic application all of your code is put together and an error in one part of the system might influence other parts of your application as well. Microservices are a solution to this: they divide your application into small pieces of functionality that are independent and do a single thing, and do it well. Since each functionality is a small application, they can be deployed and updated separately, and any bugs that might have slipped in will not influence any of the other microservices.
Cloud Functions go hand in hand with this approach as they are small pieces of functionality that can be triggered on certain events.
Cloud Functions are serverless. In a more traditional environment the developers have to take servers into account, configuring the server, managing the infrastructure.. In a serverless environment, developers do not have to think about a server and can focus on writing code. Of course the code still runs on a server, but everything that comes with it is handled by Cloud Functions.
Pay for what you use
If you’ve read our previous blog post on docker & containers, you’ve read that containers are small units of computing power with minimal overhead. With Cloud Functions you should think in functions instead of applications, the resources needed to run one function are of course much smaller than for an application, so the overhead here is even smaller!
Runtime & autoscaling
In the real world
As mentioned before, Cloud Functions are triggered on certain events, such as uploading files to Cloud Storage or plain HTTP calls, which opens up the possibility of writing WebHooks.
There are dozens of things you can do with Cloud Functions: Want to notify owners of Cloud Storage buckets every time someone uploads/overwrites a new file? Write the logic, tick off the Cloud Storage trigger, deploy it and off you go. With HTTP triggers you can respond to events originating from services such as Github, so you could for example perform some logic every time a push happens to a certain repository. As mentioned before you could also write a (microservices) API with Cloud Functions since they are such a good fit to this strategy.
To summarise: Cloud Functions are small, independent functions that will automatically scale, run in a serverless environment and have minimal overhead.
Want to find out more about Cloud Functions? Head over to the official page or watch the talk at Next that I followed.
Written by: Robin Hellemans
This post belongs to a series of blogs in response to Google’s yearly conference in San Francisco, March 8-10th. Stay tuned for more.