Memory Reduction Proven:
up to 30% Improvement
To demonstrate the benefits of using Alpaquita containers over the traditional method of running Java applications, we compared performance of Alpaquita + Liberica Lite vs OpenJDK + DockerHub.
The following tests measure the RAM consumed by the same app launched within two images:
- "alpaquita" — Liberica JRE executed on Alpaquita Linux base image;
- "official" — official OpenJDK image on DockerHub: https://hub.docker.com/_/openjdk.
Note that while the “official” image is not supported anymore, it can be used as the “average” OpenJDK implementation and the reference point. You can use other distros in tests, for example, “temurin”, which is supported. See the list in the “kits” file.
Step 1: Download the scripts
First, download measurement scripts (tested on Mac, Linux, and Windows) from the GitHub repository.
Step 2: Refresh Docker and buildx
You will need Docker to enable the buildx command, so install it if necessary. Next, check the version of the buildx command by launching docker buildx version
. The version we needed was v0.8 or higher, the scripts were tested on v0.10.3, the latest at the moment of testing. If your buildx version is too low, install the new one.
Step 3: Create builder
For buildx to run, you need to configure it by running create_builder
or create_builder.bat
for Windows.
Step 4: Build the application for testing
Now, it is time to choose what app you are going to test, your own or demo (in our case, Spring Petclinic).
If you decide to utilize Petclinic, run the ./bake
script (Mac, Linux), or bake.bat
(Windows).
Wait some time and check the results in the target
folder.
In case you use your app, build the JAR file and then put it into the target
folder of the project.
The name of the file must be “app.jar”.
Run the ./bake custom
(Mac, Linux) or bake.bat custom
(Windows).
Step 5: Run the tests
In case you use Petclinic, just run the ./test
script with no parameters.
If you use your own app, run the same script with a single argument, which is the address where your app listens for connections (like ./test http://localhost:9090/endpoint
).
Step 6: Wait for a bit
The script launches several processes:
- Downloading several necessary artifacts from Maven Central (for Petclinic);
- Java application building (for Petclinic);
- Loading and building of wrk2 and psrecord (which is a native C++ code and will take a lot of time);
- Loading and building the Python modules for the traffic analysis (pandas, numpy);
- Running the tests.
You may need to wait for a while.
Step 7: Analyze the results
To check the image size, run the docker images
command and look for two images,petclinic-alpaquita
and petclinic-official
.
Retrieve the results from the logs
folder. Other than the logs that display the RAM load results, there are two more important files: frequency.png
и median.png
.median.png
is the graph that shows the median values of RAM consumption for both images. The frequency.png
graph displays the frequency distribution of RAM consumption by images. The X-axis represents the RAM consumption, the Y-axis shows how much time the application managed to hold the corresponding level of RAM consumption. The second graph could be more important for analysis but is more difficult to interpret.petclinic-alpaquita
and petclinic-official
.
Step 8: Share your results!
We hope you will share the results of your testing with the world! Please mention us (https://twitter.com/bellsoftware) in your reply so we can answer your questions and see your results.
Here are the findings from our tests, clearly highlighting the superior performance of the Alpaquita container in comparison to the OpenJDK + Docker approach.