减少Redmine的内存使用 - 唾手可得的成果
我正在使用 Passenger 和 Nginx 运行 Redmine 实例。由于数据库中只有少数问题,Redmine 消耗了超过 80mb 的 RAM。
任何人都可以分享减少Redmine 内存使用的技巧吗? Redmine实例由3个人使用,我愿意牺牲速度。
I am running a Redmine instance with Passenger and Nginx. With only a handful of issues in the database, Redmine consumes over 80mb of RAM.
Can anyone share tips for reducing Redmine's memory usage. The Redmine instance is used by 3 people and I am willing to sacrifice on speed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有真正的、容易实现的成果。如果有的话,我们已经默认包含并激活它们。
80 MB RSS(相对于虚拟大小可能更大)实际上相当不错。在正常操作中,每个进程将使用 70 到 120 MB RSS(取决于部署模型,乘客的用量相当少)。
正如 andrea 所建议的,当您使用 REE(Ruby Enterprise Edition,也是免费的)时,您可以将总体内存占用量减少大约三分之一。但只有当您运行多个进程(每个进程都需要上述内存)时才能实现这种节省。 REE 通过优化 Ruby 的一种称为“写入时复制”的技术来实现这种节省,从而使额外的应用程序进程占用更少的内存。
所以很抱歉,您的(假设的)128 MB vServer 可能不够用。对于小型安装,您也许可以将最小安装压缩为 256MB,但在 512MB(包括数据库)时,它才开始变得非常痛苦。
这是因为 Rails 应用程序的工作方式与 PHP 等应用程序不同。它们需要一个正在运行的应用程序服务器实例。该实例通常能够一次回答一个请求,始终使用大约相同数量的内存。因此,您的内存消耗大致相当于您运行的应用程序进程的数量,与实际负载无关。但如果你正确地调整你的系统,你可以从一个进程中获得相当多的请求。
There are not really and low hanging fruits. And if there were, we would've already included and activated them by default.
80 MB RSS (as opposed to virtual size which can be much more) is actually pretty good. In normal operation, it will use between 70 and 120 MB RSS per process (depending on the deployment model, rather few on passenger).
As andrea suggested, you can reduce your overall memory footprint by about one third when you use REE (Ruby Enterprise Edition, which is also free). But this saving can only achieved when you run more than one process (each requiring the above memory). REE achieves this saving by optimizing Ruby for a technique called Copy on Write, so that additional application processes take less memory.
So I'm sorry, your (hypothetical) 128 MB vServer will probably not suffice. For a small installation, you might be able to squeeze a minimal installation into 256MB, but it only starts to be anything but a complete pain in the ass at 512 MB (including database).
That's because of how Rails applications work in contrast to things like PHP. They require a running application server instance. That instance is typically able to answer one request at a time, using about the same amount of memory all the time. So your memory consumption is roughly equivalent to the number of application processes you run, independent of actual load. But if you tune your system properly, you can get quite a number of reqs/s out of one process.
可能我回复得很晚,但我陷入了同样的问题,我找到了一个优化 ruby/rails 内存使用的链接,这对我有用
http://community.webfaction.com/questions/2476/how-can-i-reduce -my-rubyrails-memory-usage-when-running-redmine
这可能对其他人有帮助。
May be i am replying very late but i got stuck in the same issue and I found a link to optimize ruby/rails memory usage, which works for me
http://community.webfaction.com/questions/2476/how-can-i-reduce-my-rubyrails-memory-usage-when-running-redmine
It may be helpful for someone else.