模拟数据包丢失和延迟的编程实现

huangapple go评论99阅读模式
英文:

simulating packet losses and delays programmatically

问题

我有一个服务器,通过rpc公开其服务,并有一个使用这些服务的客户端。为了测试这个设置,我需要引入数据包丢失和延迟。我在stackoverflow上找到了一些技术,比如tc、修改iptables等,但所有这些都需要root密码来模拟数据包丢失。有没有一种方法可以在不需要root密码的情况下模拟这些数据包丢失。

注意:代码是用GO编程语言编写的。

英文:

I have a server that exposes its services over rpc and a client that uses these services. To test this setup, I need to introduce packet losses and delays. I found a few techniques on stackoverflow like tc, modifying iptables etc but all of them need root password to simulate the packet loss. Is there a way to simulate these packet losses without needing a root password.

Note: The code is written in GO programming language

答案1

得分: 1

一种方法是将您的数据包处理代码隔离出来,并创建一个模拟版本(或使用ifdef的部分),以便在测试时以您选择的方式出现问题。

这可能已经足够满足您的需求。

对于商业或关键应用的工业级测试,您至少需要一个具有root密码的设备。 模拟数据包丢失和延迟的编程实现 可能还需要更多能以更奇特方式出现问题的测试设备。

英文:

One way is to isolate your packet handling code, and create mock-version of it (or ifdef'd sections) that, for testing, misbehave in the manner of your choosing.

That may be enough for your needs.

For industrial-strength testing, for a commercial or critical application, you'll want AT LEAST a box where you have root password. 模拟数据包丢失和延迟的编程实现 And perhaps more exotic test equipment that can misbehave in more exotic ways.

huangapple
  • 本文由 发表于 2011年4月1日 06:19:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/5507043.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定