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 6721403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:19:35+00:00 2026-05-26T09:19:35+00:00

I am implementing a worker pool in Java. This is essentially a whole load

  • 0

I am implementing a worker pool in Java.

This is essentially a whole load of objects which will pick up chunks of data, process the data and then store the result. Because of IO latency there will be significantly more workers than processor cores.

The server is dedicated to this task and I want to wring the maximum performance out of the hardware (but no I don’t want to implement it in C++).

The simplest implementation would be to have a single Java process which creates and monitors a number of worker threads. An alternative would be to run a Java process for each worker.

Assuming for arguments sake a quadcore Linux server which of these solutions would you anticipate being more performant and why?

You can assume the workers never need to communicate with one another.

  • 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-05-26T09:19:36+00:00Added an answer on May 26, 2026 at 9:19 am

    One process, multiple threads – for a few reasons.

    When context-switching between jobs, it’s cheaper on some processors to switch between threads than between processes. This is especially important in this kind of I/O-bound case with more workers than cores. The more work you do between getting I/O blocked, the less important this is. Good buffering will pay for threads or processes, though.

    When switching between threads in the same JVM, at least some Linux implementations (x86, in particular) don’t need to flush cache. See Tsuna’s blog. Cache pollution between threads will be minimized, since they can share the program cache, are performing the same task, and are sharing the same copy of the code. We’re talking savings on the order of 100’s of nanoseconds to several microseconds per switch. If that’s small potatoes for you, then read on…

    Depending on the design, the I/O data path may be shorter for one process.

    The startup and warmup time for a thread is generally much shorter. The OS doesn’t have to start a process, Java doesn’t have to start another JVM, classloading is only done once, JIT-compilation is only done once, and HotSpot optimizations are done once, and sooner.

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

Sidebar

Related Questions

implementing publishActivity in PHP using the REST API using this code: $activity = array(
When implementing a needle search of a haystack in an object-oriented way, you essentially
I am implementing a search functionality in a website I am building, which involves
For various reasons, we are writing a new business objects/data storage library. One of
I am implementing a thread pool. The work required by each thread is 1-10
I ran into this problem using EF4 and a self-referential table (implementing an adjacency
I am implementing a simple thread pool mechanism for my ubuntu server (for my
I am solving this problem. I am implementing cycling mapping, I have 4 processors,
I was discussing with a co-worker the other day the similarities of implementing a
I have created a library which can download JSON data which is then placed

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.