Ubuntu server vs Ubuntu server minimal: memory usage

Just a quick post as I had been using the Ubuntu server minimal install option a lot lately but couldn’t find any solid information on whether it used less memory than the standard server install.

Typically the advantage of the minimal installation option is that it includes fewer applications and other bits and pieces (for example the man pages function isn’t installed). The advantages of this are that you will potentially have a smaller attack-surface and that there will be fewer software updates to install, along with the corresponding reduction in disk space requirements.

Setup

In order to test this I simply provisioned two identical Virtual Machines on Promox VE 8.1. These VMs have vanilla settings with the exception of the enabling QEMU agent support and storage discards.

Each VM was assigned:

  • CPU: 4 cores
  • RAM: 2GB

The Ubuntu installations were identical and used vanilla defaults with the exception that I enabled the SSH server. The installation media was the same using ubuntu-23.10-live-server-amd64.iso (SHA256: d2fb80d9ce77511ed500bcc1f813e6f676d4a3577009dfebce24269ca23346a5)

Once installed, I allowed 20 minutes for each VM to get into a steady state and measured memory usage using the free command:

Bash
free -m

Testing results: unpatched

As we can see there is a substantial difference between the standard server install and the minimal install of 128MB, which is an increase of 47%, or put the other way around a decrease of 32%
The fact that there is some difference isn’t too surprising but the degree of difference is very much so and well worth paying attention to.

So is that it? Well, not quite…

These numbers were collected from freshly installed systems but without all the latest patches. Once we install the patches then the picture changes somewhat:

Testing results: patched

While the memory usage of the minimal installation hasn’t changed much from 270MB to 285MB (+5.5%) the standard installation’s usage has reduced dramatically from 400MB to 308MB (-14.75%).

The sum result is that the standard install now uses 19% more memory than the minimal install.

Whether that number is significant will depend on your environment but to use a practical example: if I have a virtual server host with 128GB of RAM then that would allow a theoretical density of about 375 VMs on the host using the standard Ubuntu server install compared with 449 VMs using Ubuntu minimal.
An extra 74 VMs is nothing to sneeze at! And even doubling the VM memory to 4GB would net you an extra 37 VMs.
Still, bear in mind that this is theoretical because your real-world VM memory density is going to also be affected by what applications/services you end up running on these nodes.

A final test that I thought might be useful was to see if the installation of Virtual Machine guest services changed the memory situation much; one of the functions of such services is to facilitate features such as memory ballooning and so it might produce some interesting results…but the answer was ‘not really’.

It’s also worth a quick look at the disk space used by each install…

Test results: disk space


For the default Volume Group where root is installed Ubuntu server uses about 4.2GB whereas Ubuntu minimal uses 3.6GB: a difference of -14%. Granted these aren’t huge numbers in today’s world of multi-terabyte storage but it’s definitely significant from a statistical perspective.

What, however, is very interesting is that after patching the standard server install uses 4.4GB (+4.7%) and the minimal install still uses 3.6GB.

Caveats

This was a very quick and dirty investigation. The data is definitely worth considering and taking notes on. However, bear in mind that memory usage changes over time and since I did not capture numerous data points in parallel it is impossible to say with certainty how far apart each scenario is- all we can see is that approximately there is a statistically and practically significant difference.
Moreover, when we’re dealing with numbers as small as circa 100-300MB we will find that small differences in those numbers will result in large-ish differences when we calculate them as percentages. This is why I’ve provided the results in Megabytes as well as in percentages, so that we keep any percentage differences in context.
Finally, it’s worth noting that I obviously didn’t investigate where the (used) memory went. This is important because what I did observe was that the buffer/cache value for each scenario was substantially different (for example, Ubuntu server with patches is about 234MB buffer/cache whereas Ubuntu minimal is about 173MB). As such, it may straight-forwardly be that more applications and services on the standard install lead to an increase in cached data; however, I did not prove that and it could just as well (although less likely) be to do with different caching settings on each installation.

Leave a Reply

Your email address will not be published. Required fields are marked *