• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Java heap and Application hang

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

I have this problem. After some time our application begins to hang. We figured it probably had an out of memory error or something but we couldn't find any in the logs. When we checked task manager, we noticed that when the process javaw.exe begins to reach 500MB, thats when the application starts hanging. Restarting the instance is the only way to make it work normally again.

My question is even if our maximum java heap size was set to 1.5GB in the application server admin console, why is it that our application begins to hang when it reaches memory consumption 500MB? Shouldn't it be behaving like that if it was consuming near 1.5GB already?


Thanks.
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The -Xmx parameter just limits the maximum amount of memory a Java application can get. It is possible that, if there is no memory available, the JVM process won't be able to allocate that much. However, if this was the case, I'd expect you'd see some OutOfMemoryErrors in the logs.

You might try to allocate that much memory right at the beginning with -Xms; I believe the JVM won't start if it won't be able to allocate memory requested by -Xms.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

My question is even if our maximum java heap size was set to 1.5GB in the application server admin console, why is it that our application begins to hang when it reaches memory consumption 500MB? Shouldn't it be behaving like that if it was consuming near 1.5GB already?



How did you objectively conclude that the application hangs because of memory consumption ? Like Martin said, you should see an OOM if you run out of memory. If the application is slow after some time, it could be because of a plethora of reasons.

1. CPU usage
2. Back log of application threads
3. Costly IO operations
etc

Check for other parameters that can cause the application to misbehave.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Exactly what happens when the application "hangs"?

1. CPU use goes to 100%
2. New requests are accepted but do not progress
3. New requests get an error message
.... etc - so many possible symptoms

Does your application call a database - in the same computer -or- elsewhere in your network

Bill
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excessive memory usage could cause application slow down . However, as other people have mentioned there could be lot of other reasons

To rule out(or in) memory usage, you can monitor the java process in JConsole. If you go to the memory tab, JConsole will show you how much heap is being used, and how much time is spent in GC. If GC is very frequent, and/or application spends too much time in collections, you have memory issues
 
We don't have time to be charming! Quick, read this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic