File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes EJB cluster Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB cluster" Watch "EJB cluster" New topic
Author

EJB cluster

Tonny Tssagovic
Ranch Hand

Joined: Dec 30, 2003
Posts: 226
Hello dudes,
I want to make a cluster to handle some "high" laod. Now; my content is 100% dynamic, and user centric (no 2 users will "ever" ask about the same content). I was thinking before to have Apache web server with mod_jk spraying the load to Tomcat-JBoss servers. I don't think I will need Apache since there is no static content, and all the requests will be forwarded anyway.
So now, my questions are:
1- Is it a good idea to have Apache even if the content is 100% dynamic? (more robust and can handle several com without crashing).
2- NOW assuming I will not use Apache/mod_jk, how is the load goin to be distributed, I think that the jboss server could forward the request to another server when the load is high, but to which server will my clients point to (In case I don't want to make any kind of clustering at the client level, and the client needs to know only one IP adress).
3- If the answer to question 2 is an IP balancer (IP sprayer), then you would you need to have your application "cluster" aware, the IP sprayer can just do it for you. I have read that mod_jk is doing fail-over, and I know that many (costly load balancers also detect when a server is down (by healp of some kinda heart beats requests) and takes the request to the next server. They are even session aware and let you continue when you where the other server stopped. Why do would you ever need EJB clustering, at all?
4- For now I don't need any kind of ACID functions and there is no need for EJB transaction capabilities (a function will mostly have reads and might have a single write), and I have an API that gives me some async calls. Is there a need for EJBs (yes I have read all the EJB threads in this forum)
5- The web server usually is put in the same computer and JVM as the application EJB container so that calls from a tier to an other wouldn't make performance problems. Now, since the requests are sprayed accross these applications servers at the web server/load balancer and they also deal with failover and so on, why would you ever need EJB container to sit and take place for your valuable tomcat server? for transactions? and in case Tomcat acts as a client to the EJB layer and can broadcast a request to get saccess to JNDI and search for EJB eobjects, it would not help if they sit together, since if JBoss is dead in a machine, Tomcat in the same machine is probably dead.
6- Any experiance with free software based Load balancers? Any free layer 7 switch software?
Well sorry for the long message,
ANY help will be very very much appreciated.
Thanks in advance
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
First let me start off saying that I am not an expert when it comes to Systems Infrastructure. However, I have been involved in enough of these decisions to pick up a few things along the way. Now on to your questions...
1- Is it a good idea to have Apache even if the content is 100% dynamic? (more robust and can handle several com without crashing).
I always use a separate HTTP Server for my applications for two reasons:
1 - Dedicated HTTP Servers offer a lot more options when it comes to things like access control, bandwidth throttling, and IP blocking.
2 - Using a separate HTTP Server(s) allows a greater level of security for your application. The HTTP Server can and should sit in the public-facing DMZ and be separated from your Application Server by another Firewall. A typical setup looks like this (the |'s represent Firewalls):
Internet | HTTP Server | Application Server | Database Server
2- NOW assuming I will not use Apache/mod_jk, how is the load goin to be distributed, I think that the jboss server could forward the request to another server when the load is high, but to which server will my clients point to (In case I don't want to make any kind of clustering at the client level, and the client needs to know only one IP adress).
Like I mention above... you will definitely want to have a dedicated HTTP Server like a Apache in the mix. You will also probably want to put a hardware load balancer in front of the whole thing. Don't forget redundancy for both!
3- If the answer to question 2 is an IP balancer (IP sprayer), then you would you need to have your application "cluster" aware, the IP sprayer can just do it for you. I have read that mod_jk is doing fail-over, and I know that many (costly load balancers also detect when a server is down (by healp of some kinda heart beats requests) and takes the request to the next server. They are even session aware and let you continue when you where the other server stopped. Why do would you ever need EJB clustering, at all?
Why indeed? If you are always packaging the client and business tier together than you really don't need to cluster at the EJB level, you can instead package the whole thing as an ear and just cluster at the Web application level. This is the case for the majority of J2EE Web Applications. However, some applications have distributed clients (Swing Applications, Web Services, etc.) and the EJB tier must be clustered in these cases. Note, that though the load balancers may seems costly, they are just a drop in the bucket compared to the cost of most projects and are definitely worth the investment.
4- For now I don't need any kind of ACID functions and there is no need for EJB transaction capabilities (a function will mostly have reads and might have a single write), and I have an API that gives me some async calls. Is there a need for EJBs (yes I have read all the EJB threads in this forum)
EJBs offers a number of services: Remotability, Security, Persistence, Caching, Messaging, and Transactioning are the main ones. You are obviously not using any Remotability since it seems you are packaging your Web and EJB Tiers together. Then you say that you do not need Messaging or Transactioning. That only leaves Security, Persistence, and Caching. It up to you to decide if those services are worth the extra overhead of EJB. I don't know enough about your application to say for sure either way. However, my gut feeling would say that you probably don't need EJB.
5- The web server usually is put in the same computer and JVM as the application EJB container so that calls from a tier to an other wouldn't make performance problems. Now, since the requests are sprayed accross these applications servers at the web server/load balancer and they also deal with failover and so on, why would you ever need EJB container to sit and take place for your valuable tomcat server? for transactions? and in case Tomcat acts as a client to the EJB layer and can broadcast a request to get saccess to JNDI and search for EJB eobjects, it would not help if they sit together, since if JBoss is dead in a machine, Tomcat in the same machine is probably dead.
First let us be absolutely clear. You are referring to Web Containers... not Web Servers. Secondly, this is really the same question as number 4. When is EJB a good choice? The answer is simply that EJB is a good choice when you can take advantage of the above mentioned EJB Container services. If you can not use those services then EJB is not appropriate for your application. Just like I have mentioned many times in this forum... I personally only like to use EJBs when my applications have heavy transactioning and messaging requirements. I don't find the other services all that useful.
6- Any experiance with free software based Load balancers? Any free layer 7 switch software?
Most J2EE Servers come with plugins for the various HTTP Servers that support load balancing. I do not have any experience with any of the free software load balancers. Though my suggestion is to invest in the best solution available (free or otherwise). Like I mention above, this is a mere fraction of the cost of the entire application and it is one of the most critical pieces.
Tonny Tssagovic
Ranch Hand

Joined: Dec 30, 2003
Posts: 226
Thanks a lot Chris, I don't know what I would have done without you.
PS: I Like free things because this is a school project , If I were rich and had to make the decision, buying one of these expeansive L7 load balancers would probably be an easy choice. Especially if the application is going to be successful enough to require such devices.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB cluster
 
Similar Threads
Need to log client IP address in clustered environment
RMI + Thread: perform searching on different worker PCs
How to Forward request for jboss client to apache load balancer ?
Is EJB needed if clustering is involved?
Clustering SSL requestes in JBoss+Jetty (3.2.1)