2

I have a website that is running WordPress (PHP and MySQL). A website is very slow responding to requests.

As I look into a web inspector in Safari, the problem doesn't seem to be file sizes.

http://img.skitch.com/20100127-1yjnf586wdr3tx4akk8fj5qwhx.png

It's taking 5 seconds before serving contents. What are the measures I can take? I'm new to server administration, and this is just a shared server. I don't have a full control, but it may be worth trying to optimize.

I tried traceroute and ping commands, but the commands work without an issue.

1
  • A late extension to this problem, what further troubleshooting steps might be taken if one has full control over the web server (Apache).
    – Kingsolmn
    Jul 18, 2012 at 20:03

4 Answers 4

3

You really need to have administrator rights to do any type of real troubleshooting on the server.

However, if you want to figure out if it is your code or the server's fault (heh), there are a few steps you can take. One of them is to add a timer to your php code to see how long it is taking to execute on the server. From here:

<!-- put this at the top of the page --> 

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

<!-- put other code and html in here --> 

<!-- put this code at the bottom of the page --> 
<?php 
  $mtime = microtime(); 
  $mtime = explode(" ", $mtime); 
  $mtime = $mtime[1] + $mtime[0]; 
  $endtime = $mtime; 
  $totaltime = ($endtime - $starttime); 
  echo 'This page was created in ' .$totaltime. ' seconds.'; 
?>

Using this, you can see if the server is actually slow, or if it is on the connection end.

If the server is slow there are a number of steps to take but you need admin rights to go any further, especially since you are using wordpress which is on hundreds of thousands of servers worldwide and is fairly optimized.

One more thing to try is to disable plugins and enable them one by one to see if any are causing your slowness.

3

It's probably nothing to do with the sizes of the files. If you're running wordpress your backlogs are going to be database and processor. Database for recovering all the information about what the page is supposed to look like, the content, etc. And processor for compiling all that stuff into an actual document and sending it out.

Might want to look at tweaking Apache's cache settings. If certain pages are getting requested often, there is no point in building them over and over.

1

Try using Firefox and install a plugin for it called Firebug (http://getfirebug.com/). Once you have it set up enable the 'net' panel and reload your pages. This will show you the amount of time it takes for each portion of the server response including initial connection speeds, time in download, server response lag, etc. Also you can use this panel to see if you are cacheing items such as JavaScript, Images, and CSS.

Since you are on shared hosting you are going to have VERY little control over your server setup, but you can speed things up in other ways by paying close attention to what you are asking that server to do.

GL! And get used to using Firebug, it is a lifesaver.

One last thing, make sure you are using the most up-to-date version of wordpress that you can, and don't use too many plugins. Every bit of overhead is going to slow your load down.

1

Wordpress, as many CMS out there, is known to be quite heavy, I'm not surprised a shared server gives you delays like this to serve the first byte.

The first thing to do is to make sure you have an available opcode cache (php-apc is the "standard" one), without one Wordpress will generate the homepage each time a new user requests it. If apc is installed on the server and if you have a way to configure it, you may try this configuration first:

apc.enabled=1
apc.shm_size=64
apc.max_file_size=3M
apc.ttl=7200
apc.user_ttl=7200
apc.stat_ctime=1

Then have a look at the stats given by the apc.php script included in the package, it will help you set those values more adequately.

The second thing I'll do is use a cache plugin for Wordpress like this one: http://wordpress.org/extend/plugins/w3-total-cache/

It will render content on first request and then serve static content every time it's possible.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .