是否可以使用 ping 来测量带宽?

发布于 2024-07-17 16:56:16 字数 46 浏览 7 评论 0原文

我们能否从 ping 服务器所需的时间找到互联网带宽(如果是的话)是如何完成的

Can we find the internet bandwidth from the time it takes to ping a server if yes how is it done

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

神也荒唐 2024-07-24 16:56:16

不,ping 不会告诉您任何有关带宽的信息,它只是测量延迟。 测量带宽最好通过专门的测试来完成,即传输一堆比特并测量它需要多长时间。 您可能需要考虑带宽可能会因许多因素而发生巨大变化,例如:

  • 方向; A 到 B 可能比 B 到 A 更快,反之亦然
  • ; 取决于所涉及链路的总体负载水平所
  • 采取的确切路线,而该路线又可能随机变化

No, ping tells you nothing about the bandwidth, it just measures latency. Measuring bandwidth is best done by a dedicated test, i.e. transferring a bunch of bits and measuring how long time it takes. You might want to consider that the bandwidth can vary dramatically with many factors, such as:

  • Direction; A to B might be faster than B to A, or vice versa
  • Time of day; depending on general load level of links involved
  • The exact route taken, which in turn can vary randomly
鹊巢 2024-07-24 16:56:16

您可以通过创建不同大小的 ping 来进行非常粗略的测量,

然后可以使用较小和较大 ping 之间的延迟差异来形成延迟计算的基础。

实际上,对于宽带速度来说,这不会产生任何有意义的数据。 在调制解调器速度或更慢的情况下,您也许能够获得带宽指示,但不太可能准确且可重复。

但正如其他人已经指出的那样,ping 最好用作延迟的指示,并且有更好的方法来测量带宽。

You might be able to make a very crude measure by creating pings of differing sizes

You could then use the difference in the latency between the smaller and larger pings to form the basis of your latency calculation.

Practically though with broadband speeds this would yield no meaningful data. At modem speeds or slower you may be able to get an indication of bandwidth, but it is unlikely to be accurate and repeatable.

But as others have already indicated pings are best used as an indication of latency and there are better ways to measure bandwidth.

旧街凉风 2024-07-24 16:56:16

几年前,我对电缆延迟和带宽使用之间的关系进行了一些调查。

基本上,如果您从零带宽开始并增加带宽使用,延迟会非常缓慢地增加 - 直到您达到大约 90% 的带宽。 然后,延迟时间会达到顶峰,到达另一个平台,之后再次缓慢增加。

Some years ago, I did some investigation into the relationship between latency and bandwidth use over cable.

Basically, if you start from zero bandwidth and increase bandwidth use, latency very slowly increases - until you hit about 90% of your bandwidth. Then latency goes through the roof, up to another plateau, after which it again increases slowly.

三生一梦 2024-07-24 16:56:16

不,但您也许能够估计延迟。

No, but you might be able to estimate the latency.

長街聽風 2024-07-24 16:56:16

如果您事先知道通道的延迟,则可以测量带宽。

您可以使用大 ping 包并在了解通道类型和预期 RTT 的情况下估计带宽。

You can measure bandwidth if you know the latency of the channel beforehand.

You can use big ping packages and estimate the bandwidth knowing the type of channel and the expected RTT.

御守 2024-07-24 16:56:16

我问了同样的问题,但每个人都说 ping 不能很好地测量带宽。 下面列出的这批是使用 ping 进行的带宽速度测试,但其最大限制为 1000kb/s,并且在这种简单的形式中不会进行舍入,但您可以使用它并进行实验。

@echo off
:begin
color 0b
MODE CON:COLS=15 LINES=3
for /F "tokens=10 delims=ms=," %%a in ('ping -n 1 -w 1000 -l 1024 8.8.8.8^| find "Average"') do set "A1=%%a"
set /a T=%A1%
set /a varia=1000/%T%
set /a answer=%varia%
set /a varia2=%answer%
set /a answer2=%varia2%
echo.
echo  Speed %answer2% Kb/s
sleep 5
goto begin

I asked the same thing but what everybody says is true ping will not measure bandwidth well. this batch listed below is a bandwidth speed test with ping but its limited to a max of 1000kb/s and in this simple form doesn't round up but you can play with it and experiment.

@echo off
:begin
color 0b
MODE CON:COLS=15 LINES=3
for /F "tokens=10 delims=ms=," %%a in ('ping -n 1 -w 1000 -l 1024 8.8.8.8^| find "Average"') do set "A1=%%a"
set /a T=%A1%
set /a varia=1000/%T%
set /a answer=%varia%
set /a varia2=%answer%
set /a answer2=%varia2%
echo.
echo  Speed %answer2% Kb/s
sleep 5
goto begin
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文