~/talk

Using and (slightly) abusing APCu cache in high load concurrent environments

Talkat HighLoad++ 2024 · 2024-12-02..12-03· [php, web-performance]
links:none on file
slides:none on file

APCu is used as a local PHP in-memory cache to cut DB reads and achieves roughly ~500 requests/sec fewer queries but forces careful tuning: split huge arrays into per-key entries, implement per-feature key prefixes and a stored index to flush segments, and raise entry_hint to 250000 plus more shared memory to avoid evictions. Using APCu as a durable store breaks availability; fix required adjusting entries and memory and yields about 7–9% latency reduction with CPU rising ~3–7%.

AI-written summary · about

  1. 0:00Introduction to APCu caching
  2. 1:03What is APCu and its benefits
  3. 5:24APCu in concurrent environments
  4. 7:54Choosing cacheable data
  5. 10:46First attempt and failure
  6. 16:09Data selection for APCu
  7. 17:37Why APCu shouldn't be a store
  8. 19:03First deployment results
  9. 20:30APCu memory usage issues
  10. 21:33CPU spike from deserialization
  11. 24:51Fixing the CPU problem
  12. 25:54Database latency increase
  13. 27:21Memory calculation mistakes
  14. 28:03Understanding APCu memory settings
  15. 31:17Setting entry hints correctly
  16. 33:29Final results and summary
  17. 36:10Q&A: Protobuffers vs APCu
  18. 37:57Q&A: APCu serialization
  19. 38:40Q&A: Performance comparison
  20. 40:11Q&A: Redis cluster setup
  21. 40:54Q&A: APCu failure impact
  22. 42:39Q&A: Metrics in APCu
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.