kamila.is

I took a fun course on Software-Defined Networking (with P4), which included a project. Here is what I did and learned.

Load balancer

The project

I created a load balancer able to distribute the traffic on real-time server metrics, at line rate. The data plane uses fun data structures such as Bloom filters and fights the P4 compiler in terrible ways. And I think the code is readable and pretty!

Presentation

Describes how my load balancer works. Has lots of diagrams!

Report

Explains things in more detail than the presentation, plus contains evaluation.

P4 notes

How to…

Multicast

  • multicast group is a thingy with an ID, created via control plane and used from data plane
    • CLI for creating it: mc_mgrp_create <group_id>
    • using it from P4 code: standard_metadata.mcast_grp = 47
  • multicast node is for informing the switch that this port can be used for multicast. Nodes are associated with (/put into) groups. Usually there would be a 1:1 correspondence with a port, but it can be multiple ports too – that makes sense if these ports will always be used together.
    • CLI for making a multicast node from a port: mc_node_create <node_id> <port_number(s)>
      • this returns a node handle ID, which is numbered from 0 in the order it was created ==> first node will be handle ID 0, second handle ID 1…
      • in order to make it even more confusing, node_id is actually called “replication ID”
      • multicast nodes are assigned into multicast groups by the control plane via CLI: mc_node_associate <mcast_grp_id> <node_handle_id> (many nodes to 1 group)

therefore:

  1. create group in control plane: mc_mgrp_create 1
  2. create multicast node(s): mc_node_create 0 1 2 3
  3. put nodes into groups: mc_node_associate 1 0