Help troubleshooting website performance

[ad_1]

Hi! I ran a WordPress website on a dedicated server (16 GB RAM, 6 CPU, SSD storage) with cPanel.

`WordPress 6.1.3`

`Database: 10.5.21-MariaDB`

`PHP: 7.4.33 (fastcgi)`

`webserver: nginx (reverse proxy) + Apache`

All worked fine for *months*.

Since last week, I noticed very high load (about 30) several times during the day.

No new plugins/themes added.

With “top” I always see `mariadb` process with an high CPU usage, these are the queries I always see:

​

​

MariaDB [(none)]> show processlist;
+——–+————————–+———–+————————–+———+——+———————+——————————————————————————————————+———-+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+——–+————————–+———–+————————–+———+——+———————+——————————————————————————————————+———-+
| 76544 | my_database | localhost | my_database | Query | 0 | Creating sort index | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
WHERE 1=1 AND wp_posts.post_type = ‘at | 0.000 |
| 79436 | my_database | localhost | my_database | Query | 0 | Creating sort index | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
WHERE 1=1 AND wp_posts.post_type = ‘at | 0.000 |
| 81672 | my_database | localhost | my_database | Query | 1 | Creating sort index | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
WHERE 1=1 AND wp_posts.post_type = ‘at | 0.000 |
| 88786 | my_database | localhost | my_database | Query | 1 | Creating sort index | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
WHERE 1=1 AND wp_posts.post_type = ‘at | 0.000 |

When this happens, nginx/Apache are still up&runnning, but if I try to load the homepage, browse hangs.

If I restart mysql service, problem goes away and website is stable even for several hours.

I’d need some help to find root cause for this high cpu usage.

How do you approach this? 🙂

Thank you!

​

[ad_2]
2 Comments
  1. Hello, did you update any of the mariadb services to a newer version lately?

  2. The queries you provided in your example suggest that the database is generating sorting indexes, which might indicate the presence of inefficient queries or missing indexes.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer