Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use multiple NTP hosts? #72

Open
ncreated opened this issue Nov 25, 2020 · 4 comments
Open

Is it possible to use multiple NTP hosts? #72

ncreated opened this issue Nov 25, 2020 · 4 comments

Comments

@ncreated
Copy link

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"
@Reflejo
Copy link
Contributor

Reflejo commented Nov 26, 2020

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 :)

@ncreated
Copy link
Author

ncreated commented Nov 26, 2020

@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?

@Reflejo
Copy link
Contributor

Reflejo commented Nov 28, 2020

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.

@ncreated
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants