The Story About Cache           charsyam@naver.com
Use Case: Login
Use Case: LoginCommon Case
Use Case: Login  Common Case         Read From DBSelect * from Users where id=‘charsyam’;
Use Case: LoginMay be it’s genenallyfast
Use Case: LoginBut it’s SlowIn Many Read/Write
Use Case: Login Advanced Case      Read From CacheGet charsyam
Use Case: Loginit’s always fast
Use Case: LoginMemcache VS Mysql    136 vs 1613     seconds
Use Case: Login250 million User ID    Request 10 million
Where We Can Use Cache?Just Check User exists?           Mail Receive, Tweet MentionGet User’s ProfileGet User’s Timeline
CachesMemcache           Redis
MemcacheAtomic Operation
MemcacheAtomic Operation         Key:Value
MemcacheAtomic Operation          Key:Value  Single Thread
Memcache    Processing Over 100,000 TPS
RedisKey:Value
RedisKey:Value            Collection        List   Sorted Set
Cache Layer                         Storage Layer                             Cache   Application   READ                  ...
Cache Layer Like Twitter             K: UserID, V: Y/N  1st Level Cache         Check User exists   K: UserID_TIMELINE, V:...
BUTsSometimes Cache is slower than DB
Why?DBMS Also Uses CacheIf Cache is hit. It’s faster than …
DBMS                        Storage Layer  Application   READ                              Cache    Server                ...
EnvironmentSmall Data SetsRead Just 0.2~03mili
ComparisionDB’s Cache: 0.2milimemCache: 0.4mili If you check cache, you spend more time
BUTs BUTsCache helps to reduceDBMS’s Loads And It reduces Performance Deviation
Use Cache!
Thank you!
Upcoming SlideShare
Loading in...5
×

The story about cache

906

Published on

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

No Downloads
Views
Total Views
906
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
12
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!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×