Jump to content

by third page, the page is loading very slow :: php MySQL speed measuring script


programguru

Recommended Posts

have a situation where I have a specific website I am working on.

 

Select the category, sub-category, then product.

 

The product page loads very slowly for some reason. Even if there are not images on the page its just dragging.

 

No other sites on the same server are having this issue.

 

My supsicions are:

 

--MySQL connection speed

--MySQL data loading

 

There are multiple form fields being populated.

 

Does anyone know of a script for the actual page which I can test the speed of the MySQL query when the page loads?

 

 

You can do this:

 

Put this at the beginning of your script:

<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
?> 

 

And this at the end:

 

<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
echo '<p>Page generated in '.$total_time.' seconds.</p>'."\n";
?> 

You could also just try and run the queries in a tool such as phpmyadmin to see how long the query itself takes to return.

 

Another good site load test is tools.pingdom.com which will show you how long each aspect of your page takes to render.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.