+ All Categories
Home > Documents > StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts...

StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts...

Date post: 29-May-2020
Category:
Upload: others
View: 13 times
Download: 0 times
Share this document with a friend
98
Using Modern C++ In Anger Todd L. Montgomery @toddlmontgomery StoneTor
Transcript
Page 1: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Using Modern C++ In Anger

Todd L. Montgomery @toddlmontgomery

StoneTor

Page 2: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

•Aeron and C++?

• What constitutes Modern C++? • How Aeron Adopts Modern C++?

• What Lessons were learned?

• What’s Next?

Page 3: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Aeron and C++?

Page 4: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Truly modern messaging transport

Page 5: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Feature Bloat & Complexity

Page 6: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Not Fast Enough

Page 7: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Low & Predictable Latency is key

Page 8: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

We are in a new world

Multi-core, Multi-socket, Cloud...

Page 9: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

We are in a new world

UDP, IPC, InfiniBand,RDMA, PCI-e

Multi-core, Multi-socket, Cloud...

Page 10: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Aeron is trying a new approach

Page 11: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

The Team

Todd Montgomery Richard Warburton

Martin Thompson

Page 12: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Publishers SubscribersChannel

Stream

Messaging

Channel

Page 13: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

A library, not a framework, on which other abstractions and

applications can be built

Page 14: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Composable Design

Page 15: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

OSI layer 4 Transport for message oriented streams

Page 16: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

OSI Layer 4 (Transport) Services

1. Connection Oriented Communication

2. Reliability 3. Flow Control

4. Congestion Avoidance/Control

5. Multiplexing

Page 17: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Multi-Everything World!

Page 18: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Publishers Subscribers

Channel

Stream

Multi-Everything World

Page 19: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

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

Page 20: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Publisher

Subscriber

Subscriber

Publisher

Architecture

IPC Log Buffer

Page 21: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Sender

Receiver

Receiver

Sender

Publisher

Subscriber

Subscriber

Publisher

Architecture

Media

IPC Log BufferMedia (UDP, InfiniBand, PCI-e 3.0)

Page 22: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

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

Page 23: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

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

Page 24: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

C++?

Page 25: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

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

Page 26: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

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

Client • Application API • Java, C, C++, C#, etc.

Page 27: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

The Media Driver is (currently) Java…

Page 28: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.
Page 29: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

What constitutes Modern C++?

Page 30: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.
Page 31: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.
Page 32: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Modern C++

Page 33: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Resource Ownership & Lifetime

Page 34: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Modern C++

• Idioms (RAII, etc.)

Page 35: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

std::lock_guard std::unique_ptr

Resource Acquisition is Initialization (RAII)

http://en.cppreference.com/w/cpp/language/raii

Page 36: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Modern C++

• Idioms (RAII, etc.) • Smart Pointers

Page 37: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

std::shared_ptr std::unique_ptr std::weak_ptr

Smart Pointers

http://en.cppreference.com/w/cpp/memory

Page 38: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Modern C++

• Idioms (RAII, etc.) • Smart Pointers

• Lambda's & Function Objects

Page 39: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Modern C++

• Idioms (RAII, etc.) • Smart Pointers

• Lambda's & Function Objects

• Atomics (std::atomic)

Page 40: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

std::atomic<bool> std::atomic_flag

Atomic Operations

http://en.cppreference.com/w/cpp/atomic

Page 41: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Modern C++

• Idioms (RAII, etc.) • Smart Pointers

• Lambda's & Function Objects

• Atomics (std::atomic)

• Thread Support

Page 42: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

std::thread std::mutex std::promise std::future

Thread Support

http://en.cppreference.com/w/cpp/thread

Page 43: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Modern C++

• Idioms (RAII, etc.) • Smart Pointers

• Lambda's & Function Objects

• Atomics (std::atomic)

• Thread Support • Move Construction/Assignment

Page 44: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Modern C++

• Idioms (RAII, etc.) • Smart Pointers

• Lambda's & Function Objects

• Atomics (std::atomic)

• Thread Support • Move Construction/Assignment • Toolchain (Build/Test)

Page 45: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

CMake Google Test

Google Mock etc.

Modern Toolchain

https://cmake.org/https://github.com/google/googletest

Page 46: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

How Aeron Adopts Modern C++?

Page 47: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Smart Pointers

Page 48: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Lambda’s & Function Objects

Page 49: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Thread Support

Page 50: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

What Lessons were learned?

Page 51: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Lessons - What do you think?

• Idioms (RAII, etc.) • Stack Allocation • Smart Pointers

• Lambda's & Function Objects

• Atomics (std::atomic) • Thread Support • Move Construction/Assignment • Toolchain (Build/Test)

Page 52: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Lessons

• Idioms (RAII, etc.) • Stack Allocation • Smart Pointers

• Lambda's & Function Objects

• Atomics (std::atomic) • Thread Support • Move Construction/Assignment • Toolchain (Build/Test)

Page 53: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.
Page 54: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

RAII & Smart Pointers

• Give in to Smart Pointers

Page 55: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

RAII & Smart Pointers

• Give in to Smart Pointers • Explicit Coupling

Page 56: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

RAII & Smart Pointers

• Give in to Smart Pointers • Explicit Coupling • Explicit Scoping

Page 57: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

[insert excuse Y] …

Escape Analysis Value Types

Stack Allocation (Lack of)

Page 58: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.
Page 59: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.
Page 60: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Lessons

• Idioms (RAII, etc.) • Stack Allocation • Smart Pointers

• Lambda's & Function Objects

• Atomics (std::atomic) • Thread Support • Move Construction/Assignment • Toolchain (Build/Test)

Page 61: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.
Page 62: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Move Construction/Assignment

• Much more than you think

Page 63: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Move Construction/Assignment

• Much more than you think • Sometimes/Often better to copy

Page 64: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Move Construction/Assignment

• Much more than you think • Sometimes/Often better to copy • Optimization Interactions

Page 65: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Move Construction/Assignment

• Much more than you think • Sometimes/Often better to copy • Optimization Interactions • When you have to do it… why?!?

Page 66: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Lessons

• Idioms (RAII, etc.) • Stack Allocation • Smart Pointers

• Lambda's & Function Objects

• Atomics (std::atomic) • Thread Support • Move Construction/Assignment • Toolchain (Build/Test)

Page 67: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.
Page 68: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

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

Page 69: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Data Structures (Shared Memory)

• IPC Ring Buffers

• IPC Broadcast Buffers

• IPC Log Buffers

Page 70: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Creates a replicated persistent log

of messages

What Aeron does

Page 71: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

TailFile

Page 72: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Tail

File

Message 1Header

Page 73: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Tail

File

Message 1Header

Message 2

Header

Page 74: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Tail

File

Message 1Header

Message 2

Header

Page 75: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Tail

File

Message 1Header

Message 2

Header

Message 3

Page 76: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Tail

File

Message 1Header

Message 2

Header

Message 3

Header

Page 77: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Log Buffer File

Term 0

Term 1

Term 2

Term Meta Data 0

Term Meta Data 2

Term Meta Data 1

Log Meta Data

Page 78: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Log Buffer File

Term 0

Term 1

Term 2

Term Meta Data 0

Term Meta Data 2

Term Meta Data 1

Log Meta DataA

tom

ic &

Ord

ere

d O

pe

ratio

ns

Page 79: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Position

Page 80: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Unique identification of a byte within each stream

Page 81: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Publishers, Senders, Receivers, and Subscribers all keep position counters

Page 82: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Position counters are the key toflow control and monitoring

Page 83: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Statistics & Position Counters are accessible in shared memory

Atomic & Ordered Operations

Page 84: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Multiple Challenges

• Size (and Layout) • Memory Models (C++11 to Java)

Page 85: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Size Matters

Page 86: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.
Page 87: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Size Matters (Atomics)

• Not designed for arbitrary memory • Size not the same as the types • Concerned only with operations

Page 88: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Memory Models

• Interoperability with JMM • std::memory_order fit for purpose

Page 89: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

So…

Aeron uses its own atomic operations C/C++ functions

(JMM compatible)

*gccx86_64initiallycontributedbyphaynes([email protected])

Page 90: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

What’s Next?

Page 91: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Finished a few passes ofProfiling and Tuning

Page 92: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

C++ to C++ 32+ Million messages per

second

IPC, 32-byte Messages

Page 93: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

C++: 32M msg/sec Java: 30M msg/sec .NET: 15M msg/sec

IPC, 32-byte Messages

Page 94: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Replication

Services

Aeron Core

Persistence

PerformanceC/C++ Driver

Multi Unicast Send

Efficient FEC

Encryption/Security

1.0!!

Page 95: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

In closing…

Page 96: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.
Page 97: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

https://github.com/real-logic/Aeron

Where can I find it?

Page 98: StoneTor - GOTO Conference...•Aeron and C++? • What constitutes Modern C++?• How Aeron Adopts Modern C++?• What Lessons were learned?• What’s Next?Design Principles 1.

Aeron: https://github.com/real-logic/Aeron Twitter: @toddlmontgomery

Thank You!

Questions?


Recommended