Cacheが速いのか確認する話

 Cacheが速いのか確認する話

F04982ad61107b5408ad139966596316?s=128

Ryo Tomidokoro

August 08, 2017
Tweet

Transcript

  1. Cache͕଎͍ͷ͔֬ೝ͢Δ࿩ 1)1#-5 *OOPWBUPS+BQBO*OD ෋ॴ྄ &OHJOFFS

  2. I˕UCON΋ഭ͖ͬͯͨͷͰ

  3. ύϑΥʔϚϯεʹහײʹͳΔ

  4. ࠓճͷ͓୊ LaravelͰγϯϓϧͳΞϓϦΛ࡞ΓCacheͷੑೳΛܭଌ Laravel 1. Bench؀ڥ͸DockerͰߏங 2. Benchπʔϧ͸siege 3. title(255), content(1024)Λ1ສ݅औಘ

    4. PHP7.1 with Opcache ຊεϥΠυʹ͓͍ͯCacheͱ͸ΞϓϦέʔγϣϯଆͰσʔλϕʔεͷݕࡧ ݁ՌΛCache͢Δͱ͍͏ҙຯͰ͢ɻΫΤϦΩϟογϡͷ͜ͱͰ͸͋Γ· ͤΜɻ
  5. ॗʑͱܭଌ͢Δ

  6. #FODI.BSL siege -t10s http://localhost/test 5SBOTBDUJPOSBUF USBOTTFD ૉLaravelͷύϑΥʔϚϯε

  7. #FODI.BSL siege -t10s http://localhost/test_mysql 5SBOTBDUJPOSBUF USBOTTFD Cacheͳ͠MySQL 10000݅SELECT

  8. ΍ͬͺΓ஗͍ɻͦ͏ͩCache͠Α͏

  9. #FODI.BSL siege -t10s http://localhost/test_predis 5SBOTBDUJPOSBUF USBOTTFD predisϥΠϒϦͰCache

  10. #FODI.BSL siege -t10s http://localhost/test_redis 5SBOTBDUJPOSBUF USBOTTFD redis-extensionͰCache

  11. ݁ՌΛ·ͱΊΔ

  12. #FODI.BSL USBOTTFD ݅ .Z42-  1SFEJT  3FEJTFYU 

  13. ԾઆΛཱͯΔ 1. ݅਺͕ଟ͍ͷͰIOό΢ϯυ 2. MySQL5.7Ͱѹॖసૹ͕ޮ͍ͯΔ 3. PHPͷ༨ܭͳ৘ใ͕෇༩͞ΕͯΔ ݅਺͕ݮΔͱRedis͕༏੎ʹͳΔ͸ͣ

  14. #FODI.BSL USBOTTFD ݅ ݅ ݅ ݅ .Z42-   

     1SFEJT     3FEJTFYU    
  15. ෺଍Γͳ͍

  16. #FODI.BSL Ͳ͏ͤͳΒɺCache͡Όͳͯ͘PHPʹͯ͠͠·͓͏ $val = var_export($res, true); file_put_contents(“tmp/$key”, '<?php $val =

    ' . $val . ';', LOCK_EX); ͜͏ͯ͠ include “tmp/$key”; ͜͏͡Ό
  17. #FODI.BSL USBOTTFD ݅ ݅ ݅ ݅ .Z42-   

     1SFEJT     3FEJTFYU     *ODMVEF    
  18. ൵͍͠ͷͰ

  19. #FODI.BSL ΠϯϥΠϯͰvar_exportͨ͠ม਺Λॻ͍ͪΌ͏ $val = var_export($res, true); file_put_contents(“tmp/$key”, '<?php $val =

    ' . $val . ';', LOCK_EX); ͜͏ͯ͠ ͦͷ··ϖʔετ
  20. #FODI.BSL USBOTTFD ݅ ݅ ݅ ݅ .Z42-   

     1SFEJT     3FEJTFYU     JODMVEF     JOMJOF    
  21. ࠓ೔ͷڭ܇ 1. mysql͸Ғେ 2. ೣ΋ḏࢠ΋Redis => NG 3. IO͸ίετ͕͔͔Δ(คຶ׷) Redis͸SortedListͱ͔࢖Θͳ͍ݶΓ

    ͸ߟ͑ͳͯ͘ྑ͍͔΋͠Εͳ͍ɻ
  22. ࠓޙͷ՝୊ 1. େྔσʔλΛ௿ίετͰ՚ྷʹಡΈࠐΉํ๏ 2. Cacheʹ͢΂͖͔Ͳ͏͔ͷᮢ஋ͷ೺Ѳ