简体   繁体   English

如何测量单向延迟?

[英]How to measure one-way latency?

I wanna measure the time the troughput takes from my client to my server.我想测量 troughput 从我的客户端到我的服务器所花费的时间。 Currently i can only measure the full trip (from client to server and back to client) i can do this by measuring the time before we send a packet and measuring it after we receive it back from the server.目前我只能测量完整的行程(从客户端到服务器再回到客户端)我可以通过测量发送数据包之前的时间和从服务器接收回来的时间来测量它。 Technically speaking, if i were to devide the full trip time i would get an avarage of each one-way throughput.从技术上讲,如果我要划分完整的行程时间,我将得到每个单向吞吐量的平均值。

But what if some throughput actually took longer to arrive like this:但是,如果一些吞吐量实际上需要更长时间才能到达,就像这样:

在此处输入图像描述

In the image i created the throughput from client to server is 30 ms and from server to client 90 ms.在我创建的图像中,从客户端到服务器的吞吐量是 30 毫秒,从服务器到客户端是 90 毫秒。 If the data would have such arrival rates then measuring the full round trip and dividing it by 2 would not give an accurate one-way arrival time.如果数据有这样的到达率,那么测量整个往返行程并将其除以 2 将不会给出准确的单向到达时间。 How can i accurately measure one-way arrival times?如何准确测量单程到达时间?

How can i accurately measure one-way arrival times如何准确测量单程到达时间

TL;DR - YOU CAN'T TL;DR - 你不能

This is actually a very deep philosophical question that is unanswered at the very core of physics (the rock bottom "metal" of the universe).这实际上是一个非常深刻的哲学问题,在物理学的核心(宇宙的底部“金属”)中没有得到解答。 Physics does not unequivocally know the one-way speed of light, only the two-way speed.物理学并没有明确地知道单向光速,只知道双向光速。 No experiment we have so far devised can answer that question.到目前为止,我们设计的任何实验都无法回答这个问题。 See The One-Way Speed of Light .请参阅单向光速

Although the average speed over a two-way path can be measured, the one-way speed in one direction or the other is undefined (and not simply unknown), unless one can define what is "the same time" in two different locations.尽管可以测量双向路径上的平均速度,但一个方向或另一个方向的单向速度是未定义的(并且不仅仅是未知的),除非可以定义两个不同位置的“同一时间”。 To measure the time that the light has taken to travel from one place to another it is necessary to know the start and finish times as measured on the same time scale.为了测量光从一个地方传播到另一个地方所花费的时间,有必要知道在同一时间尺度上测量的开始和结束时间。 This requires either two synchronized clocks, one at the start and one at the finish, or some means of sending a signal instantaneously from the start to the finish.这需要两个同步时钟,一个在开始时,一个在结束时,或者需要某种从开始到结束瞬时发送信号的方法。 No instantaneous means of transmitting information is known.没有已知的即时传输信息的方式。 Thus the measured value of the average one-way speed is dependent on the method used to synchronize the start and finish clocks.因此,平均单向速度的测量值取决于用于同步开始和结束时钟的方法。 This is a matter of convention.这是一个约定俗成的问题。

You can get arbitrarily close for non-relativistic situations by synchronizing clocks, but how do you know the clocks stay synchronized?您可以通过同步时钟来任意接近非相对论的情况,但是您如何知道时钟保持同步呢? For your case you'd have to agree to synchronize on the same time signal, but propagation delays can introduce tens to hundreds of milliseconds of delay and jitter.对于您的情况,您必须同意在同一时间信号上同步,但传播延迟可能会引入数十到数百毫秒的延迟和抖动。

So if you want to pin down one-way times to an accuracy less than clock jitter you're out of luck.因此,如果您想将单向时间确定为小于时钟抖动的准确度,那么您就不走运了。 Here's the output from ntpq peer on one of my Linux systems.这是来自我的 Linux 系统之一的ntpq peer等方的 output。

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*unifi.versadns. 71.66.197.233    2 u  289 1024  377    2.298   -0.897   0.747
+eterna.binary.n 68.97.68.79      2 u  615 1024  377   42.258   -3.640   0.430
+homemail.org    139.78.97.128    2 u  160 1024  377   45.257   -0.209   0.391
-time.skylineser 130.207.244.240  2 u  418 1024  103   24.829    2.066   1.376

You might be able to pin down one-way time to within 5ms if both systems use the same master clock for synchronization and have had enough time for delay and jitter to stabilize.如果两个系统都使用相同的主时钟进行同步,并且有足够的时间让延迟和抖动稳定下来,您可能能够将单向时间限制在 5ms 以内。

OWAMP - owping you need to have client and server running, use NTP or chrony to Synchronize time. OWAMP - owping 你需要让客户端和服务器运行,使用 NTP 或 chrony 来同步时间。 There are expensive hardware to sync time between machines as well.也有昂贵的硬件来同步机器之间的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM