Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I know some people will say this question does not belong here but i didnt find a better place on the internet to ask this. Please migrate to an appropriate place if you think it should be. I am using MongoDB to store product data. The text data(product names,categories,attributes) account for about 30 GB. The images account for about 200 GB. I am paying 184 USD for a quad core processor and 8GB Ram and 500 GB HDD dedicated server(from SingleHop). Is this setup ok for a medium traffic site(5-7K visitors a day ). I have heard that MongoDB best works when it is sharded(because of the global read write lock) but i have never worked with clusters. I have always worked with VPSs. This is my first time with a Dedicated server. Please advise me about the setup and the costs too. I live in India and expect most of my visitors from India.

Thanks.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

There really is no "ideal" environment and cost for running MongoDB (or any other database for that matter). There will be very cheap solutions that will give you enough space, but not enough RAM, there will be middle range options where you have enough RAM most of the time but at busier periods you exceed the memory limitations and the disk is too slow to cope with the increased page fault activity.

As always, it will be a trade of between what you can afford and what is best. In terms of general recommendations:

The cores and space will matter less than your available RAM and whether or not you can keep your working data set (active data plus indexes) in RAM - that is the key to performance. You won't really be able to tell until you start with real traffic, but if you have decent testing you should be able to estimate it.

I would recommend using MMS to track the stats, it's free and it includes a memory graph that will track your resident memory usage and many other things.

FYI - there is no global read lock and as of 2.2 (release candidate is up for testing as of writing this), the global write lock has been replaced by a database level lock. Have a look at the relevant concurrency presentations for an in-depth discussion on the 10gen website.

Another thing to make sure of is that you have more than one MongoDB instance, it is highly recommended that you run a replica set (primary, secondary, arbiter minimum) and not a single instance.

Sharding can be used to help scale out horizontally though - that is correct, it allows you to add more resources to your cluster without having to increase the resources available on a particular host. However, it is not really correct to say that MongoDB runs "best" when sharded - sharding has overheads (you need more servers to run the config DB, mongos processes etc.).

MongoDB runs best when your working set can fit in RAM and your disk subsystems are fast enough to keep up with the amount of data you want to write to disk. Whether than requires a single replica set or a sharded environment will very much depend on how you use it.

share|improve this answer
    
version 2.2 is the development release and because i am new to mongo i am using version 2.0.6 which is stable i know about replication but I have not done it. I was thinking of renting 3 VPS and then make one primary and two secondary. Is this setup OK –  lovesh Jul 26 '12 at 9:56
1  
Yes, the 3 server approach would be fairly standard. A couple of caveats - make sure each one is identical in terms of spec (any secondary can become primary) and prioritize RAM first over other needs. If you like, you can use the minimum 1 x Primary, 1 x Secondary, 1 x Arbiter approach also - the Arbiter has very low requirements (no data, just votes to break ties). In terms of the releases, 2.2 is at release candidate stage and will be production ready soon, the odd number releases are actually the dev releases. For prod at the moment, 2.0.x is definitely the recommended release. –  Adam C Jul 26 '12 at 11:14
    
How much money do you recommend spending on the above setup. Any preferred hosting services? –  lovesh Jul 26 '12 at 11:29
    
I have most experience using Amazon and EC2 (and associated products), generally I have not used other providers, but I don't know if that would be appropriate for you in India. For EC2, if I thought my data would fit in ~8GB, I would start with 2 x m1.large (7.5GB) instances for the primary and secondary and m1.small for the arbiter (I stay away from micro). There are decent production notes on the MongoDB website (mongodb.org/display/DOCS/Amazon+EC2) –  Adam C Jul 26 '12 at 12:44
1  
Basically because it makes it easier to upgrade when you exceed your original specifications, and as you say you only pay for what you use in most cases. Usually the path is cloud --> bigger cloud --> dedicated servers as their usage grows. –  Adam C Jul 26 '12 at 13:23
show 3 more comments

Your Answer

 
discard

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.