Re: Question about apache-php concurrent process control
| From: | Liang ZHONG | Date: | Fri, 15 Jul 2005 22:26:49 +0000 |
| Subject: | Re: Question about apache-php concurrent process control | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-218782@lists.php.net to get a copy of this message | ||
Could you please explain it a little bit more?
I did test this way.
The code is the same for a.php and b.php
<?php
sleep(20);
print Done. <br />";
?>
I place request from 2 browser windows.
First time, I placed with http://baseURL/a.php with both 2 browsers, starting times have 5 second interval. Then the first "Done" shows after 20 seconds and the second "Done" shows 20 seconds after the first "Done".
Then, I placed one browser with http://baseURL/a.php and the second one with http://baseURL/b.php, with starting time of 5 second interval. Then I got the first browser showing "Done" after 20 seconds and 5 seconds later, the second browser showed "Done", too.
Thus it seems that the apache can spoon out multiple php interpreters responding to http requests, while php can not deal with concurrent process from one program.
I do not know if it is due to the php's design limitation, or I did not configure the php correctly to fulfill its full functionality?
Thank you
Liang ZHONG wrote: As I know, apache-php works this way. When the web server gets an http request with file name extension ".php", it will start the php interpreter to process the php file. Now I have a php program does something like this: when it is executing with one parameter p1, the program code goes to contact a database, gets back huge amount of data, writes it to file system. This will take pretty long time to finish. In the mean time, the same php code will be invoked by apache with another request, passing different parameter p2, indicates the code need to run to check the availability and read partial of the data which has already writen to the file system just now. The program location need to be in the same URL, but with only different parameter passing to it. for example: http://baseURL/a.php?v=p1 http://baseURL/a.php?v=p2 I want these 2 process can be run concurrently, but through a small test, I found out that they just sequentially execute one after the other. Sorry, your test is wrong then. Apache/PHP does not serialize requests like that. If somehow the backend you are collecting data from is serializing the requests, then you are out of luck and frontend threads isn't going to solve that since your threads would simply be serialized as well. You are on the wrong track here. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php