Before implementing asynchronous code, carefully consider the need for performing multiple tasks in parallel. Increasing parallelism can have a significant effect on your performance metrics. Additional threads consume resources such as memory, disk I/O, network bandwidth, and database connections. Also, additional threads may cause significant overhead from contention, or context switching. In all cases, it is important to verify that adding threads is helping you to meet your objectives rather than hindering your progress.
The following are examples where performing multiple tasks in parallel might be appropriate:
Where one task is not dependent on the results of another, such that it can run without waiting on the other.
If work is I/O bound. Any task involving I/O benefits from having its own thread, because the thread sleeps during the I/O operation which allows other threads to execute. However, if the work is CPU bound, parallel execution is likely to have a negative impact on performance.
Mainly serves as my backup reference on programming & technology. Plus some random thoughts
- HOME
- PROGRAMMING
- TECHNOLOGIES
- GENERAL
- ABOUT ME
0 comments:
Post a Comment