Managing the clock source
The PingDirectory server measures the duration of many operations using the system clock. A clock source that is slow to read can reduce server throughput, particularly on virtualized systems.
Some virtualized environments, such as older Amazon Web Services (AWS) EC2 T2 instance types, use the Xen clock source by default. The Xen clock source is significantly slower to read than alternatives such as Time Stamp Counter (TSC). Modern KVM and Nitro instance types and bare metal systems typically use TSC.
Steps
-
To display the current clock source, run the following command:
$ cat /sys/devices/system/clocksource/clocksource0/current_clocksourceIf the output shows any clock source other than
xen, stop here. The remaining steps don’t apply. -
If the output shows
xen, switch the running system to a faster clock source, such astsc, by running the following command as a user with root privileges:$ sudo bash -c 'echo tsc > /sys/devices/system/clocksource/clocksource0/current_clocksource'The change takes effect immediately for all processes on the system. To revert this change, write the previous clock source to the file in the same way. This runtime change doesn’t persist across system restarts.
-
To make the change persist across system restarts, add the
tscclock source to the kernel command line using the method for your Linux distribution:Choose from:
-
On Rocky Linux, Red Hat Enterprise Linux, and other RHEL-family distributions, run the following command:
$ sudo grubby --update-kernel=ALL --args="clocksource=tsc"This command updates all installed kernels. To verify that the clock source was added to the kernel command line, run the following command:
$ sudo grubby --info=DEFAULT | grep -E 'clocksource|args=' -
On Ubuntu, edit the
/etc/default/grubfile to add thetscclock source to the GRUB_CMDLINE_LINUX_DEFAULT value, preserving any existing arguments. For example:GRUB_CMDLINE_LINUX_DEFAULT="quiet splash clocksource=tsc"Then regenerate the GRUB configuration:
$ sudo update-grub -
On SUSE Enterprise Linux, edit the
/etc/default/grubfile to add thetscclock source to the GRUB_CMDLINE_LINUX_DEFAULT value, preserving any existing arguments. For example:GRUB_CMDLINE_LINUX_DEFAULT="quiet splash clocksource=tsc"Then regenerate the GRUB configuration:
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
-
-
Restart the system:
$ sudo systemctl reboot -
After the restart, display the current clock source again to confirm that the output shows
tsc, and check the kernel command line:$ cat /sys/devices/system/clocksource/clocksource0/current_clocksource $ cat /proc/cmdlineThe
clocksource=tscargument appears in the output of the/proc/cmdlinecheck on all distributions.