• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Question Mysql memory usage and memory used by system reach 90% of available ram and then crash

It doesn't release the cache, because it does not need to release it. From MariaDBs perspective, it has plenty of RAM left. The problem is that the system starts occupying RAM outside MariaDB, and that triggers OOM to kill MariaDB, because that memory manager thinks it needs to clear RAM. But the cause for all of this is not MariaDB but something else, which brings us back to Apache and PHP.
Ok Any ideas how I can investigate further?

Am I looking for a bad PHP process on the website or am I looking for a PHP setting to change the behaviour?
 
On the other thread I already suggested to look at Apache's RAM usage and to limit it so that it can never exceed a certain value. If Apache is consuming a lot of RAM, it either has spawned too many children or PHP processes executed by it occupy the RAM. So first check Apache, then go after PHP processes. I bet there are either tons of them occupying RAM or some runaway processes in infinite loops that keep requesting more and more.

Here's another magic command line that will let you monitor the most important aspects "live":
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` watch "uptime && echo "\ " && ps aux | sort -nrk 3,3 | head -n 20 && echo "\ " && mysqladmin proc status -u admin"
(Stop with Ctrl+C)

Also simply counting processes might reveal more, or just looking at PHP RAM usage (all through the # ps directive on the command line).
 
On the other thread I already suggested to look at Apache's RAM usage and to limit it so that it can never exceed a certain value. If Apache is consuming a lot of RAM, it either has spawned too many children or PHP processes executed by it occupy the RAM. So first check Apache, then go after PHP processes. I bet there are either tons of them occupying RAM or some runaway processes in infinite loops that keep requesting more and more.

Here's another magic command line that will let you monitor the most important aspects "live":
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` watch "uptime && echo "\ " && ps aux | sort -nrk 3,3 | head -n 20 && echo "\ " && mysqladmin proc status -u admin"
(Stop with Ctrl+C)

Also simply counting processes might reveal more, or just looking at PHP RAM usage (all through the # ps directive on the command line).
I can see a few processes with the same PID hanging around but I have no idea how to identify what is actually continuing to run.

The number of users is changing from approx 12 to 21 but has fallen to between 12 and 15 while I have been watching approx..

And threads reasonably stable from 2-10 depending on activity.

Approx 16 our of the 20 displayed records are phpfpm from the one website. Which is right given how much traffic they get.

I cannot see anything particularly unusual looking. The only queries I can really see are action scheduler, and shop filters and then the shop search and filter functions pinging some slightly longer queries.

Is there anything I can send on here that will help you see what I am seeing.

1757689027878.png
 
Following on from this the PID number does appear to be cycling. So the queries are completing sensibly.

Looking at the physical and virtual memory use - There is quite high memory use per PHPFPM activity so if we can bring this down then it would improve the situation.
 
Back
Top