[acassen/keepalived] 7630e7: vrrp: vrrp_dispatcher_read() performance extension

Alexandre Cassen <[email protected]> Sun, 17 Feb 2019 08:39:46 -0800
Newsgroups gmane.linux.keepalived.devel
Message-ID <acassen/keepalived/push/refs/heads/master/[email protected]>
  Branch: refs/heads/master
  Home:   https://github.com/acassen/keepalived
  Commit: 7630e72ba38be27b060a9db4b01a6045ee794c66
      https://github.com/acassen/keepalived/commit/7630e72ba38be27b060a9db4b01a6045ee794c66
  Author: Alexandre Cassen <[email protected]>
  Date:   2019-02-17 (Sun, 17 Feb 2019)

  Changed paths:
    M keepalived/vrrp/vrrp_scheduler.c
    M lib/bitops.h

  Log Message:
  -----------
  vrrp: vrrp_dispatcher_read() performance extension

We took time with Quentin to simulate and rework this code. We introduced
2 imbricated while loop:

(1) First one is catching recvfrom EINTR (this code trig
only on kernel older than 2.6.22 where signalfd was firstly introduced).
Newer kernel will immediately break the loop (hey guys: if you are running
older than 2.6.22 it is worth considering upgrading).

(2) Second loop will continue reading from socket until same VRID advert
has been received during the same cycle. After simulating, it appears that
during contention with a lot of VRRP instances (around 1500), this design
is needed to relax socket recvq from growing. This can be viewed as a
Poll-Mode activation during contention and fallback to regular I/O MUX
during normal operations. This loop breaks immediately and re-submit
opration to I/O MUX when there is no more to be read.