Understanding the Statistics Model in VPP for Enhanced Networking Performance
Dive into the world of VPP with a focus on the statistics consumption model, shared memory structures, and optimistic locking techniques. Learn how to leverage these concepts for optimal network performance at FOSDEM 2022.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Arthur de Kerhor arthurdekerhor@gmail.com Hedi Bouattour Keep appetite for the stats, it costs nothing Presentation of the statistics consumption model in VPP from the costless low-level design to their exploitation in user space FOSDEM 2022 6 February 2022 1
Vector VPP intro Packet 1 af-packet- input Packet 2 Packet 256 ethernet- input Open-source networking dataplane in user space Multi-threaded Highly optimized for performance, speed and scale Designed as a graph of nodes Supports tons of features in L2-4 such as crypto, NAT, LB, ACL, tunnels, ip4-receive ip4-input ip4-lookup ip4-drop ip4- midchain Vector host-ens5- output Packet 1 Packet 2 FOSDEM 2022 6 February 2022 2
Stats segment in VPP Shared memory Vector based Single writer, multiple readers Optimistic locking Hypothesis: number of writes << number of reads Reading the stats in shared memory costs nothing for the data plane What is costly however is to update the stats counters in the data plane: it sometimes induces some additional cacheline misses. FOSDEM 2022 6 February 2022 3
Shared memory layout Vector of stats entries Shared memory header Name: /sys/num_worker_threads Type: Scalar Data: 4 Directory vector Name: /if/tx Type: Combined counter vector Data: pointer to the vector Errors vector Epoch counter + in_progress bool Threads Name: /interfaces/eth1/tx Type: Symlink Data: - Directory index=1 - Interface index=1 Thread 1 Thread 2 Interfaces Packets: 15 Bytes: 4021 Packets: 3 Bytes: 1643 loop0 Name: /if/names Type: Name vector Data: pointer to the vector Packets: 172 Bytes: 54812 Packets: 243 Bytes: 75031 eth1 FOSDEM 2022 6 February 2022 4
Optimistic locking Take the lock = set in_progress boolean Release the lock = unset in_progress + increment epoch counter WRITE: Counter added/extended by the main thread (e.g. new interface): lock taken directory vector update (pointers may change) counters vectors updates (e.g. new row in /if/tx) lock released READ: A stats client wants to access shared memory: wait until in_progress == 0 store epoch value read the stats of interests check that (epoch == stored epoch and not in_progress) If false, retry the read No concurrency issues when adding/extending counters because it is always done under a barrier no counters updates during writes. FOSDEM 2022 6 February 2022 5
Various clients for different usages - A simple client to access raw statistics - A filesystem in user space leveraging go-fuse - A Prometheus exporter to gather statistics for applications FOSDEM 2022 6 February 2022 6
Simple client to access raw statistics Small executable Connects to the stats socket of VPP to learn about the shared memory location Allows to list and/or dump the statistics available Takes a list of regexp as input and returns the matching counters Usage: quick access to the statistics, easy to launch FOSDEM 2022 6 February 2022 7
Fuse filesystem in Golang File Node (leaf) Name Counter index Directory Node Path Epoch Root node Path = / Epoch = 1 Path = interfaces/ Epoch = 2 Epoch = 4 Path = net/ Epoch = 3 Path = sys/ Epoch = 3 OpenDir Path = eth0/ Epoch = 3 Epoch = 4 Path = eth1/ Epoch = 2 Epoch = 4 Name = last_update Counter index = 134 Name = num_threads Counter index = 21 Name = rx Counter index = 46 Name = tx Counter index = 76 Name = punt Counter index = 163 5 Open FOSDEM 2022 6 February 2022 8
Demo! FOSDEM 2022 6 February 2022 9
Calico/VPP context Calico: open-source Kubernetes networking solution and network policy Standard Linux networking pipeline mode dataplane Integrating VPP dataplane: faster networking FOSDEM 2022 6 February 2022 10
Calico/VPP agent Architecture FOSDEM 2022 6 February 2022 11
Calico/VPP agent Architecture Stat segment shared memory PrometheusServer FOSDEM 2022 6 February 2022 12
VPP stats in Prometheus VPP PULL Node exporter Stat segment shared memory PrometheusServer Kubernetescluster FOSDEM 2022 6 February 2022 13
Demo! FOSDEM 2022 6 February 2022 14
Q&A session FOSDEM 2022 6 February 2022 15