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 .

      1      

      2      

      3      

      4      

      5      

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

      1      

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.

      1      

      2      

      3      

      4      

      5      

{

'_id': ,

'name': ,

'value':

}

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

MongoDB 3.0 snappy vs zlib vs uncompressed

 

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.html














本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/bonelee/p/6289874.html,如需转载请自行联系原作者


相关文章
|
并行计算 Linux 测试技术
GPU实例使用--单实例上运行Linux桌面多开解决方案
客户前期使用的旧异构实例面临更新换代,新的推荐异构实例性能更强,客户的业务软件运行时,GPU使用率不高,需要探索多开方案,提高GPU使用率,提高实例性价比。
|
6月前
|
存储 算法 JavaScript
OAuth2协议与微信扫码登录实战
本文介绍了OAuth2协议及其在微信扫码登录中的应用实现。OAuth2是一种开放、安全的授权标准,支持授权码、密码等多种模式,其中授权码模式被微信扫码登录采用。文章详细解析了微信扫码登录流程:用户扫码授权→获取授权码→换取令牌→获取用户信息→完成登录。技术实现方面,使用JWT令牌解决认证服务与资源服务间的校验问题,并提供了完整的后端接口设计(包括获取授权URL、处理回调等)和前端测试页面代码。系统通过网关进行统一认证,各微服务自行处理授权,确保安全性的同时提高性能。整体方案实现了基于OAuth2协议的无缝第
1020 1
|
监控 网络协议 Linux
Gobuster目录/文件扫描工具
Gobuster 是用 Go 语言编写的高效命令行扫描工具,支持目录/文件暴力扫描、子域名枚举和虚拟主机发现。其多线程机制使扫描速度快,资源占用低,适合远程或云服务器使用。它具备灵活性,支持自定义字典、代理、HTTP 认证等功能,适用于敏感目录查找、资产管理、渗透测试等场景。此外,Gobuster 可通过安装在 Kali 或 Linux 系统上,快速执行各类扫描任务,是安全测试和自动化脚本的理想选择。
920 0
|
C# Android开发 iOS开发
2025年全面的.NET跨平台应用框架推荐
2025年全面的.NET跨平台应用框架推荐
962 23
|
数据库
【计算机三级数据库技术】第11章 数据库的故障管理--附思维导图
文章概述了数据库故障类型及其解决办法、数据库恢复技术、数据转储、日志文件的使用与格式、硬件容错方案(包括RAID技术和服务器容错技术)、以及数据库镜像与容灭策略。
581 2
|
存储 运维 安全
什么是日志审计系统?性价比较高的日志审计系统有哪些?
日志审计系统主要是通过对信息系统中的各种信息进行采集分析和存储管理的,通过日志统计和汇总等功能实现对信息系统日志的全面审计;规范的日志管理对企业是否合规的评判具有重要帮助。
273 0
什么是日志审计系统?性价比较高的日志审计系统有哪些?
|
人工智能 自然语言处理 供应链
想拥抱新智能?不妨看看这家高速增长企业的AI创新实践
想拥抱新智能?不妨看看这家高速增长企业的AI创新实践
|
NoSQL Unix MongoDB
【docker 】docker-compose 部署mongoDB
【docker 】docker-compose 部署mongoDB
781 1
DC-MOTOR直流电机的simulink建模与性能仿真
使用MATLAB2022a和Simulink构建的DC电机模型进行仿真,展示了电机在240V电枢电压和150V励磁绕组输入下的性能。仿真输出包括转速、电枢及励磁电流、电磁转矩随时间的变化。结果以图像形式呈现,揭示了电机在洛伦兹力和电磁感应定律作用下的工作原理,通过电流与磁场的交互转换电能为机械能。直流电机借助换向器维持稳定的电磁转矩,并遵循法拉第电磁感应定律和楞次定律。
|
存储 IDE 物联网
物联网生活平台使用8266远程控制的操作实例
物联网生活平台使用8266远程控制的操作实例
1171 0

热门文章

最新文章