Jruby、垃圾收集器、Redis
我有一个 Jruby On Rails 应用程序,它使用多个 WS 来收集数据。应用程序处理数据并将其显示给用户,用户进行更改,然后发送回 WS。
这里的问题是我将所有内容存储在使用内存存储的缓存(基于会话)中。但有时,没有明确的原因(至少对我来说),会出现此错误:
ActionView::Template::Error (GC overhead limit exceeded)
我阅读了我能找到的有关它的内容,显然这意味着垃圾收集器花费了很多时间来尝试释放内存,并且没有真正的进展正在朝着那个方向进行。我的猜测是,由于所有内容都像内存一样存储在缓存中,因此 GC 会尝试释放它,但无法做到这一点并抛出此错误。
所以这是问题。
- 我该如何解决这个问题?
- 如果我从内存存储切换到Redis,如果我的假设是正确的,这个问题还会出现吗?
- GC会尝试释放Redis的内存区域吗? (可能是一个愚蠢的问题,但是......尽管如此,请帮忙:))
谢谢。
I have an Jruby On Rails app which uses several WS's to gather data. The app processes the data displays it to the user, the user make his changes and then is sent back to the WS.
The problem here is that i store everything in the cache (session based) which is using memory store. But from time to time with no clear reason (for me at least) this error pops up:
ActionView::Template::Error (GC overhead limit exceeded)
I read what I could find about it and apparently this means that the Garbage Collector spends to much time in trying to free memory and no real progress is being made in that direction. My guess is that since everything is stored cache like into memory the GC tries to free it and can't do it and throws this error.
So here are the questions.
- How can I get around this ?
- If I switch from memory store to Redis, if my assumptions are correct, will this problem still appear.
- Will the GC try to free Redis's memory area ? (Might be a stupid question but ... please help nonetheless :) )
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Redis 是一个单独的进程,因此您的应用程序垃圾收集器不会触及它。但是,Redis 可能会耗尽应用程序可用的所有内存,或者您实际上使用的是进程内存缓存而不是 Redis(这是一种不同类型的内存存储)。
Redis is a separate process, so your app garbage collector won't touch it. However, it is possible that redis is using up all the memory that would otherwise be available for the app, or that you are actually using a process memory cache and not redis, which is a different type of memory store.