XpertEase

msg:3866334 | 3:30 pm on Mar 9, 2009 (gmt 0) |
@ jezzer, As far as i know you cant give priority to processes, for the simple reason that php can only do 1 process (single-threaded). Maybe you should optimize your script? cause 1000s of times sounds kinda 'impractical' Greetz
|
jezzer300

msg:3866370 | 4:08 pm on Mar 9, 2009 (gmt 0) |
Thanks. The 1000s of loops are necessary to analyse and pick-out all the top phrases on a page - for seo. I know PHP isn't the best language for this, but it fits in with the rest of my website which came first.
|
rocknbil

msg:3866390 | 4:25 pm on Mar 9, 2009 (gmt 0) |
Well, you could try forking the process. Part of the problem in a large or lengthy process is it has to maintain a connection with the browser. So if you could initiate the process, then return an immediate response to the browser, the child process would continue in the background. You'd need another tool to check the progress of the child. $pid=process ID. ## First you submit and return an immediate ## response. Do not exit after the response. &html('Checking the data'); ## This is the parent, which just marks the progress if ($pid = fork) { &mark_progress($pid,'current_process'); } ## This is the child. You want to close STDOUT so the ## call to your HTML sub above doesn't "hang." else { close (STDOUT); &do_your_large_process(); } ## So the parent doesn't kill the child waitpid($pid,0); The previous is a perl approach (close(),waitpid()) but it would be very easy to emulate this in PHP.
|
jezzer300

msg:3866470 | 5:57 pm on Mar 9, 2009 (gmt 0) |
Hi, I actually attempt to avoid hanging the browser by the parent PHP script using CURL to start the more busy child PHP script (which is set not to timeout and ignore_user_abort - client disconnection). This works, but the child then takes all the processor and prevents the other sessions from doing anything. It's looking like I can't force a lower priority, but maybe I will experiment with some micro sleeps etc. In general I don't think I can run this script on a shared server, I might upset someone! FYI: All current testing is on windows.
|
dmorison

msg:3866493 | 6:18 pm on Mar 9, 2009 (gmt 0) |
Can you call sleep(1) on a regular basis? sleep() is designed to relinquish control to the OS.
|
jezzer300

msg:3866513 | 6:30 pm on Mar 9, 2009 (gmt 0) |
Yes, thanks. I mentioned this in the 1st post. When the project is complete it will also run in the middle of the night, when it's quiet.
|
|