process-pool | PHP Process Pool | Web Framework library
kandi X-RAY | process-pool Summary
kandi X-RAY | process-pool Summary
[Total Downloads] ![CI] PHP Process Pool is a simple process pool using symfony process.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Get the name of the current process .
process-pool Key Features
process-pool Examples and Code Snippets
Community Discussions
Trending Discussions on process-pool
QUESTION
I am looking for a way to start two functions in parallel, each executing over a given set of different arguments. I use pool.map
to achieve this. I create two different processes and each process starts a pool executing the map
. This works - the order of execution is a little bit wild, but I will save this for another question.
Now I have also found another approach here (see the first answer). They are using only one pool and call map_async
two times in a row. So I was wondering, if there is a preferred way for doing this?
Because I have read (sadly I don't remember where) that it is best to only use one pool, which would mean the second approach (using only one pool) is better. But when I measure the time, the first approch (using two pools in separate processes) is actually a little bit faster. Additionally in the first approach the functions are really running in parallel, whereas in the second approach first the first call of map_async
executes, then the second call.
Here is my test code:
...ANSWER
Answered 2021-Oct-14 at 13:55First of all, I am assuming when you use two pools that you will be using the non-blocking map_async
method. I would say that two pools of size N each where you were submitting M tasks to each pool where all the tasks are identical (i.e. require the same resources as far as CPU, I/O, etc. are concerned) should be more-or-less equivalent execution time-wise as submitting the same 2 * M tasks to a single pool of size 2 * N.
The following program demonstrates the two cases:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install process-pool
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page