B0b Posted March 20, 2010 Share Posted March 20, 2010 Hey guys, I need to know how I could go about running 100 different PHP scripts, which are on my server, simulteanously? Each of these scripts need to run for several minutes. In other words, what would be the best way to do multi-threading with as much as 100 different instances? I used to pop up a new window via Javascript for this, but, now, for 100, that would be unmanageable. Please, shed some light on this! Quote Link to comment https://forums.phpfreaks.com/topic/195879-how-to-execute-100-scripts-in-parallel/ Share on other sites More sharing options...
trq Posted March 20, 2010 Share Posted March 20, 2010 Firstly, why on earth would you need this functionality at all let alone trying to execute it via php and a web server? Quote Link to comment https://forums.phpfreaks.com/topic/195879-how-to-execute-100-scripts-in-parallel/#findComment-1028865 Share on other sites More sharing options...
B0b Posted March 20, 2010 Author Share Posted March 20, 2010 Because I wrote a script/program and client asks to have it 100 times faster and there are no other way than having 100 of them running at once? There's really no other option. I understand PHP and web servers aren't the best platform for this but... unfortunately it's too late to go back. Hopefully the server is solid enough to handle it, I'm just unsure about what would be the most suitable way through PHP or Javascript to get this party started Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/195879-how-to-execute-100-scripts-in-parallel/#findComment-1028869 Share on other sites More sharing options...
trq Posted March 20, 2010 Share Posted March 20, 2010 Because I wrote a script/program and client asks to have it 100 times faster and there are no other way than having 100 of them running at once? That makes little sense. Besides, threading is not available in php within a web server environment. Quote Link to comment https://forums.phpfreaks.com/topic/195879-how-to-execute-100-scripts-in-parallel/#findComment-1028872 Share on other sites More sharing options...
dreamwest Posted March 20, 2010 Share Posted March 20, 2010 if you insist on running 100 script you can try multi handler with curl Quote Link to comment https://forums.phpfreaks.com/topic/195879-how-to-execute-100-scripts-in-parallel/#findComment-1028873 Share on other sites More sharing options...
B0b Posted March 20, 2010 Author Share Posted March 20, 2010 if you insist on running 100 script you can try multi handler with curl Sounds interesting! So cURL would execute all the handles (pages) simulteanously and not wait for the first to finish then go the the second? I did thought about cURL at first, but forgot about multi handling. Anyways, I'm curious how page's data (pages' HTML) are returned? Is it once all handles are loaded or gradually? Thank you very much! Quote Link to comment https://forums.phpfreaks.com/topic/195879-how-to-execute-100-scripts-in-parallel/#findComment-1028875 Share on other sites More sharing options...
dreamwest Posted March 20, 2010 Share Posted March 20, 2010 Its a multi threader so it will open all script simutaneously. This spider uses multi curl, just modify it to your prefrences http://www.wizecho.com/nav=scripts&s=spider Scroll down to the "Multi thread" example to see how to inistiate it Quote Link to comment https://forums.phpfreaks.com/topic/195879-how-to-execute-100-scripts-in-parallel/#findComment-1028882 Share on other sites More sharing options...
teamatomic Posted March 20, 2010 Share Posted March 20, 2010 Cron Batch// part of atd// can call a list file Task Spooler You might get either of these to work. Cron should be able to handle 100 at a pop. If it cant it will run what it can and then wait for 60 seconds and carry on from where it left off. HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/195879-how-to-execute-100-scripts-in-parallel/#findComment-1028883 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.