Ubuntu 22.10 Optimizing OpenSSH Server Memory Use, Other RAM Optimizations Coming
Ubuntu 22.10's OpenSSH daemon will now only start once there is an incoming connection request received, rather than running SSHD regardless of any connection request.
By not running the OpenSSH daemon until there is an incoming connection request, they save around 3MB of system memory and in the case of lightweight VMs / LXD containers, that can be around 5% of memory use for an idle, brand new Ubuntu 22.10 container.
This switch to socket-based activation for the SSH server is part of a broader push to make Ubuntu Linux leaner on the Ubuntu Server front especially for virtual machines and containers. Longtime Ubuntu engineer Steve Langasek with Canonical noted:
At Canonical we care about making Ubuntu as efficient as possible on your hardware and in the cloud, which is why this change has been landed as part of a larger effort to reduce the default memory footprint of our images. A default Ubuntu 22.04 LXD image at release time used 65MiB of RAM, which in kinetic now uses 58MiB after this OpenSSH change; and more improvements are in progress, with the intention of backporting the safer changes to our Ubuntu 22.04 images to improve memory usage for the greatest number of users.
So further tuning is in the works to make Ubuntu more lightweight for these server use-cases and some of these optimizations will find their way back into Ubuntu 22.04 as the current Long-Term Support series.
This socket-based activation handling for SSHD will happen automatically when moving to the latest Ubuntu 22.10 package. More details on this change for those interested via the Ubuntu Discourse.