thesis / demo
A small HTTP server with console logging that shows how concurrent requests overlap.
Fund package maintenance!
Requires
- php: ^8.6
- ext-pcntl: *
- thesis/async: dev-main
- thesis/dispatcher: dev-main
- thesis/formatter: dev-main
- thesis/http: dev-main
- thesis/http-protocol: dev-main
- thesis/http-server: dev-main
- thesis/io: dev-main
- thesis/logger: dev-main
- thesis/net: dev-main
- thesis/source-location: dev-main
- thesis/time: dev-main
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-11-23 23:35:14 UTC
README
Thesis Demo
This read-only repository mirrors
packages/demo. Open issues and pull requests in the thesis-php/thesis monorepo.
Each HTTP request waits for 250 ms, then returns OK and the request path. The console log timestamps
the start and finish of each request so you can see the waits overlap.
Run
Use 64-bit PHP 8.6 with Io\Poll\Context and ext-pcntl on Unix. Once the split is on Packagist, install
the development version with Composer.
composer create-project thesis/demo demo dev-main
cd demo
php run.php
From the monorepo root, run make install, then start the server in Docker.
docker compose run --rm -p 127.0.0.1:8080:8080 php php packages/demo/run.php 0.0.0.0:8080
In another terminal, send the same eight requests sequentially and then concurrently.
time curl -fsS 'http://127.0.0.1:8080/[1-8]' time curl -fsS --parallel --parallel-immediate 'http://127.0.0.1:8080/[1-8]'
On an idle machine, expect about two seconds for the first command and about 250 ms for the second.
In the parallel run, all eight Started lines appear before the first Finished line.
Press Ctrl+C to stop the server.
The server and logger are wired in run.php.