Benchmark VPN » Historique » Version 16
Baptiste Jonglez, 08/06/2014 16:39
Precisions
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 | 2 | Baptiste Jonglez | h2. Méthodologie |
12 | 1 | Baptiste Jonglez | |
13 | 7 | Baptiste Jonglez | Matériel : un routeur à benchmarker, et deux ordinateurs testeurs (voir plus bas pour se contenter d'un seul ordinateur testeur) |
14 | 7 | Baptiste Jonglez | |
15 | 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. |
16 | 7 | Baptiste Jonglez | |
17 | 7 | Baptiste Jonglez | En un schéma : |
18 | 7 | Baptiste Jonglez | |
19 | 1 | Baptiste Jonglez | !benchmark-setup.png! |
20 | 1 | Baptiste Jonglez | |
21 | 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) |
22 | 7 | Baptiste Jonglez | |
23 | 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. |
24 | 7 | Baptiste Jonglez | |
25 | 7 | Baptiste Jonglez | Tests à réaliser : *iperf TCP entre les deux laptops, dans les deux sens*, dans les cas suivants : |
26 | 7 | Baptiste Jonglez | |
27 | 7 | Baptiste Jonglez | * test gros paquets (1400 octets), puis petits paquets (cf. VoIP, 50 à 100 octets, la mesure standard étant 64 octets) |
28 | 7 | Baptiste Jonglez | * sans emprunter le VPN (baseline), puis à travers le VPN |
29 | 7 | Baptiste Jonglez | |
30 | 7 | Baptiste Jonglez | Paramètres mesurés : |
31 | 7 | Baptiste Jonglez | |
32 | 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) |
33 | 7 | Baptiste Jonglez | * consommation CPU sur le routeur (difficilement automatisable / reproductible ?) |
34 | 7 | Baptiste Jonglez | |
35 | 7 | Baptiste Jonglez | Autres tests possibles : |
36 | 7 | Baptiste Jonglez | |
37 | 7 | Baptiste Jonglez | * avec/sans firewall stateful |
38 | 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) |
39 | 2 | Baptiste Jonglez | |
40 | 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. |
41 | 2 | Baptiste Jonglez | |
42 | 11 | Baptiste Jonglez | h3. Notes sur iperf |
43 | 11 | Baptiste Jonglez | |
44 | 11 | Baptiste Jonglez | * C'est difficile de choisir la taille des paquets (l'option "-M" fait des choses...) |
45 | 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) |
46 | 11 | Baptiste Jonglez | * Les chiffres obtenus sont donc à prendre avec des pincettes... C'est l'ordre de grandeur qui est important. |
47 | 11 | Baptiste Jonglez | |
48 | 8 | Baptiste Jonglez | h3. Avec un seul laptop |
49 | 8 | Baptiste Jonglez | |
50 | 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. |
51 | 8 | Baptiste Jonglez | |
52 | 8 | Baptiste Jonglez | Solution : utiliser les *network namespaces* de linux. Technique décrite ici : http://blog.bofh.it/debian/id_446 |
53 | 8 | Baptiste Jonglez | |
54 | 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. |
55 | 9 | Baptiste Jonglez | |
56 | 9 | Baptiste Jonglez | <pre> |
57 | 9 | Baptiste Jonglez | ip netns add bench |
58 | 9 | Baptiste Jonglez | ip link set eth1 netns bench |
59 | 9 | Baptiste Jonglez | ip netns exec bench ip link set lo up |
60 | 9 | Baptiste Jonglez | ip netns exec bench ip link set eth1 up |
61 | 9 | Baptiste Jonglez | </pre> |
62 | 9 | Baptiste Jonglez | |
63 | 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 : |
64 | 9 | Baptiste Jonglez | |
65 | 9 | Baptiste Jonglez | <pre> |
66 | 9 | Baptiste Jonglez | ip netns exec bench /bin/bash |
67 | 9 | Baptiste Jonglez | </pre> |
68 | 9 | Baptiste Jonglez | |
69 | 1 | Baptiste Jonglez | h2. Related |
70 | 2 | Baptiste Jonglez | |
71 | 2 | Baptiste Jonglez | Rien de bien concret côté OpenWRT : |
72 | 1 | Baptiste Jonglez | |
73 | 2 | Baptiste Jonglez | * http://wiki.openwrt.org/doc/howto/performance |
74 | 1 | Baptiste Jonglez | * http://wiki.openwrt.org/doc/hardware/performance |
75 | 2 | Baptiste Jonglez | |
76 | 2 | Baptiste Jonglez | h2. Résultats |
77 | 2 | Baptiste Jonglez | |
78 | 10 | Baptiste Jonglez | h3. Template |
79 | 1 | Baptiste Jonglez | |
80 | 10 | Baptiste Jonglez | Example result (fictional): |
81 | 10 | Baptiste Jonglez | |
82 | 10 | Baptiste Jonglez | |_.Techno |_.Version |_.Packet size |_.In throughput |_. In measured pps |_.Out throughput |_.Out measured pps |_.Router CPU load | |
83 | 10 | Baptiste Jonglez | |/2. No VPN |/2. linux 3.3.8 | 1500 | 95 Mbps | 3K | 95 Mbps | 3K | 50% sirq | |
84 | 10 | Baptiste Jonglez | | 64 | 50 Mbps | 15K | 50 Mbps | 15K | 95% sirq | |
85 | 10 | Baptiste Jonglez | |/2. Openvpn |/2. 2.2 | 1500 | 40 Mbps | 1K | 35 Mbps | 1K | 10% sirq, 90% openvpn | |
86 | 10 | Baptiste Jonglez | | 64 | 5 Mbps | 5K | 10 Mbps | 5K | 50% sirq, 50% openvpn | |
87 | 10 | Baptiste Jonglez | |/2. PPP/L2TPv2 |/2. linux 3.3.8 |
88 | 10 | Baptiste Jonglez | xl2tp 1.3.1 | 1500 | 40 Mbps | 1K | 35 Mbps | 1K | 20% sirq, 80% kernel | |
89 | 10 | Baptiste Jonglez | | 64 | 5 Mbps | 5K | 10 Mbps | 5K | 50% sirq, 50% kernel | |
90 | 10 | Baptiste Jonglez | |
91 | 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. |
92 | 10 | Baptiste Jonglez | |
93 | 10 | Baptiste Jonglez | h3. TP-Link WR841N v8 |
94 | 12 | Baptiste Jonglez | |
95 | 12 | Baptiste Jonglez | See specs: http://wiki.openwrt.org/toh/tp-link/tl-wr841nd#hardware |
96 | 12 | Baptiste Jonglez | |
97 | 12 | Baptiste Jonglez | *Notes:* |
98 | 12 | Baptiste Jonglez | |
99 | 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. |
100 | 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) |
101 | 1 | Baptiste Jonglez | * Each throughput figure is obtained by a 60-seconds TCP iperf session |
102 | 1 | Baptiste Jonglez | * Except noted otherwise, everything uses the default config: |
103 | 1 | Baptiste Jonglez | |
104 | 1 | Baptiste Jonglez | * OpenVPN: no compression, 2048 RSA static key, p2p mode, UDP, Blowfish, SHA1 |
105 | 1 | Baptiste Jonglez | * Tinc: no compression, 2048 RSA key, Blowfish, SHA1 |
106 | 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> |
107 | 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...) |
108 | 16 | Baptiste Jonglez | * IN: from VPN server to LAN client |
109 | 16 | Baptiste Jonglez | * OUT: from LAN client to VPN server |
110 | 16 | Baptiste Jonglez | * CPU usage is determined by looking hard at <code>top</code>, so consider it ±5% (if not a bit more) |
111 | 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) |
112 | 16 | Baptiste Jonglez | * Analysis: see below the table |
113 | 12 | Baptiste Jonglez | |
114 | 12 | Baptiste Jonglez | |_.Techno |_.Version |_.Payload size |_.Direction |_.Throughput |_.pps |_.CPU (usr) |_.CPU (sys) |_.CPU (sirq) |_.Comment | |
115 | 13 | Baptiste Jonglez | |_/4.No VPN |/4. linux 3.3.8 (3.14.5) |/2. 1448 | IN |=. 94.2 Mbps |>. 8129 |=. |=. |=. 50% | Line speed | |
116 | 13 | Baptiste Jonglez | | OUT |=. 94.2 Mbps |>. 8129 |=. |=. |=. 55% | Line speed | |
117 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 17.4 Mbps |>. 28590 |=. |=. |=. 99% | | |
118 | 13 | Baptiste Jonglez | | OUT |=. 23.4 Mbps |>. 38463 |=. |=. |=. 99% | | |
119 | 13 | Baptiste Jonglez | |_/4.GRE |/4. linux 3.3.8 (3.14.5) |/2. 1448 | IN |=. 92.7 Mbps |>. 8003 |=. |=. |=. 78% | Line speed | |
120 | 13 | Baptiste Jonglez | | OUT |=. 92.8 Mbps |>. 8014 |=. |=. |=. 88% | Line speed | |
121 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 10.5 Mbps |>. 17197 |=. |=. |=. 99% | | |
122 | 13 | Baptiste Jonglez | | OUT |=. 9.92 Mbps |>. 16309 |=. |=. |=. 99% | | |
123 | 14 | Baptiste Jonglez | |_/4.IPIP |/4. linux 3.3.8 (3.14.5) |/2. 1448 | IN |=. *93.0 Mbps*|>. 8024 |=. |=. |=. *70%* | Line speed | |
124 | 14 | Baptiste Jonglez | | OUT |=. *93.0 Mbps*|>. 8026 |=. |=. |=. *80%* | Line speed | |
125 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 11.3 Mbps |>. 18602 |=. |=. |=. 99% | | |
126 | 14 | Baptiste Jonglez | | OUT |=. 11.4 Mbps |>.*18803*|=. |=. |=. 99% | | |
127 | 12 | Baptiste Jonglez | |_/4.PPP/L2TPv2 |/4. linux 3.3.8 (3.14.5) |
128 | 13 | Baptiste Jonglez | xl2tp 1.3.1 (1.3.6) |/2. 1448 | IN |=. 88.8 Mbps |>. 7661 |=. |=. |=. 99% | Router is not very | |
129 | 13 | Baptiste Jonglez | | OUT |=. 88.6 Mbps |>. 7648 |=. |=. |=. 99% | responsive (sometimes | |
130 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 9.59 Mbps |>. 15780 |=. |=. |=. 99% | the PPP session | |
131 | 13 | Baptiste Jonglez | | OUT |=. 8.36 Mbps |>. 13745 |=. |=. |=. 99% | even timeouts) | |
132 | 12 | Baptiste Jonglez | |_/4.Tinc |
133 | 12 | Baptiste Jonglez | Default cipher |
134 | 12 | Baptiste Jonglez | Default digest |/4. tinc 1.0.21 (1.0.24) |
135 | 13 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. 15.9 Mbps |>. 1369 |=. 55% |=. 20% |=. 25% | | |
136 | 13 | Baptiste Jonglez | | OUT |=. 15.1 Mbps |>. 1301 |=. 50% |=. 25% |=. 25% | | |
137 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 1.26 Mbps |>. 2069 |=. 40% |=. 25% |=. 35% | | |
138 | 13 | Baptiste Jonglez | | OUT |=. 1.30 Mbps |>. 2140 |=. 40% |=. 30% |=. 30% | | |
139 | 12 | Baptiste Jonglez | |_/4.OpenVPN |
140 | 12 | Baptiste Jonglez | Default cipher |
141 | 12 | Baptiste Jonglez | Default auth |/4. openvpn 2.2.2 (2.3.4) |
142 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *17.9 Mbps*|>. 1548 |=. 55% |=. 20% |=. 25% | | |
143 | 13 | Baptiste Jonglez | | OUT |=. 15.6 Mbps |>. 1345 |=. 53% |=. 23% |=. 23% | | |
144 | 14 | Baptiste Jonglez | |/2. 76 | IN |=. 1.46 Mbps |>. *2395*|=. 40% |=. 25% |=. 35% | | |
145 | 13 | Baptiste Jonglez | | OUT |=. 1.29 Mbps |>. 2116 |=. 40% |=. 30% |=. 30% | | |
146 | 12 | Baptiste Jonglez | |_/4.Tinc |
147 | 12 | Baptiste Jonglez | No cipher |
148 | 12 | Baptiste Jonglez | Default digest |/4. tinc 1.0.21 (1.0.24) |
149 | 13 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. 22.9 Mbps |>. 1975 |=. 45% |=. 27% |=. 27% | | |
150 | 13 | Baptiste Jonglez | | OUT |=. 21.3 Mbps |>. 1842 |=. 40% |=. 35% |=. 25% | | |
151 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 1.53 Mbps |>. 2511 |=. 35% |=. 30% |=. 35% | | |
152 | 13 | Baptiste Jonglez | | OUT |=. 1.57 Mbps |>. 2574 |=. 35% |=. 35% |=. 30% | | |
153 | 12 | Baptiste Jonglez | |_/4.OpenVPN |
154 | 12 | Baptiste Jonglez | No cipher |
155 | 12 | Baptiste Jonglez | Default auth |/4. openvpn 2.2.2 (2.3.4) |
156 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *26.8 Mbps*|>. 2313 |=. 35% |=. 30% |=. 35% | | |
157 | 13 | Baptiste Jonglez | | OUT |=. 26.2 Mbps |>. 2264 |=. 35% |=. 30% |=. 30% | | |
158 | 14 | Baptiste Jonglez | |/2. 76 | IN |=. 1.92 Mbps |>. *3153*|=. 30% |=. 30% |=. 40% | | |
159 | 13 | Baptiste Jonglez | | OUT |=. 1.90 Mbps |>. 3130 |=. 30% |=. 35% |=. 35% | | |
160 | 12 | Baptiste Jonglez | |_/4.Tinc |
161 | 12 | Baptiste Jonglez | Default cipher |
162 | 12 | Baptiste Jonglez | No digest |/4. tinc 1.0.21 (1.0.24) |
163 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *23.9 Mbps*|>. 2062 |=. 45% |=. 27% |=. 27% | | |
164 | 13 | Baptiste Jonglez | | OUT |=. 21.9 Mbps |>. 1890 |=. 35% |=. 35% |=. 30% | | |
165 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 1.95 Mbps |>. 3206 |=. 25% |=. 30% |=. 45% | | |
166 | 14 | Baptiste Jonglez | | OUT |=. 1.96 Mbps |>. *3225*|=. 25% |=. 40% |=. 35% | | |
167 | 12 | Baptiste Jonglez | |_/4.OpenVPN |
168 | 12 | Baptiste Jonglez | Default cipher |
169 | 12 | Baptiste Jonglez | No auth |/4. openvpn 2.2.2 (2.3.4) |
170 | 13 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. 22.0 Mbps |>. 1899 |=. 50% |=. 20% |=. 30% | | |
171 | 13 | Baptiste Jonglez | | OUT |=. 18.9 Mbps |>. 1632 |=. 50% |=. 20% |=. 25% | | |
172 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 1.71 Mbps |>. 2819 |=. 35% |=. 30% |=. 35% | | |
173 | 13 | Baptiste Jonglez | | OUT |=. 1.46 Mbps |>. 2403 |=. 40% |=. 30% |=. 30% | | |
174 | 12 | Baptiste Jonglez | |_/4.Tinc |
175 | 12 | Baptiste Jonglez | No cipher |
176 | 12 | Baptiste Jonglez | No digest |/4. tinc 1.0.21 (1.0.24) |
177 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *42.2 Mbps*|>. 3639 |=. 10% |=. 45% |=. 45% | | |
178 | 13 | Baptiste Jonglez | | OUT |=. 36.7 Mbps |>. 3167 |=. 10% |=. 50% |=. 40% | | |
179 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 2.60 Mbps |>. 4276 |=. 10% |=. 40% |=. 50% | | |
180 | 13 | Baptiste Jonglez | | OUT |=. 2.59 Mbps |>. 4257 |=. 10% |=. 45% |=. 45% | | |
181 | 12 | Baptiste Jonglez | |_/4.OpenVPN |
182 | 12 | Baptiste Jonglez | No cipher |
183 | 12 | Baptiste Jonglez | No auth |/4. openvpn 2.2.2 (2.3.4) |
184 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *42.8 Mbps*|>. 3693 |=. 15% |=. 35% |=. 50% | | |
185 | 13 | Baptiste Jonglez | | OUT |=. 41.8 Mbps |>. 3607 |=. 10% |=. 45% |=. 45% | | |
186 | 14 | Baptiste Jonglez | |/2. 76 | IN |=. 2.68 Mbps |>. *4411*|=. 15% |=. 35% |=. 50% | | |
187 | 1 | Baptiste Jonglez | | OUT |=. 2.66 Mbps |>. 4380 |=. 15% |=. 40% |=. 45% | | |
188 | 15 | Baptiste Jonglez | |
189 | 15 | Baptiste Jonglez | *Analysis:* |
190 | 15 | Baptiste Jonglez | |
191 | 15 | Baptiste Jonglez | * Without surprise, kernelspace tunnels are much faster than userspace tunnels |
192 | 15 | Baptiste Jonglez | * IPIP is slightly faster than GRE (but does not support IPv6) |
193 | 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]]) |
194 | 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 |
195 | 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. |
196 | 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. |
197 | 15 | Baptiste Jonglez | * Unless you need high throughput, Tinc or OpenVPN without crypto have quite acceptable performance. |