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

Node学園 25限 Introduction to Rust

Node学園 25限 Introduction to Rust

Node学園 25限の発表資料です。 

9a3693c0c3d12f2fbae51792dd6a1344?s=128

Akito0107

April 24, 2017
Tweet

Transcript

  1. Introduction to Rust Akito Ito (@Akito0107) NodeֶԂ25࣌ݶ໨

  2. ࣗݾ঺հ • ҏ౻ ӯ (@Akito0107) • Twitter / mstdn /

    Githubେମ͜ΕͰ͢ • ϦΫϧʔτςΫϊϩδʔζͱ͍͏ձࣾͰ
 ιϑτ΢ΣΞΤϯδχΞΛ΍͍ͬͯ·͢ɻ • ීஈ͸js(΋)ॻ͍ͯ·͢
  3. ͪΐͬͱ঺հ ઌिWʹͳΓ·ͨ͠ʂ

  4. None
  5. Agenda • Rustͱ͸ • RustͷԿ͕৽͍͠ͷ͔ • Rustͷ׆༻Λߟ͑Δ

  6. Rustͱ͸ • ొ৔࣌ظ͸2010೥͝Ζɻ2015೥10݄ʹ1.0ͷ ϦϦʔε • ओ೚։ൃऀ: Graydon Hoare • ϚϧνύϥμΠϜݴޠ

    • ҆શੑɺฒྻੑΛओ؟
  7. Rustͷ༻్ • System Programming • Network Programming • Kernel (OS

    / Device Driver / rust.koͰggr ) • Web Assembly (LLVMͷԸܙ) • etc…
  8. Rust࠾༻اۀ • Mozilla • Dwango • ෼ࢄfs • Dropbox •

    lossless compression
  9. RustͷԿ͕৽͍͠ͷ͔ • ϝϞϦ؅ཧ • खಈ / Smart Ptr / GCͳͲͷطଘͷ࢓૊Έͱ͸


    ҰઢΛը͢Δ • ҆શʹϝϞϦͷ؅ཧΛߦ͏
 => ॴ༗ݖͱ͍͏֓೦
  10. ϝϞϦྖҬͷछྨ • ΦϒδΣΫτΛಈతʹ֬อ͢ΔͨΊʹ༻͍Δ
 ϝϞϦྖҬʹ͸StackͱHeapͷ2छྨ͋Δ

  11. Stack • ̍ͭͷؔ਺΍αϒϧʔνϯ಺ͰͷΈ࢖༻͞Ε ΔΦϒδΣΫτͷ֬อʹ༻͍ΒΕΔ • είʔϓ͔Βൈ͚Δͱ։์͞ΕΔ • ߴ଎ʹ࣮ߦ͞ΕΔ

  12. Heap • ෳ਺ͷαϒϧʔνϯɺؔ਺Ͱ࢖͍·Θ͞ΕΔΦϒδΣ Ϋτͷ֬อʹ༻͍ΒΕΔ • ໌ࣔతʹ։์͕ඞཁ
 (ण໋ͷ؅ཧ) • (Stackʹൺ΂)
 Ұൠతʹ௿଎

    • σʔλߏ଄ͷheapͱ͸ؔ܎͕ͳ͍
  13. StackͱHeap (Cͷྫ) 1 int foo() { 2 int len =

    100; 3 int* head = (int*) malloc(sizeof(int) * len); 4 /* do some work.... */ 5 free(head); 6 return 0; 7 }
  14. StackͱHeap (Cͷྫ) 1 int foo() { 2 int len =

    100; 3 int* head = (int*) malloc(sizeof(int) * len); 4 /* do some work.... */ 5 free(head); 6 return 0; 7 } <= StackʹlenΛpush
  15. StackͱHeap (Cͷྫ) 1 int foo() { 2 int len =

    100; 3 int* head = (int*) malloc(sizeof(int) * len); 4 /* do some work.... */ 5 free(head); 6 return 0; 7 } ⊖ HeapʹྖҬΛ֬อ
  16. StackͱHeap (Cͷྫ) 1 int foo() { 2 int len =

    100; 3 int* head = (int*) malloc(sizeof(int) * len); 4 /* do some work.... */ 5 free(head); 6 return 0; 7 } <= Heap͔Β໌ࣔతʹ։์
  17. StackͱHeap (Cͷྫ) 1 int foo() { 2 int len =

    100; 3 int* head = (int*) malloc(sizeof(int) * len); 4 /* do some work.... */ 5 free(head); 6 return 0; 7 } <= Block͕ऴྃɺlen͕stack͔Βpop͞ΕΔ
  18. ϝϞϦ؅ཧখൌ (1) • Cݴޠ͸Heapͷ؅ཧΛखಈͰ͍ͯͨ͠ɻ • malloc() / free() • ਓྨʹ͸·ͩૣ͔ͬͨ

  19. खಈͰͷϝϞϦ؅ཧ 1 int foo() { 2 int len = 100;

    3 int* head = (int*) malloc(sizeof(int) * len); 4 /* do some work.... */ 5 free(head); 6 return 0; 7 } ͜͜Ͱ֬อ
  20. खಈͰͷϝϞϦ؅ཧ 1 int foo() { 2 int len = 100;

    3 int* head = (int*) malloc(sizeof(int) * len); 4 /* do some work.... */ 5 free(head); 6 return 0; 7 } ͜͜Ͱ։์
  21. CݴޠͰͷϝϞϦ؅ཧ • ಈతʹϝϞϦΛ֬อͨ͠Βɺඞͣࣗ෼Ͱղ์͠ͳ ͚Ε͹ͳΒͳ͍ • ม਺ͷण໋ΛखಈͰ؅ཧ͢Δͷ͸ਓྨʹ͸೉͍͠ • free()Λॻ͖๨ΕΔ <= memory

    leak • free()ͨ͠ϙΠϯλΛࢀর <= Seg fault
  22. ϝϞϦ؅ཧখൌ(2) • Garbage Collector (GC) ͷొ৔ • ͍Βͳ͘ͳͬͨHeapྖҬͷΦϒδΣΫτΛॲཧܥ͕ऩ ू͠ɺࣗಈͰ։์ͯ͘͠ΕΔ(ण໋؅ཧͷࣗಈԽ) •

    Java / Ruby / Python / Go…
 ࠓ೔஌ΒΕ͍ͯΔଟ͘ͷॲཧܥ͸GCΛ࣮૷ • ΋ͪΖΜJavascript΋͜Ε
  23. GCݴޠʹ͓͚ΔϝϞϦ؅ཧͷ
 ࢓૊Έ • ੜ͖ͯΔΦϒδΣΫτͱࢮΜͰΔΦϒδΣΫ τΛ൑ผ͠ɺࢮΜͰΔΦϒδΣΫτΛ։์ 7.)FBQ 3PPU
 0CK " #

    $ %
  24. GCͷ໰୊఺ • ॏ͍ • GC͕૸͍ͬͯΔؒ͸ॲཧ͕ࢭ·Δ
 (Stop The world) • ॲཧܥ͕ෳࡶʹͳΔ

    • ਓྨ͸ద߹Ͱ͖͕ͨϚγϯʹͱͬͯૣ͗ͨ͢
  25. ͜͜·Ͱͷ·ͱΊ • StackྖҬͱHeapྖҬ͕͋Δ • HeapྖҬͷม਺ͷण໋ΛͲ͏΍ͬͯ؅ཧ͢Δ ͔ͷ໰୊ • खಈ => GC

    (=> ϗϯτ͸C++ͷεϚʔτϙΠϯλ΋͋Δ͚ͲׂѪ) ҆શੑͱ଎౓ͷτϨʔυΦϑ
  26. RustͷΞϓϩʔν • ଎౓ͱ҆શੑΛཱ྆ͤ͞Δ • GC͸༻͍ͳ͍ • ม਺ͷण໋ͷ؅ཧʹର͠ɺॴ༗ݖγεςϜͰ ղܾΛࢼΈͨ

  27. RustͷϝϞϦϞσϧ • RustͷDefault͸Stack΁ͷAllocate BEES OBNF WBM O ʜ  

     ϝϞϦStack 1 struct Foo { 2 pub n: u32, 3 } 4 5 impl Foo { 6 fn new() -> Foo { 7 Foo { n: 42 } 8 } 9 } 10 11 fn main() { 12 let foo = Foo::new(); 13 let bar = 12; 14 } ←Start
  28. RustͷϝϞϦϞσϧ • RustͷDefault͸Stack΁ͷAllocate BEES OBNF WBM O ʜ  

    CBS   GPP 'PP\O^ ϝϞϦStack 1 struct Foo { 2 pub n: u32, 3 } 4 5 impl Foo { 6 fn new() -> Foo { 7 Foo { n: 42 } 8 } 9 } 10 11 fn main() { 12 let foo = Foo::new(); 13 let bar = 12; 14 }
  29. RustͷϝϞϦϞσϧ • RustͷDefault͸Stack΁ͷAllocate BEES OBNF WBM O ʜ  

     Stack 1 struct Foo { 2 pub n: u32, 3 } 4 5 impl Foo { 6 fn new() -> Foo { 7 Foo { n: 42 } 8 } 9 } 10 11 fn main() { 12 let foo = Foo::new(); 13 let bar = 12; 14 }←͜͜Ͱղ์
  30. ϝϞϦϞσϧʢؔ਺ݺͼग़͠ʣ 1 fn bar() { 2 let a = 10;

    3 let b = 15; 4 println!("{}", a + b); 5 } 6 7 fn main() { 8 let foo = Foo::new(); 9 bar(); 10 } 11 BEES OBNF WBM O ʜ    Stack
  31. ϝϞϦϞσϧʢؔ਺ݺͼग़͠ʣ 1 fn bar() { 2 let a = 10;

    3 let b = 15; 4 println!("{}", a + b); 5 } 6 7 fn main() { 8 let foo = Foo::new(); 9 bar(); 10 } 11 BEES OBNF WBM O ʜ    GPP 'PP\O^ Stack ←call
  32. ϝϞϦϞσϧʢؔ਺ݺͼग़͠ʣ 1 fn bar() { 2 let a = 10;

    3 let b = 15; 4 println!("{}", a + b); 5 } 6 7 fn main() { 8 let foo = Foo::new(); 9 bar(); 10 } 11 BEES OBNF WBM O ʜ  C   B   GPP 'PP\O^ Stack ←call bar()ͷstack frame
  33. ϝϞϦϞσϧʢؔ਺ݺͼग़͠ʣ 1 fn bar() { 2 let a = 10;

    3 let b = 15; 4 println!("{}", a + b); 5 } 6 7 fn main() { 8 let foo = Foo::new(); 9 bar(); 10 } 11 BEES OBNF WBM O ʜ    GPP 'PP\O^ Stack ← end
  34. ϝϞϦϞσϧʢؔ਺ݺͼग़͠ʣ 1 fn bar() { 2 let a = 10;

    3 let b = 15; 4 println!("{}", a + b); 5 } 6 7 fn main() { 8 let foo = Foo::new(); 9 bar(); 10 } 11 BEES OBNF WBM O ʜ    Stack ← end
  35. Heap Allocation • ΋ͪΖΜHeap Allocation΋Ͱ͖Δ • std::boxed::BoxΛ࢖͏ 1 use std::boxed::Box;

    2 fn boxed_foo() -> Box<Foo> { 3 Box::new(Foo::new()) 4 } 5 fn main() { 6 let foo = boxed_foo(); 7 println!("{}", foo.n); 8 }
  36. BoxΛ࢖ͬͨͱ͖ͷϝϞϦ BEES OBNF WBM O ʜ    BEES

    OBNF WBM Stack heap 1 use std::boxed::Box; 2 fn boxed_foo() -> Box<Foo> { 3 Box::new(Foo::new()) 4 } 5 fn main() { 6 let foo = boxed_foo(); 7 println!("{}", foo.n); 8 }
  37. BoxΛ࢖ͬͨͱ͖ͷϝϞϦ BEES OBNF WBM O ʜ    GPP

    Š BEES OBNF WBM Stack heap 1 use std::boxed::Box; 2 fn boxed_foo() -> Box<Foo> { 3 Box::new(Foo::new()) 4 } 5 fn main() { 6 let foo = boxed_foo(); 7 println!("{}", foo.n); 8 } ←call
  38. BoxΛ࢖ͬͨͱ͖ͷϝϞϦ BEES OBNF WBM O ʜ    GPP

    Š BEES OBNF WBM Stack heap 1 use std::boxed::Box; 2 fn boxed_foo() -> Box<Foo> { 3 Box::new(Foo::new()) 4 } 5 fn main() { 6 let foo = boxed_foo(); 7 println!("{}", foo.n); 8 } ←call
  39. BoxΛ࢖ͬͨͱ͖ͷϝϞϦ BEES OBNF WBM O ʜ    GPP

    Š BEES OBNF WBM " 'PP\O^ Stack heap 1 use std::boxed::Box; 2 fn boxed_foo() -> Box<Foo> { 3 Box::new(Foo::new()) 4 } 5 fn main() { 6 let foo = boxed_foo(); 7 println!("{}", foo.n); 8 } ←call
  40. BoxΛ࢖ͬͨͱ͖ͷϝϞϦ BEES OBNF WBM O ʜ    GPP

    " BEES OBNF WBM " 'PP\O^ Stack heap 1 use std::boxed::Box; 2 fn boxed_foo() -> Box<Foo> { 3 Box::new(Foo::new()) 4 } 5 fn main() { 6 let foo = boxed_foo(); 7 println!("{}", foo.n); 8 } ←return
  41. BoxΛ࢖ͬͨͱ͖ͷϝϞϦ BEES OBNF WBM O ʜ    GPP

    " BEES OBNF WBM " 'PP\O^ Stack heap 1 use std::boxed::Box; 2 fn boxed_foo() -> Box<Foo> { 3 Box::new(Foo::new()) 4 } 5 fn main() { 6 let foo = boxed_foo(); 7 println!("{}", foo.n); 8 }←End
  42. BoxΛ࢖ͬͨͱ͖ͷϝϞϦ BEES OBNF WBM O ʜ    GPP

    " BEES OBNF WBM Stack heap 1 use std::boxed::Box; 2 fn boxed_foo() -> Box<Foo> { 3 Box::new(Foo::new()) 4 } 5 fn main() { 6 let foo = boxed_foo(); 7 println!("{}", foo.n); 8 }←End ࢀরઌHeapྖҬΛղ์
  43. BoxΛ࢖ͬͨͱ͖ͷϝϞϦ BEES OBNF WBM O ʜ    BEES

    OBNF WBM Stack heap 1 use std::boxed::Box; 2 fn boxed_foo() -> Box<Foo> { 3 Box::new(Foo::new()) 4 } 5 fn main() { 6 let foo = boxed_foo(); 7 println!("{}", foo.n); 8 }←End
  44. ͜ͷέʔεΛߟ͑ͯΈΑ͏ 1 fn print_n(foo2: Box<Foo>) { 2 println!("{}", foo2.n); 3

    } 4 fn main() { 5 let foo = boxed_foo(); 6 print_n(foo); 7 println!("{}", foo.n); 8 }
  45. ͜ͷέʔεΛߟ͑ͯΈΑ͏ 1 fn print_n(foo2: Box<Foo>) { 2 println!("{}", foo2.n); 3

    } 4 fn main() { 5 let foo = boxed_foo(); 6 print_n(foo); 7 println!("{}", foo.n); 8 } BEES OBNF WBM O ʜ    GPP " BEES OBNF WBM " 'PP\O^ Stack heap
  46. ͜ͷέʔεΛߟ͑ͯΈΑ͏ 1 fn print_n(foo2: Box<Foo>) { 2 println!("{}", foo2.n); 3

    } 4 fn main() { 5 let foo = boxed_foo(); 6 print_n(foo); 7 println!("{}", foo.n); 8 } BEES OBNF WBM O ʜ   GPP "  GPP " BEES OBNF WBM " 'PP\O^ Stack heap ←call
  47. ͜ͷέʔεΛߟ͑ͯΈΑ͏ 1 fn print_n(foo2: Box<Foo>) { 2 println!("{}", foo2.n); 3

    } 4 fn main() { 5 let foo = boxed_foo(); 6 print_n(foo); 7 println!("{}", foo.n); 8 } BEES OBNF WBM O ʜ   GPP "  GPP " BEES OBNF WBM Stack heap ←End foo2ࢀরઌΛղ์
  48. ͜ͷέʔεΛߟ͑ͯΈΑ͏ 1 fn print_n(foo2: Box<Foo>) { 2 println!("{}", foo2.n); 3

    } 4 fn main() { 5 let foo = boxed_foo(); 6 print_n(foo); 7 println!("{}", foo.n); 8 } BEES OBNF WBM O ʜ    GPP " BEES OBNF WBM Stack heap ← ͜͜
  49. ͜ͷέʔεΛߟ͑ͯΈΑ͏ 1 fn print_n(foo2: Box<Foo>) { 2 println!("{}", foo2.n); 3

    } 4 fn main() { 5 let foo = boxed_foo(); 6 print_n(foo); 7 println!("{}", foo.n); 8 } BEES OBNF WBM O ʜ    GPP " BEES OBNF WBM Stack heap ← !? fooࢀরઌ͕ղ์ࡁʁ
  50. ͜Ε͸ίϯύΠϧΤϥʔʹͳΔ 1 fn print_n(foo2: Box<Foo>) { 2 println!("{}", foo2.n); 3

    } 4 fn main() { 5 let foo = boxed_foo(); 6 print_n(foo); 7 println!("{}", foo.n); 8 }
  51. ͜Ε͸ίϯύΠϧΤϥʔʹͳΔ

  52. ॴ༗ݖ (ownership) • ॴ༗ݖ = ͦͷΦϒδΣΫτΛղ์͢Δݖར • Rust͸ΦϒδΣΫτͷॴ༗ݖ͸جຊతʹ1ͭͷ ม਺ʹଋറ͞ΕΔ •

    ҧ൓ͨ͠৔߹͸͢΂ͯίϯύΠϧΤϥʔ
  53. ͜ͷ࣌ʹfoo͔Βॴ༗ݖফࣦ 1 fn print_n(foo2: Box<Foo>) { 2 println!("{}", foo2.n); 3

    } 4 fn main() { 5 let foo = boxed_foo(); 6 print_n(foo); 7 println!("{}", foo.n); 8 } BEES OBNF WBM O ʜ   GPP "  GPP " BEES OBNF WBM " 'PP\O^ Stack heap ←call
  54. 0ͷྖҬ΁ͷΞΫηε͸ېࢭ͞ ΕΔ 1 fn print_n(foo2: Box<Foo>) { 2 println!("{}", foo2.n);

    3 } 4 fn main() { 5 let foo = boxed_foo(); 6 print_n(foo); 7 println!("{}", foo.n); 8 } BEES OBNF WBM O ʜ   GPP "  GPP " BEES OBNF WBM " 'PP\O^ Stack heap ←call
  55. ίϯύΠϥ͕ݕ஌ʂ 1 fn print_n(foo2: Box<Foo>) { 2 println!("{}", foo2.n); 3

    } 4 fn main() { 5 let foo = boxed_foo(); 6 print_n(foo); 7 println!("{}", foo.n); 8 } BEES OBNF WBM O ʜ   GPP "  GPP " BEES OBNF WBM " 'PP\O^ Stack heap ↑ҧ൓
  56. ΋͏̍͜ͷέʔε 1 struct Foo { 2 pub n: u32, 3

    } 4 impl Foo { 5 fn new() -> Foo { 6 Foo { n: 42 } 7 } 8 } 9 fn main() { 10 let foo = Foo::new(); 11 let bar = foo; 12 println!("{}", foo.n); 13 }
  57. ͜Ε΋ίϯύΠϧΤϥʔ 1 struct Foo { 2 pub n: u32, 3

    } 4 impl Foo { 5 fn new() -> Foo { 6 Foo { n: 42 } 7 } 8 } 9 fn main() { 10 let foo = Foo::new(); 11 let bar = foo; 12 println!("{}", foo.n); 13 } ←͜͜Ͱॴ༗ݖͷҠৡ͕ൃੜ
  58. ॴ༗ݖͷҠৡͱ୅ೖ • Rustʹ͓͚Δ `=` ͷҙຯ͸ʮ୅ೖʯͰ͸ͳ͘ɺ
 ʮҠৡʯ (*Copy TraitΛ࣮૷͍ͯ͠ͳ͍৔߹) • ॴ༗ݖ͕Ҡৡ͞Εͨޙͷม਺(foo)ʹର͢Δ


    ૢ࡞͸ίϯύΠϥ͕͢΂ͯ஄͘
  59. ࢀরͱआ༻ • Read Onlyͷࢀর
 Λି͠෇͚Δ͜ͱ͕
 Ͱ͖Δ 1 fn print_n(foo: &Foo)

    { 2 println!("{}", foo.n); 3 } 4 fn main() { 5 let foo = Foo::new(); 6 let a = &foo; 7 let b = &foo; 8 let c = &foo; 9 print_n(a); 10 print_n(b); 11 print_n(c); 12 }
  60. ϛϡʔλϒϧࢀর • Write΋Ͱ͖Δࢀর
 # 1͔ͭ͠ି෇ΒΕͳ͍ 1 fn print_n(foo: &mut Foo)

    { 2 foo.n = 100; 3 println!("{}", foo.n); 4 } 5 fn main() { 6 let mut foo = Foo::new(); 7 let a = &mut foo; 8 // let b = &mut foo; <= ͜Ε͸ίϯύΠϧΤϥʔ 9 print_n(a); 10 }
  61. आ༻ͱण໋ • आ༻ઌͷण໋ > आ༻ݩͷण໋
 ͸ίϯύΠϧΤϥʔ 1 fn main() {

    2 let a; 3 { 4 let b = 100; 5 a = &b; 6 } 7 println!("{}", a); 8 }
  62. ৭ʑ • Lifetime Parameter
 ࢀরΛฦ͢ͱ͖ʹ໌ࣔ͢Δܕύϥϝʔλ • ৄ͘͠͸RustͷDocumentΛࢀর… • https://rust-lang-ja.github.io/the-rust- programming-language-ja/1.6/book/

    ownership.html
  63. RustͷԿ͕ྑ͍ͷ͔ • ॴ༗ݖγεςϜʹΑΔ҆શͳϝϞϦ؅ཧ
 ʢฒྻੑʹ΋د༩ʣ • ϝϞϦ҆શɺσʔλڝ߹҆શΛ͢΂ͯ
 ίϯύΠϥ͕νΣοΫͯ͘͠ΕΔ • (ଞʹ΋) ચ࿅͞ΕͨύλʔϯϚον΍Τϥʔॲ

    ཧͳͲ
  64. ͔͜͜Β͸RustΛͲΜͳͱ͜ Ζʹ׆༻͠Α͏ͱ͍ͯ͠Δ͔ Λ஻Γ·͢


  65. Rustͷ׆༻Λߟ͑Δ • ߴεϧʔϓοτ͕ٻΊΒΕΔNetwork Middleware • CPU IntensiveͳॲཧΛߦ͏αʔό
 ྫ) ը૾ɾಈըͷEncoding Server


    SSR༻ͷServer
  66. ݱࡏݕূ͠Α͏ͱ͍ͯ͠Δ΋ͷ • ը૾ͷಈతม׵αʔό • http://hoge/w/200/h/200/kaicho.jpg original small

  67. Event LoopͱCPU intensive • ҰൠతʹɺNode.js͸CPU Intensiveͳॲཧʹ ͸޲͔ͳ͍ͱݴΘΕ͍ͯΔ • CPU Intensive͸ॲཧ͸Event

    LoopΛετοϓ ͤͯ͞͠·͍ɺεϧʔϓοτΛ௿Լͤͯ͞͠ ·͏ɻ
  68. 5ISFBE1PPM ʢԾઆʣطଘγεςϜͷ໰୊఺ • Event LoopϞσϧͷαʔόʹCPU Intensiveͳ taskΛ૊ΈࠐΉ৔߹ɺEventLoopΛϒϩοΫ͢ ΔΑ͏ʹ࣮૷͞Ε͍ͯΔέʔε͕ଟ͘ɺεϧʔ ϓοτʹѱӨڹ 5BTL

    5BTL &WFOU '4 #MPDLʂ
  69. 5ISFBE1PPM ॲཧͷΦϑϩʔυ • CPU intensiveͳॲཧ͸BackendͷThread Pool ΁Ϣʔβ͕໌ࣔతʹ౤͛ΒΕΔઃܭ 5BTL 5BTL &WFOU

    '4
  70. Proof of Concepts • tokio-minihttp + ImageMagick Ͱ
 ؆қը૾ม׵αʔόΛߏங •

    (tokio … RustͰඇಉظIOΛఏڙ͢ΔFW) • ImageMagickΛIO / ThreadͰ࣮ߦ͢Δύλʔϯͱ ผ్֬อ͞ΕͨThread PoolͰ࣮ߦ͢ΔύλʔϯͰ εϧʔϓοτΛܭଌ
  71. ݕূ؀ڥ • Digital Ocean্ʹߏஙͨ͠Ubuntu (16.0.4.2) • rustc 1.18.0-nightly (1785bca51 2017-04-21)

    • Core 2 or 4 • RAM 2GB / 4GB • ಉ؀ڥͷUbuntu͔ΒwrkͰୟ͘
  72. ݁Ռ (2core) 0 2.25 4.5 6.75 9 10 50 100

    EV (2core) EV + MT (2core) ಉ࣌઀ଓ਺ req/s
  73. ݁Ռ (4core) 0 6 12 18 24 10 50 100

    EV (4core) EV + MT (4core) ಉ࣌઀ଓ਺ req/s
  74. ߟ࡯ • Event Loop Onlyͷ΋ͷ͸ಉ࣌઀ଓ਺্͕͕Δ ʹͭΕɺεϧʔϓοτ͕ݮগ͢Δ܏޲ • Event Loop +

    Multi-Threadͷ΄͏͸઀ଓ਺ʹ ର҆͠ఆ • Ծઆͷ࣮ূͷୈ̍า
  75. Future Work • httpαʔόࣗମͷ࠶࣮૷ • gzipͳͲͷ࣮૷ • Cache etc… •

    ͱΓ͋͑ͣ͋ͱ10ഒҎ্͸ૣ͘͠ͳ͚Ε͹
 ࢖͑ͳ͍
  76. Conclusion • Rustͷ͞ΘΓ • Heap / Stack • ॴ༗ݖγεςϜ •

    RustΛ༻͍ͨը૾Τϯίʔυαʔόͷ։ൃ
  77. Thank you for listening!