You may sometimes notice that your website does not perform as well as it should. Unfortunately the causes for poor performance are wide and varied. This article describes some of the reasons to help you diagnose why your website might perform poorly and to provide tips on how to improve it.
Optimizing your site
Make sure your web documents embody the best practices in web page development. These include, but are not limited to:
- Use semantically-appropriate and valid markup
- HTML or XHTML elements should be used to describe their content. For example, a
blockquoteelement should contain quoted text and not be used to create a text indentation. Your documents should be validated and (where appropriate) well-formed.
- Use absolute or relative paths
- Use CSS
You can reduce the file size of media such as images, videos, and music by using compression techniques. Background images, particularly those that are tiled, can usually stand up to extra compression. Make use of separate image thumbnails where large images are not needed. Try to avoid high definition images on the majority of your pages. Having a megabyte or more of images will seriously slow down your site because it takes longer to download all of the site files.
Sometimes a poorly-written script, or a script that conflicts with other site elements can lead to a slow site and poor performance. Try running a full page test at: http://tools.pingdom.com/fpt/
Any scripts that take a long time to load should be investigated to see if they can be better optimized. It may also be worthwhile to turn off any scripts that look problematic to test and see if deactivating them leads to an improved performance.
Make sure to test all PHP scripts. PHP scripts that do not properly end can cause processes to be skipped for hitting the FCGI process limit, which can cause site slowness.
For WordPress, review the WordPress optimization articles.
For MediaWiki, enabling the file cache can improve performance. Here's more info on how to enable the file cache.
Your MySQL database might run slowly if it has a lot of overhead. Overhead is caused by rows being deleted, leaving empty space. The more active a database is, the more overhead there may be.
You can cleanup overhead within phpMyAdmin. For example, log into phpMyAdmin and view the Structure of your database. At the bottom, click 'Check tables having overhead'. Then select the pulldown 'Optimize Tables'.
You can also cleanup overhead via a shell script and/or cron job. You may want to run a monthly cron job to do this for you. A cron job entry might look like so:
#!/bin/sh /usr/bin/mysqlcheck -o -v -u USER -p PASSWORD -h MYSQL.EXAMPLE.COM DATABASENAME;
Replace the items in all-caps with values appropriate for your site.
Make sure that spam comments are not making it take longer to access your database. Akismet is a very useful plugin for WordPress that helps you eliminate spam comments which can speed up your site.
Data passing between a user agent and a web server traverses the Internet by means of a packet switching system that may encompass a dozen or more nodes, depending on the physical locations of the user and the web server.
Main article: Traceroute
One major reason for poor site performance is when one or more "hops" taken by data packets passing through the Internet are obstructed or delayed. Traceroute is often used for network troubleshooting. By showing a list of routers traversed, it allows the user to identify the path taken to reach a particular destination on the network. This can help identify routing problems or firewalls that may be blocking access to a site.
Some users may suffer from a poorer performance more than others. This may be the result of problems with a particular Internet Service Provider (most often, if it is one of the large Online Service Providers, such as AOL). Network congestion, bandwidth throttling and restrictions, data discrimination and filtering, and even content filtering can all result in poor site performance.
Make sure to test your own local Internet speed at a site such as speedtest.net. This may help to confirm where the slowness is originating.
Check the load, users, uptime, and so on.