This article offers a few tips on how to improve your website performance and diagnose why it may not be running as efficiently as possible.
This optimization article is for any websites that were custom-built using HTML/CSS/JS and any other backend language such as PHP.
If you instead built your site using a One-Click Install (such as WordPress), please view the following article for optimization options:
Use a CDN to load jQuery
If your site is using jQuery, load it into your HTML document using a CDN as opposed to a local version on your webserver. Loading jQuery from a CDN such as Google can help to speed up page load. This is because your visitors most likely have already visited several sites that are using a jQuery CDN (like Google or Microsoft). Because they have already downloaded the jQuery library to their browser, it is already cached and will not need to be downloaded again. The following pages list options jQuery CDN options:
If a script is not needed to load the page, defer the loading of it until the page has fully loaded. This can help the most important parts of the page to load first. View the following articles for further information:
Optimize CSS delivery
CSS can also be optimized to improve the initial page load. View the following articles for further details:
Check for poorly written scripts
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 any of the following sites:
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 improved performance.
Minify your scripts
A quick online search will list many websites and tools available to minify your code.
Images are often a primary source of slowness. Having a megabyte or more of images will seriously slow down your site because it takes longer to download all of the site files. Optimizing your images will go a long way to reduce your page load time.
View the following links for further information:
Make sure you compress your videos to reduce the total size. If they are too large, the videos may pause/buffer as the user attempts to view them.
It's also a good idea to convert your videos to a format compatible with HTML5. This ensures the greatest number of browsers are able to view them.
OPcache is a caching engine built into PHP. When enabled, you’ll enjoy significant website speed improvements automatically.
It is enabled by default on Shared and DreamPress hosting plans, so if you're already using one of those plans, you do not need to enable it.
If you are on a VPS, Dedicated, or DreamCompute Hosting plan, follow the instructions in the following article to enable it manually.
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.
There are many different types of caching options for websites. Below are just a few common examples:
Use a CDN to deliver static files
Your MySQL database might run slowly if it has a lot of overhead. If tables in your database have excessive "overhead" (unused empty space), it can cause queries to the database to take longer, and may result in the web server timing out before it can receive the response from the database server.
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. The 'Traceroute' tool 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. View the Traceroute article for further information:
Some users may suffer from poorer performance more than others. This may be the result of problems with a particular Internet Service Provider. Network congestion, bandwidth throttling and restrictions, data discrimination and filtering, and even content filtering can all result in poor site performance. Check with your ISP to see if they are currently having connectivity issues.
Make sure to test your own local Internet speed at a site such as Speedtest.net. This may help to confirm if your local connection is having connectivity problems.
It's also possible that there could be a problem with the DreamHost web server your site is hosted on. View the following article for command line examples you can use to troubleshoot your site and server:
There are also browser plugins/extensions you can add that help you investigate the cause of slowness. YSlow is a good one to try out: