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

HTML cache

HTML cache

HTML cache

tsuyoshi nakamura

March 17, 2017
Tweet

More Decks by tsuyoshi nakamura

Other Decks in Business

Transcript

  1. HTML Cache
    Constitution
    2017.03.17
    社内勉強会
    @nakamura_tsuyo4

    View Slide

  2. Agenda
    ➔ Nginx proxy cache
    ➔ Varnish
    ➔ Fastcgi cache
    ➔ memo

    View Slide

  3. Agenda
    ➔ Nginx proxy cache
    ➔ Varnish
    ➔ Fastcgi cache
    ➔ memo

    View Slide

  4. Nginx proxy cache
    LB
    Nginx
    (proxy cache)
    Nginx
    (proxy cache)
    Nginx+fastcgi
    Nginx+fastcgi

    View Slide

  5. Nginx proxy cache
    LB
    Nginx
    (proxy cache)
    Nginx
    (proxy cache)
    Nginx+fastcgi
    Nginx+fastcgi
    んーん

    View Slide

  6. Nginx proxy cache
    LB
    Nginx
    (proxy cache)
    Nginx
    (proxy cache)
    LB
    Nginx+fastcgi
    Nginx+fastcgi

    View Slide

  7. Nginx proxy cache
    LB
    Nginx
    (proxy cache)
    Nginx
    (proxy cache)
    LB
    Nginx+fastcgi
    Nginx+fastcgi
    構成変更ありきだなぁー

    View Slide

  8. Agenda
    ➔ Nginx proxy cache
    ➔ Varnish
    ➔ Fastcgi cache
    ➔ memo

    View Slide

  9. Varnish
    LB
    Nginx+fastcgi
    Varnish LB
    Varnish plus?
    Varnish plus? Nginx+fastcgi

    View Slide

  10. Varnish
    LB
    Nginx+fastcgi
    Varnish LB
    Varnish plus?
    Varnish plus? Nginx+fastcgi
    VHA (VARNISH HIGH AVAILABILITY)

    View Slide

  11. Varnish
    LB
    varnish
    varnish
    Nginx+fastcgi
    Nginx+fastcgi
    varnish LB

    View Slide

  12. Varnish
    LB
    varnish
    varnish
    Nginx+fastcgi
    Nginx+fastcgi
    varnish LB
    Self-routing varnish cluster

    View Slide

  13. Varnish self-routing varnish cluster
    https://info.varnish-software.com/blog/creating-self-routing-varnish-cluster

    View Slide

  14. Varnish self-routing varnish cluster config
    https://gist.github.com/rezan/1eadaef1745286a4e7262d83e1eff19c

    View Slide

  15. Varnish self-routing varnish cluster config
    “ We leverage this director to do our content
    “ sharding by hashing on the URL and route
    “ the request to its destination:

    View Slide

  16. Agenda
    ➔ Nginx proxy cache
    ➔ Varnish
    ➔ Fastcgi cache
    ➔ memo

    View Slide

  17. FastCGI cache
    LB
    Nginx+fastcgi
    fastcgi_cache
    Nginx+fastcgi
    fastcgi_cache

    View Slide

  18. FastCGI cache
    LB
    Nginx+fastcgi
    fastcgi_cache
    Nginx+fastcgi
    fastcgi_cache
    構成変更なく手軽かも

    View Slide

  19. Agenda
    ➔ Nginx proxy cache
    ➔ Varnish
    ➔ Fastcgi cache
    ➔ memo

    View Slide

  20. memo
    ● Cache自体はそれぞれのサーバに保存されるので deleteしたい時の考慮は必要
    ○ Or 即時反映されなくても良い業務設計が必要
    ● cacheすべきurlはcache serverのconfigでの管理になる
    ● Proxy_cache_lock , fastcgi_cache_lockは使った方がよさげ
    ○ 同時アクセス負荷がかかった時に結局死ぬと思ってる
    ● パフォーマンスのBenchmarkは未検証
    ● First stepとしてfastcgi_cacheは良さげ
    ● リアルタイム性が必要なデータは当然あるので API開発はセット

    View Slide