Enabling Compression on NodeJS SDK



How does the NodeJS SDK indicate to the server that it’s capable or receiving and sending compressed documents? Can I use Google’s NodJS snappy module to compress data before inserting it in the bucket?
I am running Couchbase 5.5 Beta version and have the latest 2.4.5 NodeJS SDK.



Hey @satish.anupindi,

Using the latest beta release of the Node.js SDK, compression will be on by default. Any document which is worth compressing (greater than 32 bytes and greater than 83% compression). You can find the details of that logic here: https://github.com/couchbaselabs/sdk-rfcs/blob/master/rfc/0030-compression.md

Cheers, Brett


Hi Brett,

Thanks for the link. It’s not totally clear though if the application has to do the snappy compression separately before the insertion, or if the SDK would do it by default. Can you let me know what the process is for the Nodejs driver? Again, should I use another module (like the snappy module) to compress/decompress the data ? How does the libcouchbase behave?



Hey @satish.anupindi,

The compression is handled entirely within the SDK, there is no need to perform compression on the application-side.

Cheers, Brett