The story about cache

1,184 views

Published on

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,184
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
16
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

The story about cache

  1. 1. The Story About Cache charsyam@naver.com
  2. 2. Use Case: Login
  3. 3. Use Case: LoginCommon Case
  4. 4. Use Case: Login Common Case Read From DBSelect * from Users where id=‘charsyam’;
  5. 5. Use Case: LoginMay be it’s genenallyfast
  6. 6. Use Case: LoginBut it’s SlowIn Many Read/Write
  7. 7. Use Case: Login Advanced Case Read From CacheGet charsyam
  8. 8. Use Case: Loginit’s always fast
  9. 9. Use Case: LoginMemcache VS Mysql 136 vs 1613 seconds
  10. 10. Use Case: Login250 million User ID Request 10 million
  11. 11. Where We Can Use Cache?Just Check User exists? Mail Receive, Tweet MentionGet User’s ProfileGet User’s Timeline
  12. 12. CachesMemcache Redis
  13. 13. MemcacheAtomic Operation
  14. 14. MemcacheAtomic Operation Key:Value
  15. 15. MemcacheAtomic Operation Key:Value Single Thread
  16. 16. Memcache Processing Over 100,000 TPS
  17. 17. RedisKey:Value
  18. 18. RedisKey:Value Collection List Sorted Set
  19. 19. Cache Layer Storage Layer Cache Application READ WRITE Server UPDATE WRITE DBMS
  20. 20. Cache Layer Like Twitter K: UserID, V: Y/N 1st Level Cache Check User exists K: UserID_TIMELINE, V: Tweet IDs 2nd Level Cache Check tweet list K: UserID_TWEETID, V: Tweet Contents 3rd Level Cache Check Content
  21. 21. BUTsSometimes Cache is slower than DB
  22. 22. Why?DBMS Also Uses CacheIf Cache is hit. It’s faster than …
  23. 23. DBMS Storage Layer Application READ Cache Server DBMS WRITE
  24. 24. EnvironmentSmall Data SetsRead Just 0.2~03mili
  25. 25. ComparisionDB’s Cache: 0.2milimemCache: 0.4mili If you check cache, you spend more time
  26. 26. BUTs BUTsCache helps to reduceDBMS’s Loads And It reduces Performance Deviation
  27. 27. Use Cache!
  28. 28. Thank you!

×