# Any Async Runtimes for Linux?

**URL:** <https://ziggit.dev/t/any-async-runtimes-for-linux/4107>\
**Category:** Brainstorming\
**Created:** [April 27, 2024, 5:58pm UTC](https://ziggit.dev/t/any-async-runtimes-for-linux/4107 "2024-04-27T17:58:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![DAlba-sudo](https://ziggit.dev/user_avatar/ziggit.dev/dalba-sudo/32/2165_2.png) [@DAlba-sudo](https://ziggit.dev/u/DAlba-sudo)\
**Post date:** [April 27, 2024, 5:58pm UTC](https://ziggit.dev/t/any-async-runtimes-for-linux/4107/1 "2024-04-27T17:58:34Z")

</div>

Just wondering if anyone here is working on, or knows of, a callback oriented async runtime that can be used with sockets (ideally epoll, and friends)?

Might take a stab at it if it’s not already in the works, but want to see what’s available before I spend too much time on it.

---

<div class="post-metadata">

**Author:** ![DAlba-sudo](https://ziggit.dev/user_avatar/ziggit.dev/dalba-sudo/32/2165_2.png) [@DAlba-sudo](https://ziggit.dev/u/DAlba-sudo)\
**Post date:** [April 27, 2024, 6:02pm UTC](https://ziggit.dev/t/any-async-runtimes-for-linux/4107/2 "2024-04-27T18:02:15Z")

</div>

Not sure how I didn’t find it in my first couple of searches: found this though.

> **[GitHub - kprotty/zap: An asynchronous runtime with a focus on performance and...](https://github.com/kprotty/zap/tree/blog)**
>
> blog

Still interested in hearing people’s opinion on other libraries. Also, what’s the status on compiler-level async? I joined zig after it had been rolled-back, just curious what’s up with it.

---

<div class="post-metadata">

**Author:** ![tensorush](https://ziggit.dev/letter_avatar_proxy/v4/letter/t/6a8cbe/32.png) [@tensorush](https://ziggit.dev/u/tensorush)\
**Post date:** [April 27, 2024, 6:23pm UTC](https://ziggit.dev/t/any-async-runtimes-for-linux/4107/3 "2024-04-27T18:23:17Z")

</div>

That one’s not maintained.

The next compiler release that will contain async again remains undetermined.

See the latest Zig Roadmap presentation for the Core Team’s priorities:

[![](https://ziggit.dev/uploads/default/original/2X/3/38722bb2c23a175b04302ecc9decad5ab90fe401.jpeg "[#36] Zig Roadmap 2024 - Andrew Kelley") ](https://www.youtube.com/watch?v=5eL_LcxwwHg)

I’d suggest looking at:

- libxev

> **[GitHub - mitchellh/libxev: libxev is a cross-platform, high-performance event...](https://github.com/mitchellh/libxev)**
>
> libxev is a cross-platform, high-performance event loop that provides abstractions for non-blocking IO, timers, events, and more and works on Linux (io\_uring or epoll), macOS (kqueue), and Wasm + W...

- iofthetiger

> **[iofthetiger](https://codeberg.org/dude_the_builder/iofthetiger)**
>
> High performance async IO library for Zig.

---

<div class="post-metadata">

**Author:** ![nyc](https://ziggit.dev/user_avatar/ziggit.dev/nyc/32/1167_2.png) [@nyc](https://ziggit.dev/u/nyc)\
**Post date:** [April 27, 2024, 9:04pm UTC](https://ziggit.dev/t/any-async-runtimes-for-linux/4107/4 "2024-04-27T21:04:39Z")

</div>

I have an epoll based callback system for extreme low latency conditions that I wrote that specializes in event streaming with message sizes up to around 1k bytes (but works best when they are mostly below 300 bytes).

I was thinking of releasing it, but don’t know yet. It gets within 10% the latency target of the C++ one it is based on, so I still have some optimization work to do. I was never able to get that close in Rust with tokio and async (it was 25% off). I do still have do TLS/SSL, so that might hurt performance a little too. I’m just not sure how to do it yet. I might have to link openssl and write to its async api (always a huge mess ever time).

---

<div class="post-metadata">

**Author:** ![dee0xeed](https://ziggit.dev/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@dee0xeed](https://ziggit.dev/u/dee0xeed)\
**Post date:** [April 29, 2024, 1:33pm UTC](https://ziggit.dev/t/any-async-runtimes-for-linux/4107/5 "2024-04-29T13:33:39Z")

</div>

> [@DAlba-sudo](#):
>
> a callback oriented async runtime that can be used with sockets (ideally epoll, and friends)

I am using [event driven state machines](https://github.com/dee0xeed/xjiss/tree/main/xjiss2/src/engine).  
Callback-oriented, epoll-based, sockets (or COM-ports), timers, signals, fs events, but I wouldnt call this “async”.  
If you want “true” async ops, use `io_uring`.

---

<div class="post-metadata">

**Author:** ![dee0xeed](https://ziggit.dev/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@dee0xeed](https://ziggit.dev/u/dee0xeed)\
**Post date:** [April 29, 2024, 3:05pm UTC](https://ziggit.dev/t/any-async-runtimes-for-linux/4107/6 "2024-04-29T15:05:11Z")

</div>

> [@nyc](#):
>
> always a huge mess ever time

exactly.

a couple of additions to my previous post.

- [here](https://ziggit.dev/t/should-the-standard-library-be-batteries-included/3018/13) was an example of not so simple machine (connector to postgres dbms)
- the only thing that you can do truly asynchronously (regarding sockets) with epoll (which is synchronous syscall) is establishing connection, you just get “ready for write” (`EPOLLOUT`) notification.

---

<div class="post-metadata">

**Author:** ![DAlba-sudo](https://ziggit.dev/user_avatar/ziggit.dev/dalba-sudo/32/2165_2.png) [@DAlba-sudo](https://ziggit.dev/u/DAlba-sudo)\
**Post date:** [May 1, 2024, 1:28pm UTC](https://ziggit.dev/t/any-async-runtimes-for-linux/4107/7 "2024-05-01T13:28:30Z")

</div>

Funnily enough, I guess what I really was describing was in-fact an event driven state machine.

I hadn’t thought too deeply about the difference until you mentioned it. Looks interesting, I’ll take a look. Thanks!
