Jump to content

Apache slow when I display too much text.


Recommended Posts

This is my method of checking how long it takes to load a page:


$starttime = microtime();
$startarray = explode(" ", $starttime);
$starttime = $startarray[1] + $startarray[0];

$variable =  "(30 KB file here)";

echo $variable;
$endtime = microtime();
$endarray = explode(" ", $endtime);
$endtime = $endarray[1] + $endarray[0];
$totaltime = $endtime - $starttime; 
$totaltime = round($totaltime,5);
echo "$totaltime";


Gets around to .2 seconds. That of course is not useful timing. I assume this is a problem with Apache as I can declare the text as a variable without any lag but once I echo it, thats when it lags. If I'm wrong, please do move this topic.


Now if I was to reduce the size to 20KB it drops to .18 seconds and if I bring it to 10KB it drops to 0.00022 seconds. Clearly there is something wrong once I get to a higher display size as 0.00022 is perfectly acceptable but .18 seconds is awful just to display. Also, I looked up problems with apache and swapping/lack of memory is a problem so for your information:


            total      used      free    shared    buffers    cached

Mem:      1544152    1083376    460776          0    117748    620516

-/+ buffers/cache:    345112    1199040

Swap:      6152176          0    6152176


Nothing is swapped in this RAM usage and surely 460 MB of free RAM is enough to display 30 KB of text. So hopefully one of you guys know what could be the problem. Thanks.  :)


EDIT: Using Ubuntu 9.10 Server edition 32 bit.

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.