mongo + passenger: right way to reconnect to database from within rails? how to ensure optimal mongo performance?

自作多情 提交于 2019-12-11 21:08:36

问题


we're on rails 3.2.12, passenger + nginx (1.0.10), mongo 2.2, and mongomapper 0.12.

we were told that passenger and mongo don't work well together unless there is a configuration set to ensure speedy database connections (or reconnections).

however, one person advised us to use the code here: http://pastie.org/572282. then we found this post on stackoverflow (mongoDB, passenger and performance issues with phusion passenger), which is different.

which is the right way to ensure optimal mongo performance with passenger (and nginx)?


回答1:


The method to handle this changed between Mongomapper versions.

The correct way now is to use Mongomapper's convenience method in your initializer:

MongoMapper.connection.handle_passenger_forking

See the source on Github for implementation details.



来源:https://stackoverflow.com/questions/17098660/mongo-passenger-right-way-to-reconnect-to-database-from-within-rails-how-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!