4 ms·
Request-level concurrency has always scaled well. As for lightweight concurrency, have you worked with PHP Fibers? https://medium.com/@binumathew1988/leveraging
by CharlesW 1y ago
Request-level concurrency has always scaled well. As for lightweight concurrency, have you worked with PHP Fibers? https://medium.com/@binumathew1988/leveraging-php-fibers-for-concurrent-web-scraping-a-real-world-example-5fce41baf9c7 https://medium.com/@binumathew1988/leveraging-php-fibers-for...
- phplovesong 1y agoPHP Fibers does not do anything on its own. Its basically just syntax for generators, to be used with various external runtimes. This means in a vanilla PHP setup when i do something like this: $a = new Fiber(function () { sleep(2); // block Fiber::suspend(); return null; }); $b = new Fiber(function () { sleep(2); // block Fiber::suspend(); return null; }); // Start execution $a->start(); $b->start(); // ... later in code wait for both executions to finish $a->resume(); $b->resume(); // Total execution time is not 2 seconds, but 4 I need an additional runtime to support real concurrency. I also need a separate async IO library to handle blocking. This is usually a showstopper for most PHP still out there. And just annoying on so many levels.