From the Memory Grid to Cassandra

The new Cassandra Space Persistency implementation allows persisting space entries to Cassandra.

It’s pretty cool.

After setting everything up, you can write entries to the space and with no additional configuration, a matching column family will be created for you in the configured Cassandra Keyspace.

Moreover, this implementation provides a “flattening” mechanism. Basically this means a zero-configuration object <—> column family mapping.

For example, consider the following data classes:

You can simply write a ‘Person’ to the XAP in-memory data grid:

If this is the first time an entry of this type is written to the data grid, its type description will also be passed to the Cassandra Space Persistency component, which takes care of the mapping and the actual column family creation. This is the column family you will end up with in Cassandra:     

Moreover, Cassandra is by nature schema-optional. If you write documents to the in-memory grid with dynamic properties (meaning they are not part of the original type description), The Cassandra Space Persistency component will take care of writing (serializing) these entries in such way that their type is maintained. Later, when you need to read from Cassandra (during cache miss on the data grid for example), these properties will be read (deserialized) correctly with their type maintained.