I have a Wordpress site that loads very slowly and crash sometimes (it gives a database connection error for a few seconds and then it works again), even having very few visitors (it's basically just me configuring it and some bots).
I think it could be caused by a lack of resources (CPU and/or RAM), because in the hosting graphs I see 100% use of them sometimes (not always when it crashes, but sometimes). But before buying a bigger hosting, I want to make sure it cannot be solved by other means (maybe detecting a plugin that is slowing everything down or something like that).
I've checked the MySQL error.log and it seems to be recovering from a "XA crash" very frequently (even more frequently than the "real" crashes that I'm seeing when trying to load the website):
2022-08-10T12:41:06.210805Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-0ubuntu0.20.04.2) starting as process 600373
2022-08-10T12:41:06.345616Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-10T12:41:08.541830Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-08-10T12:41:10.177045Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
2022-08-10T12:41:10.207906Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
2022-08-10T12:41:10.315985Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-08-10T12:41:10.316071Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-08-10T12:41:10.382922Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.30-0ubuntu0.20.04.2' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu).
2022-08-10T12:41:10.383178Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock
The apache error.log doesn't give anything "strange" (just a lot of "client denied by server configuration: /var/www/XXX/xmlrpc.php", probably from bots).
Any idea of what could be causing this or how to troubleshoot it?
I tried contacting my hosting (DigitalOcean). They sent me some generic tips to monitor the server, nothing really useful to know what specific file or plugin is slowing things down or making mysql crash.
Thanks!