WebSphere eXtreme Scale V8.6 IBM Extreme Scale

132 Views Asked by At

I am trying to figure out how big my objects are when serialized in ObjectGrid (IBM Extreme Scale). I want to add more data to the object but want to see how much increase in space it will take. Is there a way I can determine this? For instance, can I call a method on any of the object grid classes to get the bytes?

Thanks

1

There are 1 best solutions below

2
On

In order to see the size of the serialized value of an inserted entry into the grid you would do code like the following:

ObjectMap map = session.getMap("map");
map.setValueOutputFormat(OutputFormat.RAW);
SerializedValue sv = (SerializedValue) map.get(key);
int size = sv.getInputStream().size();
System.out.println("The serialized size of the value for key " + key + " is " + size);