Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 12-26-2012, 01:14 AM   #1
Registered: Jul 2012
Posts: 55

Rep: Reputation: Disabled
java uses 100% of cpu


I am running java 1.7 on my server with tomcat 7.0.29
Centos 6.3 x86_64 architecture.

When I run any java application and then check top
Java uses most of the CPU that is almost 100

I have search on Google regarding this every where I found it is
bug of java.
Solution for this is:
Stop the ntp service and set the date.

But I don't have ntp or ntpd service running and still I am facing this issue.
Old 12-26-2012, 11:21 AM   #2
Senior Member
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
This is usually caused by bad java paramaters being set for the hardware config.

I have seen this happen with the min and max heap sizes were set way too low for the amount of hardware available to it, this caused Java not to be able to cache as much data as it needed for the app to run properly and jumped the CPU through the roof in order for Java to try to keep up with processing all the data on the fly. Do you know what your heap sizes are set to and what sort of memory you have on the system?
Old 12-27-2012, 12:46 AM   #3
Registered: Jul 2012
Posts: 55

Original Poster
Rep: Reputation: Disabled

Thanks for your reply.

I dont know how to check the heap size and also how to set.

This the output of free -m command on my vps
total used free shared buffers cached
Mem: 1006 981 25 0 150 541
-/+ buffers/cache: 289 716
Swap: 1022 0 1022

I search on google i found one solution for seting Heap memory
command: java -Xms256mb
Invalid initial heap size: -Xms256mb
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Old 12-27-2012, 09:51 PM   #4
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3182Reputation: 3182Reputation: 3182Reputation: 3182Reputation: 3182Reputation: 3182Reputation: 3182Reputation: 3182Reputation: 3182Reputation: 3182Reputation: 3182
Could it be simply that some Java program is real busy?

If any client process can actually use 100% of the CPU resource, then the kernel is delighted to give the CPU something to do ... which is comparatively rare.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
OpenOffice/LibreOffice writer uses 100% CPU time, 100% memory, workaround someone? jlinkels Linux - Software 11 08-30-2012 01:50 PM
100% cpu use 100% of the time serafean Linux - Newbie 4 05-04-2006 03:36 PM
cpu ......100%...... mohama Linux - General 23 01-20-2006 10:39 AM
X using nearly 100% CPU Jiawen Linux - Software 2 01-08-2006 06:35 PM
cpu nearly always at 100% xround Linux - Hardware 6 09-17-2004 05:51 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:44 AM.

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