These are chat archives for CZ-NIC/knot-resolver

16th
Apr 2018
Robert Šefr
@robcza
Apr 16 2018 18:55

Struggling with proper use of SO_REUSEPORT (kres 2.1.1, kernel 3.10.0-693.21.1.el7.x86_64):
kresd -f 2 -c /etc/kres/kres.conf /tmp/kres > kresd.log &

Content of /etc/kres/kres.conf is quite simple: net.listen('0.0.0.0')

root 32344 0.0 0.2 174976 9468 pts/1 S 18:39 0:00 kresd -f 2 -c /etc/kres/kres.conf /tmp/kres root 32345 0.0 0.2 174976 8684 pts/1 S 18:39 0:00 kresd -f 2 -c /etc/kres/kres.conf /tmp/kres

Under heavy load one process still handles all the requests:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
32344 root      20   0  189364  71884  51236 R  94.7  1.9   0:06.90 kresd
    9 root      20   0       0      0      0 S   0.3  0.0   0:05.70 rcu_sched
   13 root      20   0       0      0      0 S   0.3  0.0   0:05.08 ksoftirqd/1

I've tested this out quite a time ago without issues, any ideas what am I doing wrong now?

Petr Špaček
@pspacek
Apr 16 2018 19:20
@robcza My guess is that your testing script does not simulate clients properly :-) Kernel uses hashing over (src ip, src port, dest ip, dest port, protocol) to pick target process. This implies that all requests will go to single process if they use the same tuple (= the same client socket).
Robert Šefr
@robcza
Apr 16 2018 19:31
@pspacek oh my, you are right. Tonight I will sleep thanks to you :) tricky resperf