Kronos
Kronos copied to clipboard
Is it possible to use multiple NTP hosts?
Hello Lyft 🙂👋
I'm stepping across this project, as we're looking for NTP library. It looks great and does what we need with minimum code 🚀. Although, I'm wondering if it's possible to specify multiple NTP hosts?
Kronos Android supports it:
val NTP_HOSTS = listOf("0.pool.ntp.org", "1.pool.ntp.org", "2.pool.ntp.org", "3.pool.ntp.org")
// ..
ntpHosts: List<String> = NTP_HOSTS
but the iOS version seems to only accept single host:
pool: String = "time.apple.com"
What's your use case? You don't want to overload stratum1/2 servers so ideally you'd just use pool.ntp.org
which is, well, a pool :)
@Reflejo thanks for the response 🙂. In our case, I want to use our Datadog pool:
0.datadog.pool.ntp.org
1.datadog.pool.ntp.org
2.datadog.pool.ntp.org
3.datadog.pool.ntp.org
Should I just set it to datadog.pool.ntp.org
then?
I don't think datadog.pool.ntp.org
exists, out of curiosity:
a) Why are you using that one pool for the client? b) What do you expect to happen if you set the 4 hosts? Note Kronos would resolve a single pool and send requests to all the different IPs.
Hey @Reflejo 👋. We work on logging and tracing SDK. Our goal is to synchronise time of events in a distributed environment (where tracing span starts on the mobile client and propagates through the stack of instrumented backend servers). Because our backend agents use NTP, we want to also use it on the mobile clients, to reduce temporal misalignments.
a) Why are you using that one pool for the client?
In theory, there should be no difference depending on which NTP pool I pick, but because our backend agents default to Datadog NTP, I consider it as a good configuration for the mobile SDK as well.
b) What do you expect to happen if you set the 4 hosts? Note Kronos would resolve a single pool and send requests to all the different IPs.
I'd expect that the library picks one of those hosts randomly and performs NTP sync with it. Currently, I implemented this logic in the SDK, and I just randomly set one of these 4 hosts as the host
value for Kronos
clock.
Does it make sense 🙂? I'm not the expert on NTP topic and I don't know much of it details.