Search code examples
cachingserializationstorageinfinispankryo

Infinispan+kyro/Google Protocol Buffers to achieve more space and time efficient serialization?


If I understand correctly, Infinispan/JBoss Cache uses Java's own serialization mechanism, which can be slow and takes relatively more storage space. I have been looking for alternatives which can achieve the following:

  1. Automatic cached management, in other words objects that are used more frequently are automatically loaded into memory
  2. More efficient serialization (perhaps object --> compact binary stores). The primary goal is less disk/memory space consumption without sacrificing too much performance

Is there a framework or library that achieves both?


Solution

  • JBoss Cache did use Java Serialization but Infinispan does not. Instead it uses JBoss Marshalling to provide tiny payloads and catching of streams. If you enable storeAsBinary in Infinispan, it will store Java objects in their marshalled form.

    Re 1. Not in either products yet. Re 2. Supported in Infinispan using storeAsBinary. More info in https://docs.jboss.org/author/display/ISPN/Marshalling

    Btw, if this does not convince you, you can always let Protobufs generate the byte[] that you need and you can stick it inside Infinispan.