Serialization overview

Data is always expressed, but not necessarily stored, as Java™ objects in the data grid. WebSphere® eXtreme Scale uses multiple Java processes to serialize the data, by converting the Java object instances to bytes and back to objects again, as needed, to move the data between client and server processes.

When data is serialized, it is converted into a data stream for transmission over a network in the following situations:

Alternatively, you might decide to forgo the serialization process through WebSphere eXtreme Scale and store raw data as byte arrays. Byte arrays are much cheaper to store in memory. The Java virtual machine (JVM) has fewer objects to search for during garbage collection. The objects can be deserialized only when they are needed. Use byte arrays only if access to the objects with queries or indexes is not required. Because the data is stored as bytes, eXtreme Scale has no metadata for describing attributes to query.

Serialization for Java applications

To serialize data, you can use Java serialization, the ObjectTransformer plug-in, or the DataSerializer plug-ins. To optimize serialization with any of these options, you can use the COPY_TO_BYTES mode to improve performance up to 70 percent. With COPY_TO_BYTES mode, the data is serialized when transactions commit, which means that serialization happens only one time. The serialized data is sent unchanged from the client to the server or from the server to replicated server. By using the COPY_TO_BYTES mode, you can reduce the memory footprint that a large graph of objects can use.

Use the following figures to help you determine which type of serialization method is most appropriate for your development needs.

Figure 1. Serialization methods that are available when you are running logic that interacts with data objects directly in the data grid shardSerialization for running logic that directly interacts with data objects that are in the grid shard.
Figure 2. Serialization methods when you are not directly interacting with the data grid shard.Serialization for running logic that does not directly interact with data objects in the grid shard.

To learn more about the supported forms of serialization in the eXtreme Scale product, see the following topics: