Tjeneste-oppgradering: Følg linken for nærmere status vedrørende migrering, for generelle spørsmål og svar se vårt hjelpesenter.

Why is my website slow?


EXPERIENCING PROBLEMS WITH OUR SERVICES? RUN A DIAGNOSE FIRST TO SAVE YOURS AND OUR TIME

Added: 17.04.2021 15:24:53     Last updated: 22.04.2021 19:33:58

This guide shows you how to identify what makes the website slow. If you just want to make the website faster this guide is for you too. By following this guide you will be able to identify slow code and slow plugins running on the server side of the web page. That is, the PHP code that runs before the web page loads in your browser. The guide requires that you first log in to cPanel.

You may have worked tirelessly on your website and finally it works the way you want it to. Unfortunately, another problem have arised while adding plugin after plugin that gave you the functionality you wanted; The website has become very slow.

Until now, the only solution has been to turn on and off the plugins / functionality in the website solution you are using to find out what is causing the slowness. All our customers now have access to PHP X-Ray on all of our web hosting plans, so it will be much easier for you to find out the cause of the slowness. We are using a WordPress website with a number of plugins in this guide as an example, which represents the typical customer with us. Which solution you actually use does not matter as X-Ray checks all PHP code that is running. However, the solution are especially useful and optimized for WordPress websites since this is the most used solution for websites on the web today.

Step 1
Click the "X-Ray App" icon as shown in the screenshot below.

Find PHP X-Ray icon in cPanel

Step 2
Click the "Start tracing" button as shown on the screen below.

Main page for PHP X-Ray in cPanel

Step 3
Before you start tracing PHP code, you need to be aware of 3 things:

  • You can only run one tracing at a time, so if you have set up another tracing, it must first be completed or stopped.
  • Most websites today use caching to make the websites load faster. If you have caching turned on on the website, you will only trace the code that is not already cached. You usually want to run all the code on the website to find the code that is the bottleneck for your website. You should therefore turn off all caching before starting tracing.
  • The actual tracing will make the website run 5-10% slower while it is running. You should turn off tracing as soon as you are finished with it.

Start tracing by following these steps:

  1. Select (sub) domain tracing will be performed for.
  2. Enter the rest of the address you want to trace code for. Here you can enter * to trace all code that is running, or you can be more specific if only certain addresses are slow. If you have many people who use your site, it is an advantage to be as specific as possible so that you do not trace code that you are not interested in tracing.
    * is wildcard and includes all characters and unlimited characters. For example, if you have the addresses page-1/, page-2/, page-3/, you can enter page*/ in this field to track all 3 pages.
  3. If you select "Advanced settings" you will be able to enter a specific IP address to be traced. Then requests from all other IP addresses will be ignored. * in this example corresponds to all addresses. If you are wondering what your own IP address is, you can see it here.
  4. You can choose whether you want to track in a specific time period or a certain number of requests.
  5. Start tracking by clicking Run.

Start PHP X-Ray tracing

Step 4
You will then go to the page as shown below. Here you can:

  1. See tracking status. Since we chose to trace 20 requests, it shows here that 16 remain and that the tracing is still ongoing.
  2. 4 tracings has been completed so far.
  3. You can stop tracing here if you think you have collected enough data to identify what is causing the slowness.
  4. Here you go to take a closer look at what data has been found by the tracing. You can go here while the tracing is in progress as well. We wait until the tracing is complete and click to see the results.

List of traces with PHP X-Ray

Step 5
The result will show as shown below. Here you have:

  1. Summary of the number of traced requests and how these are categorized. You need to be aware of Throttled and Slow requests. Throttled means that one of the web hosting account limits has been reached and the request has thus been throttled. If you have checked the requests and do not see any bottlenecks then upgrading the web hosting plan will be the only solution for you to get faster loading of the website. The requests that are categorized as Slow are requests that take more than 1 second, of which there is 4 in this case.
  2. If you want to find requests to certain addresses, you can search here. As a starting point, only queries that are categorized as slow are displayed, so you must remove the option that only slow queries should show if you want to include all queries in the search.
  3. Here is a list of all the queries that match the search. We click on the request that took the most time.

Overview of traces with PHP X-Ray

Steg 6
Here shows all the data collected about the request. You can:

  1. Choose to download the information presented in a PDF. This can be very useful if you are going to send information about the slowness to the plugin provider or developers.
  2. The slowest parts of the code are listed at the top and these are essentially the ones you should focus on. In this case, we see requests against an external URL and that this is the reason why the page loads slowly. In such cases, you need to evaluate what you can do with these requests based on the information you find in this page. You should check if it can be changed to another URL that provides faster replies, consider contacting the plugin / code provider to make sure there are no problems with them or to turn off the plugin / code until it is improved.

    In this case, there is no plugin, but WordPress itself that installs a plugin and there is nothing that can be improved in any way. This request is running in the background and not via visitors to your website so in this case there is no need to do anything.
  3. Here are the slowest plugins listed.
  4. Here are the slowest database queries listed.
  5. The slowest external requests are listed here (same as in point 2). Here we have opened the slowest to show what information it is possible to look at.
  6. Here are the slowest system functions listed.

Detailed view of a tracing with PHP X-Ray

Done
We have now reviewed how you can examine slow web pages in more detail to find out what is causing the slowness by using PHP X-Ray in cPanel. This is important information to be able to optimize your website so that it is faster for your users.