0

I am new to modjk. I am trying trying to reduce the time needed for load balancing failover. Load balancer works in a round robin fashion. Currently, it takes about 30s to 40s for the load balancer to send request to another connection when one connection fails. Is there a code to reduce the time for failover?

This is my code:

    #
    worker.balancer.type=lb
    worker.balancer.balance_workers=worker1,worker2
    worker.balancer.sticky_session=false

    # Set properties for worker1 (ajp13)
    worker.worker1.type=ajp13
    worker.worker1.host=192.168.200.5
    worker.worker1.port=8009
    worker.worker1.lbfactor=1


    # Set properties for worker2 (ajp13)
    worker.worker2.type=ajp13
    worker.worker2.host=192.168.200.1
    worker.worker2.port=8009
    worker.worker2.lbfactor=1

Looking forward to any help. Thank you so much!

lwm
  • 3
  • 1
  • 2
  • 30-40 seconds is a lot. Usually it does take 5 seconds or lower. How long does the first request (new session) to you app take? How big is the session size? – Stefan Mar 10 '14 at 12:14
  • Thank you for your reply. First request is almost instant. Session size should be only a few bytes. There is only a few words in the page. – lwm Mar 10 '14 at 13:15
  • I would first check the apache cluster/tribes/replication logs and set 'JkLogLevel debug' in your apache config. – Stefan Mar 10 '14 at 13:22

1 Answers1

0

What you are looking for is the ping_mode setting documented in the workers.properties configuration reference. This sets up the way mod_jk checks to see that a back-end connection is working properly. If you set ping_mode to either P or A (A implies P), then the connection will be "tested" for every single request that will be sent to that back-end server. You could also use I to configure a time interval for checking all connections.

The AJP/1.3 has a fairly light "ping" protocol so it's not terribly expensive to configure a ping_mode.

Christopher Schultz
  • 20,221
  • 9
  • 60
  • 77