模拟高速网络连接
我创建了一个带宽计量应用程序来测量互联网总流量。我需要以相对较高的数据传输速率(例如 4 Mbps)来测试应用程序。我的互联网连接速度很慢,因此我需要一个模拟器来测试我的应用程序以查看高吞吐率的行为。
I have created a bandwidth meter application to measure total Internet traffic. I need to test the application with relatively high data transfer rates, such as 4 Mbps. I have a slow Internet connection, so I need a simulator to test my application to see the behavior with high throughput rates.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
作为一种选择,您可以在一个具有 NAT 网络适配器的虚拟机中运行一些 HTTP 服务器,并从主机系统或类似的虚拟机上对其进行带宽计量测试。
As an option, you can run some HTTP server in one virtual machine with NAT'ed network adapter and test your bandwidth meter against it from the host system or a similar VM.
有商业数据包生成器可以做到这一点,还有一些免费的,例如PackETH 和 Bit-Twist< /a>.
还有其他创造性的解决方案。例如,出于您的目的,数据包是否需要是 IP 数据包?如果没有,您总是可以得到一个“哑”交换机或集线器(没有 spanning-tree 或其他环路保护)并将交叉电缆插入其中。 (或者如果交换机支持 Auto-MDIX,则可以使用直通以太网电缆)这个想法是,如果网络中有环路,集线器/交换机将为您将网络淹没到 100%,因为它会不断地重新转发相同的数据包。
如果您尝试这样做,请确保您的计算机是网络上唯一的计算机,因为这种技术实际上会使其变得毫无用处。 ;-)
您始终可以发送一些 IP 广播数据包来“播种”循环。否则,我认为您可能看到的第一件事是广播 ARP 数据包,如果您正在测量仅限第 3 层 流量。
最后,(特别是如果这听起来太麻烦的话)我建议您阅读依赖注入并重构您的代码,以便您无需高速接口即可对其进行测试。当然,您仍然需要在真正的高速环境中测试代码,但这样做会让您对代码更有信心。
There are commercial packet generators that do this, and also a few freely available ones like PackETH and Bit-Twist.
There are also other creative solutions. For example, do the packets need to be IP packets for your purpose? If not, you could always get a "dumb" switch or hub (no spanning-tree or other loop protection) and plug a crossover cable into it. (or a straight-through Ethernet cable would work if the switch supports Auto-MDIX) The idea would be that with a loop in your network, the hub/switch will flood the network to 100% for you since it will continually re-forward the same packets.
If you try this, be sure yours is the only computer on the network, since this technique will effectively render it useless. ;-)
You could always send some IP broadcast packets to "seed" the loop. Otherwise, the first thing I think you'd likely see is broadcast ARP packets, which won't help if you're measuring layer 3 traffic only.
Lastly, (and especially if this sounds like too much trouble) I recommend you read up on dependency injection and refactor your code so you can test it without the need for a high-speed interface. Of course, you'll still need to test your code in a real high-speed environment, but doing this will give you much more confidence in your code.