Server is using high Memory

Server is using high Memory

by Abu Ali -
Number of replies: 14

dear Moodle Expert;

I would like to inform you that we are using bluehost dedicated server by using the following specification

4 cores @ 3.3 GHz

1TB (Mirrored) Storage

16 GB RAM

15 TB Bandwidth

in this server , we used to run 3 moodle site for different levels like this

home/public_html/moodle1 (3.10)

home/public_html/abc/moodle2 (3.10)

home/public_html/xyz/moodle3 (3.7)

I notices that by using free-m command, my physicaly memory is used 100% only 500MB is free. My all three sites are working fine and i don't have any issue but still i surprised that why 100% memory is using while there is no students are online.

please guide me is it okey or i should do something?


Average of ratings: -
In reply to Abu Ali

Re: Server is using high Memory

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

15+ GB for an idling machine? Something is wrong. Pl. provide the output of 'cat /proc/meminfo'. Also look at top/htop output for any memory intensive processes.

In a previous discussion https://moodle.org/mod/forum/discuss.php?d=411464 you gave more details of the server and said Bluehost manages it. Is it no more?

Was was the result of that discussion? Were you able to get some monitoring software installed as suggested?
In reply to Visvanath Ratnaweera

Re: Server is using high Memory

by Abu Ali -
Thanks dear Visvanath Ratnaweera,
yes, still bluehost is managing but they are telling me that i have to optimized the moodle files and database.
please find the screenshot of cat /proc/meminfo command
Attachment mem.png
In reply to Abu Ali

Re: Server is using high Memory

by Ken Task -
Picture of Particularly helpful Moodlers

With 3 different sites - each of which might be configured/used differently -  there are 3 cron jobs.  Can't really run crons for them every minute ... more like run crons one after the other every 5 minutes.

Optimization of multiple moodles is something they wouldn't do - after all, time is $ to them - and they are not a Moodle Partner.

So ... what are sites doing during cron/adhoc task runs?   Do you have automated backups running on each site?

Dunno really ... deeper dive/info required, me thinks!

'SoS', Ken


In reply to Ken Task

Re: Server is using high Memory

by Abu Ali -
Thanks KenTask,
I have run the cron task for every minute on main site where i have 3000 users and 250 courses.
On site 2, i have run cron task after 5 minutes and in this site there are 400 users and 50 courses.
On site 3, i have run cron job for every 1 hour and this site is the archive of main site.
Regarding the automated backup, i have enabled backup on site 2 in alternate days around 1am midnight. Automated backup is enabled on main site after a week around 12am midnight.
All these are working fine without any issues but I surprised about the usage of 100% RAM.
Should i need to apply any change to get the good performance?
In reply to Abu Ali

Re: Server is using high Memory

by Ken Task -
Picture of Particularly helpful Moodlers

So that means @5 min after the hour there are two sites running crons
and for the third site @every hour there 2-3 sites running something.  If you've ever watched a cron job run, task show how much memory is used for each job in the cron list scheduled to execute ... most in the ##Meg range.

Deeper dive ... anything in adhoc_task que of any of the sites stuck ... there is the recyclebin factor as well.  A zombie process?

If you've followed official docs for setting up crons, that recommends re-direct to la-la-land ... you don't see anything of them.   Maybe redirect all to a file in /var/log/  ... each instance it's own log file.

If you write to the same log file they don't grow but one can still see what's going on with all three by installing and using multitail pointed at all three separate log files.

Deeper dive ... install MySQLTuner.
Run it.   Tweaks/recommendations it suggest?  Server has a lot of memory ... maybe more memory needs to be allocated to DB server running 3 Moodle DB's.

'SoS', Ken

In reply to Ken Task

Re: Server is using high Memory

by Abu Ali -
Thanks dear Ken Task for sharing your knowledge.
i check all three cron files and they shows me the result like this:

Ran 0 adhoc tasks found at Sun, 11 Apr 2021 17:01:37 +0400
Cron script completed correctly
Cron completed at 17:01:37. Memory used 5.5MB.
Execution took 0.094818 seconds

2nd cron output
Scheduled task complete: Background processing for scheduled allocation (workshopallocation_scheduled\task\cron_task)
Cron script completed correctly
Cron completed at 17:02:16. Memory used 8.1MB.
Execution took 0.495216 seconds

3rd cron file
Ran 0 adhoc tasks found at Sun, 11 Apr 2021 17:04:01 +0400
Cron script completed correctly
Cron completed at 17:04:02. Memory used 9.3MB.
Execution took 0.877711 seconds

and MySQLTuner report

Variables to adjust:
join_buffer_size (> 256.0K, or always use indexes with JOINs)
table_open_cache (> 2000)
performance_schema = ON enable PFS
innodb_buffer_pool_size (>= 1.8G) if possible.
innodb_log_file_size should be (=128M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
In reply to Abu Ali

Re: Server is using high Memory

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome .. always glad to share. smile

Now just so am clear ... successful run of cron/adhoc is only as good as the date/time it ran that way.   Server admin needs to monitor that on a frequent basis until server admin learns what is 'normal' ... knowing that 'normal' could change with usage.

'SoS', Ken

In reply to Ken Task

Re: Server is using high Memory

by Abu Ali -
i am the admin of the Moodle or server and we hosted this in bluehost and they have given us full access but i have limited knowledge to manage the server.
what should i do it in this case to make it normal ?
i found the following commands that is set by the bluehost.
Attachment Capture.PNG
In reply to Abu Ali

Re: Server is using high Memory

by Ken Task -
Picture of Particularly helpful Moodlers

Can't answer your question ... 'normal' for you on bluehost isn't the same as normal for me on RackSpace!!!!

Uhhh ... you picked your 'poison' (where you host and how [unmanaged ... you are in charge]) ... so it's time for you to learn your 'antedotes'.

I see in what you shared lots of cPanel crons ... that means cPanel is your web based interface into admin of that server.  I wouldn't tinker with them at all.  But you are now aware they exist and they are scheduled to do whatever at certain times ... which means it's not only your moodle cron jobs/task/adhoc task running.  None of those stick out as a problem to a moodle ... but then again ... I don't host where you host etc.

Suggest finding tutorials on use of cPanel.   Also suggest finding any tutorials for customers Bluehost might provide.

'SoS', Ken


In reply to Ken Task

Re: Server is using high Memory

by Ken Task -
Picture of Particularly helpful Moodlers

Mr. V and I are on the same page ... we just use different tools from OP (cPanel) ... Mr. V CLI and Munion ...

I like Webmin ..

See attached! smile


Attachment webmin.png
In reply to Ken Task

Re: Server is using high Memory

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
smile

At the risk of igniting a CLI vs GUI war, this is a great example of the fact that two people using two different GUIs for the same thing can't still communicate. If their basis is CLI, numbers in this case, then we could be even using different Linux distributions, still we can compare - provided the kernels are of  same generation.

On the OP, he needs to be clear of the aim of the discussion. If it is about why Linux fills available memory, he got the answer. If it is about performance too low, which I think is the case from the previous discussion https://moodle.org/mod/forum/discuss.php?d=411464, then he should stick to that discussion.

Either way, there should be clarity, who manages what: Bluehost, the OP, some automation on CPanel? Which is which? All those scripts in a previous post are not related to Moodle. If Bluehost manages a server which is dedicated to Moodle, but do not provide Moodle support, what do they manage?
In reply to Abu Ali

Re: Server is using high Memory

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
This "bloated" memory utilization in Linux could be frustrating. It is quite logical though. Linux considers unused memory to be a waste and fills it with all sorts of temporary data, i.e. use the spare memory as a cache.

Here is another /proc/meminfo from an idling machine (to the right is your original for direct comparison):


That is why I asked you about the result of a another discussion and your monitoring methods https://moodle.org/mod/forum/discuss.php?d=420824#p1695888. If you happen to use Munin like most in this forum, it would have presented you with a graphical output with explanations. Here is the Memory usage graph from the same server as above (the meminfo was taken "now", means at the right edge of the graph):

It was rebooted Saturday at 20:30. You can see how the memory is slowly filling up. Simply there is not enough activity for Linux to determine what to cache. You can see the (potential) final state before the reboot. The server had enough activity during the week to fill its caches. On Saturday the server was idling again. Otherwise we would have seen more that the ripples what we see. Pl. do some research on the topic "memory utilization of Linux".

In short, the meminfo you presented doesn't mean there is something wrong.

If your aim is to tune the server, then you need some load. Otherwise, tune for what?

In reply to Visvanath Ratnaweera

Re: Server is using high Memory

by Abu Ali -
Thanks dear Visvanath Ratnaweera;
I clearly understand that there is no problem in my server and i need to install the monitoring method that is munin.