Async-Redis

 view release on metacpan or  search on metacpan

examples/slow-redis/README.md  view on Meta::CPAN

### 5 concurrent requests (should be ~1 second, not 5!)
```bash
time (for i in 1 2 3 4 5; do curl -s http://localhost:5001/ & done; wait)
```

### 10 concurrent requests
```bash
time (for i in $(seq 1 10); do curl -s http://localhost:5001/ & done; wait)
```

### Compare with fast endpoint (no delay)
```bash
curl http://localhost:5001/fast
```

## Expected Output

```
Slow Redis Response
===================
Worker PID:     12345

examples/slow-redis/app.pl  view on Meta::CPAN


    # Run the server
    REDIS_HOST=localhost pagi-server --app examples/slow-redis/app.pl --port 5001

    # Test single request (takes ~1 second)
    curl http://localhost:5001/

    # Test 5 concurrent requests (should still take ~1 second total!)
    time (for i in 1 2 3 4 5; do curl -s http://localhost:5001/ & done; wait)

    # Compare with fast endpoint (no delay)
    curl http://localhost:5001/fast

=head1 DESCRIPTION

This example demonstrates non-blocking I/O by intentionally sleeping for
1 second before returning a response. Despite the delay, the server can
handle many concurrent requests because the sleep is non-blocking.

With traditional blocking I/O:
- 5 sequential requests = 5 seconds



( run in 1.797 second using v1.01-cache-2.11-cpan-55a6197bec7 )