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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:31:47+00:00 2026-05-29T20:31:47+00:00

INITIAL QUESTION: I have an app that uses ExecutorService to run 4 fixedThreadPool. When

  • 0

INITIAL QUESTION:

I have an app that uses ExecutorService to run 4 fixedThreadPool. When I use this architecture the app runs faster on Windows vice a single threaded architecture. But when I ran the ExecutorService architecture in linux my app’s performance was worser than singe threaded app.

The CPU and other hardwares on both the machines are identical. I even tried on different machines and got the same result. I even tried to limit the fixedThreadPool to 3 or 2 and still got slower performance. What could be the variable that I’m missing causing the slowness in linux machines?

ExecutorService execSvc =
     Executors.newFixedThreadPool(NUMBER_OF_PROCESSORS);
Perform perform[] = new Perform[n];
Future<?>[] future = new Future<?>[n];
for(int i=0;i<n;i++)
   future = execSvc.submit(perform[i]);
for(int i=0;i<n;i++)
//To wait until all done
   future[i].get();

Both the OS runs on same machine.
JAVA Version: windows 1.6.0_22, linux Open JDK1.6.0_20

EDIT:

I tried adding -Xincgc on linux and seems like for first few minutes the code runs fast as expected and after that it starts to speed and slow rapidly. Please see that the code chunk I created runs gazillion times in my app and can this indicate that the JVM GC behaves differently in different OS?

AFTER TRIALS:

After trying with 4 different linux machines it looks like the openJDK is causing issue. I shouldn’t have installed openJDK in the first place but thanks to @Alfabravo for pointing it out.

  • 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-29T20:31:47+00:00Added an answer on May 29, 2026 at 8:31 pm

    About the only thing I can think of is the at the memory settings are somehow different on the two systems and that you are running out of memory earlier in Linux-land. Here as some things to try:

    • Increase the memory settings under Linux (duh). -Xmx1G or something
    • Assign each future to null after you reap it. This may have little effect but might be worth it to help the GC out.

      for(int i = 0; i < n; i++) {
         future[i].get();
         future[i] = null;
      }
      
    • Don’t store the Perform objects in an array. Just submit them and forget about them. If you still need them then return them in the Future<Perform> and then set them to null when you are done with them.
    • The best win might be to not submit all of the jobs at once but keep 100 outstanding or something. Turn the Future array into a list and reap the onces that isDone() or isCancelled() and only submit to the pool if the size of the list is below some threshold. You’ll need a sleep to not spin. I actually did this recently so here is some sample code: http://pastebin.com/3TkkxGYT

    Another thing to consider is that if your Perform tasks are very small then you may be just testing the context switching of the OS more than anything else. But I wouldn’t think it would slow down over time on its own.

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

Sidebar

Related Questions

I have a (JSF 2.0/ Primefaces 2.2RC-SNAPSHOT) app that has <p:layout> I use a
I have an OS X app that uses a splitview with two embeded NSTableViews.
I have an app which costs $5. I'd like to change this so that
FYI, There is some overlap in the initial description of this question with a
I have a Django app that needs to pull the follower_count information from several
Let's say I have a UITableView that is part of an iPad app doesn't
I have a Silverlight app that makes multiple (often concurrent) asynchronous calls to an
I have found some question which refers to my initial question : - on
I have a brief conceptional question: Recently, I started to develop an app in
We have already built a rails app that has several users and an image

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.