@v-namac Unfortunately we are unable to find the exact reason why it is happening, you would need to investigate the SQL queries being made and check the CPU spike caused by each of them. It seems like tools such as NewRelic for WordPress could help you with this.
If you are unable to find the issue, you can try optimizing the MySQL installation, but this may not fix the performance issues. The first thing you should check is if the database can be optimized, especially on the wp_usermeta which seems to be a bit problematic on your side.
The other thing you could try is in configuring MySQL with more appropriate configuration options for your instance size. Checking your Bitnami Support bundle we see your instance has a very high amount of memory. Bitnami autoconfigures the memory with a maximum of 32GB, and it seems you have a lot more. The changes below may or may not fix the issues, but it could be worth a try if you have a high amount of free memory.
- Copy /opt/bitnami/mysql/bitnami/my.cnf to /opt/bitnami/mysql/bitnami/my-custom.cnf
- Edit /opt/bitnami/mysql/my.cnf and change "my.cnf" with "my-custom.cnf"
- Edit /opt/bitnami/mysql/bitnami/my-custom.cnf and set innodb_buffer_pool_size=8G (you can try to increase this value and see if that helps)
If with all the above you are still unable to find the reason why MySQL, please consider creating a managed dedicated database instance via platforms such as Azure Managed MySQL. This allows you to run Apache and PHP-FPM without being affected by MySQL performance, and to scale the MySQL database separately. As a side effect, Bitnami stack upgrades will be easier since the database would be managed externally (so you would avoid to migrate it).