Skip to content

[source]

Swoole#

Swoole/OpenSwoole is an async PHP extension that also supports multiprocessing.

Tip

Swoole backend makes use of Igbinary serializer. If you need to optimize the memory usage (or getting out-of-memory errors) consider installing Igbinary.

Example#

No parameters are required. It's a drop-in replacement for the Serial backend.

use Rubix\ML\Backends\Swoole;

$backend = new Swoole();

Any estimator that implements the Parallel interface can utilize the Swoole backend by passing it to the setBackend() method:

use Rubix\ML\Classifiers\RandomForest;
use Rubix\ML\Backends\Swoole;

$estimator = new RandomForest();

$estimator->setBackend(new Swoole());

Additional Methods#

Return the number of concurrent worker processes.

public workers() : int