开发者

Rails 3: Optimize database call

What is the best way to optimize calls to a MongoDB cloud database?

For example: a user c开发者_如何学运维an have 100 tweets or 100000 tweets that needs to be shown in the page.

What shall I do in order to optimize the fetch of the tweets? Given that the old tweets are the same every time, should I cache and only fetch the new ones?

I'm using Ruby Mongo driver.


Just one question: You want to show 100000 tweets on page?

Mongodb load all collections to memory automatically(if enough ram on the server) and return data very, very fast(like from cache).

So i see two optimizations:

  1. Create indexes
  2. Limit tweets count per page (you can do it like facebook do it on news wall).
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜