1

I am running a haproxy load balancer in front of two application servers that serves images. The problem is that if i use one server or two does not make a difference on performance (see added images). I am using Digital Ocean as provider of the Vps. The vps are running nginx and the

Load with two servers:

two servers

load with 1 server:

one Server Haproxy config looks loke this:

global
log 127.0.0.1 local0 notice
maxconn 10000
user haproxy
group haproxy
chroot /var/lib/haproxy
daemon

defaults
    log global
    mode    http
    option  httplog
    option  dontlognull
        contimeout 5000
        clitimeout 50000
        srvtimeout 50000
    errorfile 400 /etc/haproxy/errors/400.http
    errorfile 403 /etc/haproxy/errors/403.http
    errorfile 408 /etc/haproxy/errors/408.http
    errorfile 500 /etc/haproxy/errors/500.http
    errorfile 502 /etc/haproxy/errors/502.http
    errorfile 503 /etc/haproxy/errors/503.http
    errorfile 504 /etc/haproxy/errors/504.http

frontend www
    bind 12.34.56.789:80
    option http-server-close
    default_backend web-backend


backend web-backend
    balance roundrobin   
    server web-1 12.34.56.789:80 check
    server web-2 12.34.56.789:80 check
  • Is both of your servers running, accepting connectios and haproxy sees it ok? Just enable stats module in haproxy and look to web interface. – Ondra Sniper Flidr Nov 08 '15 at 17:56
  • i enabled sats and it looks like both servers are serving images ang getting connections ok – Lars Erik Fagernaes Nov 08 '15 at 21:25
  • 2
    Review the syslogs generated by HAProxy, particularly the values logged for `Tq/Tw/Tc/Tr/Tt`. These should provide extremely useful, request-level detail of how your application is performing. Find the slow ones and investigate them in the application server logs. Load balancing a slow application will only allow you to serve more slow requests. – Michael - sqlbot Nov 09 '15 at 00:37

1 Answers1

0

Adding more servers behind a load balancer will not help if your application are taking too much time to send the response.

This is the law of response time.

The load balancer will not improve your response time because he need to wait the response from the application server to serve the client, in that time the connection keep established and waiting.

Your max response time is around 70 seconds and there is +17000 requests timed out (this is not good). This is an application problem.

Also make sure your database can handle these number of connections.

More application servers = more database connections.

fgbreel
  • 673
  • 4
  • 13