Thursday, 26 June 2008
Terracotta - JBoss AS - EJB3
I still need JBoss AS and its EJB 3 implementation.
Terracotta alone is too flexible which is not appropriate for agile development which heavily depends on forced blueprint like EJB to ensure design quality.
Wednesday, 25 June 2008
Terracotta. What?
While I am enjoying clustering solution using JBoss, I heard about terracotta. An interesting word, so I opened the website.
Somebody said terracotta hundreds time faster than JBoss clustering, and more transparent solution to clustering that the software components you build don't have to be EJBs. Well, I don't know yet.
I am very enthusiastic about learning terracotta tonight, but wait.. A friend needs me to compile and integrate our old java source code tonight :-(
jboss-web.xml for session replication
<!DOCTYPE jboss-web PUBLIC
"-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
<replication-config>
<replication-trigger>SET_AND_NON_PRIMITIVE_GET</replication-trigger>
<replication-granularity>SESSION</replication-granularity>
<replication-field-batch-mode>true</replication-field-batch-mode>
</replication-config>
</jboss-web>
Installing Web Load Balancing to JBoss 5
Install Apache 2. You can get it from http://httpd.apache.org.
Install mod_jk to the apache. You can get it from http://www.apache.org/dist/jakarta/tomcat-connectors/jk/binaries/
Let us say that you have added node1 in mod_jk installation. To the first node of your JBoss 5 cluster edit the file deployers/jbossweb.deployer/server.xml add attribute jvmRoute="node1" to the element
Edit deployers/jbossweb.deployer/META-INF/war-deployers-beans.xml, to the bean WebAppClusteringDefaultsDeployer add property:
Do the same to other nodes.
Edit your web applications web.xml. Add <distributable/>
Edit your web applications jboss-web.xml
Installing mod_jk
Get the mod_jk binary. You can get it from http://www.apache.org/dist/jakarta/tomcat-connectors/jk/binaries/.
Copy mod_jk.so to modules directory of your apache web server.
Put mod-jk.conf template in directory conf/extra of apache. Edit the file, replace MyApps with your application url string components.
Edit conf/httpd.conf, add one line: Include conf/extra/mod-jk.conf
Put uriworkermap.properties in directory conf/extra.
Put workers.properties in directory conf/extra. The template assuming that you have two nodes; node1 and node2 residing in host 172.16.1.37 and 172.16.1.195
workers.properties
# for mapping requests
worker.list=loadbalancer,status
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host=172.16.1.37
worker.node1.type=ajp13
worker.node1.lbfactor=1
worker.node1.cachesize=10
# Define Node2
# modify the host as your host IP or DNS name.
worker.node2.port=8009
worker.node2.host=172.16.1.195
worker.node2.type=ajp13
worker.node2.lbfactor=1
worker.node2.cachesize=10
# Load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node1,node2
#worker.loadbalancer.balance_workers=node1
worker.loadbalancer.sticky_session=0
#worker.list=loadbalancer
# Status worker for managing load balancer
worker.status.type=status
uriworkermap.properties
# Mount the Servlet context to the ajp13 worker
/jmx-console=loadbalancer
/jmx-console/*=loadbalancer
/web-console=loadbalancer
/web-console/*=loadbalancer