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

'Server-side on Swift' by Volodymyr Shevchenko

'Server-side on Swift' by Volodymyr Shevchenko

This talk was made for CocoaHeads Kyiv #13 which took place Dec 16 2017.

CocoaHeads Ukraine

December 16, 2017
Tweet

More Decks by CocoaHeads Ukraine

Other Decks in Programming

Transcript

  1. What for? - We will do mobile better - Can’t

    build App on our own - Backend is a black-box with API
  2. Why Swift? - we know Swift - we can reuse

    some code - Swift is faster
  3. ⭐ GitHub Req/sec Looks Good? Kitura 6K 2.1K No Perfect

    12.3K 4.2K Yes Vapor 11.6K 3.2K Yes Zewo 1.7K 1.7K No Benchmarks of the Top Server-Side Swift frameworks
  4. Check Local Credentials Create new User Check FB Credentials Create

    Session Object Success? Facebook Database Cache Yes No ERROR response TOKEN response
  5. Success? Database Cache Yes Proceed with request 401 response Fetch

    session from Cache Fetch session from DB Success? No No Yes
  6. [“a”, “b”, ”c”] -> “a, b, c” - Work without

    ORM - Switch to an other DB - Switch to Vapor + Fluent - Fix bug
  7. Where? - Amazon EC2 - Microsoft Azure - Google Cloud

    - Digital Ocean - Linode - Alibaba cloud - IBM cloud - Packet - Vultr - …
  8. Where? - Amazon EC2 - Microsoft Azure - Google Cloud

    - Digital Ocean - Linode - Alibaba cloud - IBM cloud - Packet - Vultr - …
  9. 2) Connect to remote machine via SSH 3) Install all

    required tools and libs 4) Setup Database server 5) Clone sources from Git repo 6) Compile 7) Configure firewall to allow http(s) traffic 8) Run executable 1) Create remote virtual machine on selected provider Plain Deploy
  10. Performance req/sec Lat, min Lat, max Lat, avg Healthcheck 26.8K

    0.6 42 7.4 Empty Auth 739 9 643 269 Auth + Read 407 10.1 952 487 Auth + Write 389 9.4 1028 511
  11. 0 500 1000 1500 2000 Empty Auth Auth + read

    Auth + write Requests per second
  12. 0 150 300 450 600 Empty Auth Auth + read

    Auth + write Average latency, ms
  13. Cluster Performance req/sec Lat, min Lat, max Lat, avg Healthcheck

    21.1K 1.4 1105 9.4 Empty Auth 1820 4.7 473 109 Auth + Read 897 3.1 243 55.6 Auth + Write 916 13 617 217.5