7

Common reasons for poor website performance

 2 years ago
source link: https://help.dreamhost.com/hc/en-us/articles/216349808-Common-reasons-for-poor-website-performance
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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.

Optimizing your CSS and JavaScript

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:

Optimize JavaScript delivery

JavaScript is rendered as the browser reads the webpage (top-down). When a JavaScript file is encountered, the browser stops rendering the page until the JavaScript file has been fully read. This is called 'JavaScript Render-Blocking' and could cause a delay as the page loads.

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

CSS and JavaScript files have lots of empty space which makes them easier for humans to read. When you minify the code, it strips out all of that empty space. This makes the file smaller and can help them to load faster.

A quick online search will list many websites and tools available to minify your code.

Optimizing Media

Images

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:

Video

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.

Caching

A Cache is a temporary storage area for different types of computerized data. For example, browser caching allows webpage files like images, CSS, and JavaScript to be cached (stored) in the browser. Since those files are already stored, the next time you visit the same website your browser does not need to download them again, resulting in a faster browsing experience.

There are many different types of caching options for websites. Below are just a few common examples:

Use a CDN to deliver static files

You can use a CDN to deliver static files such as images, video, CSS and JavaScript files. This can help speed up their delivery to the end user.

Databases

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.

View the following article for detailed instructions on how to optimize your database using phpMyAdmin or SSH.

Internet issues

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

Network tools

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.

There are also several online tools to check different parts of a network. View the 'Website tools' article for a list of network tools and site loading tools.

Web server

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:

Browser plugin

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:

See also


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK