Compressing (Gzip or Deflate) Shows, Lists and vie

2019-06-21 03:43发布

It seems that couchdb automatically compress all its _attachments when requested with the correct header. But unfortunately this doesn't happen for views, show or lists.

Is there any way to achieve a compression before returning the result to the client?

Is using a third party library like deflatejs (didn't test it yet) a bad approach?

Thanks

2条回答
贼婆χ
2楼-- · 2019-06-21 04:00

The Couchbase distribution of CouchDB (Couchbase Single Server) supports Google's snappy compression for the JSON files on disk. I believe the same goes for the views, but I'll have to defer to someone better qualified.

查看更多
太酷不给撩
3楼-- · 2019-06-21 04:07

You can certainly use js-deflate in show and list functions, but you cannot do it in view functions. I also suspect it would be inefficient (just a guess, test it if you want numbers).

Until CouchDB does not support gzip encoding, the easiest solution is to put a reverse proxy in front of CouchDB to do the compression. For example you can use nginx with the HttpGzipModule.

查看更多
登录 后发表回答