Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the number of "workers" in Laravel Octane equal to the number of requests that can be handled simultaneously?

Do I understand correctly that the number of "workers" in Laravel Octane is equal to the number of requests that can be executed simultaneously?

For example, if there are 2 workers, and 2 of them are busy returning CSV exports - new requests will not be processed?

What's the situation like with concurrency in Laravel Octane?

like image 500
Ostap Brehin Avatar asked Jan 23 '26 16:01

Ostap Brehin


1 Answers

Octane with RoadRunner or Swoole

When Octane is used with RoadRunner or Swoole, the number of workers is directly responsible for the number of requests your app can handle simultaneously. You can verify it with following route:

Route::get('longrequest', function () {
    sleep(15);
    return 'done';
});

If you spin a Laravel Octane instance with 2 workers and hit this endpoint twice, the third execution will have to wait until one of the two workers becomes free to process it.

Octane with FrankenPHP

By default, this also applied to FrankenPHP.

Hovewer, in FrankenPHP, it's possible to set max_threads to auto, and it would then auto-scale the number of workers.

https://frankenphp.dev/docs/performance

Other alternatives

In case you want something Laravel-like and truly asynchronous, check out Hypervel.

like image 131
Ostap Brehin Avatar answered Jan 27 '26 00:01

Ostap Brehin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!