Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

If you are going to run the database remotely, run it at the same network segment than your app servers, or at least the same datacenter.

Even if you get low(ish) latency like < 10 ms, that can impact on your queries depending on the type of data load you have.
Also you end adding another point of failure to your system, communication between your application servers and database servers may fail. MongoDB doesn't use any encryption on it's protocol and your data will be running clear between god knows how many hops unless you tunnel it some way. And, as you pointed, there's the bandwidth use. Overall I suggest you to get another node to run your DB, but at the same place of your application server.

share|improve this answer
I'm planning the same thing, running database server on the same datacenter. Linodes do not charge for transfer in private LAN, so bandwidth isn't problem anymore. Can you explain the point about failure a bit more? –  KPL Mar 31 '11 at 5:33
@KPL Suppose that you have your DB on somewhere else than Linode, and that their link to the internet fail or degrade too much. You end with your application server up but effectively not working because the lack of communication with the DB servers. –  coredump Mar 31 '11 at 13:37
Oh, got it :) –  KPL Mar 31 '11 at 15:46
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.