Hazelcast近缓存

时间:2014-05-06 07:00:10

标签: hazelcast

我设置了两个节点hazelcast 3.2,每个节点包含500 MB数据。我已经配置了客户端近缓存。

我有以下问题

  1. 如何验证是否从近缓存hashmap中提取数据?
  2. 我的一些地图只有一个条目,即size = 1,有时会打开 重负载需要20到30毫秒才能获取数据?
  3. 重载时间在4ms到20 ms之间。如果是这样的话 从近缓存中获取,最佳获取时间是什么 毫秒。
  4. 在服务器上设置的最佳GC策略是什么?
  5. 我的服务器端配置

    mapCfg = new MapConfig();
    mapCfg.setName("TL_MAP_2");
    mapCfg.setBackupCount(1);
    mapCfg.setReadBackupData(true);//enabled as it is sync backup
    mapCfg.setInMemoryFormat(InMemoryFormat.BINARY);
    cfg.addMapConfig(mapCfg);
    

    我的客户端代码是单身

    public enum CacheService {
        INSTANCE;
    
        private static ClientConfig clientConfig = null;
        private static HazelcastInstance cacheClient = null;
        private static Set<String> nearcaches = new HashSet<String>(Arrays.asList("TL_MAP_1","TL_MAP_2","TL_MAP_3","TL_MAP_4","TL_MAP_5","TL_MAP_6","TL_MAP_7","TL_MAP_8","TL_MAP_9","TL_MAP_10"));
    
        static{
    
            if(clientConfig ==null || cacheClient ==null){
    
            clientConfig = new ClientConfig();
            clientConfig.getGroupConfig().setName("dev").setPassword("dev-pass");
            clientConfig.getNetworkConfig().addAddress("XXX.XX.XXX.XXX:5701","XXX.XX.XXX.XXX:5702").setSmartRouting(true);;
    
    
            clientConfig.setExecutorPoolSize(120);
            Iterator<String> iterator = nearcaches.iterator();
            String near = null;
            while(iterator.hasNext()){
                near = iterator.next();
                clientConfig.addNearCacheConfig(near, new NearCacheConfig().setInMemoryFormat(InMemoryFormat.OBJECT));
            }
    
    
            cacheClient = HazelcastClient.newHazelcastClient(clientConfig);
            }
        }
    
        public HazelcastInstance getCacheClient(){
            return cacheClient;
        }
    
        public Map get(String cacheName) {
    
            Map cacheMap = cacheClient.getMap(cacheName);
    
        if (nearcaches.contains(cacheName)) {
    
                NearCacheStats stats = ((IMap) cacheMap).getLocalMapStats()
                        .getNearCacheStats();
                logger.info("Near Cache HITS for map " + cacheName + "  ::"
                        + stats.getHits());
            }
    
    
            return cacheMap;
        }
    
    
    }
    

0 个答案:

没有答案