Can i incrase number of threads to use in ntpd proccess?


Hello there,

As some users know, like i posted before, i have a raspberry pi stratum 1 server running ntpd, but sometimes when the load incrases i see only one cores of raspberry pi is fully used to process the ntpd process, I already incrased de nice of process to -20 (highest priority), but i want to know if have some way to incrase the number of cores that can be used by ntpd…

Best regards,

Luiz Paulo



Both NTPD & Chrony are single-thread applications…

I don’t know if a Pi has a Rust package, but there is this multi-threaded front-end…



FWIW, I tried rsntp on a Pi 3B+ some time ago and it didn’t help much. IIRC it could do only about 20-25 kpps. I suspect the bottleneck is in the USB NIC, not the CPU.



I’m gonna try here, i’m using a full link of 100mbps (with onboard ethernet) and preempt-rt kernel… How can i configure this rsntp? is the same of ntpd configuration? Already compilled.



You still need ntpd or chronyd to synchronize the clock. They need to be configured to listen on a different port or the loopback interface, so rsntp can bind to the NTP port and respond to client requests. Please see the README in the github repo.



so, i should use “restrict ntpport 11123” on my ntp.conf ?



No extra restrict commands should be necessary. ntpd cannot be configured to change the port, so it needs to listen on the loopback interface only:

interface ignore wildcard
interface listen

rsntp should be started with the following options:

rsntp -4 2 -6 0 -a $ADDRESS:123 -s

where $ADDRESS is the address of the real interface (it cannot bind to wildcard). If you have an IPv6 address, it should be specified with the -b option and -6 should be changed to 1 or how many threads you want to use for IPv6.

1 Like


Thanks! Did you recommend some specific testing? Its running perfectly i think



Run ntpdate or similar on a remote machine to make sure it is responding with “synchronized” packets. If your score is dropping suddenly, you know it’s wrong.

htop shows that all cores are utilized, but it would be nice to confirm it’s actually handling more packets. In my experience with a Raspberry Pi it was only slightly more, maybe 20%. That was with rsntp built by cargo build --release. Debug binary was significantly slower.



The peak was arround 35kpps



What was the max rate before?



Before the rsntp The packet rate was about 7 to 12 kpps



Good news! With rsntp the server score stays very stable, is really impressive! The only drop after reach maximum punctuation is because a reboot that i’ve made!



I have also good experience with rsntp.
Its better use of resources to use rsntp instead of some other.

1 Like


The only drops are for server load while i’m tweaking and compilling kernel, so, it is really good! Another question, RPI has 4 cores, can i use 3 cores for IPv4 and 1 core for IPv6? The

interface listen

flag should be different?



rsntp -4 3 -6 1 would do that.



i’m with this error:

thread ‘main’ panicked at ‘Couldn’t bind socket: Address already in use (os error 98)’, src/



I’ll have to try rsntp. I have optimized chrony to the point that it can handle at least 20mbps but I had to make some compromises



Chrony is better than ntpd? What are the advantages?



Chrony vs NTPD comparison

Better is a matter of opinion I suppose. NTPD has been around a long time, has direct support for many (legacy) refclocks, and other good things. However the source code has really grown over the decades and is in serious need of a major overhaul.

Chrony is a more recent program, it’s also much leaner. It doesn’t have all the legacy support that NTPD has, it’s geared towards more modern OSes.

There is also NTPsec which is a fork of NTPD that has been stripped down and removed a ton of the obsolete legacy code (thus like Chrony it also only builds on more modern OSes). As the name implies it is more security focused too, I believe they have also re-written a fair amount of code.

1 Like