Skip to content

Is it possible to use multiple NTP hosts? #72

Open

Description

@ncreated

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"

Activity

  1. Reflejo commented on Nov 26, 2020

    @Reflejo
    Contributor

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

  2. ncreated commented on Nov 26, 2020

    @ncreated
    Author

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

  3. Reflejo commented on Nov 28, 2020

    @Reflejo
    Contributor

    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.

  4. ncreated commented on Nov 30, 2020

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions