Skip to content

Commit 1ad1d10

Browse files
authored
docs: Highlight the differences with Amphp/Reactphp (#276)
1 parent d814e1d commit 1ad1d10

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This library supports the parallelization of Symfony Console commands.
1212
- [Batches](#batches)
1313
- [Configuration](#configuration)
1414
- [Hooks](#hooks)
15+
- [Differences with Amphp/ReactPHP](#differences-with-amphpreactphp)
1516
- [Contribute](#contribute)
1617
- [Upgrade](#upgrade)
1718
- [Authors](#authors)
@@ -266,6 +267,30 @@ The library supports several process hooks which can be configured via
266267
*: When using the `Parallelization` trait, those hooks can be directly configured by overriding the corresponding method.
267268

268269

270+
## Differences with Amphp/ReactPHP
271+
272+
If you came across this library and wonder what the differences are with [Amphp] or [ReactPHP] or other potential
273+
parallelization libraries, this section is to highlight a few differences.
274+
275+
The primary difference is the parallelization mechanism itself. Amphp or ReactPHP work by spawning a pool of workers and
276+
distributing the work to those. This library however, spawns a pool of processes. To be more specific, the differences
277+
lies in how the spawn processed are used:
278+
279+
- An Amphp/ReactPHP worker can share state; with this library however you cannot easily do so.
280+
- A worker may handle multiple jobs, whereas with this library the process will be killed after each segment is
281+
completed. To bring it to a similar level, it would be somewhat equivalent to consider the work of handling a
282+
segment in this library as a Amphp/ReactPHP worker task, and that the worker is killed after handling a single task.
283+
284+
The other difference is that this library works with a command as its central point. This offers the following advantages:
285+
286+
- No additional context need to be provided: once in your child process, you are in your command as usual. No custom
287+
bootstrap is necessary.
288+
- The command can be executed with and without parallelization seamlessly. It is also trivial to mimic the execution of
289+
a child process as it is a matter of using the `--child` option and passing the child items via the STDIN.
290+
- It is easier to adapt the distribution of the load and memory leaks of the task by configuring the segment and batch
291+
sizes.
292+
293+
269294
## Contribute
270295

271296
Contributions to the package are always welcome!
@@ -293,8 +318,10 @@ See the [upgrade guide](UPGRADE.md).
293318
All contents of this package are licensed under the [MIT license].
294319

295320

321+
[Amphp]: https://amphp.org/
296322
[Composer]: https://getcomposer.org
297323
[Bernhard Schussek]: http://webmozarts.com
324+
[ReactPHP]: https://reactphp.org/
298325
[Théo Fidry]: http://webmozarts.com
299326
[The Community Contributors]: https://github.com/webmozarts/console-parallelization/graphs/contributors
300327
[issue tracker]: https://github.com/webmozarts/console-parallelization/issues

0 commit comments

Comments
 (0)