Building a Stable and Clustered J2EE Environment?
royles asks: "I am working with several J2EE Application Servers and all seems fine until I start to scale and cluster. The goal is to ensure a web and EJB session is maintained across a pool of Application Servers. The level of complexity to achieve this straightforward requirement is proving too much. It quickly becomes evident that vendors claims of 'robust and scalable' go straight out the window in favour of extortionate support and consultant costs when the installation becomes large. Anybody else experienced this type of problem? What are other peoples experienceâ(TM)s in this area? Any recommendations on Application servers that âdo what they say on the tinâ(TM)? Any good online resources for achieving a highly scaled and robust solution?"
Develop apps quickly
Provides a powerful integrated development environment
Allows you to create web services or three-tier Java server apps
Generates code-free prototypes in minutes
Build services dynamically
Allows you to create or use web services based on SOAP, XML and WSDL
Includes tools for code-free generation, configuration, and testing of web services from existing database assets
Integrates easily with services written in Java, AppleScript, Perl and .Net
Access data automatically
Reverse-engineers your database, modeling all tables, columns and relationships
Generates Java objects from JDBC and JNDI data sources, transparently handling data persistence
Offers database independence and simultaneous access to multiple databases
Generate pages seamlessly
Generates HTML, XML and SMIL from reusable templates
Builds data-driven web pages from visual development tools
Streamlines delivery of multi-lingual content
Deploy painlessly
Deploys to virtually any J2EE server or the WebObjects J2SE application server
Provides easy scalability with built-in clustering support and low-cost licensing
Supports Servlet/JSP, EJB, RMI-IIOP and JTA/JTS (J2EE technologies)
First of all, do not store data on the application server. Secondly, make sure that all of your objects associated with a session in either the EJB layer or the HTTP session implement Serializable.
;-)
I'd recommend running JBoss + Tomcat on Linux with Apache frontending it with mod_jk2. Put all your static web content on Apache to free up Tomcat. The easiest way to do this is to use a load-balancing solution in front. Have it pass the sessions through to the Apache server which will offload any JSP/Servlet requests to Tomcat. Have the JBoss/Tomcat installation on each node of the cluster clustered using JBoss' JavaGroups based clustering. You can also use the JBoss Farm service to deploy the EAR file to one node in the cluster then have the other nodes pick it up from there.
If you use a seperate set of machines for the database cluster than the JBoss/Tomcat nodes can be set up as copies of each other with no data on board. Using Linux boxes, this is easy (dd the drives). If a node goes down for some reason, swap it with a spare. Any session info is already serialized and passed to the other nodes in the cluster, and the load-balancer w/ failover should handle the client end of that.
By the way this thing scales to at least 100 boxes from the stories I've heard. I've done it my self in small (5 box) installations. I've also used F5 equip for the load balancer/failover on the front. Everything worked well.
Buy the JBoss docs to help with the clustering. I've also got some docs I wrote on setting up JBoss clustering somewhere around here.
You'll be suprised how simple clustering is with JBoss once you understand a bit how JBoss works and is configured. You will also be amazed at how well it works.
The best part of course is that it's all Open Source, so no license fees. Hell, I'll set it up for you for 30% of the licenses and support you would have bought if you want.
Arrogance is Confidence which lacks integrity. -- me
Caucho's resin application clusters are a great way to get load balacing and distributed sessions into your appserver farm. Cost is around $1k per server, so real enterprise jocks will laugh at it, but unlike some of the "three engineers per server" solutions, it really works without having to spend all your time troubleshooting and hand-coding things.
http://tinyurl.com/4ny52
We are implementing a 3 tier high availability cluster using weblogic as the application layer. We have them clustered though a weblogic provided apache module on our load balanced web layer. It also survives the failover of the database layer as well. These things do still need consideration in the code you write (mainly the part about reconnecting after a database failover). Weblogic seems to handle the redundancy and load balancing fine if you let it maintain it's persistance by storing it's que and object data in the database layer. --Chris
Also be care to only cluster stateful EJB. with stateless stuff, it's better to no cluster and simply load balance it.
"If you upgrade each of your current servers to the quad-processor GigaFLex, you'll have no problems."
"Do you have any perfomance metrics for that? How about a customer we could reference on that?"
"Ummm, no... those results are from our research lab."
(you get the idea)
Isn't the purpose of EJB to meet these sort of goals without having to do anything special? Well, except architect your app. a certain way. If doing this is non-trivial then doesn't it mean that EJB has failed to a certain extent? If I have to hear about Data Transfer Object Factories and CMP entity beans again I think I'll puke....
Anyone want to comment on how easy it is to do this with IBM's WebSphere Application Server?
www.opencloud.co.nz
They create a SDK for creating appilcations that run over multiple systems and is extremly fault tolerant.
Clustering *is* hard. And even the best application server in the world can't reduce that complexity. It can just try to not add any complexity of it's own.
Front-end load balancing, internal load balancing policy, cache settings, fail-over settings, setting up the LAN correctly... these are all *extra* things you need to do under a clustered J2EE server that you don't need to worry about normally. Clustering is hard
Having said that, I've been involved in commercial projects using clustering under Weblogic and JBoss. We have been able to get them going without too much trouble.
Also, some things J2EE allows some things in non-clustered mode that it explicity warns won't work in clustered mode. For example, objects in Sessions must be Serializable when clustering.
=Matt
http://www.onjava.com/lpt/a/1517
Slashdot = Sarcasm
You can use a Cisco localdirector(s) at the front of the farm of your application servers, and just enable sticky cookies. This will cause the localdirector to keep the requests on the same application server, and reduces the complexity of having to implement software load balancing solutions in your code and on your servers.
"And I for one welcome our new insect overlords."
I heard good things about Orion's clustering capabilities (never tried it though).
They have some good documentation on their site.
Cheers
Excuse my ignorance, I'm just beginning to learn EJB. But as I learn more about them, I can't help thinking: "what's the deal?".
I mean, what's wrong with having your MVC webapp being based on JSP/Servlets, plus plain-old Java objects for the business-logic (accessing the DB via JDBC). Tomcat itself has support for load-balancing among several Tomcat servers; and as for the business-logic objects, these would be acting like client apps in a traditional C/S fashion, so they can be distributed without problems (and the transactional stuff should be taken care of by the DB, that's what RDBMS are for, no?)
So again, what's the big deal with EJB? Training wheels for programmers who don't grok databases and transactions; who think tha JDBC is too complicated??? Seriously, I'd like to be enlightened on this.
You create a 'server group' and add clones to it with mouse clicks. Viola, instant-on, growable/shrinkable massively scalable J2EE container.
Maybe this guy is trying to use the "Free except the documentation" JBoss and getting lost in the API set?
MORTAR COMBAT!
I'd second JBoss for clustering. The middle tier, EJBs and the like 'just works'.
The front end is tricker: e.g. setting up DNS round robin + virutal IP takeover in case a front end server goes down.
And the back end (database) is also fun. e.g. setting up a distributed file system. Or setting up database replication. Both doable, but hard to do right and get great performance.
I had one customer use our VPS servers to help them get clustering going.
They can set up several virtual servers (with their own file systems and IP addresses, etc) all on one physical server.
Once they have nailed they setup, they can them deploy on separate physical servers. Its a lot quicker, easier to manage (and cheaper) doing it that way.
Cheers, Peter RimuHosting - VPS/JBoss HostingIf you plan to cluster, be sure to evaluate your use of session. If you intend to replicate your session objects across each instance of the cluster, they will need to be serializable so that the container can move them around. From past experience, you will need to consider the size of these objects as well -- if each session footprint is large, you may have some scalability limits. As an alternative, you can choose to not cluster the session objects and leave them on the original container. To do this, your front end router must ensure that the sessions return to the original container via a cookie or some other means. Also, consider eliminating any file-based storage on the cluster. Use JDBC for queues and logs. In this way, if you lose an instance of the cluster, your data will still be safe in your database (assuming you have a HA solution for your database)
ZZ
Thanks for all the responses and detail. JBoss comes up a lot... I will investigate this further. Good points about sessions and DB usage.
I thought at this stage in J2EE development, clustering would be well understood and available 'out of the box'.
Thanks, Royles
Actually 'this guy' is using the 'mouse click' features of Borland BES as well as BEA Weblogic.
Both of which 'cost and arm and a leg' for the documentation then rip you off totally when it comes to support.
Also the documentation on clustering for BES is very lightweight. YOu are looking at committing thousands to put together even the most basic clustered solution.
Will investigate your recommendations further though.
If you really are interested in investigating WebSphere... let me know and I can probably get you in touch with some evaluation licensed software. (Note that however I do not work for IBM Sales!)
MORTAR COMBAT!
If you are working with multiple servers, you should look at Coherence.
We do a lot more than clustering app servers. Our product serves as an in-memory data store in a clustered application tier. If you have experience with high-scale J2EE applications, you'll probably have experienced what I call the "single point of bottleneck": the database. For some of our customers, we've reduced their database usage by 99.9%+ and their overall infrastructure costs by over half. With the replicated cache, each application server has all the "cached" data locally, so access is instantaneous. With our concurrency features, the data integrity is maintained, whether on a single server or replicated across 100 servers. With our distributed cache, if you have 100 servers each caching a half GB of data, you have a 50GB cache!
Other features include support for grid computing, cache querys, and more. We've focused heavily on making sure that our clustering is fault tolerant and extremely reliable.
Check out how the TheServerSide created a single cluster out of multiple vendor's app servers using Coherence. You may not need it for your application, but it shows what you can accompish.
Gene Gleyzer
Tangosol, Inc
I'm looking at a JBoss install - which Linux Distro(s) work best with Java - Slackware? Suse? Redhat?
Which have you used?
Your using Apache2 right? does 1.3.* also work?
thx
Why do you need such 'Application Clusters' anyway ?
v er s.html
http://philip.greenspun.com/wtr/application-ser
cherio
venu