转自: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/

最新文章

  1. Array.splice()理解记忆
  2. 在Mac下配置php开发环境:Apache+php+MySql
  3. php上传文件大小限制修改
  4. iOS 宏(define)与常量(const)的正确使用
  5. startService()和bindService()区别
  6. Hibernate学习笔记--------4.查询
  7. (Problem 22)Names scores
  8. bash报错./mq.sh: line 15: warning: here-document at line 10 delimited by end-of-file (wanted `eof&#39;)
  9. JAVAEE——spring01:介绍、搭建、概念、配置详解、属性注入和应用到项目
  10. hi3531的时钟系统
  11. [BJOI2019]排兵布阵(动态规划)
  12. SpingBoot+Mybaits+Vue,更新学习
  13. 干货 | 教你如何监控 Java 线程池运行状态
  14. Navicat for Mysql导入mysql数据库脚本文件
  15. C#设计模式之十四命令模式(Command Pattern)【行为型】
  16. MongoDB操作(1)—MongoDB java驱动核心层次结构及操作流程
  17. SQL查询无限层级结构的所有下级,所有上级
  18. 在Win10 Anaconda中安装Tensorflow
  19. JVM内存区域详解(Eden Space、Survivor Space、Old Gen、Code Cache和Perm Gen)
  20. setting-mirrorO以及下载jar包流程简介

热门文章

  1. icecap录屏gif
  2. A New Change Problem
  3. Course
  4. jquery从tr获取td
  5. HDU1896Stones(优先队列)
  6. UVALive 4031 Integer Transmission(贪心 + DP)
  7. Java类锁和对象锁实践(good)
  8. messages exchanged between the client&#39;s and server&#39;s computers will never be lost, damaged, or received out of order. [1]
  9. ecb, 找不到button
  10. C# 经典入门15章 RadioButton和CheckBox