Friday, April 17, 2020

Simulating a crappy network for benchmarking - Need second opinion on my benchmark-setup

TL;DR: Dev, not an expert in networking. Trying to simulate really bad WAN connection for benchmarking. I came up with a way how to do it but not completely sure about it. Pls help me verify that my setup makes sense. I am afraid my benchmarking-results won't be meaningful at all if I make any mistake at this stage.

 

Hello fellow redditors,

I am a developper trying to create an application that should works well even under bad WAN conditions (High latency, potentially high loss, maybe over VPN, ...). To verify that my application works well enough I tried to build a testing environment where I can simulate different network conditions.

 

I read a lot of blog posts on how to do this under Linux. I found out that Linux has a lot of the tools needed already on board (tc and netem). I came up with a setup that consists of three ubuntu VMs (server, client and router) and two virtual networks between them. I made tried to make a drawing (benchmark-arcitecture.png) to make my setup clearer for you. I configured the router VM to IP-Forward so client and server can reach each other. To then simulate the network latency/loss/bandwidth I created below script that is executed on the router Ubuntu-VM.

#!/bin/bash LATENCY="50ms" JITTER="10ms" JITTER_CORRELATION="25%" LOSS="0.1%" LOSS_CORRELATION="25%" RATE="10mbit" sudo tc qdisc del dev enp0s3 root sudo tc qdisc del dev enp0s8 root sudo tc qdisc add dev enp0s3 root handle 1: netem delay $LATENCY $JITTER $JITTER_CORRELATION distribution normal loss $LOSS $LOSS_CORRELATION rate $RATE sudo tc qdisc add dev enp0s8 root handle 1: netem delay $LATENCY $JITTER $JITTER_CORRELATION distribution normal loss $LOSS $LOSS_CORRELATION rate $RATE 

The thing I am the most unsure about in this setup are the two tc-commands. I built them together from different things I read in several blog-posts. With some trial-and-error i got it all to work. Now I am somewhat afraid that I made some mistake in this setup that would later cause all my benchmarking-results to be not meaningful at all.

 

Now here are my questions:

  1. Is it really true, that I need the tc/netem command for both network interfaces (because they only apply to outgoing packages). I am afraid of accidentally adding twice as much network-crappiness as I intend to in this way.

  2. Do you think that this approach can work/is any good at simulating realistic bad network conditions?

  3. Maybe do you know a better solution how to simulate bad WAN conditions?

  4. I already used ping, tracepath and iperf3 to try to verify that the connection actually behaves as I am expecting. Do you have any other suggestions how I could verify that my network simulator behaves in a realistic way.

  5. Little bit off the original topic: What do you think would be some really bad (but still realistic) network conditions (latency/jitter/loss/bandwith) that I should be using for my testing.

Of course any other suggestions on that topic are very welcome.

 

Thank you:)



No comments:

Post a Comment