O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Scalability

Another area where asynchronous programming is quintessential is the construction of scalable services. When dealing with many requests, it’s common to initiate the processing for a request on the thread pool. This technique is used to reduce the thread creation and deletion churn that would occur if each request would use a dedicated thread. Because thread creation is rather expensive, it’s better to reuse threads using a pool mechanism.

When using a pool, a critical question to answer is how many threads should be allocated. The ideal number of threads is quite simply the same as the amount of CPUs available. Using fewer threads causes underutilization of the system, which may be warranted if many different services are run on the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required