Photo by Joshua Earle on Unsplash

It’s 2019, the worlds a changing place but the biggest question of them all is how have lambdas performance changed since 2018? I’m here again to compare the cold start time of competing languages on the AWS platform. And with the recent addition of Ruby, combined with the 2018 results this should be an interesting analysis! See my Apr 2018 Language Comparison. Without spoiling the results, the improvements the AWS team made are exciting.

Cold Start?

The world of Serverless computing dictates that functions are run on demand and are thrown away when not needed. All these efficiencies of running the function only when needed, leads to a phenomenon called cold starts.

Regular cold start (screenshot from the video)

A cold start is the first time your code has been executed in a while (5–25minutes). This means it requires to be downloaded, containerised, booted and primed to be run. And this process adds significant latency between ~ 20–60 times worse performance. The length of the cold start depends on several variables, the language/runtime, the amount of resources (mb) dedicated to the function & the packages/dependencies pulled into run the function.

The cold start time, is important as despite being an edge case. Every-time you’re hit by a spike of traffic, ever lambda function is facing a potential cold start! For more information check out a previous post, that explains cold starts further.

Methodology

I tested the following languages: Go 1.x, Node.js 8.10, Java 8, Ruby 2.5, Python 3.6 & .netcore 2.1. I created three functions respectively for each language. The function did nothing except emit ‘hello world’. Each language had a function which was assigned 128mb, 1024mb & 3008mb of memory. I then created a step function, to trigger all 18 functions. I manually collected the results from AWS x-ray on a periodic basis.

Results

I collected both the cold start times and a new variable AWS x-ray introduced called initialisation which measures the environment setup time.

Below is the Cold Starts graph, which is segmented into three sections: functions run with 128mb, 1024mb & 3008mb of memory.