mongo db --smallfiles切换缺点 [英] mongo db --smallfiles switch drawbacks

查看:98
本文介绍了mongo db --smallfiles切换缺点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的新项目中使用mongodb.问题是,mongo使用预分配文件:

I want to use mongodb for my new project. the problem is, mongo use pre-alocate files :

每个数据文件都已预先分配为特定大小. (这样做是为了防止文件系统碎片,其中包括其他原因.)数据库的第一个文件名是.0,然后是.1,依此类推..0将是64MB,.1 128MB等,最大为2GB.一旦文件大小达到2GB,每个后续文件也将为2GB.因此,如果当前存在的最后一个数据文件为1GB,那么如果该文件是最近创建的,则该文件可能为90%空.

Each datafile is preallocated to a particular size. (This is done to prevent file system fragmentation, among other reasons.) The first filename for a database is .0, then .1, etc. .0 will be 64MB, .1 128MB, et cetera, up to 2GB. Once the files reach 2GB in size, each successive file is also 2GB. Thus, if the last datafile present is, say, 1GB, that file might be 90% empty if it was recently created.

从这里

: http://www.mongodb.org/display/DOCS /Excessive + Disk + Space

通常会有很多2GB的文件,里面什么也没有.有一个--smallfiles开关,可以将文件限制为512MB

And its normal to have many 2GB files with nothing in it. there is a --smallfiles switch, to limit this files to 512MB

-smallfiles =>使用较小的初始文件大小(16MB)和最大大小(512MB)

--smallfiles => Use a smaller initial file size (16MB) and maximum size (512MB)

我想知道使用smallfiles对生产有好处吗?还有它的缺点.

I want to know using smallfiles is good for production? and what's its drawbacks.

没有noprealloc开关,但在生产中效果不佳.但是没有关于小文件的提示.

there is noprealloc switch but its not good in production. but there is no note about smallfiles.

推荐答案

如果您要创建一堆数据库,通常只使用小文件;如果仅使用少数几个数据库进行操作,那将不会节省您的时间足以惹上麻烦.

You would usually only use smallfiles if you are creating a whole bunch of databases, if you're only operating out of a few databases it doesn't save you enough to mess with.

对于拥有许多DBS(实际上受益于小文件)的客户,我们还没有看到任何性能问题.但是,与其他安装相比,它们的活动水平通常较低.根据Mongo的操作,执行某些操作可能会稍慢一些,但我认为您永远不会注意到.

We haven't seen any performance problems with it for customers that have many, many DBS (and actually benefit from small files). Their activity level is normally somewhat low compared to other installs, though. Based on what Mongo is doing, it might be slightly slower to do some operations but I don't think you'll ever notice.

这篇关于mongo db --smallfiles切换缺点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆