We'd like to simulate the impact of locality using VMs within a on a public cloud (say AWS EC2).

To do this, we would like to inject delays in packets such that we can simulate a particular network topology.

Assume that there are three VMs: A, B, C


A |  <- 5 μs delay -> B 

  | <---- 25 μs delay ----> C

How could we most easily inject a 5 μs delay (or any arbitrary value) for connections between A and B, versus a 25 μs delay between A and C? Any solution is appreciated (Linux kernel level changes on each VM / creating an overlay network / ...).


Creating delays can be simulated by the traffic shaping algorithms supported by the Linux kernel. From the netem manual:

# tc qdisc add dev eth0 root handle 1: prio
# tc qdisc add dev eth0 parent 1:3 handle 30: tbf rate 20kbit buffer 1600 limit  3000
# tc qdisc add dev eth0 parent 30:1 handle 31: netem  delay 200ms 10ms distribution normal
# tc filter add dev eth0 protocol ip parent 1:0 prio 3 u32  match ip dst <IP_of_server_B>/32 flowid 1:3

Which, when issued on Server A creates a 200ms delay with ± 10ms random variation in the traffic to server B.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.