Object Pool vs Thread Pool

  • Thread starter Thread starter Mullin Yu
  • Start date Start date
M

Mullin Yu

I want to know what're the main differences between them.

In fact, I want to write an application to get the request from DB, and then
based on the request type (print, email, fax), and then send to print or
email or fax objects to send the request out.

In order to increase the performance, I intend to create a COM+ object (with
object pool), and each object will get the request from db, and then
process. In this case, it seems that each object should create only a thread
to do send out the request, then any needs of using thread pool?
 
Hi,

I'd recommend avoiding COM+ in a managed application, especially when you
have managed means of doing the same. Employ the ThreadPool class and queue
each print/fax/email job as a work item in the pool. Thus you will avoid
creating a thread per request which is considered performance-killing
practice as it incurs lots of overhead related to switching thread contexts.
The pool, on the other hand, maintains an optimum number of threads for the
number of CPUs available and distributes the work items among these threads.
 
Back
Top