Katie
Katie

Reputation: 305

How can I compress the JSON content from CouchDB's HTTP responses?

I am making a lot of _all_docs requests to CouchDB's HTTP server. One thing I'm realizing is that the data is not compressed, so this results in large file sizes. Even by using limit and skip, the files can sometimes be 10MB each. That doesn't cause any problems for my app, but it does mean that if a connection to our CouchDB server is slower than our office connection, it will go rather slow.

Is there any way I can enable HTTP compression? I am not referring to attachments - just the JSON files.

Also, I am using Windows Server - not Linux/Unix.

Thanks!

Upvotes: 4

Views: 814

Answers (1)

Dominic Barnes
Dominic Barnes

Reputation: 28439

There is no support in CouchDB directly, but it has been requested. (so voice your support there if you want this included)

That being said, there are a number of options you have. First, you can set up nginx as a reverse proxy and allow it to compress (and possibly cache) responses for you. After a quick search, I found this plugin that you install in CouchDB directly.

Another thing is that CouchDB does a pretty solid job of allowing clients to cache reliably. You can leverage this to prevent repeatedly downloading the same large resource.

Upvotes: 5

Related Questions