List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:May 11 1999 5:29am
Subject:Threads related issues.
View as plain text  
>>>>> "Alvin" == Alvin Starr <alvin@stripped> writes:

Alvin> In trying to find a thread problem in linuxthreads on alpha I noticed a
Alvin> possible optimazation point.

Alvin> Thread creation requires several system calls and the allocation of memory
Alvin> on the stack of the running process. Thread termination has about the same
Alvin> overhead. I was wondering if it would not make sense to keep created
Alvin> threads around for reuse instead of terminating them. This would avoid the
Alvin> overhead of creating the new ones. Even though the cost of a clone in
Alvin> linux is not nearly as high as a fork there will still be sugnificant
Alvin> overhead. I expect that the same holds true for any other OS that supports
Alvin> threads as kernel/user processes. 

Alvin> One idea would be to do somthing like the Apache pre-forking where a
Alvin> minimum number of threads is keept around all the time and any idle
Alvin> threads over that limit will after some timeout be released. This would
Alvin> mean that in high traffic times the number of live threads would rise and
Alvin> then slowly decay when the threads are no longer used.

Alvin> Just my thoughts.

Alvin> Alvin Starr                   ||   voice: (416)585-9971
Alvin> Interlink Connectivity        ||   fax:   (416)585-9974
Alvin> alvin@stripped              ||

Hi!

Sounds like a good idea.  I have added this to the MySQL TODO.

Generally persistent connections are a much better choice, as a
MYSQL connect is also not that fast (because of the user
authentication), but there are applications when a faster connect could 
pay off..

Regards,
Monty
Thread
Threads related issues.Unknown Sender5 May
  • Threads related issues.Michael Widenius11 May