Version 10

    A Simple Replicated Counter Test Application

     

    This little application can help you test HttpSession replication.

     

    The sample project attached below provides a simple counter that is stored in the HttpSession.  With each request, the counter is incremented and replicated.  It is implemented as a Counter object that spits out log4j messages whenever replication/serialization happens. 

     

    The project was built with NetBeans.  For some reason the default ant target doesn't work, but the targets you might want to use such as clean, compile, dist, etc. work fine.  So, you can easily modify the source if you need to.

     

    If you have two clustered JBoss servers on the same domain then you can use the counter.war provided in the /dist directory to test if HttpSession replication is working.  Just drop the war in your /deploy directory for each server.  Then, change the port of the URL in your browser to simulate failover.

     

    http://localhost:8080/counter
    http://localhost:8180/counter
    

     

    If you have trouble, refer to Tomcat 5 clustering for details and configuration options of HttpSession replication.

     

    To manually test loadbalancing and failover on more than one box, you will need to configure a load balancer.