Asynchronous Programming with Seastar
Nadav Har’El - nyh@ScyllaDB.com
Avi Kivity - avi@ScyllaDB.com
1
Introduction
1.1
Asynchronous programming
1.2
Seastar
2
Getting started
3
Threads and memory
3.1
Seastar threads
3.2
Seastar memory
4
Introducing futures and continuations
4.1
Ready futures
4.2
Preemption and Task Quota
5
Coroutines
5.1
Lambda coroutines
5.2
Generators in coroutines
5.3
Exceptions in coroutines
5.4
Concurrency in coroutines
5.5
Breaking up long running computations
5.6
Bypassing preemption checks in coroutines
6
Continuations
6.1
Capturing state in continuations
6.2
Evaluation order considerations (C++14 only)
6.3
Chaining continuations
7
Handling exceptions
7.1
Exceptions vs. exceptional futures
8
Lifetime management
8.1
Passing ownership to continuation
8.2
Keeping ownership at the caller
8.3
Sharing ownership (reference counting)
8.4
Saving objects on the stack
9
Advanced futures
9.1
Futures and interruption
9.2
Futures are single use
10
Fibers
11
Loops
11.1
repeat
11.2
do_until
11.3
do_for_each
11.4
parallel_for_each
11.5
max_concurrent_for_each
12
when_all: Waiting for multiple futures
13
Semaphores
13.1
Limiting parallelism with semaphores
13.2
Limiting resource use
13.3
Limiting parallelism of loops
14
Pipes
15
Shutting down a service with a gate
16
Introducing shared-nothing programming
17
More about Seastar’s event loop
18
Introducing Seastar’s network stack
19
Sharded services
20
Shutting down cleanly
21
Command line options
21.1
Standard Seastar command-line options
21.2
User-defined command-line options
22
Debugging a Seastar program
22.1
Debugging ignored exceptions
22.2
Finding where an exception was thrown
22.3
Debugging with gdb
23
Promise objects
24
Memory allocation in Seastar
24.1
Per-thread memory allocation
24.2
Foreign pointers
25
Seastar::thread
25.1
Starting and ending a seastar::thread
26
Isolation of application components
26.1
Scheduling groups (CPU scheduler)
26.2
Latency
26.3
Disk I/O scheduler
26.4
Network scheduler
26.5
Controllers
26.6
Multi-tenancy