First for all thanks for making such great improvements in terms of performance by Moodle Team. Lot of slow queries are gone now.
We have updated our moodle from 3.8 to 3.9 on 19th July and suddenly we have started facing two issues which was not faced before. We are using Redis(Elastic cache) for session, Aurora MySql with autoscaling and EC2 linux instances with autoscaling. We have quite good load coming to server during the day time like say 1000+ students are hitting on the same time.
1) Getting huge number of slow queries logged like below and query time is around 25 to 80 sec. Which is a big problem for us.
Time: 200720 2:44:31
# Query_time: 80.011756 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
SELECT GET_LOCK('418865d95a81bf4014128aa00b9026703cd40a13', '97') AS locked;
Interesting part is the key string inside the get lock function is same in the all slow lock query. Not sure if we are using Redis for session then why lock is required in database
2) We are using localcache directory. The size of the directory is ever growing like atm its 32GB. It was not making localcache earlier.
$CFG->localcachedir = '/var/www/cache'; // Intended for local node caching
Not finding solution so far and its not possible to go back to the previous version as well. Something sure has been cause after upgrade only. Looking forward to your help.