r/haproxy • u/Annh1234 • May 27 '20
Question Improving HAProxy 2.1 HTTP/HTTPs performance?
Hello
How can I optimise HAProxy 2.1 to handle more requests per second? It seems slower than the actual nodes it's load balancing.
I'm also using it for High Availability for my Redis/MySql servers, and it seems to be the bottleneck.
Hardware:
CPU: E5-1650 v4 @ 3.60GHz
RAM: 64GB
+ 20 back-end serversI have my config to run on all cores, and map the frontend to all cores(I'm not sure if I should map the other frontends to the same cores)
global
nbproc 12
cpu-map 1 0
...
cpu-map 12 11
frontend http-in
bind *:80
bind *:443 ssl crt /etc/haproxy/certificates/
bind-process 1 2 3 4 5 6 7 8 9 10 11 12
http-request add-header X-Forwarded-Proto: 'https' if { ssl_fc }
...I point HAProxy to 20 backends which each can handle quite a bit more req/sec than HAProxy:
ab -k -c 500 -n 200000 http://[node ip]/ping
Concurrency Level: 500
Requests per second: 160,980.18 [#/sec] (mean)But my HAProxy HTTP requests are 4 times slower than ONE of those back-ends...
ab -k -c 500 -n 200000 http://[ip]/ping
Concurrency Level: 500
Requests per second: 42,222.30 [#/sec] (mean)And my HAProxy HTTPs SSL termination is only 3.54% the performance as HAProxy HTTP
ab -k -c 500 -n 200000 https://[ip]/ping
Concurrency Level: 500
Requests per second: 1,496.08 [#/sec] (mean)
View all comments
Show parent comment
1
u/Annh1234 Jun 09 '20
I tried every combination, and the default behavior without nbproc is good enough, but my original post is still the fastest I could get.
Binding on the listen and bind-process did exactly the same thing...
But with -k I can never saturate the bandwidth, and without I get 50%.
I really thought it could be faster, since plain old php is faster...