0

I have recently acquired my first VPS to run a mysql server for my minecraft server, I have setup MariaDB, it's using the default settings at present. I tested it last night with one plugin (GriefPrevention v7.8) to see if it was even possible to use remotely, it worked, but checking out htop there are tens of mysql processes now! I only briefly tested the plugin with this VPS mysql server, are these open connections that were not closed?

I tried restarting mysql but that didn't stop them. I also Have a web interface that runs on the VPS box that pulls information into a web UI, but I haven't advertised the URL of the VPS so it shouldn't be loading.

  1. How can I see what's causing these?
  2. I presume at this rate, they will all just build up and crash the server?
  3. How can I limit these, should I?
  4. Should I create a new user for each plugin to access the database remotely when I push them live to use it?
  5. Why are these "connections" still open, when the plugin isn't in use and I have restarted mysql?

HTOP preview of VPS tree of mysql

1

It should be okay. Unlike the top command, htop by default lists all the threads along with the processes. So all the 'mysqld' that you are seeing are not processes, but threads.

Do this:

Grab the PID of a few mysql entries you see in the htop output and grep it in the output of ps.

Eg:

ps -ef | grep 14082

Here, the grep probably won't return any mysql processes to you. Now try this:

ps -eLf | grep 14082

And now you will see grep returning you a mysql process which is not really a process, but a thread.

The L option will ask ps to list all the Light Weight Processes(threads) as well. So grep found the TID you have since that is a Light Weight Process or thread. Check the top output and you will probably see only one or two MySQL processes.

Additionally, get the PID of your MySQL process from ps -ef output and use pstree to see all the threads created from that process.

pstree -p <PIDofMySQL>

  • Ahh thanks @sree I feel silly for not checking out top now! There are literally 2 MySQL process in here, although the ps -ef | grep 14082 is displaying a mysql process (I think). Sorry for screenshots, all image hosting sites are blocked at work! vps.piratemc.com/screens/Screenshot%202014-11-21%2014.02.54.png & vps.piratemc.com/screens/Screenshot%202014-11-21%2014.03.35.png IM starting to learn more about how Unix manages processes now, sorry for being so naive. Do you think this is usual practise of mysql? I will have to give it some load to see what it can take :) – GodsDead Nov 21 '14 at 14:06
  • @GodsDead Yes, looking at the images you have posted, 14082:83 are threads and 14064 is the process from which those threads came from. You can use ps -ef | grep mysql to see the actual process. You can also upvote my answer if you found it useful :). – Sree Nov 22 '14 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.