X
X
X
X

Knowledge Base

HomepageKnowledge BaseGazduireAdvanced system parametersProcessor time - statistics ...

Processor time - statistics and optimization

What is CPU time?

This is the time required on a server processor core to perform script processing operations and return a result. Also, 1 hour per minute can be equivalent to a few processor minutes, as processors usually have more than 1 core (8-core, 16-core, etc.).

How is it reported and what is included in the statistics?

The CPU time that is accounted for in the shared hosting service includes the time for processing MySQL queries and processing the scripts (php, perl, python and other scripts) that run on the server. Statistics do not include the time for serving static content (css, js, images, etc.). You can find statistics on CPU time spent in your client profile in the " Hosting Accounts " section after selecting the " Details" button for the respective account "" Advanced system parameters"" "" CPU time consumed", and the information is updated once every 24 hours.

In our system, CPU resources are reported on an account basis, not on individual sites located in the hosting account.

In most cases, the increased CPU usage is not due to a script running for a long time and / or consuming a lot of resources. Very often the scripts in the account are executed in milliseconds, but hundreds or thousands of times, which leads to the accumulation of CPU time.

Analysis

Very useful information that helps with analysis and optimization can be found in the Logs section of the cPanel control panel - Raw Access Logs and Awstats. In the statistics, analyze the information in the sections:

Days of month (Number of visits, Pages, Hits) Pages-URL (Top 25) Hosts (Top 25) HTTP Status codes


This will allow you to track visits for different days, the IP addresses from which the site is accessed, as well as the pages that are loaded.

Increased CPU consumption

Here are the most common reasons for increased CPU usage, with some application optimization tips.

• Dynamic photo processing (dynamic visualization, thumbnails creation, watermarking on a photo, etc.)

Here's a little more information about dynamic and static image serving:

CPU time statistics, as mentioned above, take into account the processing time of scripts from the hosting account (in this case php scripts) and do not take into account the time required to serve static content. An example of dynamic image processing is to visualize an image in a similar way:

https://domain.com/image.php?path=picture.jpg

To display the photo, the script is called each time. On sites, however, there is usually much more than one picture. For example, if there are 5 pictures on one page, the script is called 5 times and this is only for one user when loading the page. But the site has much more than one user, and the page does not open only once. This leads to multiple execution of the same script, which leads to suboptimal increase in resources spent.

Serving static content is to call the image directly without using a script:

https://domain.com/picture.jpg

Most CMSs often use scripts to dynamically resize and serve images, such as phpthumb, timthumb, and more. As the site develops, such scripts begin to consume suboptimal resources, and one good solution is to "serve" them as static content.

• Located PHP chat, live chat, ShoutBOX;

• Statistical modules;

Such applications generate many hits to the web server, often every second, so that the information can be transmitted in real time. This also often leads to a multiple increase in resources expended.

• Unnecessary calls / reloads (hits) of a large number of elements (pictures) on a web page, missing elements;

• Located ad management system (PhpAdsNew, OpenAds), etc .;

Automatic reloading of certain items or pages results in unnecessary hits to the web server. Missing elements on the site can also increase resource consumption. For example, when error 404 is handled by PHP. A good option for 404 error handling is to use SSI .

Ad management systems also use php scripts to visualize content, and as hits increase, CPU usage often increases.

• Numerous visits and indexes by search engine robots.

Based on our practice, we see that bots are sometimes very aggressive in indexing sites. In case you notice increased indexing by bots , you can temporarily block them through the .htaccess file or reduce the crawl rate for the site. You can do this using the Crawl-Delay function in a robots.txt file.

• Frequent calendar / address book synchronization.

Although this is a rare reason for increased CPU usage, if you have a calendar or multiple calendars that "refresh" on many devices, and the period is set to 1 or 2 minutes, this can increase CPU usage from the hosting account. .

If you have several calendars and / or several devices synchronizing them at the same time, it is recommended that the synchronization period be set to 30 minutes (minimum 15 minutes).

Can't find the information you are looking for?

Create a Support Ticket
Did you find it useful?
(2310 times viewed / 234 people found it helpful)

Top