MySQL thread on DB server - a number of them

MySQL thread on DB server - a number of them

by Jerry Lau -
Number of replies: 8

I was just curious why on our DB server (MySQL 5.7.24-log) on REDHAT ENTERPRISE 7.5 64-bit, it has so many mysql threads when that's the only thing running for moodle.

Is there a way I can debug this to see what is calling those threads?

thanks



Average of ratings: -
In reply to Jerry Lau

Re: MySQL thread on DB server - a number of them

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Not sure what you mean by "the only thing running for moodle".  Each process the web server creates for Moodle will start it's own database connection. On a busy site, you can easily see hundreds of them.

In reply to Howard Miller

Re: MySQL thread on DB server - a number of them

by Jerry Lau -

Hello Howard..

not talking about the web server request which makes sense but I'm talking about MySQL threads... if there is only one moodle database , shouldn't it just show one mysql process running not matter how many connections there are to that 1 database?

which reminds me.. I think php maybe better served off as php-fpm rather than as an apache directive as its more efficient from apache/php. Am I correct?


In reply to Jerry Lau

Re: MySQL thread on DB server - a number of them

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

No - each connection generates a thread. 

In reply to Howard Miller

Re: MySQL thread on DB server - a number of them

by Jerry Lau -

so in a way... logged in users in the last 5 mins should in theory, match or at least close to the number of threads shown ?

In reply to Jerry Lau

Re: MySQL thread on DB server - a number of them

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Each user accessing a Moodle resource can generate more than one thread. On the other hand, 5 minutes is too long for complete threads to persist. But... you would expect the number of threads to be vaguely proportional to the number of active users

BTW.... mod-php vs php-fpm, depends who you ask.

In reply to Howard Miller

Re: MySQL thread on DB server - a number of them

by Jerry Lau -

thanks..how is your php set up?

In reply to Howard Miller

Re: MySQL thread on DB server - a number of them

by Ken Task -
Picture of Particularly helpful Moodlers

How true ... how true .. 'mod-php vs php-fpm, depends who you ask.'

Also kinda depends upon setup and current usage ... if web server (64 Gig) not the bottleneck, but dedicated DB server (also 64 Gig) seems to be is there really any 'advantage' running php-fpm?  That may not fix DB server issue.

If one has only a 4 Gig server to work with and it's both web server and db server, then could see it ... trying to squeeze every once of blood there is on that box! smile

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: MySQL thread on DB server - a number of them

by Jerry Lau -

Not moodle specific but more like php/apache setup.. I read that is the preferred method..