這篇是 StackOverflow 在講 cache 的文章,裡面不是什麼新東西,只是看到有趣的項目所以拿出來講:「How Stack Overflow Caches Apps for a Multi-Tenant Architecture」。
在講 cache 前通常都會說明各種儲存空間速度的差異,但裡面混了一個奇怪的東西:
- L1: 1.3ns
- L2: 3.92ns (3x slower)
- L3: 11.11ns (8.5x slower)
- DDR4 RAM: 100ns (77x slower)
- NVMe SSD: 120,000ns (92,307x slower)
- SATA/SAS SSD: 400,000ns (307,692x slower)
- Rotational HDD: 2–6ms (1,538,461x slower)
- Microsoft Live Login: 12 redirects and 5s (3,846,153,846x slower, approximately)
裡面混了一個不是 storage 的東西進去比較,你們是對 Microsoft 的帳號系統有多不爽 XDDD
另外他們列出了目前 Redis 的使用情況:
For the curious, some quick stats from last Tuesday (2019-07-30) This is across all instances on the primary boxes (because we split them up for organization, not performance…one instance could handle everything we do quite easily):
- Our Redis physical servers have 256GB of memory, but less than 96GB used.
- 1,586,553,473 commands processed per day (3,726,580,897 commands and 86,982 per second peak across all instances – due to replicas)
- Average of 2.01% CPU utilization (3.04% peak) for the entire server (< 1% even for the most active instance)
- 124,415,398 active keys (422,818,481 including replicas)
- Those numbers are across 308,065,226 HTTP hits (64,717,337 of which were question pages)
然後更長的版本可以在作者自己的 blog 上讀到,裡面講到的 cache invalidate (purge) 這部份有談到一些他們的作法:「Stack Overflow: How We Do App Caching - 2019 Edition」。