首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Linux命令获取rtt

Linux命令获取rtt
EN

Server Fault用户
提问于 2019-09-15 15:20:51
回答 3查看 9.9K关注 0票数 0

我是Linux的新手,我想知道如何获得或计算Linux的往返时间中位数(RTT) n Linux?

Ping或Packet Internet Groper是一种网络管理实用程序,用于检查IP网络上源和目标计算机/设备之间的连接状态。它还帮助您评估发送和接收来自网络的响应所需的时间。

代码语言:javascript
运行
复制
$ ping -c 5 127.0.0.1
EN

回答 3

Server Fault用户

回答已采纳

发布于 2019-09-15 17:45:37

往返时间(RTT)是发送信号所需的时间长度加上接收该信号的确认所需的时间长度。因此,这一时间由两个信号点之间的传播时间组成。在Internet上,终端用户可以通过敲击IP(Internet Protocol)地址来确定RTT。结果视乎各种因素而定:

代码语言:javascript
运行
复制
1. The data rate transfer of the source’s internet connection.
2. The nature of transmission medium.
3. The physical distance between source and destination.
4. The number of nodes between source and destination.
5. The amount of traffic on the LAN(Local Area Network) to which end user is connected.
6. The number of other requests being handled by intermediate nodes and the remote server.
7. The speed with which intermediate node and the remote server function.
8.The presence of Interference in the circuit.
代码语言:javascript
运行
复制
# This program is used to calculate RTT 

import time 
import requests 

# Function to calculate the RTT 
def RTT(url): 

    # time period when the signal is sent 
    t1 = time.time() 

    r = requests.get(url) 

    # time  period when acknowledgement of signal 
    # is received 
    t2 = time.time() 

    # total time taken during this process 
    tim = str(t2-t1) 

    print("Time in seconds :" + tim) 

# Pilot program 
# url address to hit
url = "http://www.google.com"
RTT(url) 

输出

代码语言:javascript
运行
复制
Time in seconds :0.0579478740692
票数 1
EN

Server Fault用户

发布于 2020-11-28 16:02:09

下面是如何使用ping从常规数据集输出中获得中间和第95百分位数的rtt:

代码语言:javascript
运行
复制
ping -c 5 1.1.1.1 | sed -rn 's|.*=([0-9]+\.?[0-9]+?) ms|\1|p' | LC_ALL=C datamash median 1 perc 1

这将向1.1.1.1发送5个回显请求,将输出过滤为只包含sed的rtt,然后使用datamash计算和输出中位数和第95个百分位数(尽管它可以做更多的事情,参见手册)。

如果在您的区域设置中使用点.作为小数分隔符,则可以在上面的命令中省略LC_ALL=C

票数 1
EN

Server Fault用户

发布于 2019-09-15 17:42:23

ping的iputils实现只对RTT进行了最小、平均、最大和移动标准差的总结。不是百分位数或中位数,而是有用的。

安装一个网络监控系统来测量TCP和ICMP,甚至可以更深入地了解您真正关心的用户响应时间。

尽管在许多ping实现中,mping似乎有一个百分位总结选项。也许其他人也是。

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/984306

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档