Benchmark VPN » Historique » Version 17
Laurent GUERBY, 23/09/2014 19:27
1 | 2 | Baptiste Jonglez | {{>toc}} |
---|---|---|---|
2 | 2 | Baptiste Jonglez | |
3 | 1 | Baptiste Jonglez | h1. Benchmark VPN |
4 | 1 | Baptiste Jonglez | |
5 | 1 | Baptiste Jonglez | But : *étudier la performance de différentes solutions de VPN sur des petits routeurs OpenWRT.* |
6 | 1 | Baptiste Jonglez | |
7 | 1 | Baptiste Jonglez | Le but final étant de se servir des tunnels pour router des IP publiques : [[Partage_ADSL_OpenVPN]] |
8 | 1 | Baptiste Jonglez | |
9 | 2 | Baptiste Jonglez | Pour les autres critères de choix (facilité de mise en place, sécurité, etc), voir [[VPN]]. |
10 | 1 | Baptiste Jonglez | |
11 | 17 | Laurent GUERBY | fastd TODO : https://projects.universe-factory.net/projects/fastd/wiki/Benchmarks |
12 | 17 | Laurent GUERBY | |
13 | 2 | Baptiste Jonglez | h2. Méthodologie |
14 | 1 | Baptiste Jonglez | |
15 | 7 | Baptiste Jonglez | Matériel : un routeur à benchmarker, et deux ordinateurs testeurs (voir plus bas pour se contenter d'un seul ordinateur testeur) |
16 | 7 | Baptiste Jonglez | |
17 | 7 | Baptiste Jonglez | Le routeur monte un tunnel VPN avec un ordinateur branché sur le WAN. Sur le LAN, l'autre ordinateur se connecte normalement. |
18 | 7 | Baptiste Jonglez | |
19 | 7 | Baptiste Jonglez | En un schéma : |
20 | 7 | Baptiste Jonglez | |
21 | 1 | Baptiste Jonglez | !benchmark-setup.png! |
22 | 1 | Baptiste Jonglez | |
23 | 7 | Baptiste Jonglez | Une fois ce setup en place, on utilise iperf en TCP entre les deux laptops, en empruntant le tunnel (i.e. entre 192.168.42.1 et 172.23.38.2 sur le schéma) |
24 | 7 | Baptiste Jonglez | |
25 | 7 | Baptiste Jonglez | On ne fait pas de iperf sur le routeur directement, car iperf bouffe lui-même pas mal de CPU. De plus, sur le routeur, on ne met ni firewall, ni NAT. |
26 | 7 | Baptiste Jonglez | |
27 | 7 | Baptiste Jonglez | Tests à réaliser : *iperf TCP entre les deux laptops, dans les deux sens*, dans les cas suivants : |
28 | 7 | Baptiste Jonglez | |
29 | 7 | Baptiste Jonglez | * test gros paquets (1400 octets), puis petits paquets (cf. VoIP, 50 à 100 octets, la mesure standard étant 64 octets) |
30 | 7 | Baptiste Jonglez | * sans emprunter le VPN (baseline), puis à travers le VPN |
31 | 7 | Baptiste Jonglez | |
32 | 7 | Baptiste Jonglez | Paramètres mesurés : |
33 | 7 | Baptiste Jonglez | |
34 | 7 | Baptiste Jonglez | * débit mesuré par iperf, et en déduire le nombre de paquets par secondes (attention à la taille des headers dans le calcul) |
35 | 7 | Baptiste Jonglez | * consommation CPU sur le routeur (difficilement automatisable / reproductible ?) |
36 | 7 | Baptiste Jonglez | |
37 | 7 | Baptiste Jonglez | Autres tests possibles : |
38 | 7 | Baptiste Jonglez | |
39 | 7 | Baptiste Jonglez | * avec/sans firewall stateful |
40 | 7 | Baptiste Jonglez | * client connecté sur le wifi plutôt que sur un des ports LAN (mais les résultats risquent de beaucoup dépendre du matériel wifi) |
41 | 2 | Baptiste Jonglez | |
42 | 1 | Baptiste Jonglez | À terme, on peut envisager une automatisation de ce processus, par exemple via un paquet OpenWRT pour le routeur et une configuration toute faite et/out script pour le testeur. |
43 | 2 | Baptiste Jonglez | |
44 | 11 | Baptiste Jonglez | h3. Notes sur iperf |
45 | 11 | Baptiste Jonglez | |
46 | 11 | Baptiste Jonglez | * C'est difficile de choisir la taille des paquets (l'option "-M" fait des choses...) |
47 | 11 | Baptiste Jonglez | * Le débit donné par iperf correspond au payload TCP. Avec des petits paquets, le débit affiché peut facilement être deux fois plus faible que le débit brut sur l'interface (overhead des headers TCP/IP/Ethernet) |
48 | 11 | Baptiste Jonglez | * Les chiffres obtenus sont donc à prendre avec des pincettes... C'est l'ordre de grandeur qui est important. |
49 | 11 | Baptiste Jonglez | |
50 | 8 | Baptiste Jonglez | h3. Avec un seul laptop |
51 | 8 | Baptiste Jonglez | |
52 | 8 | Baptiste Jonglez | C'est possible de tester avec un seul laptop, si il a deux interfaces réseau (par exemple une carte réseau USB). Par contre, il faut bidouiller un peu : si on iperf vers une de ses propres adresses, ça va rester en local et ne pas passer par le routeur. |
53 | 8 | Baptiste Jonglez | |
54 | 8 | Baptiste Jonglez | Solution : utiliser les *network namespaces* de linux. Technique décrite ici : http://blog.bofh.it/debian/id_446 |
55 | 8 | Baptiste Jonglez | |
56 | 9 | Baptiste Jonglez | La première interface est eth0, qui sera branchée sur le WAN (donc côté VPN), tandis que eth1 sera utilisée en simple client sur le LAN. |
57 | 9 | Baptiste Jonglez | |
58 | 9 | Baptiste Jonglez | <pre> |
59 | 9 | Baptiste Jonglez | ip netns add bench |
60 | 9 | Baptiste Jonglez | ip link set eth1 netns bench |
61 | 9 | Baptiste Jonglez | ip netns exec bench ip link set lo up |
62 | 9 | Baptiste Jonglez | ip netns exec bench ip link set eth1 up |
63 | 9 | Baptiste Jonglez | </pre> |
64 | 9 | Baptiste Jonglez | |
65 | 9 | Baptiste Jonglez | Il suffit ensuite de faire toutes les manips sur eth1 avec @ip netns exec bench@ devant, ou bien carrément lancer un shell dans le nouveau namespace : |
66 | 9 | Baptiste Jonglez | |
67 | 9 | Baptiste Jonglez | <pre> |
68 | 9 | Baptiste Jonglez | ip netns exec bench /bin/bash |
69 | 9 | Baptiste Jonglez | </pre> |
70 | 9 | Baptiste Jonglez | |
71 | 1 | Baptiste Jonglez | h2. Related |
72 | 2 | Baptiste Jonglez | |
73 | 2 | Baptiste Jonglez | Rien de bien concret côté OpenWRT : |
74 | 1 | Baptiste Jonglez | |
75 | 2 | Baptiste Jonglez | * http://wiki.openwrt.org/doc/howto/performance |
76 | 1 | Baptiste Jonglez | * http://wiki.openwrt.org/doc/hardware/performance |
77 | 2 | Baptiste Jonglez | |
78 | 2 | Baptiste Jonglez | h2. Résultats |
79 | 2 | Baptiste Jonglez | |
80 | 10 | Baptiste Jonglez | h3. Template |
81 | 1 | Baptiste Jonglez | |
82 | 10 | Baptiste Jonglez | Example result (fictional): |
83 | 10 | Baptiste Jonglez | |
84 | 10 | Baptiste Jonglez | |_.Techno |_.Version |_.Packet size |_.In throughput |_. In measured pps |_.Out throughput |_.Out measured pps |_.Router CPU load | |
85 | 10 | Baptiste Jonglez | |/2. No VPN |/2. linux 3.3.8 | 1500 | 95 Mbps | 3K | 95 Mbps | 3K | 50% sirq | |
86 | 10 | Baptiste Jonglez | | 64 | 50 Mbps | 15K | 50 Mbps | 15K | 95% sirq | |
87 | 10 | Baptiste Jonglez | |/2. Openvpn |/2. 2.2 | 1500 | 40 Mbps | 1K | 35 Mbps | 1K | 10% sirq, 90% openvpn | |
88 | 10 | Baptiste Jonglez | | 64 | 5 Mbps | 5K | 10 Mbps | 5K | 50% sirq, 50% openvpn | |
89 | 10 | Baptiste Jonglez | |/2. PPP/L2TPv2 |/2. linux 3.3.8 |
90 | 10 | Baptiste Jonglez | xl2tp 1.3.1 | 1500 | 40 Mbps | 1K | 35 Mbps | 1K | 20% sirq, 80% kernel | |
91 | 10 | Baptiste Jonglez | | 64 | 5 Mbps | 5K | 10 Mbps | 5K | 50% sirq, 50% kernel | |
92 | 10 | Baptiste Jonglez | |
93 | 10 | Baptiste Jonglez | "in" and "out" throughput are defined with respect to the client. "in" is VPN server to LAN client, "out" is LAN client to VPN server. |
94 | 10 | Baptiste Jonglez | |
95 | 10 | Baptiste Jonglez | h3. TP-Link WR841N v8 |
96 | 12 | Baptiste Jonglez | |
97 | 12 | Baptiste Jonglez | See specs: http://wiki.openwrt.org/toh/tp-link/tl-wr841nd#hardware |
98 | 12 | Baptiste Jonglez | |
99 | 12 | Baptiste Jonglez | *Notes:* |
100 | 12 | Baptiste Jonglez | |
101 | 16 | Baptiste Jonglez | * The router is running AA 12.09.1 (2cd71e9e), with default queuing policies (no QoS). Note that the tunnels don't have transmit queues. |
102 | 16 | Baptiste Jonglez | * The laptop used for benchmarking is running Archlinux, and uses the "netns" trick with two network cards (integrated gigabit and USB gigabit) |
103 | 1 | Baptiste Jonglez | * Each throughput figure is obtained by a 60-seconds TCP iperf session |
104 | 1 | Baptiste Jonglez | * Except noted otherwise, everything uses the default config: |
105 | 1 | Baptiste Jonglez | |
106 | 1 | Baptiste Jonglez | * OpenVPN: no compression, 2048 RSA static key, p2p mode, UDP, Blowfish, SHA1 |
107 | 1 | Baptiste Jonglez | * Tinc: no compression, 2048 RSA key, Blowfish, SHA1 |
108 | 16 | Baptiste Jonglez | * The format for versions is <code><software> <version used by the router> (<version used by the VPN server, i.e. laptop>)</code> |
109 | 16 | Baptiste Jonglez | * "payload size" is the size of the TCP payload when using iperf in TCP mode. If you specify "iperf -M X", then the size of the TCP payload is "X - 12" (don't ask me why...) |
110 | 16 | Baptiste Jonglez | * IN: from VPN server to LAN client |
111 | 16 | Baptiste Jonglez | * OUT: from LAN client to VPN server |
112 | 16 | Baptiste Jonglez | * CPU usage is determined by looking hard at <code>top</code>, so consider it ±5% (if not a bit more) |
113 | 15 | Baptiste Jonglez | * This is TCP: for small packets, the ACKs are far from negligible (small UDP packets should produce much better throughputs, probably x1.5) |
114 | 16 | Baptiste Jonglez | * Analysis: see below the table |
115 | 12 | Baptiste Jonglez | |
116 | 12 | Baptiste Jonglez | |_.Techno |_.Version |_.Payload size |_.Direction |_.Throughput |_.pps |_.CPU (usr) |_.CPU (sys) |_.CPU (sirq) |_.Comment | |
117 | 13 | Baptiste Jonglez | |_/4.No VPN |/4. linux 3.3.8 (3.14.5) |/2. 1448 | IN |=. 94.2 Mbps |>. 8129 |=. |=. |=. 50% | Line speed | |
118 | 13 | Baptiste Jonglez | | OUT |=. 94.2 Mbps |>. 8129 |=. |=. |=. 55% | Line speed | |
119 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 17.4 Mbps |>. 28590 |=. |=. |=. 99% | | |
120 | 13 | Baptiste Jonglez | | OUT |=. 23.4 Mbps |>. 38463 |=. |=. |=. 99% | | |
121 | 13 | Baptiste Jonglez | |_/4.GRE |/4. linux 3.3.8 (3.14.5) |/2. 1448 | IN |=. 92.7 Mbps |>. 8003 |=. |=. |=. 78% | Line speed | |
122 | 13 | Baptiste Jonglez | | OUT |=. 92.8 Mbps |>. 8014 |=. |=. |=. 88% | Line speed | |
123 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 10.5 Mbps |>. 17197 |=. |=. |=. 99% | | |
124 | 13 | Baptiste Jonglez | | OUT |=. 9.92 Mbps |>. 16309 |=. |=. |=. 99% | | |
125 | 14 | Baptiste Jonglez | |_/4.IPIP |/4. linux 3.3.8 (3.14.5) |/2. 1448 | IN |=. *93.0 Mbps*|>. 8024 |=. |=. |=. *70%* | Line speed | |
126 | 14 | Baptiste Jonglez | | OUT |=. *93.0 Mbps*|>. 8026 |=. |=. |=. *80%* | Line speed | |
127 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 11.3 Mbps |>. 18602 |=. |=. |=. 99% | | |
128 | 14 | Baptiste Jonglez | | OUT |=. 11.4 Mbps |>.*18803*|=. |=. |=. 99% | | |
129 | 12 | Baptiste Jonglez | |_/4.PPP/L2TPv2 |/4. linux 3.3.8 (3.14.5) |
130 | 13 | Baptiste Jonglez | xl2tp 1.3.1 (1.3.6) |/2. 1448 | IN |=. 88.8 Mbps |>. 7661 |=. |=. |=. 99% | Router is not very | |
131 | 13 | Baptiste Jonglez | | OUT |=. 88.6 Mbps |>. 7648 |=. |=. |=. 99% | responsive (sometimes | |
132 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 9.59 Mbps |>. 15780 |=. |=. |=. 99% | the PPP session | |
133 | 13 | Baptiste Jonglez | | OUT |=. 8.36 Mbps |>. 13745 |=. |=. |=. 99% | even timeouts) | |
134 | 12 | Baptiste Jonglez | |_/4.Tinc |
135 | 12 | Baptiste Jonglez | Default cipher |
136 | 12 | Baptiste Jonglez | Default digest |/4. tinc 1.0.21 (1.0.24) |
137 | 13 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. 15.9 Mbps |>. 1369 |=. 55% |=. 20% |=. 25% | | |
138 | 13 | Baptiste Jonglez | | OUT |=. 15.1 Mbps |>. 1301 |=. 50% |=. 25% |=. 25% | | |
139 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 1.26 Mbps |>. 2069 |=. 40% |=. 25% |=. 35% | | |
140 | 13 | Baptiste Jonglez | | OUT |=. 1.30 Mbps |>. 2140 |=. 40% |=. 30% |=. 30% | | |
141 | 12 | Baptiste Jonglez | |_/4.OpenVPN |
142 | 12 | Baptiste Jonglez | Default cipher |
143 | 12 | Baptiste Jonglez | Default auth |/4. openvpn 2.2.2 (2.3.4) |
144 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *17.9 Mbps*|>. 1548 |=. 55% |=. 20% |=. 25% | | |
145 | 13 | Baptiste Jonglez | | OUT |=. 15.6 Mbps |>. 1345 |=. 53% |=. 23% |=. 23% | | |
146 | 14 | Baptiste Jonglez | |/2. 76 | IN |=. 1.46 Mbps |>. *2395*|=. 40% |=. 25% |=. 35% | | |
147 | 13 | Baptiste Jonglez | | OUT |=. 1.29 Mbps |>. 2116 |=. 40% |=. 30% |=. 30% | | |
148 | 12 | Baptiste Jonglez | |_/4.Tinc |
149 | 12 | Baptiste Jonglez | No cipher |
150 | 12 | Baptiste Jonglez | Default digest |/4. tinc 1.0.21 (1.0.24) |
151 | 13 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. 22.9 Mbps |>. 1975 |=. 45% |=. 27% |=. 27% | | |
152 | 13 | Baptiste Jonglez | | OUT |=. 21.3 Mbps |>. 1842 |=. 40% |=. 35% |=. 25% | | |
153 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 1.53 Mbps |>. 2511 |=. 35% |=. 30% |=. 35% | | |
154 | 13 | Baptiste Jonglez | | OUT |=. 1.57 Mbps |>. 2574 |=. 35% |=. 35% |=. 30% | | |
155 | 12 | Baptiste Jonglez | |_/4.OpenVPN |
156 | 12 | Baptiste Jonglez | No cipher |
157 | 12 | Baptiste Jonglez | Default auth |/4. openvpn 2.2.2 (2.3.4) |
158 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *26.8 Mbps*|>. 2313 |=. 35% |=. 30% |=. 35% | | |
159 | 13 | Baptiste Jonglez | | OUT |=. 26.2 Mbps |>. 2264 |=. 35% |=. 30% |=. 30% | | |
160 | 14 | Baptiste Jonglez | |/2. 76 | IN |=. 1.92 Mbps |>. *3153*|=. 30% |=. 30% |=. 40% | | |
161 | 13 | Baptiste Jonglez | | OUT |=. 1.90 Mbps |>. 3130 |=. 30% |=. 35% |=. 35% | | |
162 | 12 | Baptiste Jonglez | |_/4.Tinc |
163 | 12 | Baptiste Jonglez | Default cipher |
164 | 12 | Baptiste Jonglez | No digest |/4. tinc 1.0.21 (1.0.24) |
165 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *23.9 Mbps*|>. 2062 |=. 45% |=. 27% |=. 27% | | |
166 | 13 | Baptiste Jonglez | | OUT |=. 21.9 Mbps |>. 1890 |=. 35% |=. 35% |=. 30% | | |
167 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 1.95 Mbps |>. 3206 |=. 25% |=. 30% |=. 45% | | |
168 | 14 | Baptiste Jonglez | | OUT |=. 1.96 Mbps |>. *3225*|=. 25% |=. 40% |=. 35% | | |
169 | 12 | Baptiste Jonglez | |_/4.OpenVPN |
170 | 12 | Baptiste Jonglez | Default cipher |
171 | 12 | Baptiste Jonglez | No auth |/4. openvpn 2.2.2 (2.3.4) |
172 | 13 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. 22.0 Mbps |>. 1899 |=. 50% |=. 20% |=. 30% | | |
173 | 13 | Baptiste Jonglez | | OUT |=. 18.9 Mbps |>. 1632 |=. 50% |=. 20% |=. 25% | | |
174 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 1.71 Mbps |>. 2819 |=. 35% |=. 30% |=. 35% | | |
175 | 13 | Baptiste Jonglez | | OUT |=. 1.46 Mbps |>. 2403 |=. 40% |=. 30% |=. 30% | | |
176 | 12 | Baptiste Jonglez | |_/4.Tinc |
177 | 12 | Baptiste Jonglez | No cipher |
178 | 12 | Baptiste Jonglez | No digest |/4. tinc 1.0.21 (1.0.24) |
179 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *42.2 Mbps*|>. 3639 |=. 10% |=. 45% |=. 45% | | |
180 | 13 | Baptiste Jonglez | | OUT |=. 36.7 Mbps |>. 3167 |=. 10% |=. 50% |=. 40% | | |
181 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 2.60 Mbps |>. 4276 |=. 10% |=. 40% |=. 50% | | |
182 | 13 | Baptiste Jonglez | | OUT |=. 2.59 Mbps |>. 4257 |=. 10% |=. 45% |=. 45% | | |
183 | 12 | Baptiste Jonglez | |_/4.OpenVPN |
184 | 12 | Baptiste Jonglez | No cipher |
185 | 12 | Baptiste Jonglez | No auth |/4. openvpn 2.2.2 (2.3.4) |
186 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *42.8 Mbps*|>. 3693 |=. 15% |=. 35% |=. 50% | | |
187 | 13 | Baptiste Jonglez | | OUT |=. 41.8 Mbps |>. 3607 |=. 10% |=. 45% |=. 45% | | |
188 | 14 | Baptiste Jonglez | |/2. 76 | IN |=. 2.68 Mbps |>. *4411*|=. 15% |=. 35% |=. 50% | | |
189 | 1 | Baptiste Jonglez | | OUT |=. 2.66 Mbps |>. 4380 |=. 15% |=. 40% |=. 45% | | |
190 | 15 | Baptiste Jonglez | |
191 | 15 | Baptiste Jonglez | *Analysis:* |
192 | 15 | Baptiste Jonglez | |
193 | 15 | Baptiste Jonglez | * Without surprise, kernelspace tunnels are much faster than userspace tunnels |
194 | 15 | Baptiste Jonglez | * IPIP is slightly faster than GRE (but does not support IPv6) |
195 | 15 | Baptiste Jonglez | * L2TPv2 is slightly slower than GRE or IPIP, and has a higher packet overhead; however, it can be simpler to deploy (see [[VPN#PPPL2TPv2]]) |
196 | 15 | Baptiste Jonglez | * *but* don't use L2TPv2 if you expect very high throughput, as control messages will get completely overlooked by our busy router and the session will drop |
197 | 15 | Baptiste Jonglez | * OpenVPN is slightly faster than Tinc, _except_ when encrypting packets without authenticating them (this is kind of funny). But basically, use the one you like best, there is no real difference. |
198 | 15 | Baptiste Jonglez | * PPS performance is definitely not great: 4K in userspace, 19K in kernelspace. However, remember that this is TCP, so the router is also busy forwarding ACKs. |
199 | 15 | Baptiste Jonglez | * Unless you need high throughput, Tinc or OpenVPN without crypto have quite acceptable performance. |