This week’s system design refresher:
We’ve launched a Fb web page and wish our content material to be extra accessible.
Observe us on FB: https://lnkd.in/eKnvWMx2
Information is cached in all places, from the entrance finish to the again finish!
This diagram illustrates the place we cache information in a typical structure.
There are a number of layers alongside the move.
-
Consumer apps: HTTP responses could be cached by the browser. We request information over HTTP for the primary time, and it’s returned with an expiry coverage within the HTTP header; we request information once more, and the shopper app tries to retrieve the information from the browser cache first.
-
CDN: CDN caches static net sources. The shoppers can retrieve information from a CDN node close by.
-
Load Balancer: The load Balancer can cache sources as nicely.
-
Messaging infra: Message brokers retailer messages on disk first, after which shoppers retrieve them at their very own tempo. Relying on the retention coverage, the information is cached in Kafka clusters for a time frame.
-
Companies: There are a number of layers of cache in a service. If the information shouldn’t be cached within the CPU cache, the service will attempt to retrieve the information from reminiscence. Typically the service has a second-level cache to retailer information on disk.
-
Distributed Cache: Distributed cache like Redis maintain key-value pairs for a number of companies in reminiscence. It offers significantly better learn/write efficiency than the database.
-
Full-text Search: we typically want to make use of full-text searches like Elastic Seek for doc search or log search. A replica of information is listed within the search engine as nicely.
-
Database: Even within the database, now we have completely different ranges of…