English 中文(简体)
如何衡量网络业绩(如何确定网络协议的基准)
原标题:How to measure network performance (how to benchmark network protocol)

第一,背景。 对分布式控制系统(DVCS)进行了多种比较,比较了储存量或基准操作速度。 我没有发现任何能够衡量各种家庭暴力和暴力侵害妇女现象网络业绩的基准,而采用的各种议定书......是衡量诸如衣帽、拉/骑自行车或推车等网络行动速度的侧面。

然后,我想知道你如何进行这种比较;如何衡量申请的网络业绩,或如何确定网络协议的基准。 我在此设想,除其他外,还衡量对网络带宽和网络排位(选择时间)的绩效依赖程度;一些议定书以更多的双向交换(谈判)的形式牺牲了相对性,以发送最低要求的最后“包装”。

如果可能,我更喜欢只使用一台电脑的解决办法。 我愿看到开放源解决方案,在含水层工作。 但我也欢迎更多的一般性答复。

Preferred OS: Linux
Preferred languages: C, Perl, shell script


Possible measurements:

  • total number of bytes transferred from server to client and from client to server in one session; this can also be used to measure overhead of protocol (bandwidth)
  • number of round-trips (connections) in one transaction (latency)
  • dependency of speed of network operation (time it takes to clone/pull/push) from network bandwidth, and from network latency (ping time)

如何进行此类测量(这些基准)?


Added 02-06-2009:
A simplest benchmark (measurement) would be a network version of time command, i.e. command which run would give me number of bytes transferred, and number of round trips / network connections during execution of a given command.


Added 09-06-2009:
Example imaginary output for mentioned above solution of network version of time command could look like the following:

$ ntime git clone -q git://git.example.com/repo.git
...
bytes sent: nnn (nn kiB), bytes received: nnn (nn kiB), avg: nn.nn KB/s
nn reads, nn writes

请注意,这只是一个例子,它详细说明了人们可能希望获得的信息类型。


Added 09-06-2009:
It looks like some of what I want can be achieved using dummynet, tool (originally) for testing networking protocols...

最佳回答

如果我正确理解你的话,你对以下一点基本感兴趣:、 字幕() 具体网络系统电话?

Possibly a combination of a profiler and a debugger, for network applications (i.e. ntrace ), providing a detailed analysis of various optional measurements?

strace 实用性主要基于由Lino kernel提供的功能,即:ptrace(过程追踪)。 页: 1

Using ptrace, it should be possible to obtain most of the data that you re interested in.

在Windows,你或许希望查看detours,以便拦截/redirect Winsock API,要求检查/基准。

如果你真的需要所有这种低水平的信息,那么你或许也可以直接使用平级(直线)并且只能用它来追踪某些系统的需求,例如,考虑以下线,仅能追踪公开回忆(使用额外参数——FLE参数,你可以将所有产出转向产出档案):

通过增加一只旗帜以 st笑,你可以提高获得额外信息的快艇(当与许多小壳公用事业公司和独立工具组成的SCM公司合作时,你或许也希望利用国旗,以便也遵循被遗忘的程序)。

因此,你感兴趣的是,所有与/sockets有关,即:

  • accept
  • bind
  • connect
  • getpeername
  • getsockname
  • getsockopt
  • listen
  • recv
  • recvfrom
  • send
  • sendto
  • setsockopt
  • shutdown
  • socket
  • socketpair

(一开始,你可能只想处理发出的....../recv......电话,但)

为了简化这项工作,你还可以将“网络”作为追踪参数,追踪所有与网络有关的电话:

-e trace=network: Trace all the network related system calls.

因此,相应地援引:

strace -v -e trace=accept,bind,connect,getpeername,getsockname,getsockopt,listen,recv,recvfrom,send,sendto setsockopt,shutdown,socket,socketpair -o results.log -f git pull

当方案完成时,你主要希望审查记录,以评价数据,然后通过使用定期表述很容易实现。

For example, when running the following in a linux shell: strace -v -o wget.log -e trace=connect,recv,recvfrom,send,sendto wget http://www.google.com

由此产生的记录中包含诸如以下信息:

  • recv(3, "HTTP/1.0 302 Found Location: htt"..., 511, MSG_PEEK) = 511
  • sendto(4, "242613^206*J"..., 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20

Looking at the man pages for these two system calls, it s obvious that 511 and respectively 20 are the number of bytes that are transferred. If you also need detailed timing information, you can pass the -T flag to strace:

-T - 每一次扫描的印刷时间

此外,可以通过悬挂以下国旗获取一些统计数据:

-c: Count time, calls, and errors for each system call and report a summary on program exit. On Linux, this attempts to show system time (CPU time spent running in the kernel) independent of wall clock time. If -c is used with -f or -F (below), only aggregate totals for all traced processes are kept.

如果你还需要审查所处理的实际数据,你不妨研究阅读/测试的光谱仪:

-e read=set: Perform a full hexadecimal and ASCII dump of all the data read from file descriptors listed in the specified set. For example, to see all input activity on file descriptors 3 and 5 use -e read=3,5. Note that this is independent from the normal tracing of the read(2) system call which is controlled by the option -e trace=read. -e write=set: Perform a full hexadecimal and ASCII dump of all the data written to file descriptors listed in the specified set. For example, to see all output activity on file descriptors 3 and 5 use -e write=3,5. Note that this is independent from the normal tracing of the write(2) system call which is controlled by the option -e trace=write.

你们也可以根据体力的最大长度:

-s strsize: Specify the maximum string size to print (the default is 32). Note that filenames are not considered strings and are always printed in full

或者说有str被丢弃:

-xx: Print all strings in hexadecimal string format.

因此,如果你发现需要额外的低水平信息,你可能希望考虑扩大race,或向

然而,如果更多地考虑这一问题,采用一个比较简单网络交通基准的平台比较少,则采用某种中间层,在客户与实际服务器之间使用:一个基本计量的服务器,分析并向实际服务器转移交通工具。

远如代理服务器(例如SOCKS),这样所有交通都是通过你的分析仪进行铺设的,这反过来又可以积累统计和其他衡量标准。

类似这种基本版本可能很容易通过使用净目录和一些手稿加以合并,但较复杂的版本则可能从使用 per或假冒中获益。

关于SOCKS服务器的安装情况,请查看pysocks

此外,还开设了。 注:

Twisted is an event-driven networking engine written in Python and licensed under the MIT license.

如果你确实需要更低水平的信息,那么你很可能真的想要看拦截系统电话。

If you also need protocol-specific efficiency data, you might want to look into tcpdump.

问题回答

Possible answer would be to use SystemTap. Among example scripts there is nettop which displays (some of) required network information in the "top"-like fashion, and there is iotime script which shows I/O information in required form.





相关问题
C# Networking API s [closed]

Lately I ve been looking for a good networking API i could possibly use and/or reference some of the code within, but i have mere luck searching for some on Google/Bing. Hopefully somebody here has ...

Listen to a port that is in use [duplicate]

Possible Duplicate: Get connecting IP from specified ports that using by other program. If a port is used by a program, is there any way I can listen that port and get the connected IP on that ...

Twisted Spread suitable for multiplayer racing sim?

Do you think that Twisted Spread may be suitable (in terms of performance) for a multiplayer racing simulator? The rest of the application is based on Python-Ogre. Can Perspective Broker run upon (...

Optimizing a LAN server for a game

I m the network programmer on a school game project. We want to have up to 16 players at once on a LAN. I am using the Server-Client model and am creating a new thread per client that joins. ...

multicast ip address - blocked in call to recvfrom

i am writing a simple multicast application. i intend to run it on localhost. i have done the following: char *maddr; . . . sendfd = socket(...); struct sockaddr_in sasend; sasend.sin_family = ...

Java HTTPAUTH

我试图把桌面应用程序连接起来,我是同D.icio.us api @ Delicious Alan书写的,简单地向他们提供我的用户名和密码,并请他把书记上写给我......。

热门标签