# Performance degradation behind HAProxy

**URL:** <https://discourse.haproxy.org/t/performance-degradation-behind-haproxy/5318>\
**Category:** Help!\
**Created:** [June 4, 2020, 3:44pm UTC](https://discourse.haproxy.org/t/performance-degradation-behind-haproxy/5318 "2020-06-04T15:44:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vladk](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/vladk/32/1192_2.png) [@vladk](https://discourse.haproxy.org/u/vladk)\
**Post date:** [June 4, 2020, 3:44pm UTC](https://discourse.haproxy.org/t/performance-degradation-behind-haproxy/5318/1 "2020-06-04T15:44:35Z")

</div>

Hi there,  
I am trying to set up HAProxy in front of some node js apps but having trouble with performance. In the best case I get just under half the performance of a raw node server.

I have a simple hello world app -  
const http = require(‘http’);

const server1 = http.createServer((req, res) =\> {  
res.statusCode = 200;  
res.setHeader(‘Content-Type’, ‘text/plain’);  
res.end(‘Hello World 1’);  
});

const server2 = http.createServer((req, res) =\> {  
res.statusCode = 200;  
res.setHeader(‘Content-Type’, ‘text/plain’);  
res.end(‘Hello World 2’);  
});

server1.listen(3000, ‘0.0.0.0’, () =\> {});  
server2.listen(3001, ‘0.0.0.0’, () =\> {});

When I do wrk -c100 -d10 [http://localhost:3000](http://localhost:3000) I am getting around 10k req/sec

I set up haproxy and have tried multiple different configs but I can not get even half the speed of raw server. Is that normal?

Here’s my latest config that gets around 4k req/sec -  
global  
maxconn 50000  
log 127.0.0.1:514 local0 info  
chroot /var/lib/haproxy  
stats timeout 30s  
user haproxy  
group haproxy  
daemon

defaults  
maxconn 50000  
log global  
mode http  
option httplog  
option dontlognull  
timeout connect 5000  
timeout client 50000  
timeout server 50000

frontend http\_front  
bind \*:5000  
stats uri /haproxy?stats  
default\_backend http\_back

backend http\_back  
balance roundrobin  
server server\_name1 0.0.0.0:3000 check  
server server\_name2 0.0.0.0:3001 check

What am I doing wrong or is that normal to have HAProxy cut the req/sec in more than half?

Thank you!
