Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
60
'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
27
Effective A/B testing in iOS Apps
cocoaheadsukraine
1
39
How to hide from very curious users
cocoaheadsukraine
1
37
Hacking iOS Simulator
cocoaheadsukraine
1
190
Dig into Value types. It's really obvious when to use them. Or not?!
cocoaheadsukraine
0
590
Классифицируем текст в iOS без CoreML: как и зачем?
cocoaheadsukraine
0
130
Managed side effects
cocoaheadsukraine
3
180
10 lines of encryption, 1500 lines of key management
cocoaheadsukraine
1
110
Мифический full-stack разработчик
cocoaheadsukraine
2
220
Other Decks in Programming
See All in Programming
ゲームの物理 剛体編
fadis
0
370
「コードは上から下へ読むのが一番」と思った時に、思い出してほしい話
panda728
PRO
39
26k
AIの誤りが許されない業務システムにおいて“信頼されるAI” を目指す / building-trusted-ai-systems
yuya4
6
3.9k
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
130
Python札幌 LT資料
t3tra
6
1k
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
8
2.5k
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
4
960
tparseでgo testの出力を見やすくする
utgwkk
2
270
re:Invent 2025 のイケてるサービスを紹介する
maroon1st
0
150
Cap'n Webについて
yusukebe
0
150
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
170
perlをWebAssembly上で動かすと何が嬉しいの??? / Where does Perl-on-Wasm actually make sense?
mackee
0
120
Featured
See All Featured
The Cult of Friendly URLs
andyhume
79
6.7k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
170
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.4k
Building Applications with DynamoDB
mza
96
6.8k
How Software Deployment tools have changed in the past 20 years
geshan
0
30k
Color Theory Basics | Prateek | Gurzu
gurzu
0
150
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.2k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Navigating Team Friction
lara
191
16k
The Invisible Side of Design
smashingmag
302
51k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.4k
So, you think you're a good person
axbom
PRO
0
1.8k
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!