转自:https://scalegrid.io/blog/enabling-data-compression-in-mongodb-3-0/

MongoDB 3.0 with the wired tiger storage engine enables you to transparently compress the data stored in your database. This is a fairly exciting and useful feature that can be used to reduce the disk space usage of your fast growing data. By default wired tiger uses the ‘Snappy’ block compression engine for all the collections. You can turn off compression by default using the following options in the mongodb server config file .

storage:
engine: wiredTiger
wiredTiger:
collectionConfig:
blockCompressor: none

The compression algorithm can be specified at the collection level during cluster creation. Here is an example of creating a collection with ‘zlib’ compression

db.createCollection( "test", {storageEngine:{wiredTiger:{configString:'block_compressor=zlib'}}} );

MongoDB wiredtiger storage engine provides two options for compression – snappy and zlib. There is essentially a tradeoff between the extent of compression and the amount of CPU load to decompress. ‘Zlib’ achieves a lot more compression and is correspondingly less performant. ‘Snappy’ aims for ‘aims for very high speeds and reasonable compression’.

We ran some simple unscientific tests to measure the compression performance. We used one of data sets storing strings which we felt would compress well. Here is the basic structure of each document.

{
'_id': <ObjectID>,
'name': <Five character string>,
'value': <Random 1MB string>
}

We inserted about 5000 of these documents (about 5GB of data). The results were fairly impressive. Zlib achieves considerable amount of compression. Snappy also achieves a fair amount of compression with little or no load on the system.

  Zlib Snappy uncompressed
Data size (MB) 5000.5 5000.5 5000.5
Storage size (MB) 19.62 254.37 5019

As always you need to run some tests to understand the performance gains for your data set.  Here are some more detailed benchmark studies on compression performance and tradeoffs

http://www.mongodb.com/blog/post/new-compression-options-mongodb-30
http://www.acmebenchmarking.com/2015/02/mongodb-v30-compression-benchmarks.htmlhttps://comerford.cc/2015/02/04/mongodb-3-0-testing-compression/

mongodb 压缩——3.0+支持zlib和snappy的更多相关文章

  1. 饼干是这样压缩的——PHP使用zlib扩展实现页面GZIP压缩输出

    饼干是这样压缩的——PHP使用zlib扩展实现页面GZIP压缩输出 GZIP(GNU-ZIP)是一种压缩技术.经过GZIP压缩后页面大小可以变为原来的30%甚至更小.这样用户浏览的时候就会感觉很爽很愉 ...

  2. hadoop对于压缩文件的支持及算法优缺点

    hadoop对于压缩文件的支持及算法优缺点   hadoop对于压缩格式的是透明识别,我们的MapReduce任务的执行是透明的,hadoop能够自动为我们 将压缩的文件解压,而不用我们去关心. 如果 ...

  3. C#5.0支持的await格式

    C#5.0支持的await格式 C#5.0引入了编译器支持的 async 和 await 关键字,这就为开发者提供了使用同步思想写异步代码的方便. 但是有些传统函数仅提供了异步回调实现,如何对其封装, ...

  4. WebStorm 7.0 支持更多的Web技术

    JetBrains刚刚发布了WebStorm 7.0 GA,支持EJS.Mustache.Handlebars.Web组件.Stylus.Karma.Istanbul.Compass,并增强了很多功能 ...

  5. hadoop对于压缩文件的支持

    转载:https://www.cnblogs.com/ggjucheng/archive/2012/04/22/2465580.html hadoop对于压缩格式的是透明识别,我们的MapReduce ...

  6. 干货来袭:Redis5.0支持的新功能说明

    Redis5.0支持的新特性说明 本文内容来自华为云帮助中心 华为云DCS的Redis5.x版本继承了4.x版本的所有功能增强以及新的命令,同时还兼容开源Redis5.x版本的新增特性. Stream ...

  7. NoSQL Manager for MongoDB 4.6.0.3 带key

    NoSQL Manager for MongoDB 4.6.0.3 是一个Windows平台的MongoDB高级管理工具.请低调使用. 博客园文件一次最大不超过10M. 官方安装包: mongodbm ...

  8. mongodb压缩——snappy、zlib块压缩,btree索引前缀压缩

    MongoDB 3.0 WiredTiger Compression and Performance One of the most exciting developments over the li ...

  9. 跨平台的zip文件压缩处理,支持压缩解压文件夹

    根据minizip改写的模块,需要zlib支持 输出的接口: #define RG_ZIP_FILE_REPLACE 0 #define RG_ZIP_FILE_APPEND 1 //压缩文件夹目录, ...

随机推荐

  1. springmvc+mybatis下载项目自带模板

    1.首先如果要获取javaweb项目中的文件在哪,用到的代码:request.getSession().getServletContext().getRealPath("/WEB-INF/d ...

  2. Hibernate 系列教程15-一级缓存

    Product public class Product { private Long id; private String name; Product.hbm.xml <class name= ...

  3. dede修改templets模板文件夹后,出现“无法在这个位置找到: ”错误的解决办法

    修改templets模板文件夹的方法: 首先找到系统配置文件common.inc.php,此文件存放在Include目录下,打开common.inc.php来修改默认模板目录templets, 查找: ...

  4. 求N以内与N互质的数的和

    题目连接 /* 求所有小于N且与N不互质的数的和. 若:gcd(n,m)=1,那么gcd(n,n-m)=1; sum(n)=phi(n)*n/2; //sum(n)为小于n的所有与n互质的数的和 // ...

  5. 两个byte[]拼接

    //两个byte[]拼接 public byte[] copybyte(byte[] a, byte[] b, byte[] c, byte[] d, byte[] e)///,byte[] f,by ...

  6. 2017 ZSTU寒假排位赛 #1

    题目链接:https://vjudge.net/contest/147102#overview. A题:给出一堆的点,要找出两条垂直的直线,一条与x轴呈45度.-->使得所有的点到任意一条直线的 ...

  7. JavaScript判断数组是否存在key

    JS中复合数组associative array和对象是等同的,判断一个key是否存在于数组中(或对象是否包含某个属性),不能使用ary[key] == undefined,因为可能存在ary = { ...

  8. div使用

    div style常用属性 一.常用属性: 1.Height:设置DIV的高度. 2.Width:设置DIV的宽度. 例: <div style="width:200px;height ...

  9. angular Jsonp的坑

    angular 为了解决跨域问题 一些第三方接口会提供jsonp来调用,需要使用callback=JSON_CALLBACK来处理 这个时候问题来了,有些借口是不支持callback里面带有点语法的, ...

  10. 10、end关键字和Fibonacci series: 斐波纳契数列

    # Fibonacci series: 斐波纳契数列 # 两个元素的总和确定了下一个数 a, b = 0, 1 #复合赋值表达式,a,b同时赋值0和1 while b < 10: print(b ...