英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论