Deploying a Low Latency Kernel with Ubuntu Server 16.04 LTS

Overview

In this brief article I will discuss deploying a low latency kernel for Ubuntu Server 16.04 LTS. This kernel changes the timer frequency from the default 250Hz to 1000Hz. This kernel is also called the “soft real-time kernel” and is forked (and regularly updated) from the generic kernel source tree. This kernel can be useful for all applications that require very low latency response like Asterisk. In this document, I will also describe how to set the lowlatency kernel as the primary kernel, and make sure its update and reboot “proof”. It’s also important to note that this kernel is generally updated days after the generic stock kernel. There’s no need to custom-compile a kernel to achieve higher timer frequency. This approach also assures future kernel updates are quick and painless.

Update the APT Cache

We’re starting with a fresh system, so we should first update the APT cache for good measure.

# sudo apt-get update

 

Install the “linux-lowlatency” package

Use APT to install the “linux-lowlatency” package.

# sudo apt-get install linux-lowlatency

 

Obtain the “ubuntustudio-default-settings” package from the repository – STEP 1

media_1503323148243-1.png

First, let’s visit https://packages.ubuntu.com/. This step is a little less obvious. The package “ubuntustudio-default-settings” contains a file named “09_lowlatency”. This file is a GRUB configuration file we can use to assure our lowlatency kernel is booted first and assures it will stay that way.

 

Obtain the “ubuntustudio-default-settings” package from the repository – STEP 2

media_1503323206179-1.png

Search for “ubuntustudio-default-settings” in the search field. Make sure to select “Source package names” and your distribution. Then press “Search”.

 

Obtain the “ubuntustudio-default-settings” package from the repository – STEP 3

media_1503323294187-1.png

Click on the link named “ubuntustudio-default-settings” to the right of “Binary packages”.

 

Download the compressed file to your Ubuntu server

We will now download the compressed file to our local system.

# cd /usr/src/; sudo wget -q http://archive.ubuntu.com/ubuntu/pool/universe/u/ubuntustudio-default-settings/ubuntustudio-default-settings_0.61.tar.xz

 

Extract files in the downloaded package

Extract the files in the “ubuntustudio-default-settings” file.

# sudo tar xvf ubuntustudio-default-settings_0.61.tar.xz

 

Move the 09_lowlatency GRUB configuration in to /etc/grub.d

We will now move the 09_lowlatency GRUB configuration into /etc/grub.d. This file contains configurations to assure the lowlatency kernel packaage will boot first every time and survive upgrades.

# sudo cp ubuntustudio-default-settings-0.61/etc/grub.d/09_lowlatency /etc/grub.d/

 

Update GRUB configurations

In this step, we update the grub configurations to assure all grub.cfg and related files are consistent after installation of the additional lowlatency configuration.

# sudo update-grub

 

Reboot the system

Reboot the system and check if the new lowlatency kernel is installed.

# uname -r
4.4.0-92-lowlatency


Leave a Reply

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