如何使用C#实施单向延迟测量? [英] How to can I implement one way latency measurment using C#?

查看:124
本文介绍了如何使用C#实施单向延迟测量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要测量通过局域网进行通信的两个应用程序之间的单向延迟测量,并将结果报告给数据收集服务器.

客户端应用程序使用多播发送数据,然后它通过两个服务器,最后一个服务器是此测试的终点,就像这样:

Agent -> multicast cloud -> server 1 -> server 2

我曾考虑过使用NTP(或LAN上的PTP)来同步代理"和服务器2",但我想知道什么是实现此目标的正确算法,以及它的精确度.

如何执行此测量(使用C#)?它的精度是多少?

更新:请注意,数据是在代理和服务器2之间进行处理的,因此,测量并非纯粹是基于网络的.

解决方案

根本的问题是在两台或更多台计算机之间同步时钟.

两个远程计算机之间的(时钟)同步

一旦有了这个,您就可以在创建/发送数据包时简单地在数据包本身上添加一个构建时间".从开始到结束的单向延迟是到达时间"减去构建时间"

如果您不能信任中间节点,则必须在服务器上注册代理,以便它希望在特定时间发送数据包.那么从开始到结束的单向延迟就是到达时间"减去期望到达时间"

I need to measure a one direction latency measurement between two applications that communicate thru a LAN and report the result to a data collection server.

The client application sends the data using multicast, then it passes thru two servers and the last server is the end point of this test, like so:

Agent -> multicast cloud -> server 1 -> server 2

I thought about using NTP (or PTP for LAN) to synchronize "agent" and "server 2", but I wonder what's the right algorithm to implement this and what would be its precision.

How can I perform this measurement (using C#)? and what would its precision be?

UPDATE: note that the data is being processed between agent and server 2, so the measurement is not purely network-wise.

解决方案

Underlying problem is synchronizing the clock between two or more machines.

Synchronization (of clocks) between two remote computers

Once you have this, you simply add the add a "construction time" to the packet itself, when it is created/sent. the one-way latency from start to finish is the "arrival time" minus the "construction time"

If you cannot trust the intermediate nodes, then you would have to have Agent register with Server, that it expects to send a packet at a specific time. Then the one-way latency from start to finish is the "arrival time" minus the "expected-arrival time"

这篇关于如何使用C#实施单向延迟测量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆