Slide 1

Slide 1 text

HTML Cache Constitution 2017.03.17 社内勉強会 @nakamura_tsuyo4

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

Varnish LB Nginx+fastcgi Varnish LB Varnish plus? Varnish plus? Nginx+fastcgi

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

Varnish LB varnish varnish Nginx+fastcgi Nginx+fastcgi varnish LB

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

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:

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

FastCGI cache LB Nginx+fastcgi fastcgi_cache Nginx+fastcgi fastcgi_cache

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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