Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulate bad network #50

Open
MichaelMure opened this issue Apr 22, 2018 · 6 comments
Open

Simulate bad network #50

MichaelMure opened this issue Apr 22, 2018 · 6 comments

Comments

@MichaelMure
Copy link

Dropping the idea here, it would be neat to be able to simulate bad network with IPTB. For instance, the DHT works well in perfect network condition, but much less in the real world.

Maybe by integrating https://github.com/tylertreat/comcast with some profiles (x% of low bandwidth node, y% of NATed connection, ...).

Simulating churn would be neat as well.

@maxvisser
Copy link

We also have the use case of wanting to simulate the real world on a private IPFS network. Simulating churn and 'bad' peers would be great addition for benchmarking performance of IPFS on production load.

@whyrusleeping
Copy link
Member

This makes me really happy to say...

Iptb can do this :)

caveat, you must be running on linux, using the docker backend for iptb and have some special permissions surrounding the networking stack granted to your user... but!

You can do:

# make sure to init with the docker backend:
iptb init -n 10 --type=docker

# add 50ms of latency to everything node 4 does
iptb set latency 50ms 4

# limit nodes 3-5 to 12Mbps (input parsing is bad here, i know)
iptb set bandwidth 12 [3-5]

# set a 6% packet loss on node 9
iptb set loss 6 9

# set latency jitter (+/-) of 7ms on nodes 0 through 9
iptb set jitter 7ms [0-9]

My apologies for the lack of documentation around this feature. If someone wants to play around with this, figure the permissions stuff out better (i've just been running commands as root :/) and send me a PR documenting it/improving it, i'll literally buy you a cake.

@whyrusleeping
Copy link
Member

@maxvisser what youre looking for differs slightly from what @MichaelMure is talking about in that you want nodes spun up to perform some set of actions, to simulate a real world ipfs network, right? we built iptb so we could write tests like that using it, but iptb itself doesnt run those tests. Thats intended to be done at a higher level (and we havent quite gotten to that point yet :/)

@dgrisham
Copy link
Member

To avoid having to run the commands that @whyrusleeping listed as root, you can do:

sudo chmod u+s /bin/tc

That's the best solution I've found so far.

@maxvisser
Copy link

maxvisser commented Jun 13, 2018

@whyrusleeping yes. we are currently developing an application that going to use orbitdb and a ipfs node closed off from the internet. We want to test functionallity of IPFS and orbitdb on a production application. In the future we want to migrate to the 'real world ipfs network'. Therefor we already want to start adding some bad network affect like latency etc. that also occur on the real IPFS network.

Plan b for us is built the application and run it on the real IPFS network with dummy data sometime with test users. (which is still not a proper test on production load)

@lry666-yep
Copy link

This makes me really happy to say...

Iptb can do this :)

caveat, you must be running on linux, using the docker backend for iptb and have some special permissions surrounding the networking stack granted to your user... but!

You can do:

# make sure to init with the docker backend:
iptb init -n 10 --type=docker

# add 50ms of latency to everything node 4 does
iptb set latency 50ms 4

# limit nodes 3-5 to 12Mbps (input parsing is bad here, i know)
iptb set bandwidth 12 [3-5]

# set a 6% packet loss on node 9
iptb set loss 6 9

# set latency jitter (+/-) of 7ms on nodes 0 through 9
iptb set jitter 7ms [0-9]

My apologies for the lack of documentation around this feature. If someone wants to play around with this, figure the permissions stuff out better (i've just been running commands as root :/) and send me a PR documenting it/improving it, i'll literally buy you a cake.

Hello, I failed to use these commands on the Linux system. May I ask if there is any document for reference on setting the network environment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants