How Discourse handle high HTTP request?

I just take a look at the source code, there is no Rails #stale? method on controller to return 304
or cache the entire page based on record cache key

Sorry to bother you, I’m just curious about this

People are not hitting reload like crazy on Discourse … we rarely need this kind of protection. And will just use rate limiting for that.

Instead we rely on anonymous cache for the bulk of our high load handling. It has 2 modes

  • For high hits from anon we cache home page and topic pages for up to 1 minute
  • For high hits from logged in, we revert to anon if a topic page is under extreme load

You can read through for all the gory implementation.

We also have tons of internal caching of bits and pieces to avoid high cost queries.


ok thanks for the enlightenment

I will read the source code more deeper