Htop shows >100% for a single-threaded application


#1

Specs:
Haproxy 1.7.2. running on CentOS7, Intel® Xeon® CPU E5-2650 v3 @ 2.30GHz.
Haproxy frontend has ~1200 sessions per second.

My question:
I have haproxy 1.7.2 running on CentOS7 with two hexacore CPUs. haproxy runs with default setting of nbproc=1. Here is output of htop:

How can a single-threaded application utilize more than 100% of CPU? top or atop never show >100% CPU utilization for that process.

Other than that, CPU utilization for haproxy is 0% except some pulses which reach 100%. Here is an excerpt of output of > while :; do top -d1 -n1 -b -p 95949 | grep haproxy ; done where 95949 is haproxy’s pid:

95949 haproxy   20   0   84836  65556    968 R   0.0  0.0  11216:48 haproxy

95949 haproxy 20 0 84836 65556 968 S 0.0 0.0 11216:48 haproxy
95949 haproxy 20 0 84836 65556 968 R 0.0 0.0 11216:48 haproxy
95949 haproxy 20 0 84836 65556 968 S 0.0 0.0 11216:48 haproxy
95949 haproxy 20 0 84836 65556 968 S 0.0 0.0 11216:48 haproxy
95949 haproxy 20 0 84836 65556 968 R 0.0 0.0 11216:48 haproxy
95949 haproxy 20 0 84836 65556 968 R 0.0 0.0 11216:48 haproxy
95949 haproxy 20 0 84836 65556 968 R 0.0 0.0 11216:48 haproxy
95949 haproxy 20 0 84836 65556 968 S 0.0 0.0 11216:48 haproxy
95949 haproxy 20 0 84836 65556 968 R 0.0 0.0 11216:48 haproxy
95949 haproxy 20 0 84836 65556 968 S 0.0 0.0 11216:48 haproxy
95949 haproxy 20 0 84836 65556 968 R 100.0 0.0 11216:59 haproxy
95949 haproxy 20 0 84836 65556 968 R 0.0 0.0 11216:59 haproxy
95949 haproxy 20 0 84836 65556 968 R 0.0 0.0 11216:59 haproxy
95949 haproxy 20 0 84836 65556 968 S 0.0 0.0 11216:59 haproxy
95949 haproxy 20 0 84836 65556 968 R 0.0 0.0 11216:59 haproxy
95949 haproxy 20 0 84836 65556 968 S 0.0 0.0 11216:59 haproxy
95949 haproxy 20 0 84836 65556 968 S 0.0 0.0 11216:59 haproxy
95949 haproxy 20 0 84836 65556 968 S 0.0 0.0 11216:59 haproxy
95949 haproxy 20 0 84836 65556 968 S 0.0 0.0 11216:59 haproxy
95949 haproxy 20 0 84836 65556 968 R 0.0 0.0 11216:59 haproxy

What can cause these peaks?


#2

Note sure; this is a question for htop developers I’d say.

SSL handshake are the most likely cause, followed by haproxy bugs. Are you terminating SSL here?


#3

Hi,

SSL handshake are the most likely cause, followed by haproxy bugs. Are you terminating SSL here?

No HTTPS at all.

Any other thoughts?


#4

Like I said, a bug. Try 1.7.3, it contains a fix that may cause your issue (BUG/MEDIUM: tcp: don’t poll for write when connect() succeeds).


#5

Are you using cpu-map also?

Some like this:

  cpu-map all 1-16
  nbproc 16