Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8216735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:14:01+00:00 2026-06-07T12:14:01+00:00

In our multithreaded java app, we are using LinkedBlockingDeque separate instance for each thread,

  • 0

In our multithreaded java app, we are using LinkedBlockingDeque separate instance for each thread, assume threads (c1, c2, …. c200)

Threads T1 & T2 receive data from socket & add the object to the specific consumer’s Q between c1 to c200.

Infinite loop inside the run(), which calls LinkedBlockingDeque.take()

In the load run the CPU usage for the javae.exe itself is 40%. When we sum up the other process in the system the overall CPU usage reaches 90%.

By using JavaVisualVM the run() is taking more CPU and we suspect the LinkedBlockingDeque.take()

So tried alternatives like thread.wait and notify and thread.sleep(0) but no change.

The reason why each consumer having separate Q is for two reason,
1.there might be more than one request for consumer c1 from T1 or T2
2.if we dump all req in single q, the seach time for c1 to c200 will be more and search criteria will extend.
3.and let the consumer have the separate Q to process thier requests

Trying to reduce the CPU usage and in need of your inputs…

SD

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:14:04+00:00Added an answer on June 7, 2026 at 12:14 pm
    1. do profiling and make sure that the queue methods take relatively much CPU time. Is your message processing so simple that is compared to putting/taking to/from queue?
      How many messages are processed per second? How many CPUs are there? If each CPU is processing less than 100K messages per second, then it’s likely that the reason is not the access to the queues, but message handling itself.

    2. Putting in LinkedBlockingDeque creates an instance of a helper object. And I suspect, each new message is allocated from heap, so 2 creation per message. Try to use a pool of preallocated messages and circular buffers.

    3. 200 threads is a way too many. This means, too many context switches. Try to use actor libraries and thread pools, for example, https://github.com/rfqu/df4j (yes, it’s mine).

    4. Check if http://code.google.com/p/disruptor/ would fit for your needs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our app (before authentication) has Customers and Widgets. As you'd expect each customer has
In our system we have multi-threaded processing engine. During processing each thread calls methods
our Java EE applications writes large (>3000 rows, >300 columns) Excel files using Apache
Since Appengine won't allow java multithreading, how then can we migrate our existing multithreaded
Our web app uses SystemPropertyPlaceholder to load property files depending on the value of
Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have
Our company produces cross-platform software and we have Bamboo instance which is building projects
Our goal is simple for an iPhone app: show a splash page then hide
Our team is currently using some ported code from an old architecture to a
I've set breakpoints on exit and _exit and my program (multithreaded app, running on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.