问题描述
我正在使用WCF编写客户端和服务器代码,在这里我需要知道客户端和服务器之间的感知"流量带宽.我可以使用ping统计信息来分别收集此信息,但是我想知道是否存在一种方法可以在WCF中配置通道堆栈,以便在执行Web服务调用时可以同时收集相同的统计信息.这在禁用ICMP的情况下特别有用(例如ping不起作用).
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).
简而言之,在进行常规的与业务相关的Web服务调用(准确地说是REST调用)时,是否可以隐式收集连接速度数据?
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?
当然,与往返使用的数据大小相比,我可以对Web服务往返进行计时,以使我对吞吐量有一个了解-但是我不知道感知到的带宽中有多少与网络有关,或者仅仅是由于服务器处理延迟.我也许可以通过让服务器发回代表服务器延迟的时间增量来解决该问题,以便客户端可以计算实际的网络流量时间.如果没有更复杂的方法,那可能就是我的答案...
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并不是为了尝试这些连接速度统计信息,而是创建了两个主机之间的有效连接.
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.
我最好的猜测是,在这些REST调用或ICMP流量中发送的数据量不足以计算可感知的连接速度/带宽.
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.
如果通过这些指标计算,您将获得非常大的带宽统计信息或非常低的带宽统计信息,以Windows XP中的副本框为例.您需要不断发送大量数据才能计算有效的吞吐量统计信息.
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.
这篇关于在.net/WCF中检测连接速度/带宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!