Score:0

High CPU Usages After Migrating Wordpress in Ubuntu 20.4

kh flag

I am using a WordPress site with Woocommerce in a managed hosting service. I have taken 8GB ram's new AWS t3.large ec2 instance and installed PHP and MariaDB 10.4. After migrating my website is running but I noticed that my CPU usage went up to 90%. And it's not decreasing.

Here is the CPU usage screenshot. Imgur

Here is my nginx config

server {
    server_name beta.website.com www.beta.website.com;
    root /var/www/html/website;

    index index.html index.htm index.php;
    #client_max_body_size 100M;
    location / {
        #try_files $uri $uri/ =404;
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
     }

    location ~ /\.ht {
        deny all;
    }
    location ~ ^/wp-json/ {
        rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last;
    }
    location = /favicon.ico{
          log_not_found off;
          access_log off;
      }

    listen 443 ssl;
    ssl_certificate /home/ubuntu/ssl/beta_website/beta.website.pem;
    ssl_certificate_key /home/ubuntu/ssl/beta_website/beta.website.key;

}
server {
    if ($host = beta.website.com) {
        return 301 https://$host$request_uri;
    } 


    listen 80;
    listen [::]:80;

    server_name beta.website.com www.beta.website.com;
    return 404; 


}

Information

My MySQL file size is 146MB and the backup file size is 7.5GB. My php.ini config's memory was set to 512MB. When I saw the CPU usages I had disabled the server block in Nginx and then the server usage went to 45% and when I remove the project directory from /var/www/html the current CPU usages is less than 1%.

Where am I making mistake?

ChanganAuto avatar
us flag
What's the problem with the CPU at 90%? Resources are to be used.
Mohammad Fathi Rahman avatar
kh flag
Sorry forget to mention, there are 2 other sites running, one is in PHP and another one is static react. And the other website including WordPress become super slow.
uz flag
Jos
The MySQL instance using this much CPU is unusual. WordPress is not a heavy database client. I would turn on general logging in MySQL for a while, and see what is going on there.
in flag
When your MySQL load is high, it may be useful to log into the database and use the `SHOW PROCESSLIST;` command, which will list all of the currently-running SQL queries. If there are some queries that need tuning, this is one way you can find them.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.