Hello guys!
I have a problem om my 1GB Droplet with ‘mysqld’:
The droplet is configured via ServerPilot and everything works just fine.
My only problem is that when the server is being used (+50 users on the same time) the memory will go up, and use almost 900mb of RAM. I guess it’s cool, and the sites work fast and so on (Also got SWAP file in case) but my problem is that the memory wont go down again (To like 200-300 MB RAM). Is this normal behavior?
If I use ‘htop
’ I get the following:
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
1077 mysql 20 0 868M 103M 3124 S 3.3 10.4 3:12.34 /usr/sbin/mysqld
1173 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:03.92 /usr/sbin/mysqld
1174 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:06.79 /usr/sbin/mysqld
1175 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:04.96 /usr/sbin/mysqld
1176 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:05.67 /usr/sbin/mysqld
1177 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:06.64 /usr/sbin/mysqld
1178 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:04.03 /usr/sbin/mysqld
1179 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:05.08 /usr/sbin/mysqld
1180 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:04.96 /usr/sbin/mysqld
1181 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:06.41 /usr/sbin/mysqld
1182 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:06.78 /usr/sbin/mysqld
1190 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:11.25 /usr/sbin/mysqld
1191 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:15.42 /usr/sbin/mysqld
1192 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:01.02 /usr/sbin/mysqld
1193 mysql 20 0 868M 103M 3124 S 3.3 10.4 0:24.00 /usr/sbin/mysqld
1215 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:00.00 /usr/sbin/mysqld
1337 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:15.42 /usr/sbin/mysqld
1421 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:20.37 /usr/sbin/mysqld
1705 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:13.58 /usr/sbin/mysqld
2464 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:18.78 /usr/sbin/mysqld
2467 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:13.16 /usr/sbin/mysqld
11823 mysql 20 0 868M 103M 3124 S 0.0 10.4 0:03.01 /usr/sbin/mysqld
As you can see the /usr/sbin/mysqld
is there a lot, and uses a lot of memory, even when no users are using the sites (I have 2 sites on the droplet) - Side question: why is there so many instances?
My /var/log/mysql.log is empty - Is this normal? Is there anything I can do to get it to log anything? Delete the file? (It’s 0 bytes) Same applies for my syslog
If you need more information, I’ll be more than happy to asist.
Thank you very much!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I’m glad the htop suggestion helped. That’s the first thing I change in htop on any new server of my own.
Regarding the memory usage remaining high, I suggest opening a support ticket with ServerPilot. There’s almost certainly a good explanation for what you’re seeing but it will take more information and possibly us looking directly at your server to determine it.
Hi,
The MySQL processes in that list are actually different threads. In htop’s settings, you can configure it to not show separate threads for each process which can make it much simpler and more useful to look at. So, what you’re seeing there is really MySQL using 10.4% of your server’s memory.
As memory is increasing when you have many concurrent requests, the memory increase is likely due to the additional PHP processes that are needed to handle the requests. When a request comes in but there are no available PHP worker processes for the app (that is, they are all busy handling a request), PHP-FPM will create an additional process for the new request. If your request concurrency later goes down, after a period of time PHP-FPM will kill any PHP processes that have been idle (not needed to handle requests) and memory usage will go down.
For more information on memory usage on ServerPilot and ways to reduce memory usage, see here:
https://serverpilot.io/community/articles/how-to-reduce-php-and-wordpress-memory-usage.html
Hi,
The MySQL processes in that list are actually different threads. In htop’s settings, you can configure it to not show separate threads for each process which can make it much simpler and more useful to look at. So, what you’re seeing there is really MySQL using 10.4% of your server’s memory.
As memory is increasing when you have many concurrent requests, the memory increase is likely due to the additional PHP processes that are needed to handle the requests. When a request comes in but there are no available PHP worker processes for the app (that is, they are all busy handling a request), PHP-FPM will create an additional process for the new request. If your request concurrency later goes down, after a period of time PHP-FPM will kill any PHP processes that have been idle (not needed to handle requests) and memory usage will go down.
For more information on memory usage on ServerPilot and ways to reduce memory usage, see here:
https://serverpilot.io/community/articles/how-to-reduce-php-and-wordpress-memory-usage.html
Did you ever solve this? how?