Serverless computing is getting adopted across the landscape from startups to large enterprises. One of the matured and popular serverless compute platform is AWS Lambda. Microsoft equivalent for AWS Lambda is Azure functions.
A very useful feature released recently is AWS Lambda extensions.
Before I explain AWS Lambda extensions, a quick take on Serverless computing. Serverless computing refers to running your application without provisioning or managing servers. You don’t provision servers , scale up or down for performance , monitor them, etc. All these are taken care of by the serverless computing service.
With AWS Lambda you focus on building the code and deploying it. AWS Lambda takes care of server provisioning , upgrading or downgrading config as required and shutting down after use. You pay only for the time your code runs.
AWS Lambda supports a variety of languages including Python, Node.js and Java.
There are some constraints though.
Serverless computing brings its own set of challenges. You can’t check the performance , bottlenecks or issues in your code runtime environment since it is not accessible to you. Various metrics like code runtime duration, resources used , part of code that is taking more time,etc is essential. This is where the recent addition of AWS Lambda extensions come into play.
How to REDUCE your monthly cloud bills by 25% in 7 days ?
5 simple and highly effective suggestions in blueprint to reduce your cloud costs.
Monitoring of lambda functions is also possible using approaches like cloud watch and integrating handlers in your code to publish metrics. These approaches were not simple and required extra configuration tasks. Lambda extensions make it easier to integrate 3rd party and AWS tools into lambda. Using these extensions you can collect the runtime metrics you need.
Benefits of using AWS Lambda extensions. ?
- Integrate your existing tools with Lambda. You may be using tools from providers like Datadog , NewRelic , AppDynamics , etc for monitoring and other requirements. After integration you can view all the metrics in your tools dashboard.
- Earlier approaches were complex and required extra configuration tasks. Lambda extensions make it easier
- Lambda Extensions can do tons of other activities like start a new process or run some logic based on Lambda lifecycle events. Lifecycle events are function initialization , invocation and shutdown.
- Extension can continue to run even after the function is fully processed.
An extension can be internal or external. Internal runs as part of your function runtime process and ends along with your function. An external extension runs as an independent process in the same environment. It continues to run even after the function is processed.
One of the key points to be aware of is that extensions share your functions resources such as CPU, memory and storage. There is a possibility extensions can impact the performance of your function.
Each extension must complete its initialization before Lambda invokes the function. So a Lambda extension that has long initialization times can increase the time taken for function invocation.
If your extension is compute intensive then your function takes more time to complete and you will also incur more charges. So ensure that you measure the impact of the extension and decide if it is fine or you need to adopt a different approach.
Have you put off Serverless computing thinking it is complex and requires lots of learning ? Not at all. Give it a try and you will be surprised at how easy it is to get started and achieve great benefits. More so considering you continue to use your favourite languages like Python , Node.Js , Java,etc.