[id='kryo_marshalling']
= Using the Kryo Marshaller
{brandname} provides a marshalling implementation that uses Kryo libraries.

.Prerequisites for {brandname} Servers

To use Kryo marshalling with {brandname} servers, add a JAR that includes the
runtime class files for the Kryo marshalling implementation as follows:

//Community
ifndef::productized[]
. Download the
link:http://central.maven.org/maven2/org/infinispan/infinispan-marshaller-kryo-bundle/{infinispanversion}/infinispan-marshaller-kryo-bundle-{infinispanversion}.jar[Kryo Bundle].
endif::productized[]
//Product
ifdef::productized[]
. Copy `infinispan-marshaller-kryo-bundle.jar` from the {brandname} Maven repository.
endif::productized[]
. Add the JAR file to the `server/lib` directory in your {brandname} server installation directory.

.Prerequisites for {brandname} Library Mode

To use Kryo marshalling with {brandname} as an embedded library in your application, do the following:

. Add the `infinispan-marshaller-kryo` dependency to your `pom.xml`.
+
[source,xml]
----
include::dependencies_maven/marshaller-kryo.xml[]
----
+
. Specify the `org.infinispan.marshaller.kryo.KryoMarshaller` class as the
marshaller.
+
[source,java]
----
GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder();
builder.serialization()
       .marshaller(new org.infinispan.marshaller.kryo.KryoMarshaller());
----

.Procedure

. Implement a service provider for the `SerializerRegistryService.java` interface.
. Place all serializer registrations in the `register(Kryo)` method; where
serializers are registered with the supplied `Kryo` object using the Kryo API,
for example:
+
----
kryo.register(ExampleObject.class, new ExampleObjectSerializer())
----
+
. Specify the full path of implementing classes in your deployment JAR file within:
+
----
META-INF/services/org/infinispan/marshaller/kryo/SerializerRegistryService
----

.Reference

* link:https://github.com/EsotericSoftware/kryo[Kryo on GitHub]
