Async-Redis

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        - t/60-scripting/script-registry.t (17 tests)
        - t/60-scripting/pipeline-scripts.t (16 tests)
        - t/60-scripting/pagi-channels.t (16 tests) - realistic channel layer scenarios

0.001002  2026-01-17
    - Bug Fix: Concurrent command response matching
        - Fixed race condition where multiple async commands on a single
          connection could receive mismatched responses
        - Implemented Response Queue pattern with FIFO ordering
        - Commands now register in inflight queue before sending
        - Single reader coroutine processes responses in order
    - New Features:
        - Added inflight_count() method to check pending commands
        - Added _wait_for_inflight_drain() for pipeline/PubSub synchronization
    - Documentation:
        - Added CONCURRENT COMMANDS section to POD
        - Documented Response Queue pattern and best practices
    - Testing:
        - Added t/92-concurrency/response-ordering.t test suite
        - Tests for concurrent SET, GET, mixed command types
        - Stress test with 100 concurrent commands

examples/async-job-queue/SPEC.md  view on Meta::CPAN

the process remains responsive.

## Runtime Behavior

The app should:

- connect to Redis using `REDIS_HOST` and `REDIS_PORT`, defaulting to
  `localhost` and `6379`
- clean only its own demo keys at startup
- enqueue a burst of jobs immediately so the queue depth is visible
- start a fixed number of worker coroutines
- start one heartbeat coroutine
- exit automatically after all jobs are processed
- clean up its worker unblock sentinels before exit

Default values:

- jobs: `10`
- workers: `2`
- simulated work delay: `1.5` seconds
- heartbeat interval: `0.25` seconds
- queue key: `async-job-queue:jobs`

examples/stress/README.md  view on Meta::CPAN

```

## Implementation

See `lib/Stress/`:

- `Metrics.pm` — counters + reservoir sampling.
- `Integrity.pm` — sequence trackers and chaos window.
- `Output.pm` — stderr line + JSONL emitter.
- `Chaos.pm` — CLIENT KILL controller.
- `Workload.pm` — five `async` coroutines.
- `Harness.pm` — orchestrator.

Spec: `docs/plans/2026-04-24-stress-example-design.md`.
Plan: `docs/plans/2026-04-24-stress-example-plan.md`.

lib/Async/Redis.pm  view on Meta::CPAN

commands without explicitly awaiting them:

    my @futures = (
        $redis->set('k1', 'v1'),
        $redis->set('k2', 'v2'),
        $redis->get('k1'),
    );
    my @results = await Future->needs_all(@futures);

Each command is registered in an inflight queue before being sent to Redis.
A single reader coroutine processes responses in FIFO order, matching each
response to the correct waiting future. This prevents response mismatch bugs
that can occur when multiple coroutines race to read from the socket.

For high-throughput scenarios, consider using:

=over 4

=item * B<Explicit pipelines> - C<< $redis->pipeline >> batches commands
for a single network round-trip

=item * B<Auto-pipeline> - C<< auto_pipeline => 1 >> automatically batches
commands within an event loop tick



( run in 1.305 second using v1.01-cache-2.11-cpan-df04353d9ac )