I'm asking this question, because I can't find anything in the docs: https://new-console.ng.bluemix.net/docs/services/DataCache/index.html#datac001
As far as I understand IBM Data Cache (ObjectGrid) is a simple distributed storage that consists of maps, where each map consists of key/value pairs. Since both the key and value can be any Object (java.lang.Object), they just need to be Serializable (implement java.io.Serializable). However, I wonder if there's a size limit for the value of an entry in the map?
In our Liberty Java application we experience de-serialization issues for some of the maps we created. By inspecting the values - via the IBM Bluemix Dashboard - which are stored in Data Cache , it seems like that some of the objects are not completely serialized. For example, there's a cut after 8182 characters, which seems to be close to 8KB (8192 byte) limit. I don't know if this is a limit of the dashboard, that it can't show more than that for a value in a map, or if that's the limit of what can be stored in a map entry? Unfortunately there's (at least I don't know) any other way to inspect the contents of a map in the Data Cache.
When we write to the map via
map = objectGrid.getSession().getMap(mapName);
map.upsert(key, value);
no exception is thrown. If there was a size limit of how big the values in a map can be, I would expect an exception here when you write to the map. But there's none. However, when we try to read from the map again via
map = objectGrid.getSession().getMap(mapName);
value = map.get(key);
a de-serialization exception is thrown with the following cause:
2016-04-17T23:00:39.53+0200 [App/0] ERR [ERROR ] cause:
2016-04-17T23:00:39.53+0200 [App/0] ERR Metadata for typeId 97; domainHashCode=99 could not be found. The metadata may not have yet replicated from a foreign domain.
2016-04-17T23:00:39.53+0200 [App/0] ERR [err] com.ibm.websphere.objectgrid.TransactionException: transaction marked rollback only, see caused by exception
2016-04-17T23:00:39.62+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.SessionImpl.mapPostInvoke(SessionImpl.java:3729)
2016-04-17T23:00:39.62+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.ObjectMapImpl.postInvoke(ObjectMapImpl.java:883)
2016-04-17T23:00:39.62+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.ObjectMapImpl.get(ObjectMapImpl.java:476)
2016-04-17T23:00:39.62+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.ObjectMapImpl.get(ObjectMapImpl.java:411)
...
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] Caused by:
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] com.ibm.websphere.objectgrid.ObjectGridRuntimeException: Metadata for typeId 97; domainHashCode=99 could not be found. The metadata may not have yet replicated from a foreign domain.
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.plugins.io.dataobject.values.ValueDataImpl.getObject(ValueDataImpl.java:391)
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.DiffMap.get(DiffMap.java:1061)
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.ObjectMapImpl.get(ObjectMapImpl.java:451)
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] ... 105 more
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] Caused by:
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] com.ibm.ws.objectgrid.MissingSerializationInfoException: Metadata for typeId 97; domainHashCode=99 could not be found. The metadata may not have yet replicated from a foreign domain.
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.SerializerFactory.getDescriptorFromID(SerializerFactory.java:610)
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.GenericClassSerializer.deserializeFieldsToObject(GenericClassSerializer.java:318)
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.javaStream.XDFObjectInputStreamV2Impl.defaultReadObject(XDFObjectInputStreamV2Impl.java:70)
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.javaStream.GenericJavaSerializer2.deserializeObject(GenericJavaSerializer2.java:242)
2016-04-17T23:00:39.72+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.javaStream.GenericJavaSerializer2.deserializeFieldToObject(GenericJavaSerializer2.java:269)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.GenericClassSerializer.deserializeFieldsToObject(GenericClassSerializer.java:307)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.GenericClassSerializer.deserializeObject(GenericClassSerializer.java:227)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.CheckTypeSerializer.deserializeObject(CheckTypeSerializer.java:82)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.GenericClassSerializer.deserializeFieldToObject(GenericClassSerializer.java:376)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.GenericClassSerializer.deserializeFieldsToObject(GenericClassSerializer.java:286)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.GenericClassSerializer.deserializeObject(GenericClassSerializer.java:227)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.CheckTypeSerializer.deserializeObject(CheckTypeSerializer.java:82)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.GenericClassSerializer.deserializeFieldToObject(GenericClassSerializer.java:376)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.GenericClassSerializer.deserializeFieldsToObject(GenericClassSerializer.java:286)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.GenericClassSerializer.deserializeObject(GenericClassSerializer.java:227)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.CheckTypeSerializer.deserializeObject(CheckTypeSerializer.java:82)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.serializers.collections.AbstractListSerializer.deserializeObject(AbstractListSerializer.java:223)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.xdf.XDFSerializerPlugin.inflateDataObject(XDFSerializerPlugin.java:363)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] at com.ibm.ws.objectgrid.plugins.io.dataobject.values.ValueDataImpl.getObject(ValueDataImpl.java:383)
2016-04-17T23:00:39.73+0200 [App/0] ERR [err] ... 107 more
Answer by JHF (152) | Jul 17, 2016 at 05:05 PM
We finally found the source of the exception com.ibm.ws.objectgrid.MissingSerializationInfoException: Metadata for typeId 97; domainHashCode=99 could not be found when serializing/de-serializing to/from IBM Data Cache in our Liberty Application.
And the cause of this exception is really nasty one and was hard to spot!
We recently migrated our IBM Liberty application from the JPA 2.0 feature (which uses OpenJPA) to the JPA 2.1 feature, which uses EclipseLink as the persistence layer now. After that we were experiencing the above mentioned exception for some of the objects we store in the Data Cache (ObjectGrid).
The problematic object to serialize/deserialize contains (among others) the following java.util.List field:
Simplified Example:
public class MyClass extends BaseClass implements Serializable {
...
private List<OtherSerializableClass> myList;
...
public MyClass(MyJPAEntity entity) {
...
myList = entity.getSomeElements();
...
}
...
}
The hard thing is, that the exception complaining about typeId 97; domainHashCode=99 doesn't give a clue about which class within the object hierarchy to serialize causes the problem. And the last thing we suspected is that the java.util.List is causing the problem. Well, java.util.List is just the interface, but it turns out that EclipseLink uses a org.eclipse.persistence.internal.indirection.jdk8.IndirectList for a @ElementCollection JPA entity field.
And it turned out that exactly this org.eclipse.persistence.internal.indirection.jdk8.IndirectList class is causing the serialization/deserialization issues with IBM Data Cache service on IBM Bluemix. If we convert it explicitely into an java.util.ArrayList for example, the problem is gone and serialization/deserialization works fine again.
Answer by 2H9U_Kenny_C (1) | Apr 18, 2016 at 02:36 PM
Can you please go to the VCAP environment and find which ecaas collective is hosting your app. You should see something like the following : ecaasXXX where XXX is the collective number to indicate which caching server is hosting your application.
Ecaas4 US or LON? Can you give us the full host name please? Thanks
Answer by Abelard Chow (121) | Apr 18, 2016 at 04:20 PM
Hi JHF,
There is no size limit for the values in a map, except the available memory resource allocated to the grid. But that number is much bigger than 8k.
On the other hand, we don't recommend store big objects in Data Cache. Data Cache is for caching and performance improvement purpose. Storing big objects in Data Cache will increase the data transfer time, which defeat the purpose of a caching solution.
Thanks
The values we want to store are a few hundred kbyte... Just the results of some expensive DB queries, that can be cached for a while. It's not like we want to store tens or hundreds of megabytes in a value.
ClassNotFoundException: com.ibm.ws.Transaction.TransactionManagerFactory 3 Answers
Get 500 error trying to insert into IBM Data Cache on Bluemix using POST REST API 1 Answer
How to use DataCache service on mobile 1 Answer
Data Cache Cleanup 1 Answer
Deploying app to Bluemix using the liberty builpack and Bluemix for Eclipse tools 5 Answers