Compression of JSON documents in Couchbase

1.4k views Asked by At

In our application we are storing JSON documents in Couchbase which have a structure something like this:

{ "type": "sometype", "timestamp": 1458999, "data": "{\"key1\":\"val1\", \"key2\":\"val2\"}" }

The value of the data field is a stringified json document which is quite huge, around 5-10MB of text. We have put it as a string(stringified json) instead of json subdocument so that it does not suffer serialisation/deserialisation while moving through different layers of the application since we need to just put and fetch it raw and supply to the client from the application.

The concern is would couchbase compress the stringified json while writing to disk. I am not sure whether couchbase compression is a kind of text compression or is it some kind of compression which can compress only json documents?

1

There are 1 answers

0
DaveR On BEST ANSWER

Yes, Couchbase will compress the document when storing it on disk.

When documents are stored on disk they are simply treated as a array of bytes which is compressed using the snappy compression algorithm.