Mysql Threads Clarification

Hi everybody,

I am starting experiencing with an Ubuntu Apache+Mysql server

I have seen that Apache starts lots of processes (one for each connection request) which I can monitor using ps aux while mysql has only one process and a number of threads which I can monitor using ps -eLf

Why mysql has only one process? Right now I have only one user for the database. Having multiple users connecting to the database would result in having multiple process? (thus reserving more cpu and ram for the db)

thank you :roll:

2 Replies

MySQL will run multiple threads for multiple users connecting concurrently to the database. This behavior can be controlled using the my.cnf settings file.

MySQL does have some memory allocations that get allocated to each connection for it to use, but not all of them are like this - some are global. I am not sure which ones are and are not. I know that the MySQL tuning primer (found here: http://day32.com/MySQL/) seems to give a good indication of the total possible RAM usage from MySQL (if all connections allowed by my.cnf were in use at once) so you might try running that to get an idea of what's going on.

Perfect, thank you for your help :)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct