Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
'Server-side on Swift' by Volodymyr Shevchenko
Search
CocoaHeads Ukraine
December 16, 2017
Programming
0
58
'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
Share
More Decks by CocoaHeads Ukraine
See All by CocoaHeads Ukraine
Reasons to love functional programming
cocoaheadsukraine
1
16
Effective A/B testing in iOS Apps
cocoaheadsukraine
1
25
How to hide from very curious users
cocoaheadsukraine
1
29
Hacking iOS Simulator
cocoaheadsukraine
1
180
Dig into Value types. It's really obvious when to use them. Or not?!
cocoaheadsukraine
0
550
Классифицируем текст в iOS без CoreML: как и зачем?
cocoaheadsukraine
0
130
Managed side effects
cocoaheadsukraine
3
160
10 lines of encryption, 1500 lines of key management
cocoaheadsukraine
1
110
Мифический full-stack разработчик
cocoaheadsukraine
2
210
Other Decks in Programming
See All in Programming
『自分のデータだけ見せたい!』を叶える──Laravel × Casbin で複雑権限をスッキリ解きほぐす 25 分
akitotsukahara
1
550
「Cursor/Devin全社導入の理想と現実」のその後
saitoryc
0
160
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
330
5つのアンチパターンから学ぶLT設計
narihara
1
110
今ならAmazon ECSのサービス間通信をどう選ぶか / Selection of ECS Interservice Communication 2025
tkikuc
20
3.6k
ReadMoreTextView
fornewid
1
480
Azure AI Foundryではじめてのマルチエージェントワークフロー
seosoft
0
130
Blazing Fast UI Development with Compose Hot Reload (droidcon New York 2025)
zsmb
1
220
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
1
400
Cline指示通りに動かない? AI小説エージェントで学ぶ指示書の書き方と自動アップデートの仕組み
kamomeashizawa
1
580
#kanrk08 / 公開版 PicoRubyとマイコンでの自作トレーニング計測装置を用いたワークアウトの理想と現実
bash0c7
1
440
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
2
360
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
36
2.8k
A Tale of Four Properties
chriscoyier
160
23k
How to train your dragon (web standard)
notwaldorf
93
6.1k
KATA
mclloyd
29
14k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
53k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
60k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
930
Faster Mobile Websites
deanohume
307
31k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.6k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Transcript
Server-side on Swift by Volodymyr Shevchenko
What for? - We will do mobile better - Can’t
build App on our own - Backend is a black-box with API
Why Swift? ??
Why Swift? - we know Swift - we can reuse
some code - Swift is faster
Kitura Perfect Vapor Zewo What do we have:
⭐ 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
Vapor Perfect
Let’s build something
Pet Store - Authorization - Domain CRUD - REST API
Check Local Credentials Create new User Check FB Credentials Create
Session Object Success? Facebook Database Cache Yes No ERROR response TOKEN response
Success? Database Cache Yes Proceed with request 401 response Fetch
session from Cache Fetch session from DB Success? No No Yes
User Pet Order Tag Category Domain relations *
Our stack: - Perfect as a framework - Mongo DB
as storage - StORM as ORM
Few words from Cap…
Leaks are evil
None
Crashes are evil
! Force unwrap is evil
Cocoapods Carthage SPM
XCode just an editor
≠
- this won’t compile on Linux: - after fix:
Foundation is NOT ported for 100% https://github.com/apple/swift-corelibs-foundation/blob/master/Docs/Status.md … …
≠ (curl + libssl) (curl + openssl)
[“a”, “b”, ”c”] -> “a, b, c” Bugs in MongoDBStORM
[“a”, “b”, ”c”] -> “a, b, c” - Work without
ORM - Switch to an other DB - Switch to Vapor + Fluent - Fix bug
Nested objects are MongoDBStORM not supported
¯\_(ツ)_/¯
Lets Deploy
Where?
Where? - Amazon EC2 - Microsoft Azure - Google Cloud
- Digital Ocean - Linode - Alibaba cloud - IBM cloud - Packet - Vultr - …
Where? - Amazon EC2 - Microsoft Azure - Google Cloud
- Digital Ocean - Linode - Alibaba cloud - IBM cloud - Packet - Vultr - …
How to deploy?
Perfect Assistant
Perfect Assistant
Docker
Plain
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
Performance - apib tool - Latency (MIN, MAX, AVG) -
Requests/second
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
Scale - Vertical - Horizontal
Database is Server Database Server API Server Network
Scaled infrastructure Database Server API Server II API Server I
API Server III Load Balancer
0 500 1000 1500 2000 Empty Auth Auth + read
Auth + write Requests per second
0 150 300 450 600 Empty Auth Auth + read
Auth + write Average latency, ms
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
Questions?
Thanks!