Last week Red Hat introduced the open source framework Quarkus which promises fast boot times and low memory usages. This makes Quarkus interesting for Java workloads running as serverless functions.
Note:This is just a quick experiment. I haven’t measured the actual memory in the cloud, I haven’t created much load, the functions don’t really do anything, etc.
I compare four different types of functions:
- Java functions as OpenWhisk provides them out of the box
- Java functions using Quarkus
I’ve open sourced the code and the scripts. Get the code.
You can run the functions in the cloud on IBM Cloud Functions and measure the time it takes to execute them. In my quick tests, all of them took roughly the same amount of time once the containers were warm. Also the functions only implement echo functionality, which is why it doesn’t make much sense to measure the execution times of these functions.
That’s why I focussed on memory usage. Since I’m not aware of any way to measure the memory on IBM Cloud Functions, I’ve set up OpenWhisk locally . I hadn’t done this before, but it was really easy and didn’t take longer than 10 minutes. This allows you to run the same containers locally that are run in the cloud.
In order to run the tests yourself, follow the steps in the README . You need to install some prerequisites and build the images. After this you can create the four functions via some scripts I’ve provided. I create the functions with a memory limit of 128 MB which is the smallest possible configuration .
In order to see the memory usage, I’ve used the ‘docker stats’ command. Here are the results: