Rails 3 进程的内存占用量应随时间增长多少?
环境:Rails 3.0.4、Passenger/Nginx
当我查看生产切片上“top”的输出时,一个新实例开始时约为 110MB,并随着时间的推移(几天)缓慢增长到 200MB 左右。由于缓存了各种对象,这是预期的吗?或者更有可能是某处内存泄漏。
我试图消除所有常见的问题:用“find_each”替换任何“find.all”,仅加载关联中必要的列等。
我很好奇这是否是人们所看到的典型问题他们自己的环境,即内存占用量增加了一倍。
Environment: Rails 3.0.4, Passenger/Nginx
When I look at the output of 'top' on my production slice, a fresh instance starts around 110MB and grows slowly over time (a few days) to around 200MB. Is that to be expected as various objects are cached? Or is it more likely a memory leak somewhere.
I've tried to eliminate all the usual problems: have replaced any 'find.all' with 'find_each', only load the necessary columns in associations etc. etc.
I'm mostly curious whether this is typical of what people are seeing in their own environments i.e. a 2x doubling in the memory footprint.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样的持续增长听起来像是内存泄漏。
一个简单的解决方法是使用 MaxRequests 指令每 n 个请求滚动您的 Passenger 工作人员。
Continuous growth like that sounds like a memory leak.
An easy work around is to roll your Passenger workers every n requests using the MaxRequests directive.