Robert Roskam
Engineer Manager at Pantheon
Organizer
@raiderrobert
twitter | github | medium
Introduction to Concurrency in Programming Languages
by Sottile, Mattson, Rasmussen
1 VM with 1 Core, $10/mo
(Prices are from Linode)
$10/core
1 VM with 2 Cores, $20/mo
$10/core
1 VM with 4 Cores, $40/mo
$10/core
1 VM with 6 Cores, $80/mo
$15/core
1 VM with 8 Cores, $160
$20/core
1 VM with 20 Cores, $480
$24/core
Core | Price/mo | Price per Core |
---|---|---|
16 | $320 | $20 |
20 | $480 | $24 |
24 | $640 | $27 |
32 | $960 | $30 |
1 VM with 4 Cores, $40/mo
$10/core
2 VMs with 4 Cores, each $40/mo
8 Cores for $120/mo
$10/core
DB VM
App VM
3 VMs with 4 Cores, each $40/mo
12 Cores for $120/mo
$10/core
DB VM
App VMs
4 VMs with 4 Cores, each $40/mo
16 Core for $160/mo
$10/core
DB VM
App VMs
Seems Legit?
Fundamentally
Minimum Cost Difference
10000x
*Depending on # of cores on system, working set size, # of other processes, and virtualization
Attempt to Humanize
Add | Context Switch | |
---|---|---|
CPU | 1ns | 10 µs to 1 ms |
Person | 1s | 2.7 hrs to 115.7 days |
1 VM with 1 Core for 1 Request
1
2
A
Web Server
App Server
1 VM with 2 Cores for 1 Request
B
A
B
A
Web Server
App Server
1 Core | 2 Cores | |
---|---|---|
CPU | 20 µs to 2 ms | 0.1 µs to 1µ |
Person | 5.4 hours to 231.4 days | 1.6 min to 16 min |
chart from dreamhost
chart from dreamhost
Classic HTTP request-response cycle:
- Request comes in
- Response goes out
WS, SSE, MQTT, GRPC, etc:
1) Negotiate a connection
2) Request comes in OR
3) Response goes out
4) Repeat (2) or (3) maybe
5) Close connection
async
user threads
coroutines
greenthreads
fibers
Scheduler in control.
Acts like modern OS threads/processes and will switch "contexts" per a strategy.
Task is in control.
Can potentially block and not "context" switch to another task.
Erlang/Elixir
Nodejs/JS
Python asyncio
PHP (swoole)
Ruby (nio4r)
Kotlin coroutines
Java green threads
C# Async
Go
Haskell
Rust
My utterly imperfect but best attempt to classify
Ruby :(
By Robert Roskam