This is a very good answer about how to limit bandwidth.Now Bandwidth is not my primary concern - latency is.What happens if I put a few hundred kilometres between my application-servers and its database-servers?I am looking for a possibility to simulate the expected lag for every IP-packet.
Is there a method for simulating high latency?
networking
You can do this using netem. From their homepage:Emulating wide area network delaysThis is the simplest example, it just adds a fixed amount of delay to all packets going out of the local Ethernet.# tc qdisc add dev eth0 root netem delay 100msNow a simple ping test to host on the local network should show an increase of 100 milliseconds. The delay is limited by the clock resolution of the kernel (Hz). On most 2.4 systems, the system clock runs at 100Hz which allows delays in increments of 10ms. On 2.6, the value is a configuration parameter from 1000 to 100Hz.Later examples just change parameters without reloading the qdiscReal wide area networks show variability so it is possible to add random variation.# tc qdisc change dev eth0 root netem delay 100ms 10msThis causes the added delay to be 100  10ms. Network delay variation isn't purely random, so to emulate that there is a correlation value as well.# tc qdisc change dev eth0 root netem delay 100ms 10ms 25%This causes the added delay to be 100  10ms with the next random element depending 25% on the last one. This isn't true statistical correlation, but an approximation.Delay distributionTypically, the delay in a network is not uniform. It is more common to use a something like a normal distribution to describe the variation in delay. The netem discipline can take a table to specify a non-uniform distribution.# tc qdisc change dev eth0 root netem delay 100ms 20ms distribution normalThe actual tables (normal, pareto, paretonormal) are generated as part of the iproute2 compilation and placed in /usr/lib/tc; so it is possible with some effort to make your own distribution based on experimental data.