{"id":21091524,"url":"https://github.com/dennis-krasnov/uringy","last_synced_at":"2025-05-16T13:31:54.592Z","repository":{"id":45693210,"uuid":"394796758","full_name":"Dennis-Krasnov/Uringy","owner":"Dennis-Krasnov","description":"A simple single-threaded concurrency runtime for Rust based on io_uring.","archived":false,"fork":false,"pushed_at":"2024-01-06T17:25:58.000Z","size":1549,"stargazers_count":29,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-03T12:48:13.099Z","etag":null,"topics":["async","concurrency","io-uring","non-blocking","runtime","rust","thread-per-core"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dennis-Krasnov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-08-10T22:34:17.000Z","updated_at":"2024-12-17T02:01:23.000Z","dependencies_parsed_at":"2023-11-06T02:32:29.978Z","dependency_job_id":"4be83cea-e502-44d1-87f0-626564c45629","html_url":"https://github.com/Dennis-Krasnov/Uringy","commit_stats":{"total_commits":75,"total_committers":1,"mean_commits":75.0,"dds":0.0,"last_synced_commit":"c77a38e05e20e0e8499dee291f6da8d882c1bce1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dennis-Krasnov%2FUringy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dennis-Krasnov%2FUringy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dennis-Krasnov%2FUringy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dennis-Krasnov%2FUringy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dennis-Krasnov","download_url":"https://codeload.github.com/Dennis-Krasnov/Uringy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254538477,"owners_count":22087870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","concurrency","io-uring","non-blocking","runtime","rust","thread-per-core"],"created_at":"2024-11-19T21:46:45.206Z","updated_at":"2025-05-16T13:31:54.202Z","avatar_url":"https://github.com/Dennis-Krasnov.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Uringy\n======\n\n[![website]](https://uringy-documentation.fly.dev/)\n[![github]](https://github.com/Dennis-Krasnov/Uringy)\n[![crates-io]](https://crates.io/crates/uringy)\n[![docs-rs]](https://docs.rs/uringy)\n[![license]](https://github.com/Dennis-Krasnov/Uringy/blob/master/LICENSE)\n\n[website]: https://img.shields.io/static/v1?label=website\u0026message=uringy-documentation.fly.dev\u0026style=for-the-badge\u0026labelColor=555555\u0026color=blue\u0026logo=github\n[github]: https://img.shields.io/static/v1?label=github\u0026message=Dennis-Krasnov/Uringy\u0026style=for-the-badge\u0026labelColor=555555\u0026color=17c208\u0026logo=github\n[crates-io]: https://img.shields.io/crates/v/uringy.svg?style=for-the-badge\u0026logo=image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNMjM5LjEgNi4zbC0yMDggNzhjLTE4LjcgNy0zMS4xIDI1LTMxLjEgNDV2MjI1LjFjMCAxOC4yIDEwLjMgMzQuOCAyNi41IDQyLjlsMjA4IDEwNGMxMy41IDYuOCAyOS40IDYuOCA0Mi45IDBsMjA4LTEwNGMxNi4zLTguMSAyNi41LTI0LjggMjYuNS00Mi45VjEyOS4zYzAtMjAtMTIuNC0zNy45LTMxLjEtNDQuOWwtMjA4LTc4QzI2MiAyLjIgMjUwIDIuMiAyMzkuMSA2LjN6TTI1NiA2OC40bDE5MiA3MnYxLjFsLTE5MiA3OC0xOTItNzh2LTEuMWwxOTItNzJ6bTMyIDM1NlYyNzUuNWwxNjAtNjV2MTMzLjlsLTE2MCA4MHoiPjwvcGF0aD48L3N2Zz4=\n[docs-rs]: https://img.shields.io/static/v1?label=docs.rs\u0026message=uringy\u0026style=for-the-badge\u0026labelColor=555555\u0026color=red\u0026logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K\n[license]: https://img.shields.io/static/v1?label=license\u0026message=BSD0\u0026style=for-the-badge\u0026labelColor=555555\u0026color=b509a4\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NDAgNTEyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNOTYgNDY0djMyYzAgOC44NCA3LjE2IDE2IDE2IDE2aDIyNGM4Ljg0IDAgMTYtNy4xNiAxNi0xNlYxNTMuMjVjNC41Ni0yIDguOTItNC4zNSAxMi45OS03LjEybDE0Mi4wNSA0Ny42M2M4LjM4IDIuODEgMTcuNDUtMS43MSAyMC4yNi0xMC4wOGwxMC4xNy0zMC4zNGMyLjgxLTguMzgtMS43MS0xNy40NS0xMC4wOC0yMC4yNmwtMTI4LjQtNDMuMDVjLjQyLTMuMzIgMS4wMS02LjYgMS4wMS0xMC4wMyAwLTQ0LjE4LTM1LjgyLTgwLTgwLTgwLTI5LjY5IDAtNTUuMyAxNi4zNi02OS4xMSA0MC4zN0wxMzIuOTYuODNjLTguMzgtMi44MS0xNy40NSAxLjcxLTIwLjI2IDEwLjA4bC0xMC4xNyAzMC4zNGMtMi44MSA4LjM4IDEuNzEgMTcuNDUgMTAuMDggMjAuMjZsMTMyIDQ0LjI2YzcuMjggMjEuMjUgMjIuOTYgMzguNTQgNDMuMzggNDcuNDdWNDQ4SDExMmMtOC44NCAwLTE2IDcuMTYtMTYgMTZ6TTAgMzA0YzAgNDQuMTggNTcuMzEgODAgMTI4IDgwczEyOC0zNS44MiAxMjgtODBoLS4wMmMwLTE1LjY3IDIuMDgtNy4yNS04NS4wNS0xODEuNTEtMTcuNjgtMzUuMzYtNjguMjItMzUuMjktODUuODcgMEMtMS4zMiAyOTUuMjcuMDIgMjg3LjgyLjAyIDMwNEgwem01Ni0xNmw3Mi0xNDQgNzIgMTQ0SDU2em0zMjguMDIgMTQ0SDM4NGMwIDQ0LjE4IDU3LjMxIDgwIDEyOCA4MHMxMjgtMzUuODIgMTI4LTgwaC0uMDJjMC0xNS42NyAyLjA4LTcuMjUtODUuMDUtMTgxLjUxLTE3LjY4LTM1LjM2LTY4LjIyLTM1LjI5LTg1Ljg3IDAtODYuMzggMTcyLjc4LTg1LjA0IDE2NS4zMy04NS4wNCAxODEuNTF6TTQ0MCA0MTZsNzItMTQ0IDcyIDE0NEg0NDB6Ij48L3BhdGg+PC9zdmc+\n\nWriting concurrent code in Rust doesn't need to be painful.\nUringy is a runtime that combines structured concurrency, a single-threaded design, and Linux's io_uring.\nIntended for server applications, from simple single-threaded to highly scalable thread-per-core designs.\n\n## Goals\n#### Simple API\n- Familiar blocking syntax which closely mirrors Rust's standard library\n- Avoid `async`/`await`'s limitations and footguns\n- Easy to learn with stellar documentation and examples\n- Spawn with non-`Send` and non-`'static` types\n- Leak-free hierarchy of fibers with first-class cancellation support\n\n#### Performant\n- Issue non-blocking, batched, zero-copy syscalls with io_uring\n- Efficient context switching with cooperative multitasking\n- Atomic-free scheduler, parallelized manually if required\n\n#### Quick to compile\n- Compile only what you need using [cargo features](#Compile Time Flags)\n- Minimal dependencies\n- Minimal use of macros\n\n## Quick Start\n[Install Rust](https://www.rust-lang.org/tools/install) and [create a new cargo project](https://doc.rust-lang.org/book/ch01-03-hello-cargo.html).\n\nAdd uringy as a dependency: `cargo add uringy`\n\nThen replace `src/main.rs` with:\n```rust\n// No need for async main\n#[uringy::start]\nfn main() {\n    let handle = uringy::fiber::spawn(|| tcp_echo_server(9000)); // No need for async block\n\n    uringy::signals().filter(Signal::is_terminal).next().unwrap();\n    uringy::println!(\"gracefully shutting down\");\n    handle.cancel(); // Cancellation propagates throughout the entire fiber hierarchy\n\n    // Automatically waits for all fibers to complete\n}\n\n// No need for async functions\nfn tcp_echo_server(port: u16) {\n    let listener = uringy::net::TcpListener::bind((\"0.0.0.0\", port)).unwrap();\n    uringy::println!(\"listening for TCP connections on port {port}\"); // No need for .await\n    let mut connections = listener.incoming();\n    while let Ok((stream, _)) = connections.next() {\n        uringy::fiber::spawn(move || handle_connection(stream));\n    }\n}\n\nfn handle_connection(tcp: TcpStream) {\n    let (mut r, mut w) = stream.split();\n    let _ = std::io::copy(\u0026mut r, \u0026mut w); // TcpStream implements std::io's Read and Write\n}\n```\n\nAnd run your project using: `cargo run --release`\n\nIf you're using macOS, use a [Linux virtual machine](https://orbstack.dev) or a docker container.\nIf you're using Windows, use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install).\n\nFor more, check out the [examples](examples) directory.\n\n## Compile Time Flags\nThere are currently no cargo flags.\n\n## Comparison with Other Runtimes\n|                                                                                             | std thread                                 | uringy fiber                                 | tokio task                                                                                                                                  |\n|---------------------------------------------------------------------------------------------|--------------------------------------------|----------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|\n| OS support                                                                                  | all                                        | Linux                                        | most                                                                                                                                        |\n| IO interface                                                                                | blocking                                   | [io_uring](https://unixism.net/loti)         | epoll + thread pool                                                                                                                         |\n| [function color](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function) | sync                                       | sync                                         | sync and async                                                                                                                              |\n| start                                                                                       | N/A                                        | 27 μs                                        | 27.5 μs (3.5 μs using [current thread scheduler](https://docs.rs/tokio/latest/tokio/runtime/struct.Runtime.html#current-thread-scheduler))  |\n| spawn                                                                                       | 9828 ns                                    | 59 ns                                        | 907 ns (58ns using [current thread scheduler](https://docs.rs/tokio/latest/tokio/runtime/struct.Runtime.html#current-thread-scheduler))     |\n| spawn `Send` bound                                                                          | yes                                        | no                                           | yes, unless using [LocalSet](https://docs.rs/tokio/latest/tokio/task/struct.LocalSet.html)                                                  |\n| spawn `'static` bound                                                                       | yes, unless using scope                    | yes, unless using scope                      | yes                                                                                                                                         |\n| [stack size](https://without.boats/blog/futures-and-segmented-stacks)                       | virtual 8MB (configurable), 4KB increments | virtual 128KB (configurable), 4KB increments | perfectly sized                                                                                                                             |\n| stack limitations                                                                           | may overflow                               | may overflow                                 | can't use recursion                                                                                                                         |\n| context switch                                                                              | 1405 ns                                    | 60 ns                                        | 1328 ns (308 ns using [current thread scheduler](https://docs.rs/tokio/latest/tokio/runtime/struct.Runtime.html#current-thread-scheduler))  |\n| multi-tasking                                                                               | preemptive                                 | cooperative                                  | mostly cooperative                                                                                                                          |\n| structured concurrency                                                                      | no guarantees                              | parent fiber outlives its children           | no guarantees                                                                                                                               |\n| runs until                                                                                  | main thread completes                      | all fibers complete                          | block_on completes                                                                                                                          |\n| parallelism                                                                                 | automatic                                  | manual                                       | automatic, unless using [current thread scheduler](https://docs.rs/tokio/latest/tokio/runtime/struct.Runtime.html#current-thread-scheduler) |\n| userspace scheduler                                                                         | N/A                                        | minimal                                      | work stealing                                                                                                                               |\n| cancellation                                                                                | using esoteric unix signals                | first class, voluntary                       | leaks memory, [causes bugs](https://docs.rs/tokio/latest/tokio/macro.select.html#cancellation-safety)                                       |\n\n## Supported Rust Versions\nThe MSRV is 1.75.0 (released in December 2023).\nCheck your Rust version by running `rustc --version` in a terminal.\n\n## Supported Linux Kernel Versions\nThe minimum kernel version is 6.1 (released in December 2022).\nCheck your kernel version by running `uname -r` in a terminal.\n\n## License\nUringy is licensed under the [MIT license](LICENSE).\nIt's a permissive license, which basically means you can do whatever you want.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdennis-krasnov%2Furingy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdennis-krasnov%2Furingy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdennis-krasnov%2Furingy/lists"}