I am running a http webserver that is connected to a backend database. Now if a client generates 100 threads and tries to contact that webserver through a loadbalancer, I get around 32ms delay. But with the same setup , instead of one webserver , if i have 2 webservers (connected to the same database though) .The load balancer balances the load between these 2 webservers using round robin algorithm. Now I run the same client that generates the same 100 threads but in this case the delay is nearly 55ms. i thought more webservers means better performance but it is exactly the opposite. Can someone help me understand this situation? Thanks !

EDIT: Info regarding load balancer - I am using haproxy load balancer.

This is the config file :

      maxconn 4096
      pidfile /var/run/haproxy.pid

      mode http
      retries 3
      option redispatch
      maxconn 2000
      contimeout 5000
      clitimeout 50000
      srvtimeout 50000

listen GALAXY
      mode http
      cookie GALAXY insert
      balance roundrobin
      option httpclose
      option forwardfor
      option nolinger
      stats enable
      stats auth myuser:mypass
      server EARTH cookie GALAXY_SERVER_01 check

Even in the normal case, I am reaching the single webserver through the load balancer. I dont know why I am getting additional delay for adding another webserver. -Sethu

  • To accurately explain why this occurs, we need more information about the setup. But in general; Load balancers does not deal with latency, they deal with load distribution. They do not accelerate their backends. – Kvisle Oct 24 '11 at 21:33
  • Why is 50ms a performance problem exactly ? The load balancer will allow you to use as many web server as you want, effectively spreading the computational load between nodes. But it won't fix the speed of your network. Once again, why do you think that 50ms is a performance problem ? It is not, and your web page generation time, or database lookup, is likely 10 times slower than that. – Julien Vehent Oct 25 '11 at 2:54
  • 50ms is not a problem. I am just trying to find out situations where a loadbalancer can help me increase the performance of the whole system. I dont mean loadbalancer accelerates the webserver. I can understand it will induce an additional delay but I am trying to understand why 1 webserver shows better performance than 2 webservers ? – sethu Oct 25 '11 at 4:06

A load-balancer will add some latency to your throughput, that doesn't change.

Where 'better performance' come in to play is when you start hitting concurrencies that would swamp a single server. With a load-balancer you can spread the load across an entire farm of servers. That's where the 'better performance' a load-balancer provides comes into its own.

  • If you're using a good load balancer, it should be less than 5ms added, though. From an internet perspective, it shouldn't be measurable, unless there's something wrong with the setup. – Kvisle Oct 24 '11 at 21:34
  • Thus , you mean to say, I will see better performance if i increase the number of threads? – sethu Oct 24 '11 at 21:39
  • @sethu: Number of threads depends of number of concurrent requests – pauska Oct 24 '11 at 22:43
  • Yeah , I am thinking of a case where loadbalancer will be very effective and solve the problem of latency. Say if there is only one webserver and the cpu usage of that has maxed out. In this using 2 webservers with a loadbalancer in the middle should make things better in terms of latency (Im not sure, I believe it is so) . I am looking for such scenarios. – sethu Oct 24 '11 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.