This is an old revision of the document!
Project name
- Student: YuriIozzelli (y.iozzelli@gmail.com)
- Mentor: LuigiRizzo (luigi@freebsd.org)
Project description
Software switches are a key component of any cloud infrastructure, and even proposal focused on hardware targets, such as P4 (http://p4.org), cannot ignore software implementations and their performance.
Historically, software packet processors have been limited in performance by network I/O, but this is no more true with high speed frameworks such as netmap and DPDK.
In this project I would like to implement a modified version of the reference p4 switch on FreeBSD, which uses netmap for faster packet I/O: the goal would be reaching the 1 Mpps order-of-magnitude speed (current reference implementation is limited to 150 Kpps for a simple l2 switch with 2 hosts).
This would enable P4 to be used in fast networking experimens as well as real environments.
Approach to solving the problem
The required steps would include:
- Develop a simplified p4 target wich uses netmap as a backend for packet I/O (current implementation uses pcap)
- Optimize the target performance leveraging both standard techniques (e.g. limit memory allocations by re-using buffers, use of a more parallel architecture) and netmap-enabled techniques (e.g. batching I/O)
- Reach feature parity with the reference switch target, and have a functional openflow-enabled demo, which will be used to evaluate performance vs the reference implementation and others software switch solutions
Deliverables
D1
Port the existing reference implementation code to FreeBSD. Develop a simplified P4 switch target which replaces pcap with netmap for packet I/O.
D2
Now that the I/O is faster, find the new bottlenecks and address them. I will probably need to modify the target to use pre-allocated buffers for packets and process packets in multiple threads in a pipeline, and try to keep synchronization costs low.
D3
Extend the version developed to support more advanced features used by common p4 programs (packet replication, learning, multicast groups), and evaluate the performance vs the reference implementation.
D4
Develop an extended demo which implement the openflow protocol on top of the developed target, and evaluate the performance vs the reference implementation and other openflow software switches.
Milestones
- 23 – 29 May: port the existing code to FreeBSD.
- 30 May - 5 June: add netmap-enabled I/O to a simple P4 target (D1)
- 6 – 12 June: optimize memory management
- 13 – 19 June: perform multithreading processing of packet in a pipeline (D2)
- 20 – 26 June: Prepare for mid-term evaluation: clean code and write results report
- 27 June - 17 July: Extend the target to support replication, learning and multicast
- 18 – 31 July: Evaluate and possibly improve performance (D3)
- 1 – 14 Aug: Develop the openflow demo and measure performance (D4)
- 15 – 23 Aug: clean code, improve documentation and report final speed measurements
The Code
https://github.com/zarghul/behavioral-model
relevant branches are named gsoc-*
Progress
Brief log of my progress.
Compile in FreeBSD
All the dependencies are available on FreeBSD, but the software does not compile due to the lack of support for non-POD thread_local variables in clang (only on freeBSD, in linux it works). Relevant bug
I then tried to compile on various gcc versions , with the following results:
- 4.7⇐gcc⇐5: some c++11 functions are not defined (like to_string), and rvalue references are not supported, so I think this is a dead end
- gcc6: all c++11 features supported, but I get ABI incompatibilities with dependencies libraries (for example a thrift function expects
std::__1::basic_stringas an argument, butstd::__cxx11::basic_stringis used instead.
For this reason I resorted to use clang and implementing the missing functionality.
There is only one missing function: __cxa_thread_atexit
I looked at glibc implementation (explained here), and decided that for my case I don't need to implement support for dynamic libraries unloading, but just make sure that destructors are called at thread exit.
The code now compiles, but it crashes at runtime. Investigating why.