we have app needs maintain state objects containing data (potentially lot) can interrogated client (browser) in 'conversational' interaction. not efficient reload data with each request.
we use spring , session scoped beans maintain session controlled data. these new beans larger.
would appropriate use of session scoped beans or cache (ehcache) better suited?
we're reluctant pull in caching technology unless have to.
the other factor app need deployed in cluster. in case session scoped beans replicated application server's session replication or, more efficient use ehcache (which believe can distributed in cluster)?
any guidance appreciated.
couple of thoughts on (disclaimer: work terracotta/ehcache...so keep in mind...but still trying unbiased here):
1 - there redundant data in each of sessions? shared across sessions? if yes, +1 ehcache store shared stuff (because ehcache optimized heavy concurrency)
2 - how big session objects going be? , how many concurrent users expecting on steady state basis? (in other words, how memory going have dedicate session storage on app server?)
if session footprint not big overall , can fit nicely in heap without gc issues, using session should fine solution.
but bigger gets, larger java heap need be...and more you'll have use voodoo tricks keep garbage collections , gc pause times in check. using ehcache, can store centrally objects multiple sessions access...hence consolidating memory footprint (same point 1) additionally, using enterprise extension ehcache (bigmemory=http://terracotta.org/products/bigmemory), can bypass heap limitations , store data off-heap (as needed - 10s, 100s of gb or more). that, size of objects need in memory become irrelevant (as long can add ram server of course)
3 - session replication, app servers such jboss, weblogic, websphere support it. again, it's matter of session size again (how data need replicated across wire). if session objects big, , have many of them, there lot of network traffic across cluster...could or not work well. having core objects in distributed ehcache layer optimized data storage, while keeping session minimum (i.e. login / authentication information) enhance session replication mechanism in opinion.
hope helps.
Comments
Post a Comment