21. maj 2009 - 21:40
Der er
2 kommentarer og 1 løsning
langsom first byte
er der nogen der har nogle gode råd til hvad man kan gøre for at sætte farten op på sin first byte på sin hjemmeside..?? har kørt en test og får denne rapport, mere end 9sek..!! Request Headers: GET / HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/x-silverlight, */* Accept-Language: en-us UA-CPU: x86 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648) Connection: Keep-Alive Host: 205.234.128.83 Response Headers: HTTP/1.1 200 OK Date: Mon, 18 May 2009 11:28:44 GMT Server: Apache/1.3.41 (Unix) mod_deflate/1.0.21 mod_jk/1.2.23 mod_fastcgi/2.4.2 PHP/5.2.3 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.9 FrontPage/5.0.2.2634a mod_ssl/2.8.31 OpenSSL/0.9.7a X-Powered-By: PHP/4.4.9 Set-Cookie: PHPSESSID=1bd285bfce0dbee1c3c86855a64807dc; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: time_generated=9.147 Keep-Alive: timeout=15, max=150 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html;charset=utf-8 Content-Encoding: gzip
Annonceindlæg fra Barco
Jeg har prøvet at udelukke alting efterhånden.. Det skal siges at min side er bygget op med et template system, og selvom jeg efterlader mine templates fuldstændig blanke er siden stadig 7-8 sekunder om at loade..!! Php filen der kalder mine templates ser således ud, og det er altså den laver den langsomme loadtid..!! kan der ændres noget i den, så den loader hurtigere..?? <?php function get_microtime() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } function calc_microtime($from = 0) { return get_microtime() - $from; } $t_generated = calc_microtime(); error_reporting(E_ALL); class TimeCalculator { var $start_time; var $caption; function TimeCalculator($caption) { $this->start_time = microtime(); $this->caption = $caption; } function getElapsedTime() { $end_time = microtime(); $elapsed_time = round($this->getFloatTime($end_time) - $this->getFloatTime($this->start_time), 3); echo "<b>{$this->caption}</b> was executed in <b>$elapsed_time</b> seconds <br>\r\n"; } function getFloatTime($time_str) { list($usec, $sec) = explode(" ", $time_str); return ((float)$usec + (float)$sec); } } define ('PATH_TO_SYSTEM_CLASS','system/core/System.php'); ////////////////////////////////////////////////////////////////// // // start of the script actions // ////////////////////////////////////////////////////////////////// require_once(PATH_TO_SYSTEM_CLASS); //if (file_exists('system/user-config/LocalSettings.php')) echo "file exists"; else "not"; System::loadSystemSettings ('system/user-config/DefaultSettings.php'); System::loadSystemSettings ('system/user-config/LocalSettings.php'); require_once('admin/lang/'. System::getSystemSettings ('LOCALE') .'.php');//ȀЋRˀ if (is_null(System::getSystemSettings('SITE_URL'))) { header("Location: install.php"); exit; } elseif (is_readable ("install.php")) { echo '<p>Your installation is temporarily disabled because the install.php file in the root of your' .' installation is still readable.<br> To proceed, please remove the file or change its mode to make' .' it non-readable for the Apache server process and refresh this page.</p>'; exit; } System::boot(); System::init(); header("Content-type:text/html;charset=utf-8"); if (Navigator::isRequestedUnderLegalURI()){ $uri = Navigator::getUri(); //$page_config = new PageConfig($uri); $page_config = PageConfig::getPageConfig ($uri); // the Responder!!! if ($page_config->PageExists()){ $page_content = System::getPage($page_config); $time_generated = calc_microtime($t_generated); setcookie('time_generated', sprintf('%.3f', $time_generated)); echo $page_content; } elseif ($page_config->isADirecotryRequestedWithoutASlashAtTheEnd()){ header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');// no such page in configuration header("Location: {$_SERVER['REQUEST_URI']}/"); echo "The requested resource is located under a different URL: {$_SERVER['REQUEST_URI']}/"; } elseif (System::doesParentUserPageExist($uri)) { $parent_uri = System::getUserPageParentURI($uri); $page_config = PageConfig::getPageConfig ($parent_uri); $passed_parameters_via_uri = substr($uri, strlen($parent_uri)); $_REQUEST['passed_parameters_via_uri'] = $passed_parameters_via_uri; $page_content = System::getPage($page_config); echo $page_content; } else{ // the 404 error case! header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');// no such page in configuration echo "404 Not Found"; } } else{ header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');// not configured to answer such request echo "The software is not configured to respond to requests of the following host: {$_SERVER['HTTP_HOST']}\n"; } ?>