mongodb 压缩——3.0+支持zlib和snappy
转自: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/
最新文章
- Array.splice()理解记忆
- 在Mac下配置php开发环境:Apache+php+MySql
- php上传文件大小限制修改
- iOS 宏(define)与常量(const)的正确使用
- startService()和bindService()区别
- Hibernate学习笔记--------4.查询
- (Problem 22)Names scores
- bash报错./mq.sh: line 15: warning: here-document at line 10 delimited by end-of-file (wanted `eof&#39;)
- JAVAEE——spring01:介绍、搭建、概念、配置详解、属性注入和应用到项目
- hi3531的时钟系统
- [BJOI2019]排兵布阵(动态规划)
- SpingBoot+Mybaits+Vue,更新学习
- 干货 | 教你如何监控 Java 线程池运行状态
- Navicat for Mysql导入mysql数据库脚本文件
- C#设计模式之十四命令模式(Command Pattern)【行为型】
- MongoDB操作(1)—MongoDB java驱动核心层次结构及操作流程
- SQL查询无限层级结构的所有下级,所有上级
- 在Win10 Anaconda中安装Tensorflow
- JVM内存区域详解(Eden Space、Survivor Space、Old Gen、Code Cache和Perm Gen)
- setting-mirrorO以及下载jar包流程简介
热门文章
- icecap录屏gif
- A New Change Problem
- Course
- jquery从tr获取td
- HDU1896Stones(优先队列)
- UVALive 4031	Integer Transmission(贪心 + DP)
- Java类锁和对象锁实践(good)
- messages exchanged between the client&#39;s and server&#39;s computers will never be lost, damaged, or received out of order. [1]
- ecb, 找不到button
- C# 经典入门15章 RadioButton和CheckBox