How check the rtt or latency between two nodes

I know the consul rtt command to check latency between two nodes, like consul rtt node1 node2.
Its possible verify rtt between nodes with api calls? How I can do that?

If I have two services running in different nodes, I want check the latency and use the node with lower latency.

Hi @85humberto,

Rather than querying the rtt itself, you have various other options in Consul to find the nearest nodes (based on the rtt information).

The following links would help you:

Prepared-Query (linked above) would be an out-of-the-box option to achieve this.

1 Like