New java.net Article: Reducing Contention and Overhead in Worker Queues
We've just published a new article on java.net: "A Method for Reducing Contention and Overhead in Worker Queues for Multithreaded Java Applications" by Sathiskumar Palaniappan, Kavitha Varadarajan, and Jayashree Viswanathan. The article addresses the problem of writing code that efficiently utilizes the resources of modern multicore processors and multiprocessor servers. The introduction sets the scene:
Many server applications, such as Web servers, application servers, database servers, file servers, and mail servers, maintain worker queues and thread pools to handle large numbers of short tasks that arrive from remote sources. In general, a "worker queue" holds all the short tasks that need to be executed, and the threads in the thread pool retrieve the tasks from the worker queue and complete the tasks.
Since multiple threads act on the worker queue, adding tasks to and deleting tasks from the worker queue needs to be synchronized, which introduces contention in the worker queue. This article explains the contention involved with the traditional approach (using a common queue for the thread pool) and helps you reduce the contention by maintaining one queue per thread. This article also explains a work stealing technique that is important for utilizing the CPU effectively in multicore systems.
Sathiskumar, Kavitha, and Jayashree provide detailed description of the concepts; illustrations that depict the relationships and working of threads, tasks, and worker queues; along with example code. The article builds to a performance comparison between the Type 1 and Type 3 queues that are discussed in the article using benchmark code examples.
This article demonstrated the contention involved in the common worker queue approach and then isolated the contention by creating one queue per thread. This article also demonstrated, through a simple benchmark, why work stealing is important and how it improves the overall performance of an application.
If you'd like to learn about more advanced techniques for efficiently utilizing the capabilities of modern multicore/multiprocessor systems, "A Method for Reducing Contention and Overhead in Worker Queues for Multithreaded Java Applications", by Sathiskumar Palaniappan, Kavitha Varadarajan, and Jayashree Viswanathan, is an article you'll want to read.
- Sonya Barry, Hello from South Carolina;
- Juliano Viana, GlassFish Webcast Series: Java EE 6 e GlassFish Server 3.1: Simplicidade + Leveza = Produtividade;
- Ed Burns, Jazoon 2011 Picks; and
- Alexander Potochkin, Swing in a better world: Listeners.
Our current java.net poll asks "Do you intend to experiment with the JavaFX 2.0 Beta Release?" Voting will be open until Friday, June 24.
Our latest java.net article is "A Method for Reducing Contention and Overhead in Worker Queues for Multithreaded Java Applications", by Sathiskumar Palaniappan, Kavitha Varadarajan, and Jayashree Viswanathan.
Here are the stories we've recently featured in our Java news section:
- Mark Lewis talks about Scala: The Static Language that Feels Dynamic;
- Andrew Binstock describes Making Large Classes Small (In 5 Not-So-Easy Steps);
- Giorgio Sironi presents Parallelism for dummies;
- Mark Reinhold announces the OpenJDK Community Bylaws: Final draft;
- Antonio Goncalves contributes to a [Debate] - And what about configuration in Java EE 7 ?;
- Adam Bien demonstrates How to Reuse Java EE 6 Code with Maven(3);
- Henrik Ståhl talks about the Java community Moving to OpenJDK as the official Java SE 7 Reference Implementation;
- Shai Almog comments on an Interesting Couple Of Weeks;
- Java Spotlight Episode 33: Sreekumar Pillai on Java Mobile Platform has been released;
- Tori Wieldt presents a JCP.next Update;
- Adam Bien presents A Natural Separation of JUnit Tests in Maven (3); and
- Dr. Michael Kolling announces Greenfoot 2.1 released.
Our latest java.net href="http://www.java.net/archive/spotlight">Spotlight is Java Spotlight Episode 34: Chuck Munn Lee on Using PhoneME on Nintendo DS:
Interview with Chuck Mun Lee, Java Evangelist, on porting PhoneME to Nintendo DS. Joining us this week on the Java All Star Developer Panel are Dalibor Topic, Java Free and Open Source Software Ambassador, and Alexis Moussine-Pouchkine, Java EE Developer Advocate...
We're also featuring the announcement from the Java Source, Duke's Choice Awards Open for Nominations:
Duke's Choice Awards are now open for nominations! For the ninth year running, we are looking for most compelling implementations of Java technology. Duke's Choice Awards are part of the Oracle Excellence Awards, Java Innovation 2011 program. Winners get a Duke statue, a free JavaOne full conference pass, and their winning implementation will be showcased at JavaOne. Winners are announced at JavaOne. Deadline for submission is Friday, July 22, 2011 @ 5:00 p.m. PT...
Subscriptions and Archives: You can subscribe to this blog using the java.net Editor's Blog Feed. You can also subscribe to the Java Today RSS feed and the java.net blogs feed. You can find historical archives of what has appeared the front page of java.net in the java.net home page archive.