How Stack Overflow has implemented caching?
Asked Answered
F

1

11

Not sure if Stack Overflow uses caching to enhance the loading speed of its pages, but if it has, it has done a great job. There are many components to be updated. I this picture you see every single second there are many components to be updated. How Stack Overflow does it so perfectly?enter image description here

Fumatorium answered 28/2, 2016 at 4:50 Comment(2)
From occasional hiccups when browsing the StackExchange sites, I can say that StackExchange uses CloudFlare for "accelerating" (caching) portions (all?) of the site for better experierence.Rectal
Is this a Meta Stack Overflow question?Ugric
C
5

This is answered much more comprehensively on Meta.SE in this answer. The highlights, however, are:

  • Basically everything is cached, especially everything served to anonymous users.
  • They use Redis servers with 96 GB of Ram. This server keeps an "L1 Cache" of recently set and read values. These values are compressed before sending them to Redis. They also use IIS's Output Caching
  • Each site has 3 types of caches:
    • "Local" (user sessions, view counts, etc)
    • "Site" (hot question ids, user acceptance rates)
    • "Global" (user inboxes, API quotas)

There are even more details on High Scalability , though this is nearly 5 years old at this point. There is a newer article (from 2014) that mentions that there are two additional levels of caching involved as well:

  • SQL Server (the entire database sits in memory). As of 2013, the database servers had 384 GB of memory
  • SSD (hit only when the SQL server cache is warming up...as not something I'd consider "cache", but it's mentioned in the article).
Coray answered 21/3, 2016 at 13:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.