PHP script slowing down

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a PHP-CLI script that I have made to do some disk I/O
operations, it is a pretty large script and it involves me running an
external application at the very end that will copy the data from the
disk to another location. Now my problem is that when i run this
application through my existing PHP Script , the maximum speed i can
get is around 3MB/s , However when i run the same 'external program'
using the same procedure (proc_open()) through another PHP script made
explicitly for this purpose then i get a speed of around 10MB/s.
I've gone through my code again and again but i'm not able to find out
why my original script slows down the system so much!
Any suggestions will be really appreciated .

For your information, these are some details of my script (calling
1. I have used several system() / popen() functions however I have
closed all popen()s with the corresponding pclose()
2. All unused variables have been unset
3. I have run the external application with high priority (using nice
-19 )

If there is anything else that you need to know , please tell me.


Re: PHP script slowing down

Quoted text here. Click to load it

To debug this you might want to run something like

strace -tt -p 12345

on your php process and the spawned process started with popen. The output
from strace can also be redirected to log files, but you must then
redirect stderr.

By studying those logs you can see which process is waiting for the other
one (probably the spawned process waiting for the php parent) and what the
busy process is doing.

regards Henrik
The address in the header is only to prevent spam. My real address is:
hc3(at) Examples of addresses which go to spammers:
root@localhost postmaster@localhost

Site Timeline