Zedio is a runtime for writing asycnhronous applications with the C++.
It's being developed, if you're interested in zedio and want to participate in its development, look Development
______ ______ _____ _____ ____
|___ / | ____| | __ \ |_ _| / __ \
/ / | |__ | | | | | | | | | |
/ / | __| | | | | | | | | | |
/ /__ | |____ | |__| | _| |_ | |__| |
/_____| |______| |_____/ |_____| \____/
Zedio is a event-driven platform for writing asynchronous applications with the C++, At a high level, it provides a few major components:
- A multithreaded, work-stealing based task scheduler.(reference tokio)
- A proactor backed by linux systems's io_uring.
- Asynchronous TCP and UDP sockets.
Your compiler must support C++23. My compiler is GCC 13.1.0.
Zedio is header only,and you can copy zedio into your project,or install it via CMake.
- clone zedio
git clone https://github.com/8sileus/zedio
cmake -B build
cd build
- install
cmake --install . # --prefix ./user_defined_install_path
- compile tests
cmake --build . # -j num_thread
ctest .
Writing an echo server using Zedio
// Ignore all errors
#include "zedio/async.hpp"
#include "zedio/net.hpp"
using namespace zedio::async;
using namespace zedio::net;
auto process(TcpStream stream) -> Task<void> {
char buf[1024];
while (true) {
auto len = (co_await stream.read(buf)).value();
if (len == 0) {
break;
}
co_await stream.write_all({buf, len});
}
}
auto server() -> Task<void> {
auto addr = SocketAddr::parse("localhost", 9898).value();
auto listener = TcpListener::bind(addr).value();
while (true) {
auto [stream, peer_addr] = (co_await listener.accept()).value();
spawn(process(std::move(stream)));
}
}
auto main() -> int {
auto runtime = Runtime::create();
runtime.block_on(server());
return 0;
}
OS:Ubuntu23.04
Number of cores :4
Memory:4G
CPU:AMD Ryzen 5 3600 6-Core Processor
command:./wrk -t4 -c1000 -d90s --latency http://192.168.15.33:7777/
ZEDIO:
TOKIO:
boost: https://github.com/boostorg/boost
liburing: https://github.com/axboe/liburing
You can help us develop this project if you're familiar with C++20 standard and io_uring, we have lots of things that you can help. about:
- Writing tests
- Writing benchmark
- Writing documentation
- Report bugs
- Share ideas
- QQ Group: 590815858
- Email: [email protected]