README.md
1 Benchmarks
2 ==========
3
4 This directory contains the standard benchmarks used to assess the performance of GRPC. Since these
5 benchmarks run on localhost over loopback the performance of the underlying network is considerably
6 different to real networks and their behavior. To address this issue we recommend the use of
7 a network emulator to make loopback behave more like a real network. To this end the benchmark
8 code looks for a loopback interface with 'benchmark' in its name and attempts to use the address
9 bound to that interface when creating the client and server. If it cannot find such an interface it
10 will print a warning and continue with the default localhost address.
11
12 To attempt to standardize benchmark behavior across machines we attempt to emulate a 10gbit
13 ethernet interface with a packet delay of 0.1ms.
14
15
16 Linux
17 =====
18
19 On Linux we can use [netem](http://www.linuxfoundation.org/collaborate/workgroups/networking/netem) to shape the traffic appropriately.
20
21 ```sh
22 # Remove all traffic shaping from loopback
23 sudo tc qdisc del dev lo root
24 # Add a priority traffic class to the root of loopback
25 sudo tc qdisc add dev lo root handle 1: prio
26 # Add a qdisc under the new class with the appropriate shaping
27 sudo tc qdisc add dev lo parent 1:1 handle 2: netem delay 0.1ms rate 10gbit
28 # Add a filter which selects the new qdisc class for traffic to 127.127.127.127
29 sudo tc filter add dev lo parent 1:0 protocol ip prio 1 u32 match ip dst 127.127.127.127 flowid 2:1
30 # Create an interface alias call 'lo:benchmark' that maps 127.127.127.127 to loopback
31 sudo ip addr add dev lo 127.127.127.127/32 label lo:benchmark
32 ```
33
34 to remove this configuration
35
36 ```sh
37 sudo tc qdisc del dev lo root
38 sudo ip addr del dev lo 127.127.127.127/32 label lo:benchmark
39 ```
40
41 Other Platforms
42 ===============
43
44 Contributions welcome!
45
46