Announcement Announcement Module
Collapse
No announcement yet.
Which is better to use - EHCache, OSCache or Swarmcache Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Which is better to use - EHCache, OSCache or Swarmcache

    I have some relatively large XML documents that I would like to cache for a period of time. I already cache the query from the DB using OSCache with Ibatis SQL Maps. I would like to know you opinion of caching the XML document that is then create from this data. Would you suggest using EHCache, OSCache or SwarmCache? Why?

    If you have done this analysis before, please share any performace results you may have. Thank you.

  • #2
    I think JBoss Cache is better . JBoss cache is a fully transactional, cluster-safe caching system.

    Comment


    • #3
      Take a look at Table 14.1. Cache Providers, it summarize some of the differences between these cache providers.

      Comment


      • #4
        Funny thing, I was reading 'Hibernate in Action' this weekend and saw the comparison in the book. Thanks though.

        I decided to go with Ehcache and re-used Ben's code and bean set up for what was done in Acegi. I wanted to use OSCache but the documentation is very weak.

        Comment


        • #5
          Great choice

          Spring Framework 1.1.1 allows for configuring EHCache using IOC. Take a look at package org.springframework.cache.ehcache (in cvs) for more details.

          Comment


          • #6
            If I were starting a new project, I'd use Spring's new org.springframework.cache.ehcache package. Acegi Security will be depreciating its implementations in favour for this package once it's in a Spring core release.

            Comment


            • #7
              Originally posted by Ben Alex
              If I were starting a new project, I'd use Spring's new org.springframework.cache.ehcache package. Acegi Security will be depreciating its implementations in favour for this package once it's in a Spring core release.

              Thanks Ben. I took irboubo advise and got the package you metioned from CVS. I also updated my AGEGI provider to use it. Work fine so far.

              Code:
              <!-- ##################################################### -->
              	<!-- ################## Ehcache setup #################### -->
              	<!-- ##################################################### -->
              	
              	<bean name="mwEhcacheMgr" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
              		<property name="configLocation">
              			<value>/WEB-INF/ehcache.xml</value>
              		</property>
              	</bean>
              	
              	<bean name="WBSCacheFB" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
              		<property name="cacheManager">
              			<ref bean="mwEhcacheMgr" />
              		</property>
              		<property name="cacheName">
              				<value>WBSCache</value>
              		</property>
              	</bean>
              	
              	<bean name="UserCacheFB" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
              		<property name="cacheManager">
              			<ref bean="mwEhcacheMgr" />
              		</property>
              		<property name="cacheName">
              				<value>UserCache</value>
              		</property>
              	</bean>
              	
              	<bean id="userCache" class="com.method.util.EhCacheBasedUserCache">
              		<property name="cache">
              			<ref bean="UserCacheFB" />
              		</property>
              	</bean>
              	
              	<bean id="wbsCache" class="com.method.util.WBSCache">
              		<property name="cache">
              			<ref bean="WBSCacheFB" />
              		</property>
              	</bean>

              Code:
              <bean id="mwAuthenticationProvider" class="com.method.security.MWAuthenticationProvider">
              		<property name="userCache">
              			<ref bean="userCache" />
              		</property>
              		<property name="authenticationDao">
              			<ref bean="methodDao" />
              		</property>
              	</bean>
              Code:
              <bean id="showWBSController" class="com.method.web.browse.xslt.ShowWBSController">
              		<property name="methodNameResolver">
              			<ref local="showWBSControllerResolver" />
              		</property>
              		<property name="methodDBFacade">
              			<ref bean="methodDBFacade" />
              		</property>
              		<property name="pathMapping">
              			<ref local="pathMapping" />
              		</property>	
              		<property name="wbsCache">
              			<ref bean="wbsCache" />
              		</property>		
              	</bean>
              ehcache.xml

              Code:
              <cache name="WBSCache"
                      maxElementsInMemory="10000"
                      eternal="false"
                      timeToIdleSeconds="124416000"
                      timeToLiveSeconds="124416000"
                      overflowToDisk="false"
                      diskPersistent="false"
                      diskExpiryThreadIntervalSeconds="120"
                      />
              		
              		
              		<cache name="UserCache"
                      maxElementsInMemory="10000"
                      eternal="false"
                      timeToIdleSeconds="300"
                      timeToLiveSeconds="300"
                      overflowToDisk="false"
                      diskPersistent="false"
                      diskExpiryThreadIntervalSeconds="120"
                      />

              Comment


              • #8
                A newbie question. Is com.method.util.EhCacheBasedUserCache a class of your own? How does it look like?

                Comment


                • #9
                  Jcs

                  I'm working a basic comparison of EHCache and JCS. The JCS disk store is much more sophisticated and the JCS LRU Memory cache appears to be twice as fast as EHCache.

                  http://jakarta.apache.org/jcs/JCSvsEHCache.html

                  Comment


                  • #10
                    I think JBoss Cache is better
                    +1

                    If you're building a system that can run on one box, by all means use the other caches, but if you have 2 or more servers then your only practical choice is JBoss TreeCache.

                    Comment


                    • #11
                      JCS vs JBoss

                      We discussed some of the drawbacks and benefits of the JBoss caching option son the JCS user list last year:

                      http://mail-archives.apache.org/mod_...3.mbox/browser

                      Comment


                      • #12
                        There's also a new supa dupa version of JBoss Cache coming out shortly.

                        See http://www.jboss.com/wiki/Wiki.jsp?page=JBossCache

                        Comment


                        • #13
                          Why do you like JBoss cache?

                          What specifically makes JBoss cache better? Is it easier to use, more scallable, more feature rich, or faster than other caches such as JCS? The answer to all of the above seems to be no.

                          I don't want transactional distribution. It simply cannot scale given current harware, especially via JGroups.

                          I don't want the AOP logic, since it solves an uncommon problem (where you change only a small bit of a large object but have to send the entire thing over the wire) at the cost of added complexity and a performance penalty for the common case where you want the entire object to go over the wire.

                          It's too tied to JBoss and I would never sell my soul to any container.

                          It isn't as fast as JCS.

                          It ins't plugable like JCS.

                          There may be some cool disk cache features that come with the JBoss cache, but I've never looked into how well they perform.

                          Comment


                          • #14
                            jcs site update

                            The JCS site has been updated with a getting started guide, an faq, and several other new documents:
                            http://jakarta.apache.org/jcs/index.html

                            Comment


                            • #15
                              What specifically makes JBoss cache better?
                              I wasn't so much pointing out which one is better.

                              I was pointing out that if you need to run two boxes, you choices are:
                              1. JBoss Cache, or
                              2. JBoss Cache, or
                              3. ...you get the idea...

                              You probably pointed out several aspects of caching that should be considered, but you've got to get past the "are you running 2 or more boxes?" question first before they're even relevant.

                              Also, last time I looked swarmcache wasn't transactional, which counts it out if the data in your system has any sort of value and/or the customers of your system are likely to get pissed off if problems occur relating to non-transactional caching. Given JBoss Cache as an alternative, that pretty much counts it out of the list.
                              Last edited by gmatthews; Feb 21st, 2006, 02:15 AM.

                              Comment

                              Working...
                              X