Good day, dear habrovchane!
After reading
this topic, I decided to write my own, since in my opinion the author did not fully reveal the potential of building HA systems on Jboss (Tomcat), besides, there are many errors in the article (not grammatical).
In this topic, I will not give step-by-step on the configuration of nodes, only selectively, where there are nuances.
Where the legs grow
Not so long ago, I got a job in a large telecommunications company.
After a month or two of development in the new environment, I was given the task of developing an architecture for launching, a census for Java, an updated project.
For the input data was taken:
1. Registered users of IP - 9000000
2. Active users - 2000000
3. Daily active users - 500000
The result was this architecture:')

To start the project, 6 servers were ordered in the following configuration:
2x WEB: 16 core, 12 GB DDR
2x APP: 8 core, 32 GB DDR
2x DB: 8 core, 16 GB DDR
And so, apache2 + mod_jk was installed on the WEB server
On the APP server Jboss AS6, Java 6
Oracle 11R was taken in the role of the database, but I do not think that there are big differences in the configuration of the datasource to other databases.
Customization
And so, proceed to the configuration:
WEB:
Configs can be taken as a basis in
this topic.
On both APP:
[user@app01 ~]$ echo "JBOSS_HOME=/opt/jboss" >> /home/user/.bash_profile [user@app01 ~]$ export JBOSS_HOME="/opt/jboss" [user@app01 ~]$ vim $JBOSS_HOME/server/default/deploy/jbossweb.sar/server.xml
Row
<Engine name="jboss.web" defaultHost="localhost"
we bring to the following form
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">
For APP2, respectively, node2.
This line will allow us to use use sticky sessions in mod_jk balancing.
jvmRoute = "node1" indicates mod_jk to which of the instance to throw the request to.
Next, we flood our application in $ JBOSS_HOME / server / default / deploy /, start Jboss and rejoice.
Probably many will have a question
Why such powerful servers?
The answer is: this scheme allows us to expand horizontally not only the server, but also the instances directly on existing servers.
To do this, copy the directory.
[user@app01 ~]$ cp $JBOSS_HOME/server/default $JBOSS_HOME/server/node3 [user@app02 ~]$ cp $JBOSS_HOME/server/default $JBOSS_HOME/server/node4
Accordingly, in each of the server.xml specify the required jvmRoute
And on the web servers add to the workers.properties new blocks for the new instance
In the line worker.list add new instance
Add new blocks:
worker.node3.type=ajp13 worker.node3.host=ip_app1 worker.node3.port=8009 worker.node3.lbfactor=50 worker.node3.cachesize=10 worker.node3.cache_timeout=600 worker.node3.socket_keepalive=1 worker.node3.socket_timeout=300 worker.node4.type=ajp13 worker.node4.host=ip_app2 worker.node4.port=8009 worker.node4.lbfactor=50 worker.node4.cachesize=10 worker.node4.cache_timeout=600 worker.node4.socket_keepalive=1 worker.node4.socket_timeout=300
Actually, already with this configuration, you are ready to serve quite a large number of visitors.
It is worth noting that for the correct functioning of this scheme, the balancer also requires the installation of sticky sessions, otherwise the user may simply get lost among your servers.
UPD: Do not forget that the database has a limited number of connections, so when adding new instances, you need to take this subtlety into account, otherwise you can get a lying database on the combat environment.
Conclusion
The topic does not claim to be true, but only shows in what form a rather large project of a large organization works, as well as with what blood it can serve 10,000,000 potential users.