开发者

Kohana execution time is fast, but overall response time is slow, why?

开发者 https://www.devze.com 2023-01-21 06:37 出处:网络
I use the Kohana3\'s Profiler class and its profiler/stats template to time my website. In a very clean page (no AJAX, no jQuery etc, only load a template and show some text message, no database acces

I use the Kohana3's Profiler class and its profiler/stats template to time my website. In a very clean page (no AJAX, no jQuery etc, only load a template and show some text message, no database access), it shows the request time is 0.070682 s("Requests" item in the "profiler/stats" template). Then I use two microtime() to time the duration from the first li开发者_如何学Cne of the index.php to the last line of index.php, it shows almost very fast result. (0.12622809410095 s). Very nice result.

But if i time the request time from the browser's point of view, it's totally different. I use Firefox + Temper data add-on, it shows the duration of the request is 3.345sec! And I noticed that from the time I click the link to enter the website (firefox starts the animated loading icon), to when the browser finish its work(the icon animation stops), it really takes 3-4 seconds!!

In my another website which is built with WikkaWiki, the time measured by Temper Data is only 2190ms - 2432ms, including several access to mysql database.

I tried a clean installation of kohana, and the default plain hello-world page also loads 3025ms.

All the website i mentioned here are tested in the same "localhost" PC, same setting. Actually they are just hosted in different directories in the same machine. Only Database module is enabled in the bootstrap.php for kohana website.

I'm wondering why the kohana website's overall response is such slow while the php code execution time is just 0.126 second?? Are there anything I should look into?

==Edit for additional information ==

Test result on standard phpinfo() page is 1100-1200ms (Temper data)


Profiler shows you execution time from Kohana initialization to Profiler render call. So, its not a full Kohana time. Some kind of actions (Kohana::shutdown_handler(), Session::_destroy() etc) may take a long time.


Since your post confirms Kohana is finishing in a 1/10th of a second and less, it's probably something else:

  1. Have you tested something else other than Kohana? It sounds like the server is at fault, but you can't be sure unless you compare the response times with something else. Try a HTML and pure PHP page.
  2. The firefox profiler could be taking external media into consideration. So if you have a slow connection and you load Google Analytics, then that could be another problem.


Maybe there is something related with this issue: Firefox and Chrome slow on localhost; known fix doesn't work on Windows 7

Although the issue happens in Windows 7, maybe it can help...

0

精彩评论

暂无评论...
验证码 换一张
取 消