LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-21-2011, 02:27 PM   #1
woodzy
Member
 
Registered: Feb 2011
Posts: 31

Rep: Reputation: 0
Make Java Use more CPU's


I run a java program i called it craft.jar the ram it uses is good but it times its cup usage will spike and ill have issues, i have ubunto 10 opendjdk6 64 bit everything and 6 2.00Ghz Xeon cores. the ave load on all cores is 2% but when i get heavey with my java program use only to on the cores will jump to 90-100% usage and the outheres will stay at 2%.
Qusetion is how do i force the program to run on 5 of the 6 cores to lessen issues with spiking? i use this to start my java program
Code:
#!/bin/bash 
cd "${0%/*}"; java -Xincgc -Xmx2G -jar craft.jar
 
Old 03-21-2011, 05:13 PM   #2
woodzy
Member
 
Registered: Feb 2011
Posts: 31

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by woodzy View Post
I run a java program i called it craft.jar the ram it uses is good but it times its cup usage will spike and ill have issues, i have ubunto 10 opendjdk6 64 bit everything and 6 2.00Ghz Xeon cores. the ave load on all cores is 2% but when i get heavey with my java program use only to on the cores will jump to 90-100% usage and the outheres will stay at 2%.
Qusetion is how do i force the program to run on 5 of the 6 cores to lessen issues with spiking? i use this to start my java program
Code:
#!/bin/bash 
cd "${0%/*}"; java -Xincgc -Xmx2G -jar craft.jar
umm bumbing......
 
Old 03-21-2011, 05:14 PM   #3
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
To use multiple cores, the Java program should be multi-threaded in itself; you can't spread the load if it's just running a sequence of instructions one after the other.

Assuming you can't reprogram the code to use a more parallel algorithm, one thing you can do is change how the garbage collector works, so at least Java's garbage collector is using a different CPU to the main program. You could try using this:

Code:
-XX:+UseParallelGC
or this:

Code:
-XX:+UseParNewGC
instead of -Xincgc.

I couldn't find the page describing all the GC options, but there are a list of the major ones at http://openjdk.java.net/groups/quali...gurations.html (see the bottom of the page).

This may also be of interest: http://java.sun.com/docs/hotspot/gc1.4.2/faq.html

Hope that helps,

—Robert J Lee
 
1 members found this post helpful.
Old 03-21-2011, 06:44 PM   #4
woodzy
Member
 
Registered: Feb 2011
Posts: 31

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by rjlee View Post
[Mod edit: unnecessary quotation deleted]
—Robert J Lee
so i under stand that -XX:+UseParallelGC will make the programs garbage collector use a diffrent core form the main program? is that right?
is there a way i can sneek -Xshare:auto in there?

Last edited by archtoad6; 03-23-2011 at 11:07 AM. Reason: Delete long unnecessary quotation
 
Old 03-23-2011, 11:18 AM   #5
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
woodzy,

Bumping is against policy, useless, & clutters the thread. -- Please stop doing that.

While it isn't against the rules, quoting the entire preceding post is usually unnecessary, also clutters the thread, & may may be counterproductive because it hides your reply. -- That may be why you felt the need to bump. Now that I have removed it (the quotation), maybe the increased visibility will help get you an answer.
 
Old 03-23-2011, 11:43 AM   #6
woodzy
Member
 
Registered: Feb 2011
Posts: 31

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by archtoad6 View Post
woodzy,

Bumping is against policy, useless, & clutters the thread. -- Please stop doing that.

While it isn't against the rules, quoting the entire preceding post is usually unnecessary, also clutters the thread, & may may be counterproductive because it hides your reply. -- That may be why you felt the need to bump. Now that I have removed it (the quotation), maybe the increased visibility will help get you an answer.
i am very sorry for that i was un aware of that policy
 
Old 03-24-2011, 08:33 AM   #7
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by archtoad6 View Post
woodzy, ...
While it isn't against the rules, quoting the entire preceding post is usually unnecessary, also clutters the thread, & may may be counterproductive because it hides your reply. -- That may be why you felt the need to bump. Now that I have removed it (the quotation), maybe the increased visibility will help get you an answer.
You did it again, I wonder if you are aware of the 2 "Post Reply" buttons in each thread? Both are on the left side & not in any post. The top one is just above the 1st post, & the bottom one is just below the last post. There also is a "Quick Reply" area only a little further down. Please use one of those unless replying with a quotation is really necessary.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] java hogging CPU (both Firefox/Chrome) temps skyrocket Ubunoob001 Ubuntu 5 06-05-2010 08:35 PM
Not able to kill java process with average 90% cpu usage Squall90 Slackware 13 05-12-2010 03:02 PM
CPU/Fan overuse (npviewer.bin, Java).Temps up to 68C Ubunoob001 Linux - Newbie 1 05-04-2010 02:18 PM
how to make CPU idle? asahlot Linux - Software 2 11-23-2006 05:21 AM
LXer: Java Look-Alike Project Pushed Sun To Make Java Open Source LXer Syndicated Linux News 0 11-15-2006 03:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration