Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Recently I started using great tool for load balancing - Haproxy.

There is only one disturbing thing that I cannot figure out how to deal with it. We use haproxy for load balancing mysql traffic. When there is a lot of traffic and many connection it takes ages for haproxy to reload (~ 30 min), with less traffic it doest reload within 1 min.

I do reload with:

service haproxy reload

Of course if I need to do an urgent change in configuration I expect haproxy to do reload very fast. Killing haproxy instances waiting for disconnection causes to disconnection of msyql connections.

It looks like that I made mistake in settings of haproxy or in settings of application. If you know how to solve this please help me.

Thanks!

share|improve this question
    
Is the haproxy down for that amount of time while the reload is taking place? Sounds to me more like it's just waiting for all the connections to die off before actually executing the reload. –  womble Apr 1 '12 at 10:18
    
@womble, no it's not down, old instance and the new one are up simultaneously –  com Apr 1 '12 at 11:03
add comment

1 Answer

If you pass -sf to HAProxy (probably what the init script does) then the old haproxy will handle connections until they are no longer used. So as long as there is a connection open, haproxy will have two instances until they are all done.

If you app uses connection pooling (keeping connections open for reuse) then it may take a while before these connections close. If you are using connection pooling, then you might want to look for some sort of MaxAge parameter that will cause connections to be closed after they have been open for a certain amount of time (With something like this, the age is checked after transaction is complete, in other words, before the connection is returned to the pool).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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