MYSQL???????
???????????? ???????[ 2015/5/22 14:43:52 ] ?????????????
???????????Mysql5.6???????????????????????????????????web??÷?????DB??????????????????????????????????д???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????л???????????????????????Ч??????з??????????????λ????????????Ч????????????????????????????????Mysql????????????
??????Mysql5.6?????????Mysql?????????????One-Connection-Per-Thread??????????????????????Mysql-Server????????????????????????????????????????????????????????????????????????????????????????????????????£??????????????????????????????thread-cache??????????????????????????′??????????????????????????????????????????????????One-Connection-Per-Thread?????????????????????????????????????????????????????ζ????????????????????????л?(cpu cache?????????)????????????????????·????????????????One-Thread-Per-Connection?????????????????????Thread-Pool??????У????????С??λ??statement(???)?????????????????????????????????????????????????????(?????????????С)?????????????????????????μ????????????
?????????????
????Mysql-Server?????3?????????????????No-Threads??One-Thread-Per-Connection??Pool-Threads??No-Threads????????????????????????????????????????????????????One-Thread-Per-Connection??????????????????????????????????????????Pool-Threads??????????????????????Mysql-Server?????麯????????????3??????????????????????????????????????ó??????????????????????????thread_handling????????????????£?
????1 if(thread_handling<=SCHEDULER_ONE_THREAD_PER_CONNECTION)
????2 one_thread_per_connection_scheduler(thread_scheduler??
????3&max_connections??
????4&connection_count);
????5 else if(thread_handling==SCHEDULER_NO_THREADS)
????6 one_thread_scheduler(thread_scheduler);
????7 else
????8 pool_of_threads_scheduler(thread_scheduler??&max_connections??&connection_count);
???????????????
???????poll????mysql????????????
????????????????accept???????????socket
?????????thd?????vio?????
????????thread_handling?????????????thd?????scheduler???????
????????scheduler?????add_connection???????????
???????????????scheduler_functions????????????????????????????????????????????
????struct scheduler_functions
????{
????uint max_threads;
????uint*connection_count;
????
????ulong*max_connections;
????
????bool(*init)(void);
????
????bool(*init_new_connection_thread)(void);
????void(*add_connection)(THD*thd);
????void(*thd_wait_begin)(THD*thd??int wait_type);
????void(*thd_wait_end)(THD*thd);
????void(*post_kill_notification)(THD*thd);
????bool(*end_thread)(THD*thd??bool cache_thread);
????void(*end)(void);
????};
????static scheduler_functions tp_scheduler_functions=
????{
????0??//max_threads
????NULL??
????NULL??
????tp_init??//init
????NULL??//init_new_connection_thread
????tp_add_connection??//add_connection
????tp_wait_begin??//thd_wait_begin
????tp_wait_end??//thd_wait_end
????tp_post_kill_notification??//post_kill_notification
????NULL??//end_thread
????tp_end//end
????};
???????????????
????thread_handling:???????????
????thread_pool_size:????????group?????????????????CPU?????????????????£????group????????????????????????CPU??????
????thread_pool_stall_limit:????timer????????group???“???”????????????????
????thread_pool_idle_timeout:?????worker????????????????????????????е??????????????????????£?????????????
????thread_pool_oversubscribe:?ò??????????CPU??????“???”?????????????????????????listen????????
????threadpool_high_prio_mode:?????????е?????
???????????
??????????????Mysql-Server??ι??????????????????????????????????????????1
????
?????1(???????)
??????????????????????group??group?????thread_pool_size?????????????group?????????????к???????У????????listener????????????????listener????worker?????????????worker?????????????????????????thread_pool_oversubscribe????????????????????????timer?????group?????group“???”??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11