Poor performance

From DreamHost
Jump to: navigation, search

Your users may be experiencing poor performance from your website. There are a variety of reasons why this may be happening, from issues related to how your site was built to internet and network problems. This article describes what you can do to improve the performance of your site, and how you can investigate performance issues that may be beyond your control.

Optimizing your site

Markup

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 blockquote element 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 
When linking to local resources (images, video, JavaScript, etc.) within your documents, use either absolute (also called relative from root) or relative paths. Using a remote path (such as a URL) will cause an additional and unnecessary HTTP request.
Use CSS 
Use CSS for controlling the presentation of your documents. External CSS files are cached by the browser, reducing overall page-load times. Do not use HTML tables to control page layout (unless presenting tabulated data) because they significantly increase a document's markup footprint.

Media

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.

Scripting

Templating, functions, etc.

PHP

Try installing PHP_FastCGI. It keeps PHP sessions running so it doesn't have to instantiate every time someone hits your web site.

DreamHost PS users can use XCache. It caches compiled PHP code in memory for later requests.

Caching

For WordPress, look to Wordpress performance and Fine Tuning Your WordPress Install.

For MediaWiki, enabling the File Cache can improve performance (more info).

For all sites, enable Page Speed Optimization for the domain.

Databases

Optimization, queries, connections, etc.

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. For instance, when Spam Karma sifts through spam comments in WordPress, it creates and subsequently deletes a lot of rows.

You can cleanup overhead with phpMyAdmin. View the Structure of your database in phpMyAdmin. 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 -pPASSWORD -h MYSQL.YOURDOMAIN.COM DATABASENAME;

Replace the items in all-caps with values appropriate for your site.

Internet issues

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.

Traceroute

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.

ISP

Some users may be suffering from a poorer performance than others. This may be the result of problems with a particular Internet Service Provider (particuarly 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.

Network issues

Web server

Load, users, uptime, etc.