perl cgi's and apache
I am having a problem getting my cgi script to complete processing when it is launched via apache server. The script itself runs fine from the command line. It is a script that processes a long array of values and interacts with a database per value. When the array is relatively short, the program will complete and everything is fine (even when launched through the browser). When the array is larger, and only when launched through the browser, the perl.exe on the Windows 2000 machine just seems to hang after about 30 seconds or so and if I stop apache server, it will start processing again and finish its job. I think I have all the apache timeout parameters set long enough. Can anyone help me out on this? Thanks
Re: perl cgi's and apache
On Tue, 5 Feb 2002, Jeff wrote: Date: Tue, 5 Feb 2002 19:21:39 -0500 From: Jeff [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: perl cgi's and apache I am having a problem getting my cgi script to complete processing when it is launched via apache server. The script itself runs fine from the command line. It is a script that processes a long array of values and interacts with a database per value. When the array is relatively short, the program will complete and everything is fine (even when launched through the browser). When the array is larger, and only when launched through the browser, the perl.exe on the Windows 2000 machine just seems to hang after about 30 seconds or so and if I stop apache server, it will start processing again and finish its job. I think I have all the apache timeout parameters set long enough. Can anyone help me out on this? Thanks Jeff, The browser may be what's timing out the process. There are many things you can do to work around such problem. Did you look in the guide (http://perl.apache.org/guide)? I searched for timeout, and the first suggestion is this: http://thingy.kcilink.com/modperlguide/debug/Handling_Server_Timeout_Cases_an.html However, you never mentioned that you're using mod_perl -- just Perl -- so the guide may not help all that much. (This is a *mod_perl* list you wrote to, you know. :) Regardless, one thing you can always do is to throw more hardware at the problem (bigger, faster machine; more memory; split up the load to a dedicated database server/light-weight frontend mod_perl-less Apache/big, fat mod_perl server backend). Or try to streamline your code -- maybe make one big SQL query for all your values rather than individual calls for each one. If none of that works for you, you may need to pass off the long-running process to a queue for a cronjob to pick up (well, maybe not cron if you're on Windows) or you spin it off to an external script to do the work. Search the guide. HTH, ky
Re: perl cgi's and apache
Perhaps you could give us some idea of your input set and how you interact with the database. Have you determined the break-point? At what array size? 10, 100, 1000, 10k, etc Also how do you interact with the DB? Do connect-disconnect? Do you 'prepare' your statement and use binding parameters? What Database engine are you using? Is it local or accross the LAN? And who is your web server running as? Perhaps you are hitting a quota for that user. Ken Y. Clark wrote: On Tue, 5 Feb 2002, Jeff wrote: Date: Tue, 5 Feb 2002 19:21:39 -0500 From: Jeff [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: perl cgi's and apache I am having a problem getting my cgi script to complete processing when it is launched via apache server. The script itself runs fine from the command line. It is a script that processes a long array of values and interacts with a database per value. When the array is relatively short, the program will complete and everything is fine (even when launched through the browser). When the array is larger, and only when launched through the browser, the perl.exe on the Windows 2000 machine just seems to hang after about 30 seconds or so and if I stop apache server, it will start processing again and finish its job. I think I have all the apache timeout parameters set long enough. Can anyone help me out on this? Thanks Jeff, The browser may be what's timing out the process. There are many things you can do to work around such problem. Did you look in the guide (http://perl.apache.org/guide)? I searched for timeout, and the first suggestion is this: http://thingy.kcilink.com/modperlguide/debug/Handling_Server_Timeout_Cases_an.html However, you never mentioned that you're using mod_perl -- just Perl -- so the guide may not help all that much. (This is a *mod_perl* list you wrote to, you know. :) Regardless, one thing you can always do is to throw more hardware at the problem (bigger, faster machine; more memory; split up the load to a dedicated database server/light-weight frontend mod_perl-less Apache/big, fat mod_perl server backend). Or try to streamline your code -- maybe make one big SQL query for all your values rather than individual calls for each one. If none of that works for you, you may need to pass off the long-running process to a queue for a cronjob to pick up (well, maybe not cron if you're on Windows) or you spin it off to an external script to do the work. Search the guide. HTH, ky -- - Medi Montaseri [EMAIL PROTECTED] Unix Distributed Systems EngineerHTTP://www.CyberShell.com CyberShell Engineering -