maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #06275
Re: MDEV-5019 - THREADPOOL - Create Information Schema Table for Threadpool
Hi!
Some read/study i'm doing about thread pool to understand what could be
exposed with information_schema tables...
check if i'm grouping ("creating tables") with the right information...
i'm reading threadgroup_unix.cc and others threadgroup* files to start this
work
-----
from your mail Vladislav:
*"Global all_groups array contains all thread groups ."*
*
*
=> static thread_group_t *all_groups*[MAX_THREAD_GROUPS];
=> static uint *group_count*;
"group_count" is the max value of a loop using all_groups
var?
something realted to "threadpool_max_threads", with a
limit of group_count<MAX_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."*
a request is a "php mysql_connect"? each new tcp/ip connection create a new
request?
=> struct *thread_group_t*
{
mysql_mutex_t mutex;
*connection_queue_t* *queue*;
*worker_list_t* *waiting_threads*;
* worker_thread_t* *listener; (listener thread? maybe it have a THD
and we could show the query_id/thread_id or some information?)
pthread_attr_t *pthread_attr; (what is pthread_attr? i didn't found in
threadpool*)
int pollfd; (a fd to kevent and others libs?)
int thread_count; (number of threads in this thread
group?!)
int active_thread_count; (active threads running this thread
group?!)
int connection_count; (active connections in this thread
group?!)
int io_event_count; (io event count? what is this? network
io?)
int queue_event_count; (queue event count? maybe the COUNT(*)
for connection_queue_t queue ?)
ulonglong last_thread_creation_time; (last thread create time, it's a
unixtimestamp * 1.000.000 (us)? )
int shutdown_pipe[2]; (maybe rpc to call a server shutdown?)
bool shutdown; (shutdown information?)
bool stalled; (hum... stall (nice name), well i
must study about threadpool stall yet, but i think it's a nice information
to report to DBA =] )
} MY_ALIGNED(512);
I don't know yet how I_P_List<> and I_P_List_adapter<> work, but i will
search about it in code... it's like a C++ object with ->legth and others
easy to use tools? something like "foreach" (connection_queue_t as xxx) and
interact with each connection_t inside connection_queue_t using xxx?
typedef I_P_List<*connection_t*,
I_P_List_adapter<connection_t,
&connection_t::next_in_queue,
&connection_t::prev_in_queue>,
I_P_List_null_counter,
I_P_List_fast_push_back<connection_t> >
=> *connection_queue_t*;
typedef I_P_List<*worker_thread_t*, I_P_List_adapter<worker_thread_t,
&worker_thread_t::next_in_list,
&worker_thread_t::prev_in_list>
>
=> *worker_list_t*;
---
=> struct *worker_thread_t*
{
ulonglong *event_count*; /* number of request handled by this thread */
thread_group_t* *thread_group*; (it's point to thread_group inside
all_groups? does it have an ID about what index of all_groups we are?)
worker_thread_t *next_in_list;
worker_thread_t **prev_in_list;
mysql_cond_t *cond*; (what is this?)
bool woken; (what is this?)
};
=> struct *connection_t*
{
THD *thd;
thread_group_t **thread_group*;
connection_t *next_in_queue;
connection_t **prev_in_queue;
ulonglong *abs_wait_timeout*; (what is this?)
bool *logged_in*; (hummm waiting password?)
bool bound_to_poll_descriptor; (what is this?)
bool waiting; (connection in waiting queue
state?)
};
=> *pthread_attr_t* ??? (didn't found in threadpool* files, i will search
with time about it, maybe something to linux/unix pthread lib?)
*
===========================================================================================================
*
well now i'm thinking right about *information_schema *tables using the
variables from the top of this email... :
*TABLES:*
1) *all_groups *variable => *THREADPOOL_THREAD_GROUPS *table
columns:
*THREAD_GROUP_ID *INT NOT NULL DEFAULT 0,
*THREAD_COUNT *INT NOT NULL DEFAULT 0,
*ACTIVE_THREAD_COUNT *INT NOT NULL DEFAULT 0,
*CONNECTION_COUNT *INT NOT NULL DEFAULT 0,
*IO_EVENT_COUNT** *INT NOT NULL DEFAULT 0 COMMENT "WHAT IS THIS?
NETWORK I/O?",
*QUEUE_EVENT_COUNT** *INT NOT NULL DEFAULT 0,
*LAST_THREAD_CREATION_TIME *DECIMAL UNSIGNED? UNIXTIMESTAMP?
*SHUTDOWN *ENUM('Y','N') NOT NULL DEFAULT 'N'
*STALLED *ENUM('Y','N') NOT NULL DEFAULT 'N'
maybe we should put information about *LISTERNER_THREAD_ID* (thd->query_id
/ thd->thread_id) ?
*LISTENER_QUERY_ID *BIGINT NOT NULL DEFAULT 0,
*LISTENER_THREAD_ID *BIGINT NOT NULL DEFAULT 0
2) connection_queue_t *queue *=> *THREADPOOL_CONNECTION_QUEUE *table
columns
from queue->thd
*QUERY_ID *INT NOT NULL DEFAULT 0, (does it exists? or just after
parser?)
*THREAD_ID *INT NOT NULL DEFAULT 0,
queue->thread_group
*THREAD_GROUP_ID *INT NOT NULL DEFAULT 0, ( i didn't found a ID
for each thread_group, there's something for it? like am all_groups[] index?
queue->cond (mysql_cond_t) ??? (what is this?)
queue->woken (bool) ???? (what is this?)
3) worker_list_t *waiting_threads* => *THREADPOOL_WAITING_THREADS *table,
maybe WAITING_QUEUE?
*THREAD_GROUP_ID *INT NOT NULL DEFAULT 0, (thread_group_t*
thread_group)
*EVENT_COUNT *BIGINT UNSIGNED NOT NULL DEFAULT 0, (ulonglong
event_count; /* number of request handled by this thread */ what is this?)
->cond (mysql_cond_t) ??? (what is this?)
->woken (bool) ???? (what is this?)
i didn't found a THD, for this (query_id/thread_id)
pthread_attr_t *pthread_attr; what is this?
-----
something that i didn't understand yet...
for example... if i got a *waiting_thread*, how i know what THD or what
'worker' thread will "do the job" of this query? i know it's too fast that
i will not get it with information_schema, but it's a deterministic
function right? there's a pool of worker thread that handle waiting threads?
about the thread pool work... if the query is attached to one thread_group,
it could 'jump' to another thread group? the "worker thread" is outside
from thread group and at end of the execution it will realloc the
connection to another thread_group?
if anyone have more ideas about this information tables, and where i could
get information about each column, please reply with the answer or with
ideas =)
thanks guys!
Follow ups
References