cgitb performance issue

Ethan Furman efurman at admailinc.com
Thu May 15 13:40:21 EDT 2008


Gabriel Genellina wrote:

> En Wed, 14 May 2008 13:51:40 -0300, Ethan Furman 
> <efurman at admailinc.com>  escribió:
>
>> Gabriel Genellina wrote:
>>
>>> En Mon, 05 May 2008 15:56:26 -0300, Ethan Furman  
>>> <efurman at admailinc.com> escribió:
>>>
>>>> I tried adding a form to our website for uploading large files.
>>>> Personally, I dislike the forms that tell you you did something wrong
>>>> and make you re-enter *all* your data again, so this one cycles and
>>>> remembers your answers, and only prompts for the file once the rest of
>>>> the entered data is good.  However, the first time the form loads 
>>>> it  can
>>>> take up to 30 seconds... any ideas why?
>>>
>>>
>>> Hard to tell without looking at the code... And what has cgitb to 
>>> do  with this?
>>>
>> Hmmmm... excellent question, and the answer is -- Nothing.  My
>> apologies.  I'm importing cgi (cgitb was while I was debugging it), as
>> well as a bunch of others.
>>
>> Here's the source, with a bunch of the actual html stripped out.  The -u
>> as well as the last two lines were an attempt to eliminate the 30-second
>> pause while it loads, as it seems to get all data transferred, then just
>> waits for a while.  Any ideas appreciated.  My apologies for the 
>> ugly  code.
>
>
> *When* do you see the 30-secs delay? After uploading the files? I see  
> they're transferred using SMTP, but I think you're not talking about 
> the  time it takes to send the mail.
> I'd use the old-fashioned "print" statement to see *what* gets 
> executed  and how long it takes each step.

The initial load of the page in question is a static html page (done as 
a crutch so there's *something* on screen while the rest of the thing 
loads).  After five seconds the static html page redirects to the python 
cgi script -- and that's where the delay occurs.  I just double checked, 
and it also occurs everytime it has to reload the script.  I'll try the 
print statements and see if I can narrow down where the bottleneck is 
located.  The sending of the file via smtp happens on our server after 
the file has been uploaded, the delays are happening long before that.  
Thanks for your help!
--
Ethan




More information about the Python-list mailing list