I have a web application developed in ROR and used MongoDB as a database.
When the application and database are on the same server, the application loads faster and also the queries execute faster.
But when I move them on separate servers(separate database and application server), the application works as expected but the queries to database server take more than 5-7 minutes to give a response. I also tried to put those servers in the same region, but that doesn't improve anything.
These are some possible scenarios,
- Check if both the server are in same region eg. Asia Pacific(checked)
- Check if do we need to do some extra OS level configs for MongoDB to increase the size of virtual memory
- Check if mongoid.yml has some options to improve access
- Check for MongoDB documentation for other hints
Has anyone faced similar problem? If yes then how did you resolved it?