Benchmark VPN » Historique » Version 15
Baptiste Jonglez, 08/06/2014 16:29
Analysis
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 | 12 | 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...) |
100 | 12 | Baptiste Jonglez | * IN: from VPN server to LAN client |
101 | 12 | Baptiste Jonglez | * OUT: from LAN client to VPN server |
102 | 12 | Baptiste Jonglez | * The format for versions is <code><software> <version used by the router> (<version used by the VPN server, i.e. laptop>)</code> |
103 | 15 | Baptiste Jonglez | * Each throughput figure is obtained by a 60-seconds TCP iperf session |
104 | 15 | Baptiste Jonglez | * CPU usage is determined by looking hard at <code>top</code>, so consider it ±5% (if not a bit more) |
105 | 12 | Baptiste Jonglez | * Except noted otherwise, everything uses the default config: |
106 | 1 | Baptiste Jonglez | |
107 | 13 | Baptiste Jonglez | * OpenVPN: no compression, 2048 RSA static key, p2p mode, UDP, Blowfish, SHA1 |
108 | 1 | Baptiste Jonglez | * Tinc: no compression, 2048 RSA key, Blowfish, SHA1 |
109 | 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) |
110 | 15 | Baptiste Jonglez | * Analysis below the table |
111 | 12 | Baptiste Jonglez | |
112 | 12 | Baptiste Jonglez | |_.Techno |_.Version |_.Payload size |_.Direction |_.Throughput |_.pps |_.CPU (usr) |_.CPU (sys) |_.CPU (sirq) |_.Comment | |
113 | 13 | Baptiste Jonglez | |_/4.No VPN |/4. linux 3.3.8 (3.14.5) |/2. 1448 | IN |=. 94.2 Mbps |>. 8129 |=. |=. |=. 50% | Line speed | |
114 | 13 | Baptiste Jonglez | | OUT |=. 94.2 Mbps |>. 8129 |=. |=. |=. 55% | Line speed | |
115 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 17.4 Mbps |>. 28590 |=. |=. |=. 99% | | |
116 | 13 | Baptiste Jonglez | | OUT |=. 23.4 Mbps |>. 38463 |=. |=. |=. 99% | | |
117 | 13 | Baptiste Jonglez | |_/4.GRE |/4. linux 3.3.8 (3.14.5) |/2. 1448 | IN |=. 92.7 Mbps |>. 8003 |=. |=. |=. 78% | Line speed | |
118 | 13 | Baptiste Jonglez | | OUT |=. 92.8 Mbps |>. 8014 |=. |=. |=. 88% | Line speed | |
119 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 10.5 Mbps |>. 17197 |=. |=. |=. 99% | | |
120 | 13 | Baptiste Jonglez | | OUT |=. 9.92 Mbps |>. 16309 |=. |=. |=. 99% | | |
121 | 14 | Baptiste Jonglez | |_/4.IPIP |/4. linux 3.3.8 (3.14.5) |/2. 1448 | IN |=. *93.0 Mbps*|>. 8024 |=. |=. |=. *70%* | Line speed | |
122 | 14 | Baptiste Jonglez | | OUT |=. *93.0 Mbps*|>. 8026 |=. |=. |=. *80%* | Line speed | |
123 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 11.3 Mbps |>. 18602 |=. |=. |=. 99% | | |
124 | 14 | Baptiste Jonglez | | OUT |=. 11.4 Mbps |>.*18803*|=. |=. |=. 99% | | |
125 | 12 | Baptiste Jonglez | |_/4.PPP/L2TPv2 |/4. linux 3.3.8 (3.14.5) |
126 | 13 | Baptiste Jonglez | xl2tp 1.3.1 (1.3.6) |/2. 1448 | IN |=. 88.8 Mbps |>. 7661 |=. |=. |=. 99% | Router is not very | |
127 | 13 | Baptiste Jonglez | | OUT |=. 88.6 Mbps |>. 7648 |=. |=. |=. 99% | responsive (sometimes | |
128 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 9.59 Mbps |>. 15780 |=. |=. |=. 99% | the PPP session | |
129 | 13 | Baptiste Jonglez | | OUT |=. 8.36 Mbps |>. 13745 |=. |=. |=. 99% | even timeouts) | |
130 | 12 | Baptiste Jonglez | |_/4.Tinc |
131 | 12 | Baptiste Jonglez | Default cipher |
132 | 12 | Baptiste Jonglez | Default digest |/4. tinc 1.0.21 (1.0.24) |
133 | 13 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. 15.9 Mbps |>. 1369 |=. 55% |=. 20% |=. 25% | | |
134 | 13 | Baptiste Jonglez | | OUT |=. 15.1 Mbps |>. 1301 |=. 50% |=. 25% |=. 25% | | |
135 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 1.26 Mbps |>. 2069 |=. 40% |=. 25% |=. 35% | | |
136 | 13 | Baptiste Jonglez | | OUT |=. 1.30 Mbps |>. 2140 |=. 40% |=. 30% |=. 30% | | |
137 | 12 | Baptiste Jonglez | |_/4.OpenVPN |
138 | 12 | Baptiste Jonglez | Default cipher |
139 | 12 | Baptiste Jonglez | Default auth |/4. openvpn 2.2.2 (2.3.4) |
140 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *17.9 Mbps*|>. 1548 |=. 55% |=. 20% |=. 25% | | |
141 | 13 | Baptiste Jonglez | | OUT |=. 15.6 Mbps |>. 1345 |=. 53% |=. 23% |=. 23% | | |
142 | 14 | Baptiste Jonglez | |/2. 76 | IN |=. 1.46 Mbps |>. *2395*|=. 40% |=. 25% |=. 35% | | |
143 | 13 | Baptiste Jonglez | | OUT |=. 1.29 Mbps |>. 2116 |=. 40% |=. 30% |=. 30% | | |
144 | 12 | Baptiste Jonglez | |_/4.Tinc |
145 | 12 | Baptiste Jonglez | No cipher |
146 | 12 | Baptiste Jonglez | Default digest |/4. tinc 1.0.21 (1.0.24) |
147 | 13 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. 22.9 Mbps |>. 1975 |=. 45% |=. 27% |=. 27% | | |
148 | 13 | Baptiste Jonglez | | OUT |=. 21.3 Mbps |>. 1842 |=. 40% |=. 35% |=. 25% | | |
149 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 1.53 Mbps |>. 2511 |=. 35% |=. 30% |=. 35% | | |
150 | 13 | Baptiste Jonglez | | OUT |=. 1.57 Mbps |>. 2574 |=. 35% |=. 35% |=. 30% | | |
151 | 12 | Baptiste Jonglez | |_/4.OpenVPN |
152 | 12 | Baptiste Jonglez | No cipher |
153 | 12 | Baptiste Jonglez | Default auth |/4. openvpn 2.2.2 (2.3.4) |
154 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *26.8 Mbps*|>. 2313 |=. 35% |=. 30% |=. 35% | | |
155 | 13 | Baptiste Jonglez | | OUT |=. 26.2 Mbps |>. 2264 |=. 35% |=. 30% |=. 30% | | |
156 | 14 | Baptiste Jonglez | |/2. 76 | IN |=. 1.92 Mbps |>. *3153*|=. 30% |=. 30% |=. 40% | | |
157 | 13 | Baptiste Jonglez | | OUT |=. 1.90 Mbps |>. 3130 |=. 30% |=. 35% |=. 35% | | |
158 | 12 | Baptiste Jonglez | |_/4.Tinc |
159 | 12 | Baptiste Jonglez | Default cipher |
160 | 12 | Baptiste Jonglez | No digest |/4. tinc 1.0.21 (1.0.24) |
161 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *23.9 Mbps*|>. 2062 |=. 45% |=. 27% |=. 27% | | |
162 | 13 | Baptiste Jonglez | | OUT |=. 21.9 Mbps |>. 1890 |=. 35% |=. 35% |=. 30% | | |
163 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 1.95 Mbps |>. 3206 |=. 25% |=. 30% |=. 45% | | |
164 | 14 | Baptiste Jonglez | | OUT |=. 1.96 Mbps |>. *3225*|=. 25% |=. 40% |=. 35% | | |
165 | 12 | Baptiste Jonglez | |_/4.OpenVPN |
166 | 12 | Baptiste Jonglez | Default cipher |
167 | 12 | Baptiste Jonglez | No auth |/4. openvpn 2.2.2 (2.3.4) |
168 | 13 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. 22.0 Mbps |>. 1899 |=. 50% |=. 20% |=. 30% | | |
169 | 13 | Baptiste Jonglez | | OUT |=. 18.9 Mbps |>. 1632 |=. 50% |=. 20% |=. 25% | | |
170 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 1.71 Mbps |>. 2819 |=. 35% |=. 30% |=. 35% | | |
171 | 13 | Baptiste Jonglez | | OUT |=. 1.46 Mbps |>. 2403 |=. 40% |=. 30% |=. 30% | | |
172 | 12 | Baptiste Jonglez | |_/4.Tinc |
173 | 12 | Baptiste Jonglez | No cipher |
174 | 12 | Baptiste Jonglez | No digest |/4. tinc 1.0.21 (1.0.24) |
175 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *42.2 Mbps*|>. 3639 |=. 10% |=. 45% |=. 45% | | |
176 | 13 | Baptiste Jonglez | | OUT |=. 36.7 Mbps |>. 3167 |=. 10% |=. 50% |=. 40% | | |
177 | 13 | Baptiste Jonglez | |/2. 76 | IN |=. 2.60 Mbps |>. 4276 |=. 10% |=. 40% |=. 50% | | |
178 | 13 | Baptiste Jonglez | | OUT |=. 2.59 Mbps |>. 4257 |=. 10% |=. 45% |=. 45% | | |
179 | 12 | Baptiste Jonglez | |_/4.OpenVPN |
180 | 12 | Baptiste Jonglez | No cipher |
181 | 12 | Baptiste Jonglez | No auth |/4. openvpn 2.2.2 (2.3.4) |
182 | 14 | Baptiste Jonglez | OpenSSL 1.0.1g (1.0.1.g) |/2. 1448 | IN |=. *42.8 Mbps*|>. 3693 |=. 15% |=. 35% |=. 50% | | |
183 | 13 | Baptiste Jonglez | | OUT |=. 41.8 Mbps |>. 3607 |=. 10% |=. 45% |=. 45% | | |
184 | 14 | Baptiste Jonglez | |/2. 76 | IN |=. 2.68 Mbps |>. *4411*|=. 15% |=. 35% |=. 50% | | |
185 | 1 | Baptiste Jonglez | | OUT |=. 2.66 Mbps |>. 4380 |=. 15% |=. 40% |=. 45% | | |
186 | 15 | Baptiste Jonglez | |
187 | 15 | Baptiste Jonglez | *Analysis:* |
188 | 15 | Baptiste Jonglez | |
189 | 15 | Baptiste Jonglez | * Without surprise, kernelspace tunnels are much faster than userspace tunnels |
190 | 15 | Baptiste Jonglez | * IPIP is slightly faster than GRE (but does not support IPv6) |
191 | 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]]) |
192 | 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 |
193 | 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. |
194 | 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. |
195 | 15 | Baptiste Jonglez | * Unless you need high throughput, Tinc or OpenVPN without crypto have quite acceptable performance. |