Skip to content

ECF/kryo-serialization

Repository files navigation

Kryo serialization for Eclipse ECF

This is an additional serialization module for Eclipse ECF that uses the Kryo framework to serialize and deserialize network messages used for remote invocation of OSGi Services.

An example demonstrating the setup and usage is provided.

Contents

Why

Several benchmarks show that serialization with Kryo has much better performance than default Java serialization.

How

The bundle org.eclipse.ecf.sharedobject.serializer.kryo provides a custom implementation of ISharedObjectMessageSerializer that can be used as dropin replacement to the default message serialization.

To use the custom KryoSharedMessageSerializer you need to register it on consumer and provider. See the coresponding example bundles for more details.

Setup and Usage

Target Platform preparation

In order to run the example you have to prepare a local directory which provides the necessary JAR files for Kryo and it's dependencies. This is needed because currently there is no P2 update site providing these artifacts for direct use.

Note: for production use consider using a repository manager like Eclipse Package Drone for storing and consuming external dependencies.

Running the Example

  • clone this GitHub repository using Eclipse and import the projects into your workspace
  • open the org.eclipse.ecf.example.kryo.target project and edit the target file
  • replace the directory location (eg. "/home/peter/...") with the directory location of your prepared target platform
  • the target platform editor should list 4 plugins in that directory

Target Platform Editor

  • click on "Set as Target Platform" in the upper right corner of the target platform editor
  • start the "service consumer": in the org.eclipse.ecf.example.kryo.consumer project double click on the KryoExampleConsumer.generic.zeroconf.product file to open the product file editor
  • click on the little play button on the upper right corner (ignore any errors saying something about "org.eclipse.ecf.twitter.client")
  • start the "service provider": in the org.eclipse.ecf.example.kryo.provider project double click on the KryoExampleProvider.generic.zeroconf.product file to open the Product file editor
  • click on the little play button on the upper right corner (ignore any errors saying something with "org.eclipse.ecf.twitter.client")

You should now see some debug output ("got value...") in the console view. Now look at the code ;)

Status

This hasn't been used in production so handle with care ;)

Thanks

Many thanks to the Eclipse ecf-dev mailing list for the friendly support, especially Scott Lewis.

License

Licensed under the Eclipse Public License version 1.0, available at http://www.eclipse.org/legal/epl-v10.html