L
L
Linloil2011-10-29 11:02:28
Habr
Linloil, 2011-10-29 11:02:28

How does the article page cache work on Habré?

How does fetching comments on articles (and updating them) work so fast?

I have the following options:
1) The reverse proxy server caches the entire content of the article page along with comments, after adding a new comment, the page cache is reset
2) A more likely option is that the comment cache is stored in memory on the back-end server, requests for articles and comments to it are broadcast directly to it
3) Another option - everything is stored in the database and is selected again each time

Please clarify if anyone knows. Interested in how you can achieve such a speed with a tree view of comments

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sardar, 2011-10-29
@Sardar

The whole page is usually not cached, you never know which plugin will be added later, which will require frequent updates. Although in such situations, double render is a good fit. The result of the first rendering is cached (post, comments), and the second one is always active (personal data, sidebar).
You can cache all the comments of a post with one sheet (post.id -> HTML), dropping them on new posts. Drawing comments is not difficult.

D
Dmitry Dedukhin, 2011-10-30
@Demetros

What's the problem? When using comments based on the materialized path, all comments can be selected with a single index query, and then converted to a tree on output.
It seems to me that comments are just not cached here.

@
@ngreduce, 2011-10-30
_

So the load wave usually falls only on the articles on the main page. Then the peak decreases.
It is not a problem to cache comments for 10 articles in RAM.
Still, Habr is not some kind of Facebook.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question