Oh great ones,
Further to a previous post of mine,
What can cause the delay of a cgi script? it turns out that humble print statements are the cause, and now I'd like to find out why and what I can do about it!
For the life of me I cannot track down what can cause the print statements in this:
# lock DB
# exract data and load into %content
# unlock DB
print header; # from CGI module
print $content{'menu'} . $content{'body'} . $content{'footer'};
exit;
to sometimes take between 2 and 300 seconds (Apache timeout) to execute.
Some background:
a) the total output is between 20kb and 75kb (nothing excess here)
b) program runs under one process - no kids
c) has occurred on 2 different webservers running Apache 1.3.33 Unix
d) DB's are already closed and no further disc access is asked
e) $| = 0; and $| = 1; make no difference
f) Can happen to a Googlebot just as easily as Explorer, although I've never been able to recreate it from (macosx) Safari, Explorer or Firefox on adsl connection
g) Both webservers had more than enough capacity and RAM to process the requests and were relatively quiet at the times of the intermittent delays
h) nothing in the Apache error logs
i) Perl 5.8.0 and 5.6.1
Has anyone experienced anything like this before?
Any suggestions as to how to avoid it?
Excerpt from my log:
Please note that timings are from Time::HiRes and the print statements occur between start_display_layout and end_display_layout in this case taking 8.9302 secs to execute
27-06-2005 11:23:22 (13747) xxx.xxx.xxx.xxx /index.pl exec->9.0591
day=, month=, year=2005, style=0, price=0, partorbed=1, p=search, zoek
+=Start zoeken
CONTENT_LENGTH -> 76
CONTENT_TYPE -> application/x-www-form-urlencoded
DOCUMENT_ROOT -> /home/mysite/HTML
GATEWAY_INTERFACE -> CGI/1.1
HTTP_ACCEPT -> image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, ap
+plication/vnd.ms-excel, application/vnd.ms-powerpoint, application/ms
+word, application/x-shockwave-flash, */*
HTTP_ACCEPT_ENCODING -> gzip, deflate
HTTP_ACCEPT_LANGUAGE -> nl
HTTP_CACHE_CONTROL -> no-cache
HTTP_CONNECTION -> Keep-Alive
HTTP_HOST -> www.mysite.com
HTTP_USER_AGENT -> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
HTTP_WEFERER -> AIJJPHSCRTNHGSWZIDR
PATH -> /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
QUERY_STRING ->
REMOTE_ADDR -> xxx.xxx.xxx.xxx
REMOTE_PORT -> 3128
REQUEST_METHOD -> POST
REQUEST_URI -> /index.pl
SCRIPT_FILENAME -> /home/mysite/HTML/index.pl
SCRIPT_NAME -> /index.pl
SERVER_ADDR -> xxx.xxx.xxx.xxx
SERVER_ADMIN -> webmaster@mysite.com
SERVER_NAME -> www.mysite.com
SERVER_PORT -> 80
SERVER_PROTOCOL -> HTTP/1.1
SERVER_SIGNATURE -> <ADDRESS>Apache/1.3.33 Server at www.mysite.com Po
+rt 80</ADDRESS>
SERVER_SOFTWARE -> Apache/1.3.33 (Unix) PHP/4.3.9
load_modules 0.0000 / 0.0000
get_lock 0.0745 / 0.0745
lock_granted 0.0004 / 0.0749
release_lock(start) 0.0419 / 0.1168
finished_undef 0.0001 / 0.1169
finished_untie 0.0117 / 0.1286
finished_LOCK_UN 0.0001 / 0.1287
closed_DBLOCK 0.0000 / 0.1288
start_display_layout 0.0000 / 0.1288
end_display_layout 8.9302 / 9.0590
TOTAL------------> 9.0591 / 9.0591
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.