-
Notifications
You must be signed in to change notification settings - Fork 82
Flow subsystem
When built with --enable-flow, FastClick supports a series of FlowIPManager elements. Those elements will collect an amount of space needed per IP 5-tuple for each downstream element. Instead of allocating an hashtable and lookup in all elements independently as it was done before, each element will use the space allocated for it inside the upstream FlowIPManager. The space per flow is called the Flow Control Block.
To achieve the best performance, use a sharded approach based on RSS and have an (internally duplicated) per-core pipeline using FlowIPMangerIMP. Rely on elements timeout instead of usage counters.
Therefore compile with --enable-flow --disable-flow-atomic --disable-flow-dynamic
.
- --enable-flow-dynamic Enable dynamic reference counting to automatically acquire and release flow control blocks flow system, see below.
- --disable-flow-atomic Will disable atomicity of the usage counter, pass the option if you use a sharding approach and the above.
The FlowIPManager elements support the TIMEOUT parameter that will use a timer wheel to handle flow timeouts. When the timeout reaches 0, the flow control block is recycled for further usage.
If possible, use FlowIPManagerIMP which uses a per-thread Cuckoo++ hashtable. If you need shared state (if you don't use RSS), then use FlowIPManagerMP.
If built with --flow-dynamic, flow control blocks will have a usage counter.
FlowElement
s can set a function to be called when a flow is released.
Only the CTXManager supports calling those release functions according to the flow control block's usage counters.
FlowIPManger* elements will increase the usage counter according to the number of packets passing by. When the packets are released, it will decrement their flow usage counters. FlowAcquire can be used to take a reference per-flow. Build your own FlowElement that calls fcb_release(1); to have the element decreasing to 0.
- When --enable-flow-dynamic is passed, the FlowIPManager elements could support releasing the state and calling the release functions too