Hello we are experience a weird situation with our Moodle installation and we cannot find out how its happening.
So I will share our experience in the hope that you can shed some light on the situation.
We are hosting our Moodle instance on AWS, using a Load Balancer, EC2 instances behind the ELB, RDS (MariaDB) and Redis ElasticCache for caching.
Our servers are running Apache/2.4.39, PHP 7.3.9 with php-fpm.
Randomly during the day Moodle (or WebServers [nothing else is running on the webservers by the way]) are opening too many DB connections to the DB, aroung ~800 connections.
As soon as this starts happening our Moodle becomes unreachable, the response time of the website goes crazy, like 30-40s.
When I do SHOW PROCESSLIST, I see 800 rows with state SLEEP.
I restart php-fpm, and httpd, DB Connections suddenly drop and few minutes later they go up again.
During this period server RAM and CPU are below 30%.
Could you please let us know if you had similar problem and help us resolve it?