Real Memory very high above 88% causing error establishing database

SYSTEM INFORMATION
OS type and version AlmaLinux 9.0
Webmin version 2.001
Usermin version 1.860
Virtualmin version 7.3
Theme version 20.01.1:5
Package updates 2 package updates are available

Please I need help with my system.
Just 3 days ago I started experiencing database error and this happens often and when I restart system it goes away.
Please what can be the cause of this issue.
Currently my sites are offline and can only get back when I restart the system.

Meanwhile I only have 4 websites on the server which is too little to cause this issue.
Any guide for me?
Below I attached screenshots.


I saw a suggestion that says to run free -m but when I checked the result below shows there is no space for swap.

free -m

           total        used        free      shared  buff/cache   available

Mem: 7684 6769 294 283 620 390
Swap: 0 0 0

Please how do I possibly solve this issue?
How do I create swap space if its what is causing the problem

maybe it’s a completely different problem. I had the same thing once and the solution was to increase the open_files_limit = 100000 (mysql.cfg)

I am checking where to locate this so that I can try it now.

@tscheeg I cant find the file to tweak it.

mysql logs ?

maybe it’s a completely different problem. I had the same thing once and the solution was to increase the open_files_limit = 100000 (mysql.cfg)

Where to increase the open_files_limit = 100000 (mysql.cfg)

Webmin => Servers => Database Server => Button " Edit ConfigFiles"


This is currently what I have in there.
I do not see

I had an issue like this, and it was my php FPM settings, however i do have 20 sites on my server. I am no expert but once I changed these settings, my ram usage went down, and everything was ok. In server templates, php setting i use this;

pm = ondemand
pm.max_children = 2
pm.max_requests = 200
pm.process_idle_timeout = 10s

This works really well for my config and have no memory issues anymore. Obviously, your sites have to be using the fpm option. And once you make the above change to server templates, you need to go to each site and change the fpm option to cgi, then change straight back to fpm this will force the amendments you make. Hope this helps. As I say I am no expert, and this is just what worked for me.

1 Like

What steps did you take to achieve this?
Like from Webmin > to where > and to where

It’d be great if on demand was the default for Virtualmin. I’ve had to change this on every website of all servers that I manage.

To change the PHP FPM settings, you’ll need to go Virtualmin > (Select website) > Services > PHP FPM Configuration > Edit Configuration Manually…

Replace

pm = dynamic

with

pm = ondemand

you could also add the following underneath:

pm.max_children = 10
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 1

I agree, however, you can update the server template. This will then apply to websites you add.

Virtualmin >> System settings >> Server Templates >> Default settings >> Select PHP Options from Edit Template Settings

Change the default execution mode to FPM
Add the settings you require to Additional FPM Options, e.g.

pm = ondemand
pm.max_children = 5
pm.max_requests = 200
pm.process_idle_timeout = 10s

Click Save.

This will be good for new sites from now on, however, to effect sites already set up on the server. You need select website;

Virtualmin >> Server Configuration >> PHP Options >> Change execution mode to anything other than FPM and then change back to FPM, this will then take on the setting you entered in the previous task.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.