Alex Rivera | Logout

Is mongodb fit for sites like stackoverflow?

Asked 2010-03-06T03:11:39.430
26

is mongodb appropriate for sites like stackoverflow?

Edit
Report

2 Answers

5

I think it is.

You can store the question itself, the answers and the comments on the question + answers as one mongo-document. The max doc size is 4 mb, so no document on stackoverflow will be too big for mongo. I've downloaded the content of stackoverflow (data dump) with bittorrent and I've been able to import this content into mongo.

Importing this data into mongo is not trivial because the dump of stackoverflow consists of multiple xml files and each xml file matches with one relational table, so have to recombine this data into document format.

I've also added the display name + reputation of the OP + answerers + commenters to this document. This does mean that if a user changes his/her displayname you have to update all the documents with his/her userid. There is a price to pay if you denormalize your data. Same if the reputation of a user changes.

The idea is that all the data that you see on a page like this is contained in one mongo-document. You have all the necessary information with one lookup and no joins.

Here you can download the data dump of stackoverflow: https://blog.stackoverflow.com/category/cc-wiki-dump/

answered 2010-04-22T19:05:40.927
0

I think it would be a good fit. There are a lot of reasons to use Nonrel databases like MongoDB on sites that function similarly to StackOverflow. Think about how RDBMs store data to disk and take filesystem block size and similar disk attributes into mind when planning your layout. I like taking advantage of documents that span multiple filesystem blocks and store lots of related information within itself nice and flattened. I find that the storage is less spread out and a single block can be written containing a LOT of information where multiple blocks would be written using other solutions.

answered 2011-12-07T05:34:40.437

Your Answer