← Back to team overview

maria-developers team mailing list archive

Re: MDEV-5019 - THREADPOOL - Create Information Schema Table for Threadpool

 

Hi Wlad! thanks for the explain...

for now, just unix is ok, windows is a second step =]

Just some doubts...



2013/9/17 Vladislav Vaintroub <wlad@xxxxxxxxxxxxxxxx>

> Hi Roberto,****
>
> ** **
>
> The structures you need are in sql/threadpool_unix.cc****
>
> Global all_groups array contains  all thread groups . Every
> thread_group_t has list of waiting threads , called “waiting_threads”,  and
> queue of not yet handled requests, called “queue” (request is represented
> by connection_t ), a listener  etc.
>
connection_t = THD class?
it's a different structure/class?
i didn't read the source yet, just high level doubt...


> ****
>
> “Active” connections, i.e connections that currently are executing queries
> , can neither  be found in threadpool’s waiting_threads, nor there is a
> different “active” list for them.
>

Where they are?
ok i understood that we don't have a flag to show "active/not active" this
should be done with a loop in threads to know if it's active or not, but
what should i look? waiting_thread? queue? "processlist" threads?
the thread group only have threads that are not executing, just queue and
waiting_threads, and executing threads are outside thread pool?

Other doubt... a waiting query (inside threadpool and not executing, inside
"waiting_threads") is parsed, it have a THD structure or something that
have the THD->lex? or it just have the network packages "saved in memory"?
when it start execution it will be parsed and the THD will be executed?



> So you may want to introduce special handling for those (i.e iterate the
> global “threads” list looking for active connections, get corresponding
> connection_t* struct from thd->event_scheduler.data, and do something with
> it, e.g look which thread group it belongs)
>
Hum, in this case should be more 'inteligent' have the thread_group at
PROCESSLIST table? and a SQL SELECT could do the job at SQL Layer about
"what connection is active"?
It's nice have a table with all thread, but i think it's the job of
PROCESSLIST right? the point here is the THREAD_POOL information, in other
words, now with you explain, we will have information about queue
(connections without queries, maybe in sleep state) and connections waiting
start (i don't know how is the state of this queries in processlist, do you
know?)

In this case (add information at processlist), probably, we will have two
kind of PROCESSLIST one for windows and other for unix, i'm right or wrong?

I'm thinking about some thing like
current processlist:

IDQUERY_IDUSERHOSTDBCOMMANDTIMESTATEINFOTIME_MSSTAGEMAX_STAGEPROGRESS
MEMORY_USEDEXAMINED_ROWS1962436279rspadim***:48785spd_cashflowQuery0
executingselect * from information_schema.PROCESSLIST0.321000.000832800


add two columns:

SCHEDULER
ENUM('no-threads','one-thread-per-connection','pool-of-threads','daemon-plugin')
NOT NULL DEFAULT 'one-thread-per-connection',
THREADPOOL_GROUP BIGINT UNSIGNED DEFAULT NULL COMMENT 'NULL = not thread
pool connection'

the THREADPOOL_GROUP  column is a INT? BIGINT? UNSIGNED? NOT NULL?
maybe this could be allowed without the thread-poll and we could use NULL
to show that's a "one-thread-one-connection" or "no-threads" or
"daemon-plugin", what you think?

in patch of QUERY_ID column (MDEV-4911) we had *many* test cases changes,
but it's not a problem =], just change one time instead of add one column,
write a patch, add other column write other patch...

****
>
> ** **
>
> On Windows,  I doubt you can implement any information_schema plugin for
> the threadpool. This is because threadpool is native OS threadpool, and OS
> structure representing it  PTP_POOL structure is opaque, and there is not
> much info you can extract from it (well, maybe you can , if you debug with
> a kernel debugger, but not otherwise)
>
Windows will be a other MDEV (https://mariadb.atlassian.net/browse/MDEV-5046)
=)
let's start with linux, it's easier than windows hehehe :P


> ****
>
> ****
>
> ** **
>
> Wlad****
>
> ** **
>
> *From:* Maria-developers [mailto:maria-developers-bounces+wlad=
> montyprogram.com@xxxxxxxxxxxxxxxxxxx] *On Behalf Of *Roberto Spadim
> *Sent:* Montag, 16. September 2013 21:20
> *To:* maria-developers@xxxxxxxxxxxxxxxxxxx
> *Subject:* [Maria-developers] MDEV-5019 - THREADPOOL - Create Information
> Schema Table for Threadpool****
>
> ** **
>
> Hi guys!****
>
> I openned a new MDEV *https://mariadb.atlassian.net/browse/MDEV-5019* the
> idea is expose the threadpool group information like oracle thread pool
> (more information about oracle thread pool here:
> http://mikaelronstrom.blogspot.com.br/2011_10_01_archive.html)****
>
> ** **
>
> I can help, but i don't know how access the threadpool at
> scheduler.h/scheduler.c from a information schema plugin****
>
>  ****
>
> 1) lock important mutex and others mdl****
>
> 2) acess variables ****
>
> 3) write information schema based on variables****
>
> ** **
>
> 1 and 2 i don't know how to do :( ****
>
> can anyone help ? :)****
>
> ** **
>
> thanks guys :)****
>
> ** **
>
> -- ****
>
> Roberto Spadim****
>



-- 
Roberto Spadim
SPAEmpresarial

Follow ups

References