Bug#14621627 THREAD CACHE IS UNFAIR
When a client connects to a MySQL server, first a THD object is created. If there are any idle server threads waiting, the THD object is then added to a list and a server thread is woken up. This thread then retrieves the THD object from the list and starts executing. The problem was that this list of THD objects waiting for a server thread, was not working in a FIFO fashion, but rather LIFO. This is unfair, as it means that the last THD added (=last client connected) will be assigned a server thread first. Note however that for this to be a problem, several clients must be able to connect and have THD objects constructed before any server threads manages to be woken up. This is not a very likely scenario. This patch fixes the problem by changing the THD list to work FIFO rather than LIFO. This is the 5.1/5.5 version of the patch.
This commit is contained in:
parent
5c089b0874
commit
139c8ed591
@ -4808,7 +4808,7 @@ void create_thread_to_handle_connection(THD *thd)
|
||||
if (cached_thread_count > wake_thread)
|
||||
{
|
||||
/* Get thread from cache */
|
||||
thread_cache.append(thd);
|
||||
thread_cache.push_back(thd);
|
||||
wake_thread++;
|
||||
pthread_cond_signal(&COND_thread_cache);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user