Error while saving the Document in Couchbase : Cannot cache data larger than 20971520 bytes

Hello All,

We are using couchbase (Couchbase Buckets connecting through Java Client) extensively for storing user documents across our multiple applications. From the looks of the error we are getting, exception is very straight forward wherein it says the document what we are trying to save is of more than 20MB which can not be saved in couchbase bucket. But our problem is:

  1. Document is not more than 20 MB
  2. Same document we are able to save in couchbase in system testing environment (facing the error scenario in UAT)

Below is the entire stack trace:

JBWEB000071: root cause java.lang.IllegalArgumentException: Cannot cache data larger than 20971520 bytes (you tried to cache a 27104356 byte object)
net.spy.memcached.CachedData.<init>(CachedData.java:55)
net.spy.memcached.transcoders.SerializingTranscoder.encode(SerializingTranscoder.java:135)
net.spy.memcached.MemcachedClient.asyncStore(MemcachedClient.java:284)
net.spy.memcached.MemcachedClient.set(MemcachedClient.java:745)
com.couchbase.client.CouchbaseClient.set(CouchbaseClient.java:1210)

We would like to understand, whether couchbase configuration/RAM usage/Number of buckets varies this result? Request for your suggestions in resolving this error.

If I understand correctly:

  • your document are smaller then 20MB, which size?
  • and you can save them into another Couchbase cluster (testing environment)

It is weird because the system says you are trying to save a 27Mb content…
Just wondering do you have by any change some code using for example the “append” or “prepend” operations?
I have seen in the past so dummy bugs related to some bad loop associated with these operations…

Can you give us more information about your environment:

  • Couchbase version and OS
  • Java SDK version ?
    -What are the differences between the testing environment and your production environment?

May be you can share with us some code and documents…