socketry/async
65.6
Adequate · 19 September 2026
5.5k
lines of production code
Ruby
primary language
1
measurement over time
What this system is
This system is a Ruby library providing an asynchronous event loop and concurrency primitives, including task scheduling, barriers, queues, and signal handling. It exposes top-level Kernel methods to simplify asynchronous programming and integrates with modern observability tools for metrics and distributed tracing. The codebase includes extensive benchmarks for performance analysis and a suite of examples demonstrating various concurrency patterns and edge cases.
How it got here
2017–2019 — Modernization and concurrency primitives
14 changes.
The project underwent significant modernization by migrating its test suite to the 'sus' framework, updating CI infrastructure, and raising the minimum Ruby version to 3.3. Concurrently, the library expanded its feature set with new synchronization primitives like Barrier and Condition, while simplifying the API by exposing top-level Kernel methods for common asynchronous patterns.
2021–2023 — Testing expansion and configuration
13 changes.
This period focused on expanding test coverage for core async primitives, the scheduler, and Ruby standard library integrations using the Sus framework. It also introduced new configuration files for external dependencies and instrumentation, alongside various examples demonstrating buffer usage, dataloader patterns, and debugging techniques.
2024–2025 — observability and concurrency examples
12 changes.
This period focused on enhancing the library's observability by adding metrics and tracing support for task scheduling and barriers. It also expanded the example suite to demonstrate advanced concurrency patterns, including greedy scheduling, load shedding, and deadlock avoidance. Comprehensive test coverage was added for core primitives, performance benchmarks, and edge cases involving forking and buffer operations.
Features
Add HUP signal handling test example
Added a new \hup-test\ example in the \examples/hup-test\ directory, consisting of \main.rb\ and \child.rb\, to demonstrate and test the behavior of the async scheduler when a child process receives a SIGHUP signal.
examples/hup-test · high confidence
Add Kernel-level Async, Sync, and Barrier methods
The library now exposes \Kernel\#Async\, \Kernel\#Sync\, and \Kernel\#Barrier\ as top-level methods for easier asynchronous programming. \Kernel\#Async\ runs a block asynchronously, reusing an existing reactor if available or creating a new one at the top level. \Kernel\#Sync\ runs a block synchronously within a reactor context, blocking until completion. \Kernel\#Barrier\ creates a barrier to wait for multiple tasks to complete, automatically managing the reactor lifecycle if none is active. These methods simplify common concurrency patterns by abstracting away explicit reactor management.
lib/kernel · high confidence
Add Ruby debug example using Async
A new example has been added to the debug examples directory that demonstrates how to use the debug gem alongside the async library. The example includes a Gemfile (gems.rb) and a locked dependency file (gems.locked) specifying versions for debug (1.8.0), async (2.5.1), and their dependencies, along with a sample script (sample.rb) that runs concurrent tasks using the async framework.
examples/debug · high confidence
Add Ruby version benchmark for pipe I/O performance
A new benchmark suite has been added to the \benchmark/rubies\ directory to measure the performance of reading and writing data over pipes across various Ruby versions (from 1.9.3 through 2.7 dev). The suite includes a \benchmark.rb\ script that utilizes a fiber-based reactor pattern to handle concurrent I/O, allowing users to compare execution times and observe performance trends, such as improvements in Ruby 2.6 and regressions in 2.7 preview.
benchmark/rubies · high confidence
Add buffer example using IO::Buffer
A new example script has been added to the examples/buffer directory that demonstrates the use of Ruby's IO::Buffer. The script opens /dev/zero and initializes an Async context with an interactive REPL, providing a starting point for exploring buffered I/O operations.
examples/buffer · high confidence
Add callback loop example demonstrating Async reactor usage
A new example file (examples/callback/loop.rb) has been added to demonstrate how to implement a callback-based loop using the Async reactor. The example shows creating a Callback class that wraps the reactor, running tasks with specific durations, and ensuring the reactor is properly closed in an ensure block.
examples/callback · high confidence
Add comprehensive benchmark suite for async primitives and concurrency models
The benchmark directory now includes a new suite of scripts to measure performance and resource usage of the async library and related concurrency mechanisms. This includes \async\_vs\_lightio.rb\ for comparing the async reactor against the LightIO library, \fiber\_count.rb\ and \thread\_count.rb\ for measuring resource limits, and \thread\_vs\_fiber.rb\ for comparing raw overhead. Additionally, detailed benchmarks for \Async::Task\, \Async::Queue\, and \Async::Condition\ have been added to track performance of task creation, queue operations, and signaling patterns, while \cancel\_cause.rb\ specifically measures the allocation and speed impact of propagating cancellation causes through task trees.
benchmark · high confidence
Add dining philosophers concurrency example
A new Ruby script demonstrating the dining philosophers problem has been added to the examples directory. It uses the Async library and semaphores to simulate five philosophers concurrently thinking and eating, illustrating proper synchronization to avoid deadlocks.
examples/dining-philosophers · high confidence
Add example reproducing Scheduler interrupt race condition
A new Ruby script, examples/bugs/write\_lock.rb, has been added to demonstrate a race condition in the Scheduler's interrupt and unblock logic. The example illustrates how concurrent thread interrupts can trigger failures when the reactor's selector is nil during closure, specifically on Linux with io\_uring.
examples/bugs · high confidence
Add examples demonstrating greedy scheduling with fibers and threads
Added two new example scripts in the examples/count directory that illustrate concurrent execution patterns: fibers.rb uses the Async library to demonstrate cooperative multitasking with fibers, while threads.rb uses native Ruby threads for comparison. Both examples measure execution time and track task transitions to help users understand the behavior of greedy scheduling in concurrent contexts.
examples/count · high confidence
Add fiber and thread creation benchmarks
New benchmark scripts have been added to measure the performance of creating 10,000 fibers and 20,000 threads, respectively. These benchmarks are accompanied by a results document recording execution times across Ruby versions 2.6.10 through 3.2.1, allowing users to track and compare concurrency creation overhead over time.
benchmark/core · high confidence
Add metrics for Async task scheduling and completion
The library now exposes counters for the \async.task.scheduled\ and \async.task.finished\ events via a new provider in \lib/metrics/provider/async/task.rb\. This allows users to monitor the lifecycle of asynchronous tasks, tracking how many are scheduled and successfully completed.
lib/metrics · high confidence
Add non-async Dataloader example
A new example has been added to the dataloader directory demonstrating a non-async implementation of a dataloader pattern. This example uses Ruby's Fiber.schedule for concurrent HTTP requests and includes the necessary gem dependencies (async) and a main script to load multiple URLs concurrently.
examples/dataloader · high confidence
Add queue example demonstrating producer-consumer patterns
A new example script (producer.rb) has been added to the examples/queue directory. It demonstrates how to use Async::LimitedQueue to manage a bounded queue of items between multiple producer tasks and a single consumer task, including the use of sleep for pacing and the frozen\_string\_literal pragma.
examples/queue · high confidence
Add tracing support for Async::Barrier and Async::Task
New provider files in lib/traces/provider/async.rb introduce automatic tracing for the Async library. Async::Barrier.wait is now traced with a 'size' attribute, and Async::Task.schedule is traced with 'block', 'transient', and optional 'annotation' attributes. The task tracing respects the active trace context, skipping tracing if no trace is active, and ensures trace attributes are strings.
lib/traces · high confidence
Added benchmark comparison between Timers::Group and IO::Event::Timers
New benchmark scripts have been added to the \benchmark/timers\ directory to compare the performance of the legacy \Timers::Group\ implementation against the newer \IO::Event::Timers\. These benchmarks measure throughput for scheduling timers (\after\), canceling timers, and firing events, using the \benchmark-ips\ library alongside the \timers\ (v4.3) and \io-event\ (v1.6) gems.
benchmark/timers · high confidence
Added stop behavior examples for Async
New example scripts have been added to the \examples/stop\ directory to demonstrate task lifecycle management. \condition.rb\ illustrates how to use \Async::Condition\ for producer-consumer signaling and task stopping, while \sleep.rb\ demonstrates a simple HTTP server setup that gracefully stops its reactor and child tasks after a delay.
examples/stop · high confidence
New capture example for profiling Ruby processes
Added a new example script in examples/capture that demonstrates how to profile a running Ruby process by combining getrusage statistics with strace syscall summaries. The tool accepts PIDs as arguments, captures CPU time and system call metrics over a duration, and outputs a summary including wait percentages to help users analyze process performance and blocking behavior.
examples/capture · high confidence
New configuration files for Giscus, external dependencies, and instrumentation backends
This change introduces several new configuration files to the project. The \config/environment.yaml\ file now defines Giscus repository and category settings for GitHub Discussions integration. The \config/external.yaml\ file lists URLs and test commands for several external repositories (async-pool, async-websocket, async-dns, async-http, falcon, async-rest). Additionally, new Ruby configuration files (\config/metrics.rb\, \config/traces.rb\, \config/sus.rb\) set up metrics and traces providers using the \async\ backend and configure the \sus\ test framework to use test backends for traces and metrics during testing.
config · high confidence
New load shedding example using Async::Idler
Added a new example script (examples/load/test.rb) that demonstrates load shedding and saturation handling. The script instantiates an Async::Idler with a 0.8 threshold, spawns continuous background tasks, and periodically prints the current scheduler load to stdout, illustrating how to monitor and manage system saturation.
examples/load · high confidence
New synchronization primitives and concurrency utilities
The library introduces several new concurrency primitives and utilities: \Async::Barrier\ for waiting on groups of tasks, \Async::Condition\ for edge-triggered signaling, \Async::Deadline\ for managing compound timeouts, \Async::Idler\ for load shedding, and \Async::Loop\ for quantized or periodic execution. It also adds \Async::Cancel\ for explicit task cancellation with cause propagation, \Async::ForkHandler\ for automatic fork event handling, and \Async::Notification\ for non-blocking fiber resumption. Additionally, \Async::LimitedQueue\ is now a distinct class with a deprecation warning for the old require path, and \Async::Clock\ gains JSON serialization support.
lib/async · high confidence
Removals
Removed asynchronous TCP server example
The \examples/aio.rb\ file, which demonstrated an asynchronous TCP server and client using the Async reactor, has been removed from the repository.
examples · high confidence
Behavioural changes
Project modernization and migration to sus test framework
The project has been modernized by replacing the RSpec test suite with the \sus\ framework, removing the \Guardfile\ and \Rakefile\, and migrating CI from Travis to GitHub Actions. Development tooling now uses \bake\ for release management and \rubocop\ for code style, with dependencies managed via \gems.rb\. Documentation has been updated to reflect these changes and link to new guides.
(repo-wide) · high confidence
Simplify library entry point and expose Kernel scheduling helpers
The main library entry point (lib/async.rb) has been streamlined to remove the Logger and Wrap dependencies, replacing them with a direct require for Async::Loop. Additionally, the library now explicitly loads and exposes top-level Kernel methods for scheduling operations, including Async, Sync, and Barrier, making these features directly available on the Kernel module for easier access.
lib · high confidence
Test coverage
Added benchmark for Async::Barrier task scheduling; Added comprehensive test suite for async primitives; Added test coverage for Kernel async primitives; Added test suite for Async::Scheduler using the Sus framework; Added test suite for Ruby standard library integration; Added tests for Async::Reactor nesting behavior; Added tests for Async::Task tracing integration; Added tests for IO::Buffer large copy operations; Added tests for Process.fork within an active scheduler; Added tests for agent thread-safety context evaluation; Added tests for concurrent Net::HTTP requests; New shared test fixtures for Async primitives; Removed empty and basic test files for Async::Context and Async::Reactor; Removed spec\_helper.rb and RSpec configuration.
Dependencies
Upgrade to Ruby 3.3 and modernize dependencies
The async gem now requires Ruby 3.3 or higher, dropping support for older versions. Runtime dependencies have been updated to use \io-event\ (\~\> 1.21) and \fiber-annotation\, replacing the previous \nio4r\ and \timers\ dependencies. The \console\ gem (\~\> 1.29) is now a required runtime dependency for logging, and development dependencies like RSpec and Bundler have been removed from the gemspec in favor of standard Gemfile management.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 66.
Lenses
- Code Health 98
- Architecture 100
- Maturity 67
- Readiness 55
- Security 72
Changes since last survey
- 300 commits — 269 feature/other, 31 fixes
By area
- (root) — 121 commits
- lib/async — 82 commits
- test/async — 33 commits
- .github/workflows — 12 commits
- examples/count — 3 commits
- guides/compatibility — 3 commits
- lib/traces — 3 commits
- .context/decode — 2 commits
- benchmark/timers — 2 commits
- config/external.yaml — 2 commits
- context/thread-safety.md — 2 commits
- context/usage.md — 2 commits
- fixtures/async — 2 commits
- guides/best-practices — 2 commits
- lib/metrics — 2 commits
- test/io.rb — 2 commits
- test/kernel — 2 commits
- test/kernel.rb — 2 commits
- assets/logo-lossless.webp — 1 commit
- assets/logo-v1.svg — 1 commit
Notable commits
- fix: Fix Barrier when parent.async() yields early (#449)
- fix: Fix URing backend probe on Ruby head. (#470)
- fix: Fix context/index.yaml schema.
- fix: Fix borked test.
- fix: Fix buffered IO signatures for Ruby 4.1 (#471)
- fix: Fix coverage CI title.
- fix: Fix document title and update readme.
- fix: Fix external tests rspec -> sus.
- fix: Fix failure logs and add explicit tests.
- fix: Fix flakey test - queue timeout may be slow in CI.
- fix: Fix handling of IO#close interruption across threads/fibers. (#369)
- fix: Fix handling of spurious wake-ups.
- fix: Fix idle load computation. (#323)
- fix: Fix missing documentation coverage.
- fix: Fix missing documentation.
- fix: Fix race between stop and task exiting. (#414)
- fix: Fix release notes.
- fix: Fix state handling, possibly fixes #439.
- fix: Fix test failure with fiber profiler. (#398)
- fix: Fix test.
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
socketry/async was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit d8f59c95c3083558aa543101ee5fdcc006054f4d — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.