users@glassfish.java.net

Re: how to setup loadbalancing on glassfish?

From: <glassfish_at_javadesktop.org>
Date: Thu, 24 Apr 2008 00:24:48 PDT

Linux Virtual Server is a good solution if you are unwilling to pay for a hardware load balancer. But hardware load balancers offer what LVS can't do, for example much easier management, monitoring, and SSL acceleration among others. If your application is going to be used commercially, you definitely need a load balancer, even if its LVS. As LVS solution we use Heartbeat 2.0.x, Ldirectord and ipvs kernel module.

For SSL, we use Apache HTTPD server, since its all written in C and is fast. This is also legacy from using Apache Tomcat, when it refused to work with APR correctly, and thus SSL in Tomcat would have been slower (java vs C in SSL is no chance).

We use mod_proxy with HTTPD and Glassfish and it works fine. We set it up before we discovered mod_jk works with glassfish too. Now I would prefer mod_jk.

Do not use Web server as a load balancer, for the reasons I mentioned in previous post.
I'm not sure how HTTPD works internally, but I think your application shouldn't keep connections open for several hours. In HTTPD probably some timeout can be set, after which the server automatically closes connections, otherwise it would be easy to block HTTPD by opening connections that do nothing.

Most C programs use a technique to have multiple sockets open, and have a select kernel call running on it. Once some data arrives they pass it to some already running thread. Once request is processed, thread is reused.
Don't be affraid, Linux can live happily with thousands of threads if they do nothing.
[Message sent by forum member 'jarol1' (jarol1)]

http://forums.java.net/jive/thread.jspa?messageID=270897