Stop KVM guest clock drift from wrecking your database performance
By Saket Jain Published Linux/Unix
Stop KVM guest clock drift from wrecking your database performance
Technical Briefing | 11/5/2026
You probably have at least one VM that shows weird log timestamps or experiences strange performance hiccups that don’t show up on the host. I once spent three days debugging why a transactional database kept timing out on locks, only to realize the guest clock was jumping forward by hundreds of milliseconds every time the host kernel took a heavy I/O load. It’s a classic silent killer in KVM environments.
The KVM clock source is not a magic bullet
Most of us just slap clock source kvm-clock into the guest kernel and call it a day. But if you have an older guest or a host that is oversubscribed, the timing sync between the host hardware and the virtual interrupt controller can desync. The guest eventually thinks it’s losing time, tries to compensate, and suddenly your application layer is dealing with time-warped intervals. If your application relies on monotonic timers for polling or timeout logic, you’re going to have a bad time.
virsh edit vm-name
# Ensure these lines exist under the clock section
<clock offset='utc'>
<timer name='kvmclock' present='yes'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='rtc' tickpolicy='catchup'/>
</clock>
- Avoid using hypervclock if you aren’t running a pure Windows environment because it often conflicts with Linux guest kernel expectations.
- Check your host CPU frequency scaling, if the host is downclocking, the guest clock source jitters hard.
- If you see your database logs reporting negative durations, stop trusting the hardware clock and switch to a more stable time synchronization strategy like PTP.
- Always keep chronyd running inside the guest to handle the small drift, just don’t let it fight the KVM clock source too aggressively.
Next time a dev complains that their tasks are timing out too early, check the guest logs for time jump warnings before you spend hours digging into database row locks. Fix the clock sync first, or you’re just debugging shadows.
