Object Pool vs Thread Pool

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mullin Yu

    #1

    Object Pool vs Thread Pool

    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?


  • Dmitriy Lapshin [C# / .NET MVP]

    #2
    Re: Object Pool vs 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.

    --
    Dmitriy Lapshin [C# / .NET MVP]
    X-Unity Test Studio

    Bring the power of unit testing to VS .NET IDE

    "Mullin Yu" <mullin_yu@ctil .com> wrote in message
    news:eaFLrJEmDH A.964@TK2MSFTNG P10.phx.gbl...[color=blue]
    > 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[/color]
    then[color=blue]
    > 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[/color]
    (with[color=blue]
    > 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[/color]
    thread[color=blue]
    > to do send out the request, then any needs of using thread pool?
    >
    >[/color]

    Comment

    Working...