Question

Does anyone have advice to offer regarding using a hosted DB solution, specifically MongoDB, with a web server. Specifically:

Is the latency acceptable? How do I co-locate (geographically via Azure, etc) the web server with the hosted DB server to reduce latency? Is there a way to mitigate the bandwidth cost from making call from the web server to a hosted DB server (via private IP or other?) Are there any web hosting solutions that offer the package (App hosting & hosted DB)

Was it helpful?

Solution

I just looked at MongoHQ - I see no way to specify a specific data center. Even if you could (maybe I missed that detail), those are AWS regions, which don't live in the same datacenters as Windows Azure. You'd have to take a best guess about which AWS region is closest to, say, Windows Azure's North Central datacenter.

If you want to mitigate bandwidth/latency, you could host MongoDB in a worker role, or even in the Web Role hosting your website, which would reduce monthly instance cost. Just remember that, if you host in Windows Azure, you need to be prepared to scale, so standalone MongoDB databases won't be sufficient. Well, you could place MongoDB in its own worker role, store your database in a Cloud Drive (in blob storage) for durability, and ensure you never raised the instance count beyond 1. With only one instance running, you could have periodic outages when the worker role gets rebooted for security patch installation, or the underlying hardware crashes (you'd be back up in a very short time, but you would have periodic database offline periods).

I [demonstrated using MongoDB replicasets][1] at the MongoSV conference. The only issue is that you'd need 3 instances to accomplish this. If you typically run 3 instances of your web role, you could piggyback on those instances. Otherwise, you'd need to manage this configuration in a separate set of worker roles. Compared to MongoHQ, your monthly cost will go up (but your bandwidth won't be charged between your web role and MongoDB, you'd have extremely low latency, and you'd easily be able to scale your database up to 1TB, going beyond the MongoHQ 2GB limit.

One more thing: If you have several websites using MongoDB, you could create a single MongoDB hosted service in Windows Azure (as described above), then access it from all of your website deployments. This would give you economy of scale, reducing cost as you move to a multi-tenant MongoDB database.

EDIT 6/16/2013 This is a very old, outdated answer. A few updates:

  • Both MongoHQ and MongoLab offer hosted MongoDB. MongoHQ has both free (512MB) and shared-paid offerings in East US data center. MongoLab has free (500MB and shared-paid offerings in both East US and West US data centers.
  • Windows Azure Virtual Machines are now in production, allowing you to easily deploy dedicated standalone or replica-set deployments in any data center (as well as configuring ACLs for endpoint security).

EDIT 7/15/2013 MongoLab now has an 8GB Replica Set offering in production. I blogged about it here which also has a link to MongoLab's post.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top