Ruby on Rails 服务器长时间随机挂起/滞后
我有一个程序可以让一个简单的 Ruby on Rails 服务器上线。服务器用于在同一网络上的计算机之间进行通信和整理数据。我没有对 Ruby 做任何花哨的事情。我只是使用脚手架生成了 3 个模型,仅此而已。问题是,过了一段时间(计算机和服务器之间的许多 HTTP 请求 ~= 10 分钟),服务器开始滞后并永远挂起,迫使我终止服务器脚本并重新启动它。有什么帮助/建议吗?
I have a program that makes a simple Ruby on Rails server go live. The server is used to communicate and collate data between computers on the same network. I have not done anything fancy to the Ruby stuff. I have simply used scaffold to generate 3 models and that is it. The problem is that after a while (many HTTP requests between the computers and the server ~= 10 minutes) the server starts to lag and just hangs forever, forcing me to kill the server script and restarting it. Any help/suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否在开发模式下运行或已关闭类缓存?
在开发模式下运行的系统开始遇到一些问题的情况并不罕见。当您正在工作时,这没什么大不了的,只需重新启动开发服务器即可,但一旦您拥有了一个可以工作的系统,这可能会非常烦人。
关键问题在 config/environments/development.rb 中:
这不仅会减慢响应时间,而且随着时间的推移,可能会导致缓慢的内存泄漏和不可预测的行为。
Are you running in development mode or have the class caching turned off?
It is not uncommon to find systems running in development mode to start hitting some issues. Not such a big deal when you are working and can simply restart the dev server, but can be very annoying once you have a working system.
The key issue is in config/environments/development.rb:
Not only does this slow down response time, but it can lead to slow memory leaks and unpredictable behaviour over time.