Skip to content

jerrinot/subzero

Repository files navigation

SubZero - Fast Serialization for Hazelcast

SubZero provides fast & non-invasive serialization for Hazelcast. It's easy-to-use integration of fast serialization libraries such as Kryo into Hazelcast.

How to Use SubZero?

Use SubZero for all classes

SubZero will completely replace Java serialization. Hazelcast internal serializers will still take precedence.

Declarative Configuration:

Insert this snippet into your Hazelcast configuration XML:

<serialization>
    <serializers>
        <global-serializer override-java-serialization="true">
            info.jerrinot.subzero.Serializer
        </global-serializer> 
   </serializers>
</serialization>
Programmatic Configuration:
Config config = new Config();
SubZero.useAsGlobalSerializer(config);
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);

Use SubZero for selected classes only

In this mode Hazelcast will use SubZero for selected classes only.

Declarative Configuration:
<serialization>
    <serializers>
        <serializer type-class="some.package.Foo"
            class-name="info.jerrinot.subzero.Serializer"/> 
        <serializer type-class="some.package.Bar"
            class-name="info.jerrinot.subzero.Serializer"/>
   </serializers>
</serialization>
Programmatic Configuration:
Config config = new Config();
SubZero.useForClasses(config, Foo.class, Bar.class);
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);

All cluster members have to use SubZero for the same types and the types have to be declared in the same order. Currently programmatic configuration will result in somewhat higher performance - this is given by a limitation of Hazelcast declarative configuration API. It should be fixed in the next version of Hazelcast.

Maven Configuration

The project is currently not in the Maven Central Repository. You can use the awesome JitPack service for simple integration into your project.

How to configure Maven to fetch SubZero from JitPack:

  1. Add JitPack repository into your pom.xml:
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://www.jitpack.io</url>
    </repository>
</repositories>
  1. Add SubZero as a dependency into your project:
<dependency>
    <groupId>com.github.jerrinot.subzero</groupId>
    <artifactId>subzero-all</artifactId>
    <version>master-SNAPSHOT</version>
</dependency>

TODO

  • Upload into Maven Central
  • More serialization strategies. Currently Kryo is the only supported strategy.
  • Better Documentation

Disclaimer

This is a community project not affiliated with the Hazelcast project.