Ejabberd 内存消耗(或泄漏?)
我在我们的服务器上使用 ejabberd + mochiweb。 ejabberd 和 mochiweb 运行的时间越长,消耗的内存就越多(昨晚它消耗了 35% 的内存。现在略高于 50%)。我认为这只是一个 mnesia 垃圾收集问题 - 所以我安装了 Erlang R13B3 并重新启动了 ejabberd。但这并没有解决问题。
所以我现在注意到,在略高于全部内存消耗的 50% 时,看起来 ejabberd 开始“释放”内存并保持在 50% 左右。这是正常的吗?大约 50% 是 ejabberd 的阈值,所以当它达到它时,它会说,“嘿,是时候真正释放一些内存了……”,也许它会保留其余部分以便快速访问(例如缓存 mnesia?)
我很欣赏输入。谢谢!
I'm using ejabberd + mochiweb on our server. The longer I keep ejabberd and mochiweb running, the more memory is consumed (last night it was consuming 35% of memory. right now it's a bit above 50%). I thought this was just a mnesia garbage collection issue - so I installed Erlang R13B3 and restarted ejabberd. This didn't fix it though.
So I'm noticing now that at a bit above 50% of full memory consumption, it looks like ejabberd's starting to "let go" of memory and stay at around 50%. Is this normal? Is ~50% a threshold for ejabberd, so that when it reaches it it says, "hey time to actually let some memory go..." and maybe it keeps the rest around for quick access (like caching mnesia?)
I appreciate any input. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
时不时地在 shell 中运行
erlang:memory().
。您还可以尝试一下erlang:system_info(Type).
和allocated_areas
和allocator
。这些应该会提示您哪种类型的内存正在泄漏。
您还可以设置 memsup 来警告您进程分配过多内存。
Run
erlang:memory().
in your shell every now and then. You can also giveerlang:system_info(Type).
withallocated_areas
andallocator
a try.These should give you a hint on what kind of memory is leaking.
You can also setup memsup to warn you about processes allocating too much memory.
事实证明,没有内存泄漏(耶!)Ejabberd 仅占用 << 40MB。当我看到 EngineYard 上的使用情况图时,我终于看到了曙光——实际仅使用了 288MB,正在缓冲 550MB,正在缓存 175MB。我的 ejabberd 服务器每 2.5 秒从每个客户端更新一次,这可以解释为什么有这么多的内容被缓冲/缓存。
感谢您的帮助。
Turns out, there is no memory leak (yay!) Ejabberd is taking up only < 40MB. Finally I saw the light when I saw the Usage Graphs on EngineYard - only 288MB is actually being used, 550MB is being buffered, and 175MB is being cached. My ejabberd server an update every 2.5 seconds from each client so that may explain why so much is being buffered/cached.
Thanks for all of your help.
Erlang 进程中新创建的原子永远不会被垃圾收集。当进程由随机创建原子名称的算法注册时,这可能是一个问题。随机创建的字符串。
Newly created atoms in erlang processes get never garbage collected. This might be an issue when processes are registered by an algorith that creates atom names from random eg. randomly created strings.