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

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

3 March 2010 3 Comments

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!


3 Comments »

  • Hallbillted said:

    hell yea.thanx for sharing this post with me.i just found it buy google couse i was searching for
    more info about this.Ang WOOHOO! i found your post that was so usefull for me 🙂
    feel free to drop me email i will send small donation! love for all you here.

  • pneuttome said:

    I found this site using google.com. And i want to thank you for your work. You have done really excellent site. Great work, great site! Cheers!

    Sorry for offtopic

  • Carl said:

    I sort of found your website by accident, but your web site caught attention and that i thought that I would post to tell you that I like it.

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=""> <s> <strike> <strong>

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