dsn Posted March 21, 2009 Share Posted March 21, 2009 I have a intranet site I have written in PHP for my company. Some features are controlling services on various boxes in our infastructure. At first this wasn't a problem but as the site grows and there are more servers in the farm I have noticed large amounts of "Hang Time" when scripts are executing in the background. Simple Sample Code <? output=`sudo /path/to/script`; echo $output; ?> I have tried various other methods for accomplishing this even looking at different langs. I tried having the process run in the Background sending Stdout to a file and have a Loop in PHP to read the file and dump the data from Stdout to HTML again the problem is it seems to wait until it has completed before rendering any data. Is there any way around this? I am thinking something like an Ajax Log Viewer window in the page would solve the problem but even though its async I keep getting the "Hang" and "Pop" effect when the page renders. This causes confusion in the application to the user as for example when I say restart Tomcat / Apache in the farm there is a 10 second wait between Tomcat Starting and Apache Starting to allow resources to finish releasing after deploying webapps and with 10 + Servers this is over 1 1/2 mintues of sleep time in the script alone. So you take that plus execution time and the page takes 2-3 minutes to render while I find my users freaking out not knowing what is going on and hitting refresh and doubling up command execution and causing other problems. I tried Perl, I tried RoR, but when it comes to it I prefer PHP and would like to make this work in PHP. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.