scylladb/seastar

C++seastar.io

High performance server-side application framework

c-plus-plusseastardpdkasyncaio
Sterne-Wachstum
Sterne
9.4k
Forks
1.7k
Wochenwachstum
+10
Issues
413
5k
Feb. 2015Dez. 2018Okt. 2022Sept. 2026
README

Seastar

Test Version License: Apache2 n00b issues

Introduction

Seastar is an event-driven framework that allows you to write non-blocking, asynchronous code in a relatively straightforward manner (once understood). It is based on futures.

Building Seastar

For more details and alternative workflows, read HACKING.md.

Assuming that you would like to use system packages (RPMs or DEBs) for Seastar's dependencies, first install them:

$ sudo ./install-dependencies.sh

Then configure (in "release" mode):

$ ./configure.py --mode=release

Then compile:

$ ninja -C build/release

If compilation fails with an error such as g++: internal compiler error: Killed (program cc1plus), try giving GCC more memory. You can limit the number of parallel jobs with -j1 and/or allocate at least 4 GiB of RAM to your machine.

If you're missing a dependency of Seastar, then it is possible to have the configuration process fetch a version of the dependency locally for development.

For example, to fetch fmt locally, configure Seastar like this:

$ ./configure.py --mode=dev --cook fmt

--cook can be repeated many times for selecting multiple dependencies.

Build modes

The configure.py script is a wrapper around CMake. The --mode argument maps to CMAKE_BUILD_TYPE and supports the following modes:

CMake mode Debug info Optimi­zations Sanitizers Allocator Checks Use for
debug Debug Yes -O0 ASAN, UBSAN System All gdb
release RelWithDebInfo Yes -O3 None Seastar Asserts production
dev Dev (Custom) No -O1 None Seastar Asserts build and test cycle
sanitize Sanitize (Custom) Yes -Os ASAN, UBSAN System All second level of tests, track down bugs

Note that Seastar is more sensitive to allocators and optimizations than usual. As a rough rule of thumb, release is twice as fast as dev, 150 times as fast as sanitize, and 300 times as fast as debug.

Using Seastar from its build directory (without installation)

It's possible to consume Seastar directly from its build directory with CMake or pkg-config.

We'll assume that the Seastar repository is located in a directory at $seastar_dir.

Via pkg-config:

$ g++ my_app.cc $(pkg-config --libs --cflags --static $seastar_dir/build/release/seastar.pc) -o my_app

and with CMake using the Seastar package:

CMakeLists.txt for my_app:

set (CMAKE_CXX_STANDARD 23)

find_package (Seastar REQUIRED)

add_executable (my_app
  my_app.cc)

target_link_libraries (my_app
  Seastar::seastar)
$ mkdir $my_app_dir/build
$ cd $my_app_dir/build
$ cmake -DCMAKE_PREFIX_PATH="$seastar_dir/build/release;$seastar_dir/build/release/_cooking/installed" -DCMAKE_MODULE_PATH=$seastar_dir/cmake $my_app_dir

The CMAKE_PREFIX_PATH values ensure that CMake can locate Seastar and its compiled submodules. The CMAKE_MODULE_PATH value ensures that CMake can use Seastar's CMake scripts to locate its dependencies.

Using an installed Seastar

You can also consume Seastar after it has been installed to the filesystem.

Important:

  • Seastar works with a customized version of DPDK, so by default builds and installs the DPDK submodule to $build_dir/_cooking/installed

First, configure the installation path:

$ ./configure.py --mode=release --prefix=/usr/local

Then run the install target:

$ ninja -C build/release install

Then consume it from pkg-config:

$ g++ my_app.cc $(pkg-config --libs --cflags --static seastar) -o my_app

or consume it with the same CMakeLists.txt as before but with a simpler CMake invocation:

$ cmake ..

(If Seastar has not been installed to a "standard" location like /usr or /usr/local, then you can invoke CMake with -DCMAKE_PREFIX_PATH=$my_install_root.)

There are also instructions for building on any host that supports Docker.

Use of DPDK is optional.

Seastar's C++ standard: C++23 or C++26

Seastar supports both C++23 and C++26. The build defaults to the latest standard supported by your compiler, but can be explicitly selected with the --c++-standard configure option, e.g., --c++-standard=23, or, if using CMake directly, by setting the CMAKE_CXX_STANDARD CMake variable.

See the compatibility statement for more information.

Getting started

There is a mini tutorial and a more comprehensive one.

The documentation is available on the web.

Resources

  • Seastar Development Mailing List: Discuss challenges, propose improvements, send code contributions (patches), and get help from experienced developers. Subscribe or browse archives: here (or email seastar-dev@googlegroups.com).
  • GitHub Discussions: For more casual conversations and quick questions, consider using the Seastar project's discussions on GitHub.
  • Issue Tracker: File bug reports on the project's issue tracker.

Learn more about Seastar on the main project website.

The Native TCP/IP Stack

Seastar comes with its own userspace TCP/IP stack for better performance.

  • CPUs - As many as you need. Seastar is well suited to multicore and NUMA systems.
  • NICs - As fast as possible; we recommend 10G or 40G cards. It is possible to use 1G cards too, but you may be limited by their capacity. In addition, the more hardware queues per CPU, the better for Seastar. Otherwise we have to emulate that in software.
  • Disks - Fast SSDs with a high number of IOPS.
  • Client machines - Usually a single client machine cannot fully load our servers. Both memaslap (memcached) and wrk (httpd) may be unable to overload their matching server counterparts. We recommend running clients on machines other than the servers and using several of them.

Projects using Seastar

  • cpv-cql-driver: C++ driver for Cassandra/Scylla based on the Seastar framework
  • cpv-framework: A web framework written in C++ based on the Seastar framework
  • Redpanda: A Kafka-compatible streaming data platform for mission-critical systems
  • Scylla: A fast and reliable NoSQL data store compatible with Cassandra and DynamoDB
  • smf: The fastest RPC in the West
  • Ceph - Crimson: Next-generation OSD (Object Storage Daemon) implementation based on the Seastar framework
Ähnliche Repositories
electron/electron

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

C++appMIT Licenseelectronjavascript
electronjs.org
123k17.5k
opencv/opencv

Open Source Computer Vision Library

C++Apache License 2.0opencvc-plus-plus
opencv.org
90.8k57k
bitcoin/bitcoin

Bitcoin Core integration/staging tree

C++MIT Licensebitcoinc-plus-plus
bitcoincore.org/en/download
90.1k39.4k
obsproject/obs-studio

OBS Studio - Free and open source software for live streaming and screen recording

CGNU General Public License v2.0cc-plus-plus
obsproject.com
76k10.1k
fffaraz/awesome-cpp

A curated list of awesome C++ (or C) frameworks, libraries, resources, and shiny things. Inspired by awesome-... stuff.

awesomeMIT Licensecppcppcon
fffaraz.github.io/awesome-cpp/
73.2k8.3k
WerWolv/ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.

C++GNU General Public License v2.0hex-editorreverse-engineering
imhex.werwolv.net
54.8k2.5k
serhii-londar/open-source-mac-os-apps

🚀 Awesome list of open source applications for macOS. https://t.me/s/opensourcemacosapps

awesomeCreative Commons Zero v1.0 Universalmacosmac
serhii-londar.github.io/open-source-mac-os-apps/
50.3k2.8k
qbittorrent/qBittorrent

qBittorrent BitTorrent client

C++appOtherc-plus-plusbittorrent
qbittorrent.org
40k4.9k
aseprite/aseprite

Animated sprite editor & pixel art tool (Windows, macOS, Linux)

C++appanimationpixel-art
aseprite.org
39.4k8.9k
google-ai-edge/mediapipe

Cross-platform, customizable ML solutions for live and streaming media.

C++libraryApache License 2.0mediapipec-plus-plus
ai.google.dev/edge/mediapipe
36.9k6.2k
SerenityOS/serenity

The Serenity Operating System 🐞

C++BSD 2-Clause "Simplified" Licenseoperating-systemc-plus-plus
serenityos.org
33.8k3.5k
ossrs/srs

SRS is a simple, high-performance, AI-driven real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181, with codec support for H.264, H.265, AV1, VP9, AAC, Opus, and G.711.

C++MIT Licensertmplive-streaming
ossrs.io
29.2k5.7k