The success of e-commerce, messaging middleware, and other Internet-based applications depends in part on the ability of network servers to respond in a timely and reliable manner to simultaneous service requests. Multithreaded systems, due to their efficient use of system resources and the popularity of shared-memory multi-processor architectures, have become the server implementation of choice. However, creating and destroying a thread is far from free, requiring run-time memory allocation and deallocation. These overheads become especially onerous during periods of high load and can be a major factor behind system slowdowns. A thread-pool architecture addresses this problem by prespawning and then managing a pool of threads. Threads in the pool are reused, so that thread creation and destruction overheads are incurred only once per thread, and not once per request. However, efficient thread management for a given system load highly depends on the thread pool size, which is currently determined heuristically. In this paper, we characterize several system resource costs associated with thread pool size. If the thread pool is too large, and threads go unused, then processing and memory resources are wasted maintaining the thread pool. If the thread pool is too small, then additional threads must be created and destroyed on the fly to handle new requests. We analytically determine the optimal thread pool size to maximize the expected gain of using a thread.
[1]
Simon P. Wilson,et al.
Statistical methods in software engineering : reliability and risk
,
1999
.
[2]
David R. Butenhof.
Programming with POSIX threads
,
1993
.
[3]
Ali R. Hurson,et al.
Effects of Multithreading on Cache Performance
,
1999,
IEEE Trans. Computers.
[4]
Bil Lewis,et al.
Threads Primer: A Guide to Multithreaded Programming
,
1995
.
[5]
Y. S. Ramakrishna,et al.
An efficient meta-lock for implementing ubiquitous synchronization
,
1999,
OOPSLA '99.
[6]
L. Goddard.
Information Theory
,
1962,
Nature.
[7]
Scott Oaks,et al.
Java Threads
,
1997
.
[8]
Kevin T. Manley.
General-purpose threads with I/O completion ports
,
1998
.
[9]
Douglas C. Schmidt.
Evaluating architectures for multithreaded object request brokers
,
1998,
CACM.
[10]
Sheldon M. Ross.
Introduction to Probability Models.
,
1995
.
[11]
Sheldon M. Ross,et al.
Introduction to Probability Models, Eighth Edition
,
1972
.