Nos tempos que correm existem várias opções baratas de ter um computador em casa a fazer de “servidor”, para servir todo o tipo de serviços. Umas dessas opções mais baratas e acessíveis é o Raspberry Pi, um SBC (Small Board Computer) que já vai na sua versão 4 e que está cada vez mais popular.

Uma das funções que o Raspberry Pi pode fazer em casa é de servidor de VPN (Virtual Private Network), com o objetivo de termos conectividade à rede de casa a partir de qualquer lugar.
A nível de software de VPN, um dos mais populares é o OpenVPN, mas este é um software algo antigo e pesado, que não é muito apropriado a um computador com poucos recursos, como o Raspberry Pi 4.
Nos últimos anos, tem sido desenvolvido um software de VPN, Open Source, chamado Wireguard, que é mais moderno, simples e com melhor performance que outras soluções comuns nesta área.

Um suite de benchmarks bastante conhecida, o Phoronix test suite, tem agora um perfil para testar a performance de um processador no Wireguard. Tive sempre a curiosidade de ver qual seria a performance teórica do Raspberry Pi numa VPN que não o OpenVPN.
Decidi testar o Raspberry Pi 4 com outras máquinas que têm processadores low end. Além do ARM A72 do RPi4, testei este benchmark num Intel Celeron N2807, Intel Atom Z3735F, Intel Celeron 3865U (2 cores numa máquina virtual Hyper-V) e num Intel Core i3-8100 (2 cores numa máquina virtual Hyper-V).
O benchmark ao Wireguard só testa o processador. Não está dependente de qualquer ligação de rede que a máquina tenha. O benchmark usa o loopback para passar 10 GB em diversas condições.
Explicação do benchmark:
The way it works is it creates three namespaces. ns0 has a loopback device. ns1 and ns2 each have wireguard devices. Those two wireguard devices send traffic through the loopback device of ns0. The end result of this is that tests wind up testing encryption and decryption at the same time — a pretty CPU and scheduler-heavy workflow.
Several tests are run:
– normal MTU: v4 over v4, tcp
– normal MTU: v4 over v6, tcp
– normal MTU: v6 over v4, tcp
– normal MTU: v6 over v6, tcp
– normal MTU: v4 over v4, udp
– normal MTU: v4 over v6, udp
– normal MTU: v6 over v4, udp
– normal MTU: v6 over v6, udp
– jumbo MTU: v4 over v4, tcp
– jumbo MTU: v4 over v6, tcp
– jumbo MTU: v6 over v4, tcp
– jumbo MTU: v6 over v6, tcp
– jumbo MTU: v4 over v4, udp
– jumbo MTU: v4 over v6, udp
– jumbo MTU: v6 over v4, udp
– jumbo MTU: v6 over v6, udp
Each of these tests transfers 10 gigabytes
O resultado do benchmark é o tempo que demora em segundos. Quantos menos tempo, mais rápido é o processador nesta tarefa.
Todas as máquinas estão com Ubuntu 20.04 Beta com os últimos updates feitos. O kernel de Linux é o 5.4, que não tem suporte nativo do Wireguard. O que o teste faz é efectuar o download do Wireguard, compila e faz o load do módulo no kernel com o DKMS.
Os resultados numa tabela:

E os resultados em gráfico:

Conclusão
Conclusão que retiro destes resultados:
- A performance no Wireguard no Raspberry pi 4 não é muito boa, comparador com processadores x86 low end. Ele não é muito mais rápido que um Intel Atom Z3735F, um processador feito para telemóveis lançado em 2014 e é mais rápido que o Intel Celeron N2807, mas além de só ter sido lançado em 2014, tem também só metade dos cores. É verdade que o ARM A72, que está no Raspberry Pi 4, não é um processador muito recente e também é um processador pensado para o mercado móvel, mas foi lançado em 2016, 2 anos depois que aqueles 2 processadores Atom.
- Em relação ao Intel Celeron 3865U, o A72 do Raspberry Pi 4 não fica longe deste processador que tem um TDP superior (15 W), mas este é um dos piores processadores x86 com este TDP e também não é um processador recente.
- Comparado com um “Big core” x86, o i3-8100, mesmo sendo um processador bastante low end já quando foi lançado e só usando 2 cores numa VM, a nível de performance no Wireguard, fica muito acima do A72 do Raspberry Pi 4. Está num patamar completamente à parte. A única parte negativa é que tem um TDP de 65W.
Logs de cada teste
Raspberry Pi 4:
System Information PROCESSOR: ARMv8 Cortex-A72 @ 1.50GHz Core Count: 4 Scaling Driver: BCM2835 Freq ondemand GRAPHICS: MOTHERBOARD: BCM2835 Raspberry Pi 4 Model B Rev 1.1 MEMORY: 4096MB DISK: 128GB SH128 File-System: ext4 Mount Options: discard errors=remount-ro noatime nodiratime rw OPERATING SYSTEM: Ubuntu 20.04 Kernel: 5.4.0-1008-raspi (aarch64) Compiler: GCC 9.3.0 Security: itlb_multihit: Not affected + l1tf: Not affected + mds: Not affected + meltdown: Not affected + spec_store_bypass: Vulnerable + spectre_v1: Mitigation of __user pointer sanitization + spectre_v2: Vulnerable + tsx_async_abort: Not affected Current Description: ARMv8 Cortex-A72 testing on Ubuntu 20.04 via the Phoronix Test Suite. WireGuard + Linux Networking Stack Stress Test: system/wireguard-1.0.0 Test 1 of 2 Estimated Trial Run Count: 3 Estimated Time To Completion: 2 Minutes [17:35 UTC] Started Run 1 @ 17:34:02 Started Run 2 @ 18:02:17 Started Run 3 @ 18:31:01 Test Results: 1691.207 1720.442 1699.655 Average: 1703.768 Seconds Deviation: 0.88%
Intel Celeron N2807:
System Information PROCESSOR: Intel Celeron N2807 @ 2.17GHz Core Count: 2 Extensions: SSE 4.2 + RDRAND Cache Size: 1024 KB Microcode: 0x838 Scaling Driver: intel_pstate powersave GRAPHICS: ECS Intel Atom Z36xxx/Z37xxx & Display Frequency: 750MHz MOTHERBOARD: ECS BAT-MINI v1.0 BIOS Version: 5.6.5 Chipset: Intel Atom Z36xxx/Z37xxx Network: Realtek RTL8111/8168/8411 MEMORY: 1 x 2048 MB DDR3-1066MT/s DISK: 63GB SEM64G File-System: ext4 Mount Options: discard errors=remount-ro noatime nodiratime rw OPERATING SYSTEM: Ubuntu 20.04 Kernel: 5.4.0-25-generic (x86_64) Compiler: GCC 9.3.0 Security: itlb_multihit: Not affected + l1tf: Not affected + mds: Mitigation of Clear buffers; SMT disabled + meltdown: Mitigation of PTI + spec_store_bypass: Not affected + spectre_v1: Mitigation of usercopy/swapgs barriers and __user pointer sanitization + spectre_v2: Mitigation of Full generic retpoline IBPB: conditional IBRS_FW STIBP: disabled RS B filling + tsx_async_abort: Not affected Current Description: Intel Celeron N2807 testing with a ECS BAT-MINI v1.0 (5.6.5 BIOS) and ECS Intel Atom Z36xxx/Z37xxx & Display on Ubuntu 20.04 via the Phoronix Test Suite. WireGuard + Linux Networking Stack Stress Test: system/wireguard-1.0.0 Test 1 of 2 Estimated Trial Run Count: 3 Estimated Time To Completion: 2 Minutes [17:39 UTC] Started Run 1 @ 17:38:15 Started Run 2 @ 18:19:23 Started Run 3 @ 18:59:48 Test Results: 2464.558 2421.051 2456.173 Average: 2447.261 Seconds Deviation: 0.94%
Intel Atom Z3735F:
System Information PROCESSOR: Intel Atom Z3735F @ 1.83GHz Core Count: 4 Extensions: SSE 4.2 + RDRAND Cache Size: 1024 KB Microcode: 0x838 Scaling Driver: intel_pstate powersave GRAPHICS: Zotac Intel Atom Z36xxx/Z37xxx & Display Frequency: 646MHz Monitor: SyncMaster Screen: 1920x1080 MOTHERBOARD: ZOTAC ZBOX-PI320 BIOS Version: 5.6.5 Chipset: Intel Atom Z36xxx/Z37xxx MEMORY: 1 x 2048 MB DDR3-1333MT/s DISK: 63GB MCG8GC File-System: ext4 Mount Options: errors=remount-ro relatime rw OPERATING SYSTEM: Ubuntu 20.04 Kernel: 5.4.0-25-generic (x86_64) Compiler: GCC 9.3.0 Security: itlb_multihit: Not affected + l1tf: Not affected + mds: Mitigation of Clear buffers; SMT disabled + meltdown: Mitigation of PTI + spec_store_bypass: Not affected + spectre_v1: Mitigation of usercopy/swapgs barriers and __user pointer sanitization + spectre_v2: Mitigation of Full generic retpoline IBPB: conditional IBRS_FW STIBP: disabled RSB filling + tsx_async_abort: Not affected Current Description: Intel Atom Z3735F testing with a ZOTAC ZBOX-PI320 (5.6.5 BIOS) and Zotac Intel Atom Z36xxx/Z37xxx & Display on Ubuntu 20.04 via the Phoronix Test Suite. WireGuard + Linux Networking Stack Stress Test: system/wireguard-1.0.0 Test 1 of 2 Estimated Trial Run Count: 3 Estimated Test Run-Time: 26 Minutes Estimated Time To Completion: 28 Minutes [20:19 UTC] Started Run 1 @ 19:52:46 Started Run 2 @ 20:24:28 The test quit with a non-zero exit status. Started Run 3 @ 20:24:33 Started Run 4 @ 20:55:47 * Test Results: 1898.531 1870.069 1875.559 Average: 1881.386 Seconds Deviation: 0.80%
Intel Celeron 3865U:
System Information PROCESSOR: Intel Celeron 3865U Core Count: 2 Extensions: SSE 4.2 + RDRAND + FSGSBASE Cache Size: 2048 KB Microcode: 0xffffffff GRAPHICS: hyperv_fb Screen: 1152x864 MOTHERBOARD: Microsoft Virtual Machine BIOS Version: Hyper-V UEFI v4.0 MEMORY: 3968 MB + 128 MB DISK: 86GB Virtual Disk File-System: ext4 Mount Options: relatime rw Disk Scheduler: NONE OPERATING SYSTEM: Ubuntu 20.04 Kernel: 5.4.0-25-generic (x86_64) Compiler: GCC 9.3.0 System Layer: microsoft Security: itlb_multihit: KVM: Vulnerable + l1tf: Mitigation of PTE Inversion + mds: Mitigation of Clear buffers; SMT Host state unknown + meltdown: Mitigation of PTI + spec_store_bypass: Mitigation of SSB disabled via prctl and seccomp + spectre_v1: Mitigation of usercopy/swapgs barriers and __user pointer sanitization + spectre_v2: Mitigation of Full generic retpoline IBPB: conditional IBRS_FW STIBP: disabled RSB filling + tsx_async_abort: Not affected Current Description: microsoft testing on Ubuntu 20.04 via the Phoronix Test Suite. WireGuard + Linux Networking Stack Stress Test: system/wireguard-1.0.0 Test 1 of 2 Estimated Trial Run Count: 3 Estimated Test Run-Time: 26 Minutes Estimated Time To Completion: 28 Minutes [21:57 UTC] Started Run 1 @ 21:30:26 Started Run 2 @ 21:52:15 Started Run 3 @ 22:14:14 Test Results: 1304.537 1315.361 1352.104 Average: 1324.001 Seconds Deviation: 1.88% OpenSSL 1.1.1: pts/openssl-1.11.0 Test 2 of 2 Estimated Trial Run Count: 3 Estimated Time To Completion: 2 Minutes [22:38 UTC] Started Run 1 @ 22:36:57 Started Run 2 @ 22:37:21 Started Run 3 @ 22:37:45 RSA 4096-bit Performance: 121.5 128 121.9 Average: 123.8 Signs Per Second Deviation: 2.94%
Intel Core i3-8100:
System Information PROCESSOR: Intel Core i3-8100 Core Count: 2 Extensions: SSE 4.2 + AVX2 + AVX + RDRAND + FSGSBASE Cache Size: 6144 KB Microcode: 0xffffffff GRAPHICS: hyperv_fb Screen: 1152x864 MOTHERBOARD: Microsoft Virtual Machine BIOS Version: Hyper-V UEFI v4.0 MEMORY: 3968 MB + 128 MB DISK: 86GB Virtual Disk File-System: ext4 Mount Options: relatime rw Disk Scheduler: NONE OPERATING SYSTEM: Ubuntu 20.04 Kernel: 5.4.0-25-generic (x86_64) Compiler: GCC 9.3.0 System Layer: microsoft Security: itlb_multihit: KVM: Vulnerable + l1tf: Mitigation of PTE Inversion + mds: Mitigation of Clear buffers; SMT Host state unknown + meltdown: Mitigation of PTI + spec_store_bypass: Mitigation of SSB disabled via prctl and seccomp + spectre_v1: Mitigation of usercopy/swapgs barriers and __user pointer sanitization + spectre_v2: Mitigation of Full generic retpoline IBPB: conditional IBRS_FW STIBP: disabled RSB filling + tsx_async_abort: Not affected Current Description: microsoft testing on Ubuntu 20.04 via the Phoronix Test Suite. WireGuard + Linux Networking Stack Stress Test: system/wireguard-1.0.0 Test 1 of 2 Estimated Trial Run Count: 3 Estimated Test Run-Time: 26 Minutes Estimated Time To Completion: 28 Minutes [20:44 UTC] Started Run 1 @ 20:17:09 Started Run 2 @ 20:25:04 Started Run 3 @ 20:32:05 Started Run 4 @ 20:39:22 * Started Run 5 @ 20:46:26 * Started Run 6 @ 20:53:54 * Started Run 7 @ 21:01:08 * Started Run 8 @ 21:08:29 * Started Run 9 @ 21:15:33 * Test Results: 470.838 417.046 433.315 420.256 443.355 430.249 436.996 419.695 433.111 Average: 433.873 Seconds Deviation: 3.78% Samples: 9

Raspberry Pi 4 Model B 2GB RAM

Raspberry Pi 4 Model B 4GB RAM

Armor Aluminum Alloy Case
