Home » Clustering, Featured, Glassfish, Headline, Java, Shell

Glassfish Cluster 2.1.1, HttpSessions replication and multi-thread concurrent access

3 March 2010 No Comment

I have several clusters with Glassfish 2.1.1 in a BIG virtual environment and all worked fine … until I add new processors to this clusters. After upgrade, I started to have problems with HttpSession replication. Starting debugging JXTA, Shoal and the Web Container didn’t help at all. Until I found this page Memory Replication & Multi-threaded Concurrent Access to HttpSessions. My applications was doing multi-thread concurrent access some times (Ajax) and this was the root cause of all lost sessions. I modified sun-web.xml from my application, accordingly with the above blog post, and after that httpsession started to work as expected. All what you should do is to add relaxCacheVersionSemantics with true as value.

1
2
3
4
5
6
7
8
9
10
11
12
13
        <session-config>
            <session-manager persistence-type="replicated">
                <manager-properties>
                    <property name="persistenceFrequency" value="web-method"/>
		    <property name="relaxCacheVersionSemantics" value="true"/>
                </manager-properties>
                <store-properties>
                    <property name="persistenceScope" value="session"/>
                </store-properties>
            </session-manager>
            <session-properties/>
            <cookie-properties/>
        </session-config>

Probably in a single processor environment httpsession working very well but on multicore/multiprocessor system you can have problem if you don’t specify relaxCacheVersionSemantics. Read Memory Replication & Multi-threaded Concurrent Access to HttpSessions for more informations.

Good Luck!


Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.