I am on 1GB Linode (VPS) with MongoDB + Apache.
MongoDB has 1.5M+ records. Multiple instances of the script , over which the service entirely depends cause 50+ active connections and around 50 queries per second.
My free -m
output
total used free shared buffers cached
Mem: 995 974 21 0 4 823
-/+ buffers/cache: 145 849
Swap: 511 79 432
Now, the script need ~17MB for each instance (already optimized) and as I said multiple instances of it run. There a huge difference in the free cache memory ( 849 MB! ) and actual free memory ( 21 MB ). I cannot run instances of the PHP script, I get an error that memory allocation fails.
Most of the memory is used by MongoDB and it also causes high CPU usage, 250+ %
. This is useless, I could run even many instances of my PHP script within 849 MB. I want to know if it will be better for me to host my MongoDB remotely ( I prefer MongoHQ ). They have a $15/month plan which is fair for me. I could downgrade to 768 MB linode which will be enough without MonogDB running on it.
But, what are cons of using a remotely hosted database? 50+ connections and ~50 queries per second? There will bandwidth issues next.
Any help is greatly appreciated.