即使在禁用备份后,Hazelcast地图也会占用几乎两倍的内存

时间:2015-03-03 17:56:23

标签: hazelcast

我使用Hazelcast作为分布式键值存储。我有650万个密钥。 Hazelcast中的每个条目花费204个字节。因此,它应该只消耗~130GB的内存。但是,虽然我们禁用了备份,但它占用的内存几乎是它的两倍。

java文件(启动服务器以及创建地图)如下所示:

public class Driver {
    public static IMap<String, byte[]> createMap(String mapName, HazelcastInstance hzc){
        IMap <String, byte[]> map = hzc.getMap(mapName);
        return map;
    }
    public static void main(String[] args) {
        try {
            Config config = new XmlConfigBuilder(args[0]).build();
            HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
            IMap<String, byte[]> map = createMap("DBG", hz);
        } 
        catch (Exception e) {s
            e.printStackTrace();
        }
    }

}

在Hazelcast.xml中,我们做了以下更改(正如您在附加的java文件中看到的,我们的map-name是DBG):

<map name="DBG">
    <in-memory-format>BINARY</in-memory-format>
    <backup-count>0</backup-count>
    <async-backup-count>0</async-backup-count>
    <time-to-live-seconds>0</time-to-live-seconds>
    <max-idle-seconds>0</max-idle-seconds>
    <eviction-policy>NONE</eviction-policy>
    <max-size policy="PER_NODE">0</max-size>
    <eviction-percentage>25</eviction-percentage>
    <min-eviction-check-millis>100</min-eviction-check-millis>
    <merge-policy>com.hazelcast.map.merge.PutIfAbsentMapMergePolicy</merge-policy>
</map>

0 个答案:

没有答案