开发者

Are these the ways to write a query without joins in a NOSQL scalable website architecture?

I keep hearing that one of the ways to architect a scalable website is to not use joins. How is the world do you do that since most data is relational?

My limited research has yielded these thoughts:

A) If your data is inherently relational then indeed use a relational database, i.e., use the right tool for the job.

B) Maintain a denormalized version of your data.

C) For the data that can be forced to be non-relational then you can use NOSQL. Data architect it in such a way that joins are not necessary.

D) If you must relate your data then the application layer must manually implement joins by fetching the data sets one-by-one and manually relating the results.

E) Since ma开发者_Go百科nual joins at the application layer are very slow then try to do these offline (not while the user is waiting).

F) Use Map-Reduce.

Is this correct/any more answers?


High scalability has excellent articles on this. Check out the reddit one for how they handled the joins: http://highscalability.com/blog/2010/5/17/7-lessons-learned-while-building-reddit-to-270-million-page.html

Then there's already a stackoverflow question with a bunch of links in the answers for similar info: Techniques for writing a scalable website


Cache as much as possible, i.e. when you have expensive queries (with or without joins) try to cache the query result rather than executing the query again etc. To make the whole site fast, cache objects on the highest possible layer, i.e. try to cache whole pages, if that does not works, try caching page fragments, then the data objects that provide the data to populate the pages etc. etc.

Caveat: There's some truth to the old saying "There are only 2 hard things in Computer Science - cache invalidation and naming things", so be careful what you put in your cache and for how long.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜