Your submission was sent successfully! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates from Canonical and upcoming events where you can meet our team.Close

Thank you for contacting our team. We will be in touch shortly.Close

  1. Blog
  2. Article

Valentin Viennot
on 20 December 2022

See for yourself: the benefits of chiselled Ubuntu images in action with an ASP.NET shop demo


Looking for a way to improve the performance and reliability of your online shopping and payment systems during the holiday season? Look no further than chiselled Ubuntu images! In this blog series, I’ve already discussed the benefits of using these lightweight and efficient images for your containerised applications. In this second part, I’ll show you how to put these benefits into action with a festive ASP.NET shopping application. Get ready to deck the halls (and your containers) with chiselled Ubuntu.

A festive shopping experience

Ready to start your holiday shopping? First, I’ll introduce the online shopping demo application, built using ASP.NET and chiselled Ubuntu containers. Then, I’ll also give you a tour of the environment used to perform the tests and comparisons.

Screenshot of the running eShop ASP.NET 6 demo application as seen from the browser

For our demo application, I used the sample eShop ASP.NET Core 6.0 reference application created by the Microsoft team. The app is split into three components: an API server, a Web server, and a SQL server database.

I created two forks of this demo app, one using traditional Ubuntu containers and the other using our brand new chiselled Ubuntu containers for ASP.NET 6. I then compared the attributes and performance of the two versions using a cloned virtualised environment with limited resources.

Setting up my first testing lab to gather some base for comparison using classic Ubuntu

My lab is a 4GB RAM, 20GB disk Multipass virtual machine with 2 vCPUs running Ubuntu 22.04. I used the same clean environment for both versions of our demo application to ensure a fair comparison. By using a cloned virtualised environment with limited resources, I was able to accurately compare the attributes and performance of the two versions without introducing bias. I also made sure to maintain (as much as I could) consistent operating conditions during the tests.

Let’s now unwrap the benefits of chiselled Ubuntu, demonstrating how they’ll make your holiday shopping experience faster, more secure, and more scalable.

Smaller size, bigger savings with chiselled Ubuntu

With no doubt, the top benefit using chiselled Ubuntu container images is their smaller size. And it’s probably the easiest one to illustrate! We will compare the size of container images used to deploy our online eShop demo, both using chiselled Ubuntu images and the usual Ubuntu base image.

The sizes, in megabytes, for the two main components’ uncompressed image are displayed in the table below:

Base image type“API” image size“Web” image size
Ubuntu 22.04 LTS284MB317MB
Chiselled Ubuntu 22.04181MB (-36%)250MB (-21%)

As you can see on the table above, chiselled Ubuntu-based images are up to 100MB smaller than traditional Ubuntu-based, saving on disk space and bandwidth when downloading and running the image. For applications that are deployed at scale and much more so in distributed and edge computing environments, this can result in significant storage and deployment cost savings.

Showing the Docker images sizes on my testing lab environments, chiselled is 100MB smaller!

While I hoped for even greater savings, the Web component of our demo application uses SqlClient from ASP.NET, which requires the Globalisation feature and its accompanying ICU globalisation package. As a result, I had to use a chiselled Ubuntu base that included the ICU packages, which is 40% larger than the chiselled Ubuntu for ASP.NET images available on MCR. However, I did notice faster build times thanks to the network bandwidth savings when pulling the smaller chiselled base images.

Stay safe and secure with chiselled Ubuntu

Chiselled Ubuntu images are created using high-quality components from the Ubuntu operating system and are updated in accordance with the same release cycle and with the same support guarantees. Ubuntu has a strong track record of receiving fixes for critical vulnerabilities in less than 24 hours. Furthermore, the smaller size of chiselled Ubuntu OCI images means that there are fewer opportunities for attackers to exploit (reduced attack surface).

In addition, chiselled Ubuntu images do not include any additional libraries, tools, or components that are typically found in Linux distributions. This means that there’s no package manager, shell, or other utilities for potential hackers to use. Finally, the prebuilt chiselled Ubuntu images for .NET and ASP.NET do not include the “root” user, suppressing privilege escalation for potential attackers.

Check out Rich Lander (@runfaster2000) and I’s joint talk at the 2022 .NET developers conference for a proof of concept of the improved security benefits of chiselled Ubuntu:

Using .NET with Chiseled Ubuntu Containers | .NET Conf 2022

Run faster with chiselled Ubuntu

Chiselled Ubuntu images can boost performance for cloud and containerised apps in addition to being smaller and more secure.

The startup times and resource usage for each container type are displayed in the table below:

Base image typeStartup timeCPU usageMemory usageCPU (stressed Web server)Memory (stressed Web server)
Ubuntu4.608s~0.1%76-81MB115%218MB
Chiselled Ubuntu3.721s~0.0%67-79MB118%172MB

To measure the startup time, I timed the duration of the command docker-compose up -d, with all images cached locally. This isn’t a perfect measure, it only considers the time for the container to create and bootstrap. But as you can see, it’s already a good indicator showing that chiselled images are faster to start up (almost 20% faster).

To measure the resource consumption, I simply used the docker stats command. I first compared memory and CPU usage after once the application was launched. Then I did due-diligence stress testing of the Web component, generating 500 requests with up to 5 in parallel using cURL (kudos to Ivo on dev.to for the advice). As you can see, adoption of chiselled Ubuntu containers drives down memory usage (7%) and particularly in stressed situations (21%).

Stress-testing our demo application with a homemade cURL bash command and docker stats

This means that the application can be up and running more quickly, and it can run more efficiently on the host system. This means a faster, more responsive user experience for our Christmas-time online-shopper customers!

Celebrate the season with chiselled Ubuntu

In this blog series, I have shown the key advantages of using chiselled Ubuntu images in practice by building a simple online shopping application using the ASP.NET runtime. Although my measurements might not be the most accurate, the improvements going from Ubuntu to chiselled Ubuntu as base images for .NET/ASP.NET are quite impressive. All that with very little changes and a seamless continued developer experience.

As we look ahead to the new year, I encourage you to try out chiselled Ubuntu images for yourself and see the benefits for your own applications. Whether you are a developer, system administrator, or just interested in learning more about container technologies, chiselled Ubuntu images can provide you with a stable, efficient, and secure platform for deploying and running your applications.

So don’t let the holiday season be a pain in the elf; use chiselled Ubuntu images to keep your containerised applications running smoothly, and make sure your customers have a ho-ho-happy experience. Happy holidays, and happy containerising!

Related posts


Canonical
21 November 2023

Canonical announces the general availability of chiselled Ubuntu containers

Canonical announcements Article

Production-ready, secure-by-design, ultra-small containers with chiselled Ubuntu Canonical announced today the general availability of chiselled Ubuntu containers which come with Canonical’s security maintenance and support commitment. Chiselled Ubuntu containers are ultra-small OCI images that deliver only the application and its runtime ...


Simon Fels
20 March 2024

Implementing an Android™ based cloud game streaming service with Anbox Cloud

Cloud and server Article

Since the outset, Anbox Cloud was developed with a variety of use cases for running Android at scale. Cloud gaming, more specifically for casual games as found on most user’s mobile devices, is the most prominent one and growing in popularity. Enterprises are challenged to find a solution that can keep up with the increasing ...


Canonical
5 September 2023

도커(Docker) 컨테이너 보안: 우분투 프로(Ubuntu Pro)로 FIPS 지원 컨테이너 이해하기

FIPS Security

오늘날 급변하는 디지털 환경에서 강력한 도커 컨테이너 보안 조치의 중요성은 아무리 강조해도 지나치지 않습니다. 컨테이너화된 계층도 규정 준수 표준의 적용을 받기 때문에 보안 문제 및 규정 준수 요구 사항이 발생합니다. 도커 컨테이너 보안 조치는 경량의 어플라이언스 유형 컨테이너(각 캡슐화 코드 및 해당 종속성)를 위협 및 취약성으로부터 보호하는 것을 수반합니다. 민감한 개인 데이터를 처리하는 데 의존하는 ...