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

Server Side Swiftを
しばらく運用してみた話

Server Side Swiftを
しばらく運用してみた話

Yusuke Ito

June 27, 2017
Tweet

More Decks by Yusuke Ito

Other Decks in Programming

Transcript

  1. S E R V E R S I D E

    S W I F T Λ 
 ͠ ͹ Β ͘ ӡ ༻ ͯ͠ Έ ͨ ࿩ T O K Y O S E R V E R S I D E S W I F T M E E T U P # 8 Yusuke ItoɾനϠΪίʔϙϨʔγϣϯ novi 2017/06/27
  2. S E R V E R - S I D

    E S W I F T ӡ ༻ ɾ ࢼ ݧ த ͷ α ʔ Ϗ ε • ΫϩʔϦϯάΛߦͳ͏σʔϞϯ(Ϋϩʔϥʔ) • Ұͭ໨: 30kߦ • ೋͭ໨: 2~3000ߦ • gRPCϕʔεͷαʔόʔ • ͲͪΒ΋Swift 3.1.1Λ࢖༻
  3. t r y ! S w i f t ʹ

    ͯ … RDS ECS(EC2 Container Service)
  4. D O C K E R Ͱ C U R

    L ͕ ಈ ͔ ͳ ͍ ໰ ୊ • cURLΛ࢖͏ϥΠϒϥϦ͕Unknown Error·ͨ͸མͪΔ • URLSession • shiroyagicorp/swift-seeurl • Docker on macOS: ⭕, Docker on AWS(ECS): Crash • Docker → • libcurl4-openssl-devͰ͸ͳ͘libcurl4-gnutls-devΛ࢖͏
  5. T I M E Z O N E ܥ A

    P I ͕ ಈ ͔ ͳ ͍ • TimeZone(abbreviation: "JST") => nil ʹͳΔ • λΠϜκʔϯͷϑΝΠϧ͕DockerΠϝʔδʹೖ͍ͬͯ ͳ͍ • apt install tzdata ͢Δ (SR-4921) • SwfitͷDockerΠϝʔδΛެ͔ࣜΒϑΥʔΫͯࣗ͠෼ Ͱ࡞Δ
  6. G R P C α ʔόʔ ͕ མ ͪ Δ

    • AWS(ECS)ʹஔ͍ͯ1࣌ؒ͘Β͍ͯ͠ΞΫηε͢Δͱؾ ·͙ΕʹམͪΔ • XcodeσόοάϏϧυ&RunͰ࠶ݱ • Address Sanitizer, Thread sanitizer Λ࢖͏ • gRPCϥΠϒϥϦपΓʹ໰୊͋Γͦ͏
  7. M Y S Q L ͕ σ ο υ ϩ

    ο Ϋ • (Swift͸௚઀ؔ܎͋Γ·ͤΜ) • SHOW ENGINE INNODB STATUS ; Ͱ࠷ޙʹى͖ͨ σουϩοΫΛදࣔ • BULK INSERT࣌ͷσουϩοΫͬΆ͍ • ݪҼ: autocommit = 1 or 0; ͷ࢖͍ํ͕ؒҧͬͯͨ
  8. ௐ ࠪ • InstrumentsΛ࢖͏ • Memory Allocationଌఆπʔϧ • Xcodeͷπʔϧ͕࢖͑ͯศར •

    ϥϯλΠϜ(Linux or Darwin)͕ҧ͏ͷͰͦ͜͸໰୊ • ݪҼ·ͩௐࠪத