If we consider any CPU-intensive work that our server application can run instead of Thread.Sleep
, we will find that this application will suffer from the same problem. Worker threads will become busy quite quickly, and there is not much that we can do about this. We can try to change our application logic to work around this problem, and we will get back to this problem at the end of the chapter.
However, besides CPU-bound operations, there are tasks related to input/output processes, such as reading or writing a file, issuing a network request, or even performing a query against a database. These operations usually take much more time compared to CPU-bound work, and potentially they should be more problematic to our server application. I/O-bound work can take seconds. So does this mean that our worker threads will be locked for a longer time and the application will fail to scale?
Fortunately, there is one more component of the I/O-bound operation. When we mention...