We have a problem with our Moodle Server and Purge caches when someone makes a purge caches from the web, each user requesting the page creates a new Apache process intended to reconstruct the file cache and local cache where the theme is.
Also, it takes ~10 minutes to complete the whole process when a single person is accessing the site at not conventional hours like @11pm.
We manage an AWS Architecture with a Load Balancer, 2 ECS (m5.2xlarge) instances with PHP 7.1 and Apache 2.4, moodledata in EFS and local cache in each node.
Is this a correct behavior? Should each request launch a new Apache process to recreate the cache for the theme?
This is our SCSS: https://gist.github.com/anonymous/304623908a70acfa30c08adbac48e14a
it's a very customized site and I know that's the reason the compilation of SCSS takes that amount of time, but it shouldn't create multiple APACHE processes to the point that the node CPU usage gets to 100% and the site goes down or is it intended?
What do you recommend? Is it working as intended? Or is a configuration I am missing?
Here is a screen of the two nodes before doing the purge caches:
And after the purge:
You can see the apache process spiking per user request.
Maybe purge caches/install of modules should be executed with the site in maintenance mode? I didn't have this problem in 2.x
Thanks in advance and feel free to ask me anything I should mention but forget.