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

fastlyでええかんじにサイトリニューアル @ Yamagoya Meetup 2018 / e-kanzi Website renewal with fastly

kakerukaeru
October 26, 2018

fastlyでええかんじにサイトリニューアル @ Yamagoya Meetup 2018 / e-kanzi Website renewal with fastly

fastly Yamagoya Meetup 2018で話した資料です。
実際は、GoogleSlideで👇で話しました。
スピーカーノートとかGIFがみれるので、そっちでもどうぞ。

https://docs.google.com/presentation/d/1ifilZuGdOxHPTEqWIWTwqMnQmq2zpR3jsICkMSmu0R4/edit?usp=sharing

kakerukaeru

October 26, 2018
Tweet

More Decks by kakerukaeru

Other Decks in Technology

Transcript

  1. Amebaニュース • 200X年リリース • ニュースサイト • 認証ページなし • 更新頻度も低く •

    回遊性は低く、読み切り型 • SEOに優しいといいでしょう • PC/SP/AMP アルヨ • etc... https://news.ameba.jp
  2. なぜリニューアル • SEO ◦ ニュースサイト ◦ ある程度育ったドメイン • レガシー ◦

    積み上がった歴史 ◦ 保守性高く直したい ◦ 運用コスト安く https://news.ameba.jp
  3. Cache Object • CacheObjectを理解する • Cache-Key = Method + Host

    + Path + Vary key speakerdeck/vary-and-the-future-of-cache-variation docs.fastly.com/manipulating-the-cache-key
  4. Cache Object • CacheObjectを理解する • Cache-Key = Method + vcl_hash

    + Vary key • docs.fastly.com/creating-custom-vcl
  5. logging • CacheKeyは分かった • 集約して可視化したい • 気になりポイント ◦ なるべくリアルタイム ◦

    なるべく管理は少なく ◦ なるべく楽したい speakerdeck/vary-and-the-future-of-cache-variation
  6. logging docs.fastly.com/log-streaming-syslog • CacheKeyは分かった • 集約して可視化したい • 気になりポイント ◦ なるべくリアルタイム

    ◦ なるべく管理は少なく ◦ なるべく楽したい • CacheMISSをあぶり出そう ◦ URL / UA parser
  7. CI/CD • 高速にdebugし、 高速にdeployしよう • CircleCI ◦ for test ▪

    mocha + chai ◦ for deploy ▪ terraform ▪ custom vcl www.terraform.io/docs/providers/fastly
  8. CI/CD • 高速にdebugし、 高速にdeployしよう • CircleCI ◦ for test ▪

    mocha + chai ◦ for deploy ▪ terraform ▪ custom vcl www.terraform.io/docs/providers/fastly
  9. CI/CD • 高速にdebugし、 高速にdeployしよう • terraform ◦ workspace ▪ stg/prd

    共通のvcl ▪ domain 以外は共通 ◦ deploy ▪ master merge → prd ▪ feature → stg • originはstg/prd 同等構成に。 www.terraform.io/docs/providers/fastly
  10. CI/CD • 高速にdebugし、 高速にdeployしよう • test ◦ stg test required

    before prd apply ◦ prd test ▪ cron trigger www.terraform.io/docs/providers/fastly
  11. CI/CD • check list ◦ Cache-Key ◦ API-Key ◦ CORS

    & AMP CORS ◦ normalize ▪ Vary / User-Agent ◦ OPTION Method Cache ◦ Negative Cache ◦ etc... www.terraform.io/docs/providers/fastly
  12. 大体の方針 • Cache ◦ Static / Dynamic Content ◦ Cache

    the API Resources ◦ Cache Coverage ≒ 100% ◦ Surrogate-Control > max-age • Purge ◦ Instantly purge ◦ Surrogate-Key
  13. Cache戦略 • 「目指せCacheHit率100%」 • normalize ◦ QueryParameter ◦ User-Agent ◦

    Accept-Encoding • Cache CORS resources • Cache OPTION Method • Cache with API Key • Cache Negative Response • edge side redirect
  14. Next やっていき • やっていき ◦ SPAでのCache ◦ 認証コンテンツのCache ◦ ちゃんとしたh2の利用

    ◦ もっと大量のtrafficをfastlyに流していく • 気になっていき / Internet-Drafts とか ◦ Cache Digest ◦ Early Hints ▪ www.fastly.com/blog/optimizing-http2-server-push-fastly ◦ Variants ▪ tools.ietf.org/draft-ietf-httpbis-variants-04 ◦ TLS 1.3 0-RTT