base on High performance server-side application framework Seastar
=======
[![Test](https://github.com/scylladb/seastar/actions/workflows/tests.yaml/badge.svg)](https://github.com/scylladb/seastar/actions/workflows/tests.yaml)
[![Version](https://img.shields.io/github/tag/scylladb/seastar.svg?label=version&colorB=green)](https://github.com/scylladb/seastar/releases)
[![License: Apache2](https://img.shields.io/github/license/scylladb/seastar.svg)](https://github.com/scylladb/seastar/blob/master/LICENSE)
[![n00b issues](https://img.shields.io/github/issues/scylladb/seastar/n00b.svg?colorB=green)](https://github.com/scylladb/seastar/labels/n00b)
Introduction
------------
SeaStar is an event-driven framework allowing you to write non-blocking,
asynchronous code in a relatively straightforward manner (once understood).
It is based on [futures](http://en.wikipedia.org/wiki/Futures_and_promises).
Building Seastar
--------------------
For more details and alternative work-flows, read [HACKING.md](./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
```
In case there are compilation issues, especially like ```g++: internal compiler error: Killed (program cc1plus)```
try giving more memory to gcc, either by limiting the amount of threads ( -j1 ) and/or allowing at least 4g 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. A quick rule of the thumb of the relative performances is that
release is 2 times faster than dev, 150 times faster than sanitize and
300 times faster than 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 uses Seastar's CMake scripts for locating its dependencies.
Using an installed Seastar
--------------------------------
You can also consume Seastar after it has been installed to the file-system.
**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](doc/building-docker.md).
Use of the [DPDK](http://dpdk.org) is [optional](doc/building-dpdk.md).
#### Seastar's C++ standard: C++20 or C++23
Seastar supports both C++20, and C++23. 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=20`,
or if using CMake directly, by setting on the `CMAKE_CXX_STANDARD` CMake
variable.
See the [compatibity statement](doc/compatibility.md) for more information.
Getting started
---------------
There is a [mini tutorial](doc/mini-tutorial.md) and a [more comprehensive one](doc/tutorial.md).
The documentation is available on the [web](http://docs.seastar.io/master/index.html).
Resources
---------
* Seasatar Development Mailing List: Discuss challenges, propose improvements with
sending code contributions (patches), and get help from experienced developers.
Subscribe or browse archives: [here](https://groups.google.com/forum/#!forum/seastar-dev)
(or email
[email protected]).
* GitHub Discussions: For more casual conversations and quick questions, consider
using the Seastar project's [discussions on Github](https://github.com/scylladb/seastar/discussions).
* Issue Tracker: File bug reports on the project's [issue tracker](https://github.com/scylladb/seastar/issues).
Learn more about Seastar on the main [project website](http://seastar.io).
The Native TCP/IP Stack
-----------------------
Seastar comes with its own [userspace TCP/IP stack](doc/native-stack.md) for better performance.
Recommended hardware configuration for SeaStar
----------------------------------------------
* CPUs - As much as you need. SeaStar is highly friendly for multi-core and NUMA
* NICs - As fast as possible, we recommend 10G or 40G cards. It's possible to use
1G too but you may be limited by their capacity.
In addition, the more hardware queue per cpu the better for SeaStar.
Otherwise we have to emulate that in software.
* Disks - Fast SSDs with high number of IOPS.
* Client machines - Usually a single client machine can't load our servers.
Both memaslap (memcached) and WRK (httpd) cannot over load their matching
server counter parts. We recommend running the client on different machine
than the servers and use several of them.
Projects using Seastar
----------------------------------------------
* [cpv-cql-driver](https://github.com/cpv-project/cpv-cql-driver): C++ driver for Cassandra/Scylla based on seastar framework
* [cpv-framework](https://github.com/cpv-project/cpv-framework): A web framework written in c++ based on seastar framework
* [redpanda](https://vectorized.io/): A Kafka replacement for mission critical systems
* [Scylla](https://github.com/scylladb/scylla): A fast and reliable NoSQL data store compatible with Cassandra and DynamoDB
* [smf](https://github.com/smfrpc/smf): The fastest RPC in the West
* [Ceph - Crimson](https://github.com/ceph/ceph): Next-generation OSD (Object Storage Daemon) implementation based on the Seastar framework
", Assign "at most 3 tags" to the expected json: {"id":"3360","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"