Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP thread pool?

I have scheduled a CRON job to run every 4 hours which needs to gather user accounts information. Now I want to speed things up and to split the work between several processes and to use one process to update the MySQL DB with the retrieved data from other processes.

In JAVA I know that there is a thread pool which I can dedicate some threads to accomplish some work.

how do I do it in PHP?

Any advice is welcome.

Thank

like image 252
embedded Avatar asked Apr 07 '10 11:04

embedded


1 Answers

PHP is probably not the most suitable language for multi-threading.

You might want to have a look to different solutions. For example, Thrift allows you to have a PHP front-end talking with a Java back-end, where you could easily implement your desired behaviour.

If you still want to do this in PHP, you might want to have a look to:

http://www.php.net/pcntl

http://www.electrictoolbox.com/article/php/process-forking/

like image 112
Roberto Aloi Avatar answered Sep 22 '22 22:09

Roberto Aloi