� Data Recovery - Lunarsoft Wiki | Main | In good faith �
January 18, 2009
Dr. Dobb's | Measuring Parallel Performance: Optimizing a Concurrent Queue | December 1, 2008
To improve scalability, we need to minimize contention:
* Reduce the size of critical sections so that we can get less contention and more concurrency among client threads.
* Reduce sharing of the same data by isolating threads to use different parts of a data structure. In our case, we moved the responsibility for cleanup from the producer to the consumer so that consumers touch only the head and producers touch only the tail.
* Reduce false sharing of different data on the same cache line, by adding padding to ensure that two separate variables that should be able to be used concurrently by different threads are also far enough apart in memory.To understand our code's scalability, we need to know what to measure and what to look for in the results:
* Identify the key different kinds of work (here, producer threads and consumer threads), and then use stress tests to measure the impact of having different quantities and combinations of these in our workload.
* Identify the different kinds of data (here, representative "small" and "large" queue items), and then vary those to measure their impact.
* Measure total throughput, or items handled per unit time.
* Look for scalability, or the change in throughput as we add more threads. Does using more threads do more total work? Why or why not? In what directions, and for what combinations of workloads?
* Look for contention, or the interference between multiple threads trying to do work concurrently.
* Watch for the cost of oversubscription, and eliminate it either algorithmically or by limiting the actual amount of concurrency to avoid it altogether.
* Beware of overreliance on automated trendlines. Apply them only after first examining the raw data.
Dr. Dobb's | Measuring Parallel Performance: Optimizing a Concurrent Queue | December 1, 2008
Posted by thdyck on January 18, 2009
Trackback Pings
TrackBack URL for this entry:
http://blog.dyck.org/mt-tb.cgi/613
Comments
Post a comment
Thanks for signing in, . Now you can comment. (sign out)
(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)