ç§ã¨CDNã¨edge computing
æè¿ãCDNå種ã«ç¶ã
ã¨edge computingå¨ãã®æ©è½ãå
¥ã£ã¦ãã1ãç¾å¨ã«ããã¦CDNã§ã©ãã¾ã§ä½ãã§ããã®ãã¿ãããªãã¨ãããèãã¦ãããä»äºã§ããã£ã¦ãããããªãã¨èãã¦ããã
以ä¸çºè¡¨ã§ ãã«CDNã¢ã¼ããã¯ãã£
ã®æè¨ããã¦ãã3å¹´ãçµã¡ãä»ã§ã¯ãã«CDNã¯ããªãå½ããåã®é¸æè¢ã¨ãã¦ããã«ãããã¨ããããã¤ã¯ããµã¼ãã¹éã®éä¿¡ãCDNãéããããªãã¨ã¾ã§è¡ãããä¸çã«ãªã£ã¦ããç´ç²ã«ããããªã¨æãã¦ãã(ãããã ãã«CDNã¨ã¯ãªã«ã
ã¨ããã®ã¯ç§ã®ä¸ã§ã確ãããã®ãããããã§ã¯ãªãããã¤ã¡ã¼ã¸çã«ã¯åçãªãµã¼ãã¹ã«ããã¦ããã¹ã¦ã®ã¨ã³ããã¤ã³ããCDNçµç±ã§è¿ããããç¨åº¦æè»ãªãã£ãã·ã¥ã®Purgeãè¡ããããªãã®ãæ³åãã¦ãã2 3)ã
ä¸è¨ãç§ã¯æè¨ããã ããããããã®å¾ããã«å¼·ãåãçµããã¨ãã¦ããªãã£ãã®ã«è¥å¹²ã®å¾æããã(åçãªé¨åãTTL0ã§å ¨é¨CDNãéããã®ãããªãã¨ã¯ãã£ããã¯ãã¦ããã)ã
CDNã«éããªããæ§ã ãªæå³ã§ã®edge computingã¨ããæèã§ã¯ã以ä¸ãããã¤ã³ã¿ã¼ãããç 究æã®ãã¸ã§ã³ãè¦ã¦ããããã¯ãã¹ã¦ãã¦ã¼ã¶ã®è¿ãã¨ãã¦ã®edgeã¨ãã¦åããªããããããããå¿ è¦ã«å¿ãã¦å調ãã¦ããã¨ãã話ã§ããã夢åºãããªããªã©ã¨æãã¤ã¤è¦ã¦ããã research.sakura.ad.jp
ã¾ãã話ã¯å¤ãããç§ã¯JSãåè·ã§ã²ã¼ã ãä½ããªã©æ¸ãã¾ãã£ã¦ããããããCDNã®edge computingã¨ããã³ãã¨ã³ãã¯è¦ªåæ§ãé«ãã¨æã£ã¦ãããããããæå³ã§ãç§ã¯ããã«åãçµãã¹ã人æãªã®ã§ã¯ãªããã¨æãã¦ããã
CDNã§ã®edge computingã¯ã©ãã¾ã§frontendã®è©±é¡ã¨è¨ããã®ãã¯ããããªãããedgeã§è¨ç®ããããã¨ã«ããã¬ã¤ãã³ã·ç縮ãBFFã¨ãã¦ã®edge computingçãããã³ãã¨ã³ãã®å¿
è¦ã¨ããä¸çã®ããã®ã°ã«ã¼ã¨ãã¦CDNã®edge computingãæãããã¨ãã§ããã¨æã£ã¦ãããããããã©ãã¾ã§ãããã³ãã¨ã³ãã«ã¾ããã¦ã©ãã¾ã§ãedgeã«ä»»ããããã©ãã¾ã§ããªãªã¸ã³ã«ä»»ãããã¨ããã¨ããããæ§ã
ãªçµã¿åãããèããããã¾ãã«å¤§å¤å¤¢ã®åºãã話ã§ããã
ã¨ãã¸ã³ã³ãã¥ã¼ãã£ã³ã°ãæ´»ãããã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ãã¹ãã£ã³ã°æ§æ³ - ããããããã° ã è¶
åä½çDBã¯ã¨ãªãã£ãã·ã³ã°æ§æ³ - Speaker Deck ãªã©ãè¦ã¦ãã edgeã«ããã¾ã§ãããããã
ã¨å¤§å¤ããããããæ´ã«å¤¢ãåºãã£ã¦ããæ¥ã
ã§ããã
ã¨ããããã§ãCDNã®edge computingããã£ã¦ãããã¨ãªã£ãã¯ããããã§ã¯å®éã«ä½ããã£ã¦ããã®ããã¨æã£ã¦ããããã¡ã®ãã¼ã ã®ããã¯ãªã¼ãã"ããdekokun好ããã"ã¨è¨ã£ã¦ä»¥ä¸URLããããã訳ãã¦ã¿ãã¨ãããªããªãããããããæ±ã£ã¦ãããã®ãWebAssemblyã¨ãããã¨ãããã¡ããã©æè¿ç§ã¯Rust + WebAssemblyã®ã¢ããªä½ã£ã¦ããã¾ãã¯fastly + edge computingãè¦ã¦ããããã¨ãªã£ãã®ã§ãã£ãã
ä¸è¨URLã®å 容ã¯ãããªãéã«è¦ç´ããã¨ä»¥ä¸ã¨ãªã
- fastlyã¯labç«ã¡ä¸ãã¦ãããããã£ã¦ãããTerrarium,ã£ã¦ããããã¸ã§ã¯ããç±ãããããã¯WASMãã¼ã¹ã®ã¨ãã¸ã³ã³ãã¥ã¼ãã£ã³ã°ãã©ãããã©ã¼ã ã ããæ©ãã¦å®å ¨ã ã
- Tettariumã¯system callã®å®è£
ãå¤ããªããstd libã®ã»ã¨ãã©ã使ããªããå¯ä½ç¨ã®èµ·ããæ¹ã¯http_guestã¨ããã©ã¤ãã©ãªã使ã£ã¦ãã£ã¦ã
- KVSã使ãããããã
- ãã®å¾ãhttp_guestã®å ·ä½çãªä½¿ãæ¹ã®èª¬æãç¶ã
ãªããTerrariumã¯ãã°ã¤ã³ãªã©ãªãã§èª°ã§ãæ°è»½ã«wasmã¢ããª(ã¨ãã表ç¾ãé©åã ããããwasmã§åããµã¼ããµã¤ãã¢ããªï¼)ããããã¤ã§ããããç試ãã¦ã¿ãã¨ãããã
ãªã©ã¨ããããã§ãFastlyã«ã¯ä»é常ã«æ³¨ç®ãã¦ããããã§ãã ã§ã Fastly Yamagoya Meetup 2018 ã«åå ãã¦æé«ã¨æã£ãããæè¿ã¯Fastly Meetup #2ã«åå ããããã¾ããã以ä¸ãfastly meetupå½æ¥ã¡ã¢ãä¸è¨Terrariumã®ä¸ã§åãã¦ããLucetã«ã¤ãã¦ã®è©±ããã£ã¦å¬ããã£ãã
fastly meetupå½æ¥ã¡ã¢
Intro
- å¶æ¥ã®Toshi Aizawaãã ã«ãããfastlyã®ç´¹ä»ã¨ãã¢
Fastlyã®ã¡ãªãã
以ä¸ããã¢ãããªãããªã¢ã«ã¿ã¤ã æ§ãè¦ãã¦ããããã ãã©ããã£ãã·ã¥ã®purgeãæ¬å½ã«ããã ã£ãããlogãã¢ã¯ã»ã¹ãããæ°ç§ã§papertrailä¸ã«æµãã¦ããããè¨å®å¤æ´ã®å 容ãåæ ããããã35ç§ããã(ãã¤ãã¯10ç§ã¨ããã£ã¨æ©ãã¨ã®ãã¨)ãã¨ããã®ãåããããããã¢ãã¦ãããã¦ãã¦å¤§å¤ãã¾ããã¢ã ã£ãã è¨å®å¤æ´ã¯ã35ç§ã ã¨ãã¦ããããªãæ©ãã¨ããå°è±¡(ç§ã®è§¦ã£ããã¨ã®ããCDNã¨æ¯ã¹ã¦)
ã¡ã¢
- ãªã¢ã«ã¿ã¤ã
- instant purge
- log streaming
- config change
- cloud native(easy to manage)
- ããã©ã¼ãã³ã¹ããã
- ãã£ãã·ã¥ãããçãé«ã
How we build Fastly with Fastly
Tatsuhiko Miyagawaããã«ãããFastlyã§åãã¦ããFastlyã®ã³ã³ããã¼ã«ã·ã¹ãã ã®è£å´ã«ã¤ãã¦ã®è©±ã Fastly Yamagoya Meetup 2018ã§è©±ããã¦ããå 容ã¨ã»ã¼åãå 容(ã¨æ¬äººãæåã«è¨ã£ã¦ããã fastlyã®è£å´ã§fastlyãåãã¦ããã¨ããã®ãé¢ç½ããfastlyãå ¨ä½çã«é害ã«é¥ã£ãæã«è£å´ãä¸ç·ã«æ»ã¬ã®ã§å¤§ä¸å¤«ãªã®ã ããããã¨ããã®ã¯æ°ã«ãªã£ã(質åããã°ããã£ã)ã VCLã®ãã¹ãã¯åãè¨å®ãããä¸ã¤ä½ãã®ããã¹ããã©ã¯ãã£ã¹ãã¨ããã®ã¯APIã§æä½ããããããããã®é¸æè¢ã ãªã¨æããã
ã¡ã¢
- fastlyã®APIã¯fastlyä¸ã§å®è£
ããã¦ãã
- VCLã§routingãã¦ãã
- æè¿ãAPIã®backendãåãæ¿ãã
- å¤ãæ¹ããå¾ã ã«æ°ããæ¹ã«æµãã¦æå¾ã«shutdownãã
- APIã®routingãµã¼ãã¹ãfastlyã«å
¨é¨ã®ãããchefã§ãããã¤ãã¦ããã®ãterraformã§ãããã¤ããã¦ãã
- 確ççã«APIãå¤ãbackendã«æµãããæ°ããbackendã«æµããããã
- æ°ããæ¹ã«ãã«ã¹ãã§ãã¯ãå ¥ãã¦ããã¦ããã«ã¹ãã§ãã¯ãè½ã¨ããã¨ã§æ»ããã¿ãããªãã¨ãå¯è½
- A/Bãã¹ãã§ãä¾ãã°ãããã«ã¦ã¼ã¶IDã¨ãå ¥ãã¦ããããsha256ã§æ¯ãåããã¨ãã§ãã
- fastlyã®è¡ã£ã¦ããcanary deployæ¹å¼
- ç«ææ¥ã¨æ¨ææ¥ã«ãããã¤ãã¦ãã
- ã¾ãcanary ãµã¼ãã«ãããã¤ããªã¯ã¨ã¹ãã«canaryã®ããããå ¥ã£ã¦ãããcanaryããã¯ã¨ã³ãã«é£ã¶ããã«
- æ®æ®µã¯production clusterãè¦ã¦ãããcanary ãªãªã¼ã¹ã®éã¯canary ã¯ã©ã¹ã¿ã«ãªã¯ã¨ã¹ããé£ã¶ããã«ãªããHTTPãããã§canaryã«é£ã°ããªã©ãfastlyã§å¯è½ããã®å ´åãvaryã§ãã®ããããå®ç¾©ãã¦ãããå¿ è¦ããããããã«ãã£ã¦ãã£ãã·ã¥ãåé¢ããã¦canaryãå¤ãªåããã¦ãproductionå´ã«ã¯å½±é¿ãåã¼ããªã
- configãåedgeã«å¯¾ãã¦ã©ã®ããã«é
ä¿¡ãã¦ããã
- pullåãedgeãcontroll planeã«pollãã¦ãããä½ããå¤ãã£ãã¿ã¤ãã³ã°ã§ãã£ãã·ã¥ãpurgeããã¦æ°ãããã®ãåå¾ã§ããã¨ããã¢ãã«
- fastlyã®ãã£ãã·ã¥ãµã¼ãã¯ãªã¯ã¨ã¹ããthundering herdãé²ãæ©è½ã¨ãã¦ã¯ã©ã¹ã¿ãªã³ã°ãã¦ãããããpullåã§ã
TTLãåãã/ãã£ãã·ã¥purgeããç¬éã«originã«å¤§éã¢ã¯ã»ã¹
ã®ãããªãã¨ã¯èµ·ããªã- ã¯ã©ã¹ã¿ãªã³ã°ã¯ä½ãè¨å®ãã¦ããªãã¦ãåæã«æå¹ã«ãªã£ã¦ããã
- (ãããè¥å¹²æ¬å½ã«ããã§æ£ããã£ãã確èªããããç¹ã«shieldã«é¢ããç解ãææ§) objectã®ããã·ã¥å¤ã調ã¹ã¦masterã調ã¹ã¦ããã«æããããã®å¾ããä¸æ®µéåæ§ã®ãã¨ããã¦ãoriginã«æãããoriginã¸ã®ãªã¯ã¨ã¹ãã¯shieldããããæ¥ãªããã¨ãããã¨ãã§ãã
- shieldã«ã¤ãã¦åç §ï¼ オリジンシールド - パフォーマンス・チューニング | Fastly Help Guides
- ã¯ã©ã¹ã¿ãªã³ã°ã¯ä½ãè¨å®ãã¦ããªãã¦ãåæã«æå¹ã«ãªã£ã¦ããã
- optimizing delivery
- VCLã®binaryã¸ã®å¤æãå ¨ã¦ã®edgeã§ãã£ã¦ããããã£ãããªãã®ã§ãbinaryãä½ã£ã¦é ä¿¡ããããã«ãã¦ãã
- routing service(fastlyã®edge cloudèªä½ã®ãã¨ãæãã¦ãã)ãcompiler serviceã«åãåãããcompiler serviceãroutingã«VCLãåãåãããcontrol planeããVCLãè¿ãããcompilerãbinaryã«å¤æãã¦edgeã«è¿ã
- node, pop, customeræ¯ã«å°ããã¤binaryç´æ¥åå¾ã¸å¤æ´ãã¦ãã£ã
- edgeãã"ããã¯binaryãåãåããã"ã¨ããã®ãaccept headerã§è¡¨ç¾ãaccept headerã§æ¸¡ãã¦ãããã¹ããè¿ãå ´åããã(control planeããã®å¤æããã)ãrouting serviceã¯control planeã«binaryãè¿ãã確èªããã«ã¹ã¿ãã¼ããµã¼ãã¹ã®feature flagãã¿ã¦yesã ã£ãããbinaryãè¿ãããã«ãã
- accept: varnish-soã§ããããã¤ãcompiler_service.healthyã§ããã°compilerã«è¡ããã¤ã¾ããcompilerã®ãã«ã¹ãã§ãã¯ãè½ã¨ãããå ¨é¨æ»ã
- (質å) vclåæ ããæã«è¡ããããã¨ãvclã®ãã¹ãã®ä»æ¹ã«ã¤ãã¦
- syntax checkã§apiããã¨ã©ã¼ãè¿ã
- vclèªä½ããã¼ã«ã«ã§ãã¹ãããã®ã¯ä¸çç¸ã§ãããªãã®ã§ãåãè¨å®ãæã¤å¥ã®ãµã¼ãã¹ãä½ã£ã¦ããã«ãªã¯ã¨ã¹ããéã£ã¦ãã¹ãããã®ããã¹ããã©ã¯ãã£ã¹
- vclFiddleã¨ãããµã¼ãã¹ã§ãã§ãã¯ãããã¨ãã§ãã
- fastlyã§ã¯apiã®ãããã¤ã¯terraformã使ã£ã¦ãã¦ãããã«PRãéã£ã¦ãã¼ã¸ãããã¨ãããã¤ããã
Introduction to Lucet
ãããä»åä¸çªèãããã£ãã¨ããã§ãã£ãããããä½èª¿ä¸è¯ã¨è±èªã¨å 容ã®é£ããã«ããã»ã¨ãã©é ãç解ã§ããªãã£ãâ¦è±èªã®é¨åã¯åæé訳ãããããã ãã©ãåæé訳ããã®çºè¡¨ã«æ £ãã¦ããªãã£ããã¨ããã®ãããã
ã¡ã¢
- CTOãã
- å°äººæ°ã®ãªãµã¼ããã¼ã ãçãã¦ãã
- terrariumã¯lucetã§åãã¦ãã
- lucetã®å é¨æ§é ã«ã¤ãã¦
- lucetã¯compiler
- lucetã¯runtimeã§ããããå®å ¨ã¨åé¢
- lucetã¯ãã¼ã«ã»ããã§ããã
- ãããã¡ã¤ã©ã»ãããã¬ã¨ã®çµ±åãèãã¦ãã
- wasmã«ã¯ãéçåä»ãã®å人çä¸ä½ã®TS, Rust, Cã®3ã¤ãåççã好ã
- wasmã¸ã®ã³ã³ãã¤ã«ã¯lucetã®å¤ã§è¡ããããassemblyscript, rustc(Rust), llvm(C)
- wasiã¨ããã¹ã¿ã³ãã¼ããmozillaã¨ä½ã£ã¦ãã
- wasmã®å¤çã¸ã®interfaceãããããã®compilerã§å¥ã®åãçµã¿ããã¦ãããwasiããªãããã®ã¤ã³ã¿ã¼ãã§ã¼ã¹ãä¸ãããposixãªã©ã¨ä¼¼ã¦ãã
- wasmã§edge computingãèãã¦ãã
- lucetã¯ãã©ã¦ã¶ã®å¤ã§wasmãåããå ´åã®çã
- wasm -> lucet -> native code
- AOT compilerã«ãã£ã¦elfãªãã¸ã§ã¯ããã¡ã¤ã«ã¨ãªã
- lucetc ã¯lucetã®compilerãµã¤ã
- wasmã®parser -> verifier(compileãããã¨ãã¦ãããã®ãæå¹ãªã¢ã¸ã¥ã¼ã«ãªã®ããæå¹ãããªãã¨å±éº) -> translator(wasmã®byteã³ã¼ããä¸é表ç¾ã«) -> codegen -> artifact(metaãã¼ã¿ã«æ²¿ã£ã¦ããã±ã¼ã¸å) -> runtime
- ä¸è¨ã®codegenã¯cranelift(ã³ã¬èªä½ãverifierã®ãããªåã)ãè¡ããcraneliftã¯mozillaã¨å
±åéçº
- verifier(ä¸ææ表ç¾ãæ£ããã) -> preopt(æé©å) -> legalizer(native codeçæã®èµ·ãã¦ããã¨ãããç¹å®ã®ããã»ããµã§ã³ã¼ãèªè¨¼(legalize)ãè¡ããããmachine codeã¨1対1ã®ãããã³ã°) -> postopt(ç¹å®ã®ã¢ã¼ããã¯ãã£ãã¿ã¼ã²ããã¨ãã¦æé©åãããã¤ãã®load/storeãçµ±åãã¦single instructionã«ãããã¨ããããè¡ããã) -> register allocator(ãã¹ã¦ã®ã·ã³ããªãã¯å¤æ°ãåãè¾¼ã) -> branch relaxer(説æã¯å²æãã¡ã¢ãªã®æçµã³ã¼ããã©ã®ããã«ã¬ã¤ã¢ã¦ãããã)
runtime
- metadata, globals, linear memory, guest stack, signal stack ã®ãããªã¡ã¢ãªã®ç´°é¨ã®ã¬ã¤ã¢ã¦ããæ°åãæ°ä¸ã®ä¸¦åå¦çãã§ããããã«
ãªãããããããããããï¼
- ã客ã«ææ°ã®edge computingãæä¾ãããã£ãããããã©ã¼ãã³ã¹ã¨å®å ¨æ§ã«å¤å¤§ãªãé æ ®ããã¦ãã¦ãæä¾ãããæ©è½ãæä¾ã§ãã¦ãªãã£ããå®å ¨æ§ã¨ããã©ã¼ãã³ã¹ã両æ¹ã§ãããã¯ããã¸ã¼ããªã2å¹´åã«ä½ãå§ãããlucetã¨ãã¦open sourceã§ä½ãå§ãã OSXã®ãµãã¼ããx86-64ã®ã¿ã§ç¾å¨ã¯å®è¡ãfastlyã¯intellã®ããã»ããµã®ã¿ã
lucetã®live demo
- lucetã¨wasiãã©ããªãµãã«åãã(注ï¼ä»¥ä¸ãdekokunã¯å ¨ç¶ç解ããæ©æ¢°çã«åã«åã£ããã®ãæ¸ãåããã®ã¿ã§ãã
- fastly/lucet: Lucet, the Sandboxing WebAssembly Compiler.
- helllo.cãã¾ãwasmã«compuleã
wasm32-unknown-wasi-clang hello.c -o hello.wasm
- wasm-objdump -h hello.wasm
- wasm-objdump -xj function hello.wasm
- lucetc-wasi hello.wasm -o hello.so
- lucet-objdump -t hello.so | grep "F .text" # ãã¼ãã«ãªelfãã¡ã¤ã«ã«
- lucet-wasi hello.so
質å
- cranliftã¨lucetã®éãã
- cranliftã¯law levelã§å®å ¨æ§ã®ä¿è¨¼ãã§ãã¦ããªã
- ã³ã³ããã§èµ°ãããã®ã¨ä½ãéãã®ã
- v8ãã³ã³ããã¨æ¯ã¹ã¦è»½éã大éã®ã¤ã³ã¹ã¿ã³ã¹ãé«éã«èµ·åã§ãã
LT
æ®å¿µãªããä½èª¿æªãã¦æ©éâ¦èãããã£ããâ¦ä»¥ä¸ãæµãã¦ããçºè¡¨è³æã«å¯¾ããææ³ã
blog.spacemarket.com ç§ãCookieãè¦ã¦ãã£ãã·ã¥ãåºããã©ããã®å®è£ ããããã¨ããããéãã°ã¤ã³ç¶æ ã®ãã£ãã·ã¥ããã¬ããçªç¶ã®æ¤ç´¢æµå ¥å¯¾çãªã©ã«å§åçã«ä¾¿å©ããããèªåã§ã³ã³ãã¼ãã³ããç¨æããªãã¦ãVCLæ¸ãã¦CDNã§åãã®ã¯ãã£ã±å§åçã«å¬ããããªãã
speakerdeck.com 404ããã£ãã·ã¥ããã¦å¤§å¤ã£ã¦ã®ã¯ãããããâ¦å¯¾çé¨åã«ãæ¸ãã¦ãã2ã¤ãã¾ãã«éè¦ãªå¯¾çã ãªãã誰ã§ããã¤ã§ãç°¡åã«ãããç½ ã ã¨æãã®ã§ä»å¾ç§ãæ°ãã¤ãããâ¦
æå¾ã«
ä¸è¨2æ¬ã®å 容ã¯å¥è¨äºã«ãã¦ãè¯ãã£ãããfastly meetupä¸ã«ã©ãã©ãä½èª¿ãæªããªããã¾ãå 容ãç解ã§ãããæå¾ã¯éä¸é¢è±ããã®ã§æ¸ããã¨ããã¾ããªãã¨ããã®ãããã³ã³ãã³ã2æ¬ç«ã¦ã«ãããé¢é£ã®ããå 容ã ãã¾ãããã ããã
æ´ã«æå¾ã«
CDNã®Dã¯dekokunã®Dã§ã(ã¨æè¿ç¤¾å ã§è¨ãç¶ãã¦ãããid:papix ãããèãã¦ãããæé«ã®æ¨èªããããã¨ããããã¾ããã¾ã å®ç¸¾ã¯ä¼´ã£ã¦ããªãã®ã§å®ç¸¾ä½ã£ã¦ãããã
-
ä¾ãã°ã エッジコンピューティングに向けた分散キャッシュ技術の調査 - ゆううきブログ ã«ã¯AWS Lambda@Edge2ï¼Cloudflare Workers3ï¼fly.io4ã®ä¾ãåºã¦ããããæ¬ã¨ã³ããªã§æ±ãfastlyã®Terrariumããã®ä¸ã¤ã§ãã↩
-
å ãè¶ ããããã®ããã³ãã¨ã³ãã¢ã¼ããã¯ã㣠- Speaker Deck ã®Cache Awareãªè¨è¨åç §↩
-
ãã£ã¨ããåååéä¸ãã£ã¦ããããæ¸ãã¦ãã¦ä¸ã®è注ã®
Cache Awareãªè¨è¨
ã§ããããããï¼ã¨ããæ°ããããCDNã«ãã ããå¿ è¦ããªããããªæã¯ããã↩