JBoss Cache和Ehcache的性能

| 我正在考虑使用JBoss Cache或Ehcache来实现缓存。看完这两个API之后,我觉得JBoss的内存效率可能比Ehcache高一点,因为它可以将原始对象放入高速缓存中,而Ehcache需要将数据包装在“ 0”对象中。 我建立了一个快速工作台,在缓存中重复插入键,值元组。键和值类非常简单: 键:
public class Key implements Serializable {
    private static final long serialVersionUID = -2124973847139523943L;

    private final int key;

    public Key(int pValue) {
        this.key = pValue;
    }

    public int getValue() {
        return this.key;
    }

    @Override
    public String toString() {
        return \"Key [key=\" + this.key + \"]\";
    }
}
值:
public class Value implements Serializable{

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = -499278480347842883L;
}
当在内存中插入100000个对象的结果时,Ehcache使用了13396个字节来存储对象,而JBoss使用了5712个字节来进行相同的操作(这很好,因为使用ѭ3进行的相同测试使用了5680个字节)。 但是,当我查看执行时间时,我感到非常惊讶:Ehcache花费了300毫秒来执行测试,而JBossCache花费了44秒钟来执行相同的测试。我很确定JBoss配置中有些烂解释了这种区别。 Ehcache的编程方式如下:
CacheConfiguration cacheConfiguration = new CacheConfiguration(\"MyCache\", 0).diskPersistent(false).eternal(true)                
    .diskExpiryThreadIntervalSeconds(100000).transactionalMode(TransactionalMode.OFF);
final Configuration config = new Configuration();
config.setDefaultCacheConfiguration(cacheConfiguration);
this.cacheManager = new CacheManager(config);
cacheConfiguration.name(\"primaryCache\");
this.cache = new net.sf.ehcache.Cache(cacheConfiguration);
this.cacheManager.addCache(this.cache);
JBoss缓存是通过Spring使用以下bean配置创建的:
<bean id=\"cache\" class=\"org.jboss.cache.Cache\" factory-bean=\"cacheFactory\" factory-method=\"createCache\">
    <constructor-arg>
        <value type=\"java.io.InputStream\">/META-INF/jbossCacheSimpleConf.xml</value>
    </constructor-arg>
</bean>
和以下“ 6”文件:
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<jbosscache xmlns=\"urn:jboss:jbosscache-core:config:3.2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
    xsi:schemaLocation=\"urn:jboss:jbosscache-core:config:3.2 http://www.jboss.org/schema/jbosscache/jbosscache-config-3.2.xsd\">

</jbosscache>
为了完整起见,Ehcache测试是:
for (int i = 0; i < ITEM_COUNT; i++) {
    this.cache.put(new Element(new Key(i), new Value()));
}
而JBoss之一是:
for (int i = 0; i < ITEM_COUNT; i++) {
    this.processNode.put(new Key(i), new Value());
}
我的设置/基准测试有问题吗?     
已邀请:
        我切换到infinispan,然后没有任何奇怪的性能问题。     
        注意默认的JBossCache配置。 默认情况下,JBossCache可能尝试在从属节点上查找和复制数据。     

要回复问题请先登录注册