I want to compute some metrics relative to the "distance" between two hosts on a network app. I came up with the following naïve solution inspired by ping
.
I'd like to avoid managing raw sockets, but if that's a better option, please tell me.
Would you reccomend another solution?
EDIT:
I think I was not clear on this. I know what's TTL and traceroute
and that's not what I am searching for.
What I am searching for is for a better metric that combine latency, bandwidth and yes, the traditional distance between hosts (because I think traceroute
alone is not that useful for managing a protocol). That's the motivation of using ping
-like measures.
The question becomes can you not modify the existing protocol or be more industrious and capture RTT details from existing request-reply messages?
If you modify the existing protocol, by say adding on transmission time stamp you can perform additional analytics server side. You might be able to still infer times if there is a request-reply from the server to the client.
The main idea being that adding additional messages explicitly for path latency measurement is often highly redundant and only serves to increase network chatter and complexity.
The definition of metrics you are looking for depends on the purpose of it - you can do it in many ways, and which way is the best always depends on the purpose.
In general, you are looking for some function distance(A, B)
. In general that would be a function of bandwidth and latency between A and B:
distance(A, B) = f(bandwidth(A, B), latency(A, B))
the shape of function f() would depend on the purpose, on the application - what you really need to optimize. The simplest would be to use linear function:
distance(A, B) = alpha * bandwidth + beta * latency
and again, the coefficients alpha and beta would depend on what you are trying to optimize. If you have measured some variable that measures your system performance, you can do statistical analysis (regression) to find optimal parameters:
performance(A, B) ~ alpha * bandwidth(A, B) + beta * latency(A, B)
Also be careful when you speak about metrics. Each metric must fulfil the following condition:
distance(A, B) + distance(B, C) >= distance(A, C)
Which is not always true in computer networks, as it depends on router decision.
IMHO it highly depends on specific details of your application.
There could be many manyo ther metrics, also including redundant connections between hosts when reliability is priority. So it highly depends on application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With