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

**URL:** https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159
**Category:** Server operators
**Created:** [March 20, 2019, 12:09am UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159 "2019-03-20T00:09:03Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![electronicslover](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/electronicslover/32/283_2.png) [@electronicslover](https://community.ntppool.org/u/electronicslover)
#### Post date: [March 20, 2019, 12:09am UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/1 "2019-03-20T00:09:03Z")

</div>

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

---

<div class="post-metadata">

### Author: ![littlejason99](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/littlejason99/32/242_2.png) [@littlejason99](https://community.ntppool.org/u/littlejason99)
#### Post date: [March 20, 2019, 12:55pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/2 "2019-03-20T12:55:46Z")

</div>

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…

[https://github.com/mlichvar/rsntp](https://github.com/mlichvar/rsntp)

---

<div class="post-metadata">

### Author: ![mlichvar](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mlichvar](https://community.ntppool.org/u/mlichvar)
#### Post date: [March 20, 2019, 2:48pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/3 "2019-03-20T14:48:54Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![electronicslover](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/electronicslover/32/283_2.png) [@electronicslover](https://community.ntppool.org/u/electronicslover)
#### Post date: [March 20, 2019, 2:54pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/4 "2019-03-20T14:54:04Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mlichvar](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mlichvar](https://community.ntppool.org/u/mlichvar)
#### Post date: [March 20, 2019, 2:59pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/5 "2019-03-20T14:59:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![electronicslover](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/electronicslover/32/283_2.png) [@electronicslover](https://community.ntppool.org/u/electronicslover)
#### Post date: [March 20, 2019, 3:19pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/6 "2019-03-20T15:19:42Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mlichvar](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mlichvar](https://community.ntppool.org/u/mlichvar)
#### Post date: [March 20, 2019, 3:40pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/7 "2019-03-20T15:40:25Z")

</div>

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:

```auto
interface ignore wildcard
interface listen 127.0.0.1

```

`rsntp` should be started with the following options:

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

```

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.

---

<div class="post-metadata">

### Author: ![electronicslover](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/electronicslover/32/283_2.png) [@electronicslover](https://community.ntppool.org/u/electronicslover)
#### Post date: [March 20, 2019, 3:45pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/8 "2019-03-20T15:45:11Z")

</div>

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

 ![Captura%20de%20tela%20de%202019-03-20%2012-44-00](https://us1.discourse-cdn.com/flex016/uploads/ntppool/original/1X/58dab39bf65c99bf08fbe3483520af8a337c29b9.png)

 ![Captura%20de%20tela%20de%202019-03-20%2012-45-41](https://us1.discourse-cdn.com/flex016/uploads/ntppool/original/1X/3996ab62a3984d84cae20bf7aa9d8d0e58ac50d7.png)

---

<div class="post-metadata">

### Author: ![mlichvar](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mlichvar](https://community.ntppool.org/u/mlichvar)
#### Post date: [March 20, 2019, 3:51pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/9 "2019-03-20T15:51:00Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![electronicslover](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/electronicslover/32/283_2.png) [@electronicslover](https://community.ntppool.org/u/electronicslover)
#### Post date: [March 20, 2019, 7:21pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/10 "2019-03-20T19:21:20Z")

</div>

The peak was arround 35kpps

 ![Captura%20de%20tela%20de%202019-03-20%2016-18-08](https://us1.discourse-cdn.com/flex016/uploads/ntppool/original/1X/5af74719e542930b30506c10ed5a43d61bf28e83.png)

---

<div class="post-metadata">

### Author: ![littlejason99](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/littlejason99/32/242_2.png) [@littlejason99](https://community.ntppool.org/u/littlejason99)
#### Post date: [March 20, 2019, 9:10pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/11 "2019-03-20T21:10:05Z")

</div>

What was the max rate before?

---

<div class="post-metadata">

### Author: ![electronicslover](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/electronicslover/32/283_2.png) [@electronicslover](https://community.ntppool.org/u/electronicslover)
#### Post date: [March 20, 2019, 9:27pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/12 "2019-03-20T21:27:00Z")

</div>

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

---

<div class="post-metadata">

### Author: ![electronicslover](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/electronicslover/32/283_2.png) [@electronicslover](https://community.ntppool.org/u/electronicslover)
#### Post date: [March 22, 2019, 7:53pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/13 "2019-03-22T19:53:47Z")

</div>

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!

[https://www.ntppool.org/scores/143.107.229.210](https://www.ntppool.org/scores/143.107.229.210)

---

<div class="post-metadata">

### Author: ![iocc](https://avatars.discourse-cdn.com/v4/letter/i/ba9def/32.png) [@iocc](https://community.ntppool.org/u/iocc)
#### Post date: [March 24, 2019, 6:06pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/14 "2019-03-24T18:06:46Z")

</div>

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

---

<div class="post-metadata">

### Author: ![electronicslover](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/electronicslover/32/283_2.png) [@electronicslover](https://community.ntppool.org/u/electronicslover)
#### Post date: [March 26, 2019, 2:17pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/15 "2019-03-26T14:17:36Z")

</div>

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 127.0.0.1

flag should be different?

---

<div class="post-metadata">

### Author: ![iocc](https://avatars.discourse-cdn.com/v4/letter/i/ba9def/32.png) [@iocc](https://community.ntppool.org/u/iocc)
#### Post date: [March 26, 2019, 2:37pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/16 "2019-03-26T14:37:34Z")

</div>

rsntp -4 3 -6 1 would do that.

---

<div class="post-metadata">

### Author: ![electronicslover](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/electronicslover/32/283_2.png) [@electronicslover](https://community.ntppool.org/u/electronicslover)
#### Post date: [March 26, 2019, 2:50pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/17 "2019-03-26T14:50:33Z")

</div>

i’m with this error:

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

---

<div class="post-metadata">

### Author: ![Bryce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/bryce/32/281_2.png) [@Bryce](https://community.ntppool.org/u/Bryce)
#### Post date: [March 27, 2019, 2:36am UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/18 "2019-03-27T02:36:54Z")

</div>

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

---

<div class="post-metadata">

### Author: ![electronicslover](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/electronicslover/32/283_2.png) [@electronicslover](https://community.ntppool.org/u/electronicslover)
#### Post date: [April 2, 2019, 11:30pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/19 "2019-04-02T23:30:37Z")

</div>

Chrony is better than ntpd? What are the advantages?

---

<div class="post-metadata">

### Author: ![littlejason99](https://sea2.discourse-cdn.com/flex016/user_avatar/community.ntppool.org/littlejason99/32/242_2.png) [@littlejason99](https://community.ntppool.org/u/littlejason99)
#### Post date: [April 3, 2019, 3:15pm UTC](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159/20 "2019-04-03T15:15:14Z")

</div>

[Chrony vs NTPD comparison](https://chrony.tuxfamily.org/comparison.html)

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](https://www.ntpsec.org/) 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.

[Next page](https://community.ntppool.org/t/can-i-incrase-number-of-threads-to-use-in-ntpd-proccess/1159.md?page=2)
