检测 .net/WCF 中的连接速度/带宽
我正在使用 WCF 编写客户端和服务器代码,其中我需要知道客户端和服务器之间的“感知”流量带宽。我可以使用 ping 统计信息单独收集这些信息,但我想知道是否有一种方法可以在 WCF 中配置通道堆栈,以便在执行 Web 服务调用时可以同时收集相同的统计信息。这在 ICMP 被禁用的情况下特别有用(例如 ping 不起作用)。
简而言之,在进行常规业务相关的 Web 服务调用(准确地说是 REST 调用)时,有没有办法隐式收集连接速度数据?
当然,我可以与往返中使用的数据大小相比,对网络服务往返进行计时,以让我了解吞吐量 - 但我不知道感知到的带宽中有多少是与网络相关的,或者仅仅是由于网络相关服务器处理延迟。我也许可以通过让服务器发回代表服务器延迟的时间增量来解决这个问题,以便客户端可以计算实际的网络流量时间。如果没有更复杂的方法,这可能是我的答案......
I'm writing both client and server code using WCF, where I need to know the "perceived" bandwidth of traffic between the client and server. I could use ping statistics to gather this information separately, but I wonder if there is a way to configure the channel stack in WCF so that the same statistics can be gathered simultaneously while performing my web service invocations. This would be particularly useful in cases where ICMP is disabled (e.g. ping won't work).
In short, while making my regular business-related web service calls (REST calls to be precise), is there a way to collect connection speed data implicitly?
Certainly I could time the web service round trip, compared to the size of data used in the round-trip, to give me an idea of throughput - but I won't know how much of that perceived bandwidth was network related, or simply due to server-processing latency. I could perhaps solve that by having the server send back a time delta, representing server latency, so that the client can compute the actual network traffic time. If a more sophisticated approach is not available, that might be my answer...
创建 ICMP 的目的并不是为了尝试这些连接速度统计数据,而是为了在两个主机之间建立有效的连接。
我最好的猜测是,这些 REST 调用或 ICMP 流量中发送的数据量不足以计算感知的连接速度/带宽。
如果您按照这些指标进行计算,您将获得非常大的带宽统计数据或非常低的带宽统计数据,以 Windows XP 中的复印盒为例。您需要发送恒定且大量的数据才能计算有效的吞吐量统计数据。
The ICMP was not created with the intention of trying those connection speed statistics, but rather if a valid connection was made between two hosts.
My best guess is that the amount of data sent in those REST calls or ICMP traffic is not enough to calculate a perceived connection speed / bandwidth.
If you calculate by these metrics, you will get very big bandwidth statistics or very low, use as an example the copy box in windows XP. You need a constant and substantial amount of data to be sent in order to calculate valid throughput statistics.