Skip to content
TopicTracker
From HackerNewsView original
TranslationTranslation

FoundationDB's Flow – Bringing Actor-Based Concurrency to C++11

FoundationDB's Flow is a C++11 framework that introduces actor-based concurrency, allowing developers to write asynchronous, non-blocking code using a callback-free, coroutine-like programming model. It simplifies complex concurrent logic by enabling sequential-style code for distributed systems tasks, originally developed for FoundationDB's internal use.

Background

- FoundationDB is a distributed database originally built by a startup, acquired by Apple in 2015, and later open-sourced. It is known for its strong consistency, fault tolerance, and ability to handle very high write throughput. - "Flow" is a C++ framework that FoundationDB's core team built to manage asynchronous, concurrent programming at scale. It uses an "actor" model — where each actor is a lightweight, concurrent unit of work that can communicate with others via messages — similar to languages like Erlang or frameworks like Akka. - Flow adds keywords (like `ACTOR`, `wait`, `state`) on top of standard C++11, using a custom compiler to translate them into efficient callback-based code. This was done because C++11 lacked built-in coroutines or async/await at the time. - For readers following tech infrastructure: Flow solves the same problem as modern C++20 coroutines or Rust's async/await, but was built years earlier. Many large-scale distributed systems (FoundationDB itself, some Apple services) rely on it under the hood.

Related stories