The Fiber Illusion

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →

The Fiber Illusion

What RxJS taught us about real async pipelines in PHP.

Interactive version — https://slide.darkwood.com/slides/the-fiber-illusion

Mathieu Ledru

November 27, 2026

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

18 slides
  1. Darkwood · PHP · Flow · RxJS · stream_select The

    Fiber Illusion What RxJS taught us about real async pipelines in PHP Fibers ≠ Overlapping I/O @matyo91
  2. The initial assumption Flow already looked asynchronous. Fibers Drivers MaxIpStrategy

    await() But what exactly was “async”? Multiple Fibers do not automatically mean overlapping I/O. 01 | assumption @matyo91
  3. Slide 3 · 1/1 · représentation statique Why study RxJS?

    Not for pipe(). Not to clone Observables. Interesting because of the execution lifecycle. subscribe values track work completion errors / cancel teardown Architectural mirror — not a port. 02 | why-rxjs Version interactive : https://slide.darkwood.com/slides/the-fiber-illusion @matyo91
  4. What RxJS really teaches Lifecycle under the operators from(urls).pipe( mergeMap(fetchImage,

    4), map(hashBinary), retry(2), finalize(cleanup), ); pipe() subscribe() Composes only Starts execution mergeMap(..., 4) finalize() Bounds active work Cleanup on terminal paths 03 | rxjs-pipeline @matyo91
  5. Flow vocabulary Packets through stages Fetch → Hash → Save

    → Collector Ip Job IpStrategy Instruction packet Stage work Admission control MaxIpStrategy Driver await() Bounded concurrency Schedule & wait Completion barrier 04 | flow-model @matyo91
  6. The Fiber illusion A Fiber can suspend PHP. It cannot

    unblock a socket. file_get_contents($url); // still blocks the process CONCURRENT PHP OVERL APPING I/O Many Fibers scheduled FAKE ASYNC Non-blocking + stream_select Blocking calls hidden inside Fibers 05 | fiber-illusion @matyo91
  7. Slide 7 · 1/2 · représentation statique The missing stack

    Async is a runtime contract PHP streams non-blocking mode stream_select Fiber suspension readiness resume Driver Flow 06 | stack Version interactive : https://slide.darkwood.com/slides/the-fiber-illusion @matyo91
  8. Slide 7 · 2/2 · représentation statique The missing stack

    Async is a runtime contract Not a naming convention. A yield-on-readiness story. 06 | stack Version interactive : https://slide.darkwood.com/slides/the-fiber-illusion @matyo91
  9. The concrete experiment Real sockets. Real concurrency. → URLs fetch

    → checksu m → save → summary php bin/console app:fetch-images --concurrency=4 --timeout=5 Local fixture server One deliberate 404 Per-item success / failure content/rxjs-flow 07 | experiment @matyo91
  10. What we shipped StreamSelectDriver $driver->waitReadable($stream, $timeout); $driver->waitWritable($stream, $timeout); Driver Job

    Schedule · wait · resume · deadlines HTTP / protocol / application IpStrategy Collector Admission & concurrency Aggregate results The Driver is not an HTTP client. 08 | stream-select-driver @matyo91
  11. Slide 10 · 1/2 · représentation statique What concurrency=4 means

    A concurrency limit is only meaningful if the runtime can say exactly what it limits. Queued packets Admitted jobs Active Fibers Open sockets In-flight requests 09 | concurrency Version interactive : https://slide.darkwood.com/slides/the-fiber-illusion @matyo91
  12. Slide 10 · 2/2 · représentation statique What concurrency=4 means

    A concurrency limit is only meaningful if the runtime can say exactly what it limits. MaxIpStrategy(4) + non-blocking fetch job + StreamSelectDriver → ≤ 4 fetch packets admitted → ≤ 4 fetch Fibers active → ≤ 4 sockets waiting on stream_select 09 | concurrency Version interactive : https://slide.darkwood.com/slides/the-fiber-illusion @matyo91
  13. Errors · completion · cleanup Teardown is part of the

    run BATCH CRITICAL Collect per-item errors (demo: soft DTO errors) Fail fast via errorJob await() waits → no queued packets, no active jobs, no pending Cleanup on success, error, timeout, cancellation Flow’s version of teardown / finalize discipline. 10 | teardown @matyo91
  14. What Flow keeps from RxJS Steal the guarantees Lifecycle discipline

    Start Lazy compose / explicit run → track → complete → tear down FlowFactory then await() Bounded concurrency Deterministic completion MaxIpStrategy + yielding jobs Wait for active work Cleanup Per-run isolation Every terminal path + observability 11 | keep @matyo91
  15. What Flow rejects Steal the guarantees, not the API OBSERVABLE

    / OBSERVER / SUBSCRIBER SUBJECTS · OPERATOR ZOO JS method names in PHP As public app types CUSTOM PROMISE T YPE HT TP INSIDE DRIVERS Not required for pipelines Or a second demo engine 12 | reject @matyo91
  16. Where Flow goes next Prove the waits further 01 ·

    Multi-connection benchmark 02 · Cancellation tokens Next acceptance test — not measured yet For StreamSelectDriver waits 03 · Richer result API 04 · Production examples If collectors become painful Beyond the teaching fetch Job 13 | next @matyo91
  17. Closing When a job waits on I/O, does the runtime

    actually wait with it— or does it only pretend? Jobs yield → Drivers wait → I/O overlaps @matyo91
  18. Resources Go deeper Article — The Fiber Illusion content/rxjs-flow —

    app:fetch-images darkwood/flow — StreamSelectDriver RxJS 8.0.0-alpha.14 — lifecycle study source Steal the guarantees. Keep jobs, packets, Drivers. 14 | resources @matyo91

More Decks by Mathieu Ledru

Other Decks in Programming