Author Topic: Load balancing queuemetrics?  (Read 5771 times)

barryf

  • Jr. Member
  • **
  • Posts: 62
  • Karma: 4
    • View Profile
Load balancing queuemetrics?
« on: August 24, 2010, 15:50:27 »
Hi,

Is it possible to load balance QM, using two tomcat servers?

I have a pair of servers set up with database replication and QM/Tomcat installed on both. I set both servers in DNS for round-robin load balancing, but it appears that the session breaks down when a user hits the other server.

Any way around this?

Thanks.

-Barry

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Load balancing queuemetrics?
« Reply #1 on: August 25, 2010, 11:23:44 »
The session is theoretically serializable and so it should be movable in a well configured cluster... but that's not what I would do.

I would create a master-slave MySQL scenario (or use only one MySQL) and have two separate QMs with the same config that access the same database.


We have a few clients that actually set up a master-master MySQL replica as in here: http://queuemetrics.com/manuals/QM_AdvancedConfig-chunked/ar01s10.html (note that the article is still "in progress").


barryf

  • Jr. Member
  • **
  • Posts: 62
  • Karma: 4
    • View Profile
Re: Load balancing queuemetrics?
« Reply #2 on: August 25, 2010, 12:39:29 »
Hi,

I have MySQL Master-Master replication in place. The problem appears to be that when a client browser switches from one QM instance to the other, the session information is not there and so QM throws an authentication error. The client would present the JSESSIONID cookie, but this would not be recognized by the other QM instance.

QM does not store its session state in mysql.

-Barry

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Load balancing queuemetrics?
« Reply #3 on: August 26, 2010, 11:25:39 »
No it keeps it in RAM ,and may be quite large. So we suggest using sticky sessions if you ever need it to do load-balancing.

barryf

  • Jr. Member
  • **
  • Posts: 62
  • Karma: 4
    • View Profile
Re: Load balancing queuemetrics?
« Reply #4 on: August 26, 2010, 12:11:13 »
No it keeps it in RAM ,and may be quite large. So we suggest using sticky sessions if you ever need it to do load-balancing.


FEATURE REQUEST: have an option to store session information in MySQL (or memcached) ;-)

This would make load balancing much easier, and allow you to expire out of memory sessions which have not been used for a while, but still retrieve them if needed.

-Barry

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Load balancing queuemetrics?
« Reply #5 on: September 16, 2010, 09:49:29 »
That would be pretty expensive to do though - why don't you like sticky sessions? :)

barryf

  • Jr. Member
  • **
  • Posts: 62
  • Karma: 4
    • View Profile
Re: Load balancing queuemetrics?
« Reply #6 on: September 16, 2010, 10:14:43 »
That would be pretty expensive to do though - why don't you like sticky sessions? :)


Because that would require a hardware load balancer rather than simple round robin DNS.

-Barry

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Load balancing queuemetrics?
« Reply #7 on: September 17, 2010, 09:12:43 »
As QM is resource-intensive, you could likely get it to work using a simple Apache HTTPD proxying requests for multiple backend servers..... this looks promising: http://www.wellho.net/mouth/1939_mod-proxy-ajp-and-mod-proxy-balancer-examples.html


barryf

  • Jr. Member
  • **
  • Posts: 62
  • Karma: 4
    • View Profile
Re: Load balancing queuemetrics?
« Reply #8 on: September 17, 2010, 12:06:40 »
As QM is resource-intensive, you could likely get it to work using a simple Apache HTTPD proxying requests for multiple backend servers..... this looks promising: http://www.wellho.net/mouth/1939_mod-proxy-ajp-and-mod-proxy-balancer-examples.html


Thanks for the suggestion, but really, I could use Linux LVS load balancer just as easily. However, it still requires additional hardware ;-(

-Barry

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Load balancing queuemetrics?
« Reply #9 on: September 21, 2010, 10:10:04 »
You could have Apache on Server A, port 80, that points to Tomcat on Server A, port 8080 and Server B, port 8080. :-)


barryf

  • Jr. Member
  • **
  • Posts: 62
  • Karma: 4
    • View Profile
Re: Load balancing queuemetrics?
« Reply #10 on: September 21, 2010, 10:22:00 »
You could have Apache on Server A, port 80, that points to Tomcat on Server A, port 8080 and Server B, port 8080. :-)


Yes, I realize that, but it simply introduces a single point of failure, which is what I am trying to avoid :-(

-Barry