Upgrade to Pro — share decks privately, control downloads, hide ads and more …

대용량 트래픽 아니면 안 보셔도 됩니다! 선물하기 서비스 캐싱 전략

kakao
November 01, 2024

대용량 트래픽 아니면 안 보셔도 됩니다! 선물하기 서비스 캐싱 전략

#cache #트래픽

리모트캐시의 부담을 덜기 위한 하이브리드 캐시, 선물하기만의 특성을 담은 유저 선호 데이터를 자동으로 감지하는 캐시 웜업 자동화, 초 단위 갱신으로 항상 최신 데이터를 서빙하는 캐시 웜업 등 선물하기 서비스에서 대량 트래픽을 견디기 위해 고안한 다양한 캐싱 전략을 공유합니다.

발표자 : everett.lee, joy.say
카카오 선물하기를 개발하는 에버렛 조이 입니다.

kakao

November 01, 2024
Tweet

More Decks by kakao

Other Decks in Programming

Transcript

  1.          

            ,#0োب߹ҙ઺അട ৉؀୭؀ҙ઺   ݺҙۈ  ,#0 োب߹ҙ઺അട IUUQT XXXLPSFBCBTFCBMMDPN3FDPSE$SPXE(SBQI:FBSBTQY ѐࢶߓ҃
  2. ;PPLFFQFSഝਊ 6QEBUF /PUJ fi DBUJPO %BUBCBTF "ENJO 4FSWFS 4FSWFS 4FSWFS

    ;PPLFFQFS  䡪䡪䡪䡪䡪䡪  䡪䡪䡪䡪䡪䡪
  3. ;PPLFFQFSഝਊ 6QEBUF /PUJ fi DBUJPO *OWBMJEBUJPO *OWBMJEBUJPO *OWBMJEBUJPO %BUBCBTF "ENJO

    4FSWFS 4FSWFS 4FSWFS ;PPLFFQFS  䡪䡪䡪䡪䡪䡪  䡪䡪䡪䡪䡪䡪
  4. ;PPLFFQFSഝਊ 6QEBUF /PUJ fi DBUJPO %BUBCBTF "ENJO 4FSWFS 4FSWFS 4FSWFS

    ;PPLFFQFS  䡪䡪䡪䡪䡪䡪  䡪䡪䡪䡪䡪䡪
  5. 4FSWFS" $BDIF %BUBCBTF -PDBM$BDIF 4FSWFS# -PDBM$BDIF 7FSTJPO FYQJSFE 7FSTJPO 7FSTJPO

    FYQJSFE ;PPLFFQFS 4ZODISPOJ[BUJPO 4ZODISPOJ[BUJPO 7FSTJPO FYQJSFE 6TFS" 6TFS#
  6. 3FNPUF$BDIF )ZCSJE$BDIF࠺Ү 514     3FNPUF$BDIF )ZCSJE$BDIF PG$POUBJOFS

    -PDBM$BDIF55-T 3FNPUF$BDIF55-N 3FNPUF$BDIF$16ࢎਊ۝ 
 ѐࢶ 514ࢿמೱ࢚
  7. 1&3ঌҊ્ܻਸ੸ਊೡө function get( key, timeToLive, beta ) value, delta, expiry

    = readCache(key) if !value || nowTime() − delta * beta * log(random(0,1)) ≥ expiry then start = nowTime() value = recompute(key) delta = nowTime() – start writeCache(key, (value, delta), timeToLive) end return value end
  8. 1&3ঌҊ્ܻਸ੸ਊೡө function get( key, timeToLive, beta ) value, delta, expiry

    = readCache(key) if !value || nowTime() − delta * beta * log(random(0,1)) ≥ expiry then start = nowTime() value = recompute(key) delta = nowTime() – start writeCache(key, (value, delta), timeToLive) end return value end
  9. 1&3ঌҊ્ܻਸ੸ਊೡө function get( key, timeToLive, beta ) value, delta, expiry

    = readCache(key) if !value || nowTime() − delta * beta * log(random(0,1)) ≥ expiry then start = nowTime() value = recompute(key) delta = nowTime() – start writeCache(key, (value, delta), timeToLive) end return value end
  10. 1&3ঌҊ્ܻਸ੸ਊೡө function get( key, timeToLive, beta ) value, delta, expiry

    = readCache(key) if !value || nowTime() − delta * beta * log(random(0,1)) ≥ expiry then start = nowTime() value = recompute(key) delta = nowTime() – start writeCache(key, (value, delta), timeToLive) end return value end
  11. 1&3ঌҊ્ܻਸ੸ਊೡө function get( key, timeToLive, beta ) value, delta, expiry

    = readCache(key) if !value || nowTime() − delta * beta * log(random(0,1)) ≥ expiry then start = nowTime() value = recompute(key) delta = nowTime() – start writeCache(key, (value, delta), timeToLive) end return value end
  12. 1&3ঌҊ્ܻਸ੸ਊೡө ੉ग நदјनৈࠗܳநद݅ܐ੹ਃ୒ী݅੄ઓ   NT ࢎਊ੗ਃ୒੉நदјनഛܫߧਤܳߩযզ҃਋ -> நदјन9 

     NT நदјनഛܫߧਤܳ֫ੌ҃਋ -> நदјन۽૒઺ࠂࣻ೯ࢎਊ੗਽׹૑োߊࢤоמ நद நदјनоמߧਤ நदјन۽૒दр ਃ୒
  13. 1&3ঌҊ્ܻਸ੸ਊೡө ੉ग ೐۽ݽ࣌ಕ੉૑חੌ੿ೠநदјनदр EFMUB ਸӝ؀ೞӝয۰਑ ࢚ಿ"1*਽׹दрੌ੿9 ೐۽ݽ࣌ಕ੉૑࢚ಿѐࣻૐо۽ੋೠ"1*਽׹दрૐо   NT

    ӝઓநदјनदрী࠺೧ц੘झۣѱӡয૓நदјनदр நदઑഥ9  நद நदјनоמߧਤ நदјन۽૒दр ਃ୒
  14. "VUP$BDIF8BSN6Q        ೐۽ݽ࣌ಕ੉૑ 

    दр߹౟ې೗־੸ର౟ ࢶޛೞӝ઱ਃ೐۽ݽ࣌਷        ೐۽ݽ࣌ಕ੉૑  दр߹౟ې೗־੸ର౟
  15. "VUP$BDIF8BSN6Q        ೐۽ݽ࣌ಕ੉૑ 

    दр߹౟ې೗־੸ର౟        ೐۽ݽ࣌ಕ੉૑  दр߹౟ې೗־੸ର౟ tل׮u
  16. ಕ੉૑*E ୭Ӕഐ୹दр ־੸ഐ୹പࣻ       

                 )051SPNPUJPO$PMMFDUPS QBHF\QBHF*E^ 1SPNPUJPO 6TFS
  17. ಕ੉૑*E ୭Ӕഐ୹दр ־੸ഐ୹പࣻ       

                 ࢎۈٜ੉݆੉ࠌ૑݅ Բળ൤଺૑חঋও֎ അ੤חੋӝহח೐۽ݽ࣌ੋоࠊ )051SPNPUJPO$PMMFDUPS
  18. ಕ੉૑*E ୭Ӕഐ୹दр ־੸ഐ୹പࣻ       

                 ୭Ӕী଺਷ࢎۈ਷੓૑݅ ഐ୹പࣻо݆੉੸ҵ ੌױખ؊૑ெࠁ੗ )051SPNPUJPO$PMMFDUPS
  19. ಕ੉૑*E ୭Ӕഐ୹दр ־੸ഐ୹പࣻ       

                 ࢎۈٜ੉݆੉଺Ҋ ୭Ӕө૑ഐ୹ػѦࠁפ ੋӝ݆਷೐۽ݽ࣌੉ঠ )051SPNPUJPO$PMMFDUPS
  20. *OEFY NFNCFS QBHF*E TDPSF UJNFTUBNQ     

                 ୭Ӕഐ୹ػ೐۽ݽܻ࣌झ౟ 4PSUFE4FUT *%׼୭Ӕഐ୹ػदрTDPSF੷੢ MBUFTU PMEFTU )051SPNPUJPO$PMMFDUPS3&%*4
  21. ೐۽ݽ࣌־੸ഐ୹പܻࣻझ౟ )BTI *%׼־੸ഐ୹പࣻ੷੢ fi FME QBHF*E WBMVF DPVOU  

                )051SPNPUJPO$PMMFDUPS3&%*4
  22. )BTIఃZZZZ..EE)) LFZ fi FME QBHF*E WBMVF DPVOU   

                   )051SPNPUJPO$PMMFDUPS3&%*4
  23.        4QJLFQSPNPUJPOदр߹౟ې೗־੸ର౟ 4QJLF1SPNPUJPO ৘द

    ೠ੿౸,#09நܼఠ೐۽ݽ࣌ ࠂզݏ੉஖అҮജӂ೐۽ݽ࣌ ୭Ӕীഐ୹ػ೐۽ݽ࣌ಕ੉૑о઺஖ पदрഐ୹പࣻо݆਷೐۽ݽ࣌о઺஖ )051SPNPUJPO$PMMFDUPSо઺஖
  24. )051SPNPUJPO$PMMFDUPS୭ઙझ௏য҅࢑ totalScore = ( day ∑ hour=0 counth weighth )

    × weightc + scorer × weightr दр߹־੸പࣻझ௏য  पदр־੸പࣻ9पदро઺஖   दр੹־੸പࣻ9दр੹о઺஖  j
  25. )051SPNPUJPO$PMMFDUPSUSBG fi D  ؀ਊ۝౟ې೗ਃ୒ਸ؀࠺ೠ)051SPNPUJPO$PMMFDUPSܻ࠙ 1SPNPUJPO 6TFS QBHF\QBHF*E^ )051SPNPUJPO $PMMFDUPS

    ઱ӝ੸ਵ۽EBUBTFOE *%׼୭Ӕഐ୹दр *%׼दр߹־੸ഐ୹പࣻ )051SPNPUJPO "%% */$3 -PDBM4UPSBHF *E ־੸ഐ୹പࣻ੐द੷੢
  26. "VUP$BDIF8BSN6QѾҗ ੸ਊ੹ ੸ਊറ ߸زܫ ࢚ಿ"1*DBMM     

    %#2VFSZDBMM     ੸ਊ੹ ੸ਊറѾҗח׮ܲੌ੗੄زੌदр؀ӝળਵ۽࠺Ү
  27. 2VFVF %FBE-FUUFS2VFVF $POTVNFST T T T T j T T

    T T T ࠙׼ѐ ݫद૑ߊ೯ 1VCMJTIFS NFTTBHFQSPQFSUJFTী55-ࢸ੿ ୡױਤ$BDIF8BSN6Q
  28. 2VFVF %FBE-FUUFS2VFVF $POTVNFST T T T j T T T

    T T ୡٍEFBEMFUUFSRVFVF۽੉ز 1VCMJTIFS ୡױਤ$BDIF8BSN6Q T
  29. 2VFVF %FBE-FUUFS2VFVF $POTVNFST T T T j T T T

    T T T ݫद૑ҳة நदਙসࣻ೯ 1VCMJTIFS ୡױਤ$BDIF8BSN6Q
  30. 2VFVF %FBE-FUUFS2VFVF $POTVNFST T T j T T T T

    T T ୡٍEFBEMFUUFSRVFVF۽੉ز 1VCMJTIFS ୡױਤ$BDIF8BSN6Q ݫद૑ҳة நदਙসࣻ೯
  31. 2VFVF %FBE-FUUFS2VFVF $POTVNFST T j T T T T T

    T T j T T T T T T ୡ׼ೠѤঀEFBEMFUUFSRVFVF۽੉ز ୡ׼ݫद૑Ѥҳة நदਙসࣻ೯ 1VCMJTIFS ୡױਤ$BDIF8BSN6Q
  32. 2"