RAM is not freeing up in time

RAM is not freeing up in time

by Manoj Singh -
Number of replies: 7
Hi,

We are on AWS using nginx, PHP-FPM, PHP 8.1 and Moodle 4.1.1. Please see the attachment. You'll see www-data user (ie moodle application) has created so many processes and many of them are up for over half an hour. Sometimes these processes are even around 40-50 when the instance becomes unresponsive because RAM is full.

We have timeout setting set to 5 minutes, so its my understanding that these zombie processes should be killed after 5 minutes but they are not.

Can someone please help and point us in right direction?

Thank you,
Manoj


Attachment Screenshot 2023-12-18 at 13-01-16 Systems Manager us-east-1.png
Average of ratings: Useful (1)
In reply to Manoj Singh

Ri: RAM is not freeing up in time

by Sergio Rabellino -
Picture of Particularly helpful Moodlers Picture of Plugin developers
This could be the new way of running the crontab, try to set cron_keepalive to 0 and see if it solve.
IMHO 4GB of RAM is a small, too-small thing.
In reply to Sergio Rabellino

Re: Ri: RAM is not freeing up in time

by Manoj Singh -
Hi Sergio,

Thank you for your help here. I really appreciate it. We are running multiple such EC2 servers. With that we have a powerful RDS for database, a separate REDIS sessions server, a separate file server for moodledata. So, overall it has at least 32GB RAM at a time. More comes up with auto-scaling with more EC2 server.

But for that to happen, we need to figure out why RAM is not freeing up in time.

I tried to find if there is some setting in Moodle for cron_keepalive or something similar but could not find it. Can you please elaborate a little what you meant what you said 'set cron_keepalive to 0'?

By the way, we are running crons from another server using 'https://' method.

Please help.

Thanks,
Manoj
In reply to Manoj Singh

Re: Ri: RAM is not freeing up in time

by Manoj Singh -
Hi Sergio,

Found it. It did not show up in Moodle settings search but it showed up in web search. I suppose you meant adding this in config file:

$CFG->cron_keepalive = 0;

I'll do that and see if it helps.

Thanks,
Manoj
In reply to Manoj Singh

Re: Ri: RAM is not freeing up in time

by Manoj Singh -
Hi Sergio,

I checked and did not find any instance of 'cron_keepalive' string in code repository. So, I am not sure if that is the setting that you suggested.

Again, can you please elaborate what did you mean when you said 'set cron_keepalive to 0'?

Thanks,
Manoj
In reply to Manoj Singh

Ri: Re: Ri: RAM is not freeing up in time

by Sergio Rabellino -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Dear,
 you didn't said what release of Moodle you're running, so I have to suppose the latest one, 4.3.
Probably in you Moodle this configuration parameter it's not available, but the cron runs in the way I depicted.
This is the tracking: https://tracker.moodle.org/browse/MDL-77186  that contains a lot of information.

Again, the cron it's a possible cause, I'm not sure if it solve, but you should start from somewhere...
In reply to Sergio Rabellino

Re: Ri: Re: Ri: RAM is not freeing up in time

by Manoj Singh -
Hi Sergio,

Thanks a lot for the pointers. We'll check that ticket. If needed will upgrade Moodle to 4.3 and use the setting and then see if the problem is gone or not.

Regards,
Manoj