1

I'm trying to understand how the loadbalancing in HAProxy works so that I can do some capacity planning. So which one is the right way the HAProxy load balancing works?

Scenario A: Request from Client was sent to HAProxy, Haproxy forwarded the request to the available webserver which in this scenario Webserver1. The webserver1 respond to the request and return the requested page directly to Client's browser.

Scenario B: Request from Client was sent to HAProxy, Haproxy forwarded the request to the available webserver which in this scenario Webserver2. Webserver2 respond to the request by sending the page back to HAProxy and HAProxy pass the request back to Client's browser.

Also, can this setting works? Internet facing NIC in HAPRoxy is using the public IP where the internal facing NIC for HAProxy use private IP and so does the webserver1 and webserver2. They both use private IP.

Last question. What kind of load balancing scenario does HAProxy support other than Round Robin? What I'm trying to accomplish is, when client is connected the first time to webserver1, I'd like to keep that connection for that client until the session is expired or terminated. Any suggestion on how to accomplish that?

Please advise?

Many thanks for all of your advise.

3

Scenario B. HAProxy creates a TCP connection to the backend to send the client's request, the backend responds to HAProxy, then HAProxy sends the request to the client. The client never has a TCP connection to the backend, so there's no direct communication possible between them.

Also, can this setting works? Internet facing NIC in HAPRoxy is using the public IP where the internal facing NIC for HAProxy use private IP and so does the webserver1 and webserver2. They both use private IP.

Yes, that can work.

What kind of load balancing scenario does HAProxy support other than Round Robin? What I'm trying to accomplish is, when client is connected the first time to webserver1, I'd like to keep that connection for that client until the session is expired or terminated. Any suggestion on how to accomplish that?

What you're looking for is called sticky sessions, see this question for an example.

  • Many thanks for the clarification. Good to know about sticky sessions. My only follow up question on that is about the timing. I saw in one of the example the guy put 2 minutes as time out. Is that time out the same meaning as session expire? – Le Dude Dec 9 '13 at 19:48
  • @LeDude Yeah - the expire setting on stick-table determines how long a given sticky session will last. – Shane Madden Dec 9 '13 at 20:17
  • Thanks @Shane Madden. I'm considering this question as answered. :-) Many thanks again. – Le Dude Dec 9 '13 at 22:15

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.