

There's a caveat when dynamically spawning processes: you need to make sure that there won't be too many processes at once, Which don't really need to wait for each other.īy giving these tasks a separate process to run on, the underlying operating system can take care of running them in parallel. This parallelism can improve performance significantly when dealing with multiple synchronous tasks, We're using the symfony/process component to create and manage child processes in PHP.īy creating child processes on the fly, we're able to execute PHP scripts in parallel. When using this package, you're probably wondering what's happening underneath the surface. If you're using a Task to run processes, only the run method of those tasks will be called when running in synchronous mode. The Pool class has a static method isSupported you can call to check whether your platform is able to run asynchronous processes. If the required extensions ( pcntl and posix) are not installed in your current PHP runtime, the Pool will automatically fallback to synchronous execution of tasks.

Configure how long the loop should sleep before re-checking the process statuses in microseconds. Configure which autoloader sub processes should use. The maximum amount of time a process may take to finish in seconds // (decimal places are supported for more granular timeouts). The maximum amount of processes which can run simultaneously.
