??????????
????1.tp_add_connection[??????????]
????1)???????connection????
????2)????thread_id%group_count???connection???????group
????3)??connection??????group?????
????4)???????????????0????????????????
????2.worker_main[???????]
????1)????get_event???????
????2)????????????????handle_event???д???
????3)????????????????????????????????
????3.get_event[???????]
????1)??????????????
????2)???????????????????????
????3)????group?????listener???????????listener???????????
????4)?????listener???????????????????
????5)???????????????(thread_pool_idle_timeout)
????6)????????б?????????????????????????????
????7)??????????????????????????????1
??????????????????????????ж???????????????????
????thread_pool_oversubscribe+1??????????????????????????
????4.handle_event[????????]
????1)?ж??????????е???????????У?????е?????
????2)????thd??????
????3)??????????????????????
????4)????do_command???????????????
????5)???thd???????????????ж????????epoll??????б???
????6)????У?????epoll_ctl???й???
????7)????
????5.listener[???????]
????1)????epoll_wait???ж?group???????????????????????
????2)?????????????????л??
????3)??????????????????????????????л??????????
????4)?ж????????????????
????5)???????????listener????worker???
????6)??group????л????????????????
?????????????epoll_wait????group????????????????????????????????
????????push?????У?worker????????л???????????С?
????6.timer_thread[??????]
????1)?????listener????????????io_event???
????2)????????????????????????
????3)??group??????????д??????????????????????????
????4)???group???stall????????????
?????????timer???????????group????stall??
????7.tp_wait_begin[????????????]
????1)??????????1????????????1
????2)??????????0????????????в???????????м?????????
????3)?????????????
?????????waiting_threads???????????????????????????????ν??
????????????????????????????????????????????????????????io??
????????????????????????
????8.tp_wait_end[?????????????]
????1)????connection??waiting???false
????2)??????????1????????????1
???????????????
?????????????????Client?????????(?????)??????????????????????????Щ????????????????е?DB??????????????????е???????С??DB??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????DB???????????????server?????????????????????????DB?????????one-conection-per-thread???????????????????????????????С??λ????????????????????????????????????????????server???????????????????????Χ??????????????????????????????л????????????????????????????????μ???????????????????????????????????????????????????????????????????????????????????????DB???????????????????????ü?????????????????????????????????????????????????????????????server?????????????????2????????web-server???????3??????????????????????????????????????db-server?????worker??????????????????????????????db-server???3??group?????group??????worker?????worker??????2???????????


????
?????2(??????????????)

???????????
????1.???????
???????????group??????????????????????????????????磬?е??????????η??????????е????????????????????????????????????????????????????????????????????????????????????????????????????????group???棬??????????????????У???????????????????????????????????У???????????????????л????????С?
????2.????????
???????????????????group????????????????????group??????????????????thread_pool_oversubscribe???????????????????????????????????????(??и??????????????)???????group??????stall????????????????timer???????????????????????????μ?worker?????????????????????????????????????????group????????????????????????????????????????hang????????????????????????????????????????????SQL??????????SQL????????м?????£??????????????????SQL????λ????????SQL??????ο??????????????????????????????????dump????????????????????????????????????dump???????????????Σ???????dump?????????????????????????????????????????dump???????????group???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????group?д???dump?????????????thread_pool_oversubscribe??????????????????
?????ο????
????http://ourmysql.com/archives/1303
????http://blog.chinaunix.net/uid-28364803-id-3431242.html
????http://www.atatech.org/articles/31833
????https://dev.mysql.com/doc/refman/5.6/en/connection-threads.html