Answer the question
In order to leave comments, you need to log in
How to run PHP script from console on all cores?
Tell me, gurus, is there any way to run php scripts from the console (linux, php 5.3), using all the cores at once? In short: there is a script that should not be run often, but write a lot to the database, while the requests are not large and there are a lot of them (over 100000).
Now the script works, but it loads only one core and works for a long time (7 hours each). Maybe there is some possibility from linux to specify the maximum number of cores for php?
Answer the question
In order to leave comments, you need to log in
No, PHP is single-threaded by default. You can run many scripts by hand (or not by hand, but by supervisor, for example) but they must be written appropriately, and not do the same job. And also, before optimizing something, first find a bottleneck, xhprof for example, and then eliminate it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question