Search code examples
javaignite

Apache ignite cache configuration about setStoreKeepBinary and setBackups


I am using the bellow configuarations for my cache:

    CacheConfiguration<String, TestInfo> cacheCfg =
            new CacheConfiguration<>("TestInfoCache");
    cacheCfg.setCacheMode(CacheMode.REPLICATED);
    cacheCfg.setStoreKeepBinary(true);
    cacheCfg.setAtomicityMode(ATOMIC);
    cacheCfg.setBackups(1);

I am just use the cache do some simple get and put work, should I setStoreKeepBinary true or false, I have read the doc :https://apacheignite.readme.io/docs/binary-marshaller It seems this flag used to cachestore, and should i turn it on or if it is on will not suitable for high traffic?

Also, for setBackups, I have 3 server nodes, to keep the data safe and with high performance, what number is suitable, 1 or 3, i not sure about this, Thanks.


Solution

  • False value for setStoreKeepBinary flag can simplify store implementation in some cases, but it can cause performance degradation due to additional serializations and deserializations of binary objects. You will also need to have key and value classes on all nodes since binary will be deserialized when store is called.

    So, if you already have database with certain columns in tables, you obviously can't use setStoreKeepBinary=true, but if you create CacheStore from the scratch and you don't have other applications that will access data directly from DB(since it will be stored in BinaryObject format), it will make sense to store objects in Binary format, since it will show better performance in most cases.