[dpdk-dev] Load-balancing position field in DPDK load_balancer sample app vs. Hash table
bruce.richardson at intel.com
Fri Nov 14 11:53:25 CET 2014
On Thu, Nov 13, 2014 at 01:29:32PM -0500, Kamraan Nasim wrote:
> So i've borrowed some code from the DPDK Load balancer sample application,
> specifically the load balancing position(byte 29th) to determine which
> worker lcore to forward the packet to.
> The idea is that flow affinity should be maintained and all packets from
> the same flow would have the same checksum/5-tuple value
> worker_id = packet[load_balancing_field] % n_workers
> Question is that how reliable is this load balancing position? I am tempted
> to use Hash tables but I think this position based mechanism may be faster.
> How have people's experience with this been in general?
Using a modulus "%" operation will be far, far faster than doing a hash table
lookup, though obviously it is not as flexible. [If you have a power-of-two
number of workers, you can replace the "%" by "&", if you like to shave off
another few cycles].
As for reliability, I'm afraid it depends entirely on your application and what
field you pick as to whether it works for load balancing or not.
More information about the dev