更新:这是在Meteor v0.4(2012)之后修复的.出于历史目的:
我正在微EC2 Ubuntu 11.10实例(8GiB)上测试Meteor,并在安装它并登录后运行df命令以查看核心文件消耗了多少内存(大约10%):
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 8256952 782068 7055456 10% /
udev 295276 4 295272 1% /dev
tmpfs 121248 148 121100 1% /run
none 5120 0 5120 0% /run/lock
none 303112 0 303112 0% /run/shm
Run Code Online (Sandbox Code Playgroud)
在安装NodeJS和NPM后,我再次运行df以确定消耗了多少空间并且看起来不多(额外的2%):
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 8256952 919444 6918080 12% /
udev 295276 4 295272 1% /dev
tmpfs 121248 148 121100 1% /run
none 5120 0 5120 0% /run/lock
none 303112 0 303112 0% /run/shm
Run Code Online (Sandbox Code Playgroud)
然后我开始安装MongoDB,并且正如预期的那样,这需要相当多的内存(59%的磁盘空间在使用中):
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 8256952 4585884 3251640 59% /
udev 295276 4 295272 1% /dev
tmpfs 121248 148 121100 1% /run
none 5120 0 5120 0% /run/lock
none 303112 0 303112 0% /run/shm
Run Code Online (Sandbox Code Playgroud)
然而,在安装流星,curl install.meteor.com | /bin/sh从他们的网站创建示例MYAPP meteor create myapp并运行MYAPP cd myapp与meteor我成功看到了在浏览器中显示的"Hello World"(ETC),在终端侧,我看到这个应用程序:
[[[[[ ~/myapp ]]]]]
Initializing mongo database... this may take a moment.
Running on: http://localhost:3000/
^C
Run Code Online (Sandbox Code Playgroud)
关闭服务器后,我df最后一次检查,并惊讶地发现磁盘已满!?
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 8256952 7778748 58776 100% /
udev 295276 4 295272 1% /dev
tmpfs 121248 148 121100 1% /run
none 5120 0 5120 0% /run/lock
none 303112 0 303112 0% /run/shm
Run Code Online (Sandbox Code Playgroud)
我的问题是:为什么Meteor(MongoDB?)为一个非常简单的应用程序占用~3GiB磁盘空间?
有没有办法减少磁盘空间的消耗?
谢谢!
n1m*_*mmy 10
这是在流星的开发分支上修复的,将在下一个版本中.
https://github.com/meteor/meteor/commit/6042b91a9ca75fc47b2477e613da093f1c9b943e
似乎mongo默认使用大文件,必须告诉不要.我想可以理解为mongo的正常使用情况.通过预先分配大文件,他们可以在某些情况下提高性能.