Menu

Post image 1
Post image 2
1 / 2
0

PHP async: event loop, Fibers and the limits of single-threading

DEV Community·Odilon HUGONNOT·20 days ago
#iRSLkQoT
#php#async#reactphp#loop#fiber#fullscreen
Reading 0:00
15s threshold

A colleague asks: "Can PHP do what Node.js does — jump between tasks on a single thread?" Short answer: yes. Long answer: it's more subtle than that, and the distinction between concurrency and parallelism changes everything. PHP has a reputation for being sequential and blocking. That's true in the classic Apache + PHP-FPM model. But it's far from inevitable — understanding why it blocks is the first step toward knowing when and how to stop letting it. The blocking model of PHP-FPM In PHP-FPM, each HTTP request is handled by an isolated worker. That worker is single-threaded: operations execute one after another, in order. Nothing can happen concurrently within the same process.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More