Object Pool vs Thread Pool

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?
 
D

Dmitriy Lapshin [C# / .NET MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top