GOTO Night with Todd Montgomery: Aeron: What, why and what next?
-
Upload
alexandra-masterson -
Category
Internet
-
view
76 -
download
0
Transcript of GOTO Night with Todd Montgomery: Aeron: What, why and what next?
1. Why build another Product?
2. What Features are really needed? 3. How does one Design for this?
4. How did things Evolve along the way?
5. What’s Next?
OSI Layer 4 (Transport) Services
1. Connection Oriented Communication
2. Reliability 3. Flow Control
4. Congestion Avoidance/Control
5. Multiplexing
Design Principles
1. Garbage free in steady state running 2. Smart Batching in the message path
3. Wait-free algos in the message path
4. Non-blocking IO in the message path
5. No exceptional cases in message path
6. Apply the Single Writer Principle 7. Prefer unshared state
8. Avoid unnecessary data copies
Sender
Receiver
Receiver
Sender
Publisher
Subscriber
Subscriber
Publisher
Architecture
Media
IPC Log BufferMedia (UDP, InfiniBand, PCI-e 3.0)
Conductor
Sender
Receiver
Conductor
Receiver
Sender
Publisher
Subscriber
Subscriber
Publisher
Admin
Events
Architecture
Admin
EventsMedia
IPC Log BufferMedia (UDP, InfiniBand, PCI-e 3.0)Function/Method CallVolatile Fields & Queues
ClientMedia DriverMedia Driver
Conductor
Sender
Receiver
Conductor
Receiver
Sender
Client
Publisher
Conductor Conductor
Subscriber
Subscriber
Publisher
Admin
Events
Architecture
Admin
EventsMedia
IPC Log Buffer
IPC Ring/Broadcast Buffer
Media (UDP, InfiniBand, PCI-e 3.0)Function/Method CallVolatile Fields & Queues
Broker Relationship Status: Complicated…
1. Media Driver can be standalone
2. Media Driver can be embedded
Broker Relationship Status: Complicated…
1. Media Driver can be standalone
2. Media Driver can be embedded
3. Core-to-Core memory handoff
Broker Relationship Status: Complicated…
1. Media Driver can be standalone
2. Media Driver can be embedded
3. Core-to-Core memory handoff
4. Isolation of protocol logic
Data Structures
• Maps
• IPC Ring Buffers
• IPC Broadcast Buffers
• ITC Queues
• Dynamic Arrays
• Log Buffers
ActiveDirtyClean
Tail
Message
Header
Message
Header
Message
Header
Message
Header
Message
Header
Message
Header
Message
Header
Message
Header
Tail
File
Message 1
Header
Message 2
Header
Message 3
Header
Message X
Message Y
Header
Padding
File
Header
Data Message Header
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Version |B|E| Flags | Type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-------------------------------+ |R| Frame Length | +-+-------------------------------------------------------------+ |R| Term Offset | +-+-------------------------------------------------------------+ | Session ID | +---------------------------------------------------------------+ | Stream ID | +---------------------------------------------------------------+ | Term ID | +---------------------------------------------------------------+ | Encoded Message ... ... | +---------------------------------------------------------------+
Header Evolution
1. Same header on wire & in memory
2. Frame Length originally 16-bits
3. IPv6-style Header Chains? Pfft!
4. Frame Alignment & Padding
5. Fragmentation? 2-bits
6. Position! Position! Position!
Unique identification of a byte within each stream across time
(streamId, sessionId, termId, termOffset)
count = currentTerm - initialTerm
(count * termLength) + termOffset
// termLength power of 2
bts = ntz(termLength) (count << bts) + termOffset
Position
Protocol Evolution
1. 0-length Data Frames (SETUP & HB)
2. Ranged NAKs vs NAKing a Range
3. Send Padding & Frame Alignment!
4. Eliminating Special Cases
Three Flow Control Windows
1. Publisher to Sender – Counter
2. Sender to Receiver – Status Messages
3. Receiver to Subscriber – Counter
Status Message Generation
1. Term Rollover
2. Every ¼ Term Progression
3. On Timeout
Clocked by Sender Data Rate
Some parts of Java really suck!
Unsigned Types?
NIO (most of) - Locks
Off-heap, PAUSE, Signals, etc.
Some parts of Java really suck!
Unsigned Types?
String Encoding
NIO (most of) - Locks
Off-heap, PAUSE, Signals, etc.
Some parts of Java really suck!
Unsigned Types?
String Encoding
NIO (most of) - Locks
Off-heap, PAUSE, Signals, etc.
Managing External Resources
Some parts of Java really suck!
Unsigned Types?
Off-heap, PAUSE, Signals, etc.
Selectors - GC
String Encoding
NIO (most of) - Locks
Managing External Resources
Some parts of Java are really nice!
Tooling – IDEs, Gradle, HdrHistogram
Profiling – Flight Recorder
Some parts of Java are really nice!
Tooling – IDEs, Gradle, HdrHistogram
Bytecode Instrumentation
Profiling – Flight Recorder
Some parts of Java are really nice!
Tooling – IDEs, Gradle, HdrHistogram
Bytecode Instrumentation
Unsafe!!! + Java 8
Profiling – Flight Recorder
Some parts of Java are really nice!
Tooling – IDEs, Gradle, HdrHistogram
Bytecode Instrumentation
Profiling – Flight Recorder
The Optimiser
Unsafe!!! + Java 8
Some parts of Java are really nice!
Tooling – IDEs, Gradle, HdrHistogram
Bytecode Instrumentation
Profiling – Flight Recorder
The Optimiser – Love/Hate
Unsafe!!! + Java 8
Some parts of Java are really nice!
Tooling – IDEs, Gradle, HdrHistogram
Bytecode Instrumentation
Garbage Collection!!!
Profiling – Flight Recorder
Unsafe!!! + Java 8
The Optimiser – Love/Hate
Replication
Services
Aeron Core
Persistence
Queueing
Performance
C/C++ Port
Batch Send/Recv
IPC
InfinibandMulti Unicast Send
Stream Query