开发者

How do large sites do pagination?

How do large sites handle pagination on search results so that the nth page loads roughly as quickly as the开发者_Go百科 first? For example, Google, Youtube, Hulu, etc.


Youtube:

Sorry, YouTube does not serve more than 1000 results for any query

so it probably caches the first 1k results in a something similar to a memcached blob.

Hulu: limits to 3000 results. Probably cached as well.

Google: It's pure black magic. Keep in mind it uses a lot of distributed computing (and not a simple db lookup), and probably caches the first n results for any query, and also "html ready" results for each result page, and intermediate results (See Dynamic Programming).

To summarize: Your first query to any page might take more time since it can cause the engine to start a db/distributed search, however, it's results (much more than the amount you will be showed) will probably be kept for a while in a very fast cache for serving any page for the same query without stressing the db again.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜