• Post Reply Bookmark Topic Watch Topic
  • New Topic

memory arguments to prevent OOM exception  RSS feed

 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The memory args for our prod. application are set as -Xms256m -Xmx512m -XX:MaxPermSize=128m. With our monitoring tool, we see that during peak hours, the memory usage is bordering at 500MB. Sometimes, it takes more and throws OutOfMemory exceptions. We are in the process of finding any memory leaks. I would also like to increase the maximum memory available.

Can anyone suggest what would be the safest limit to increase upto?
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you really need to cap the heap size strongly? Could you not give a really generous value for -Xmx then tweak -XX:MinHeapFreeRatio and -XX:MaxHeapFreeRatio? That would let Java to choose its own heap size.

These are questions only you can answer, I think. You may have a good reason for not doing it that way. Perhaps there are other processes running that must be given a certain part of the virtual memory?
 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats a good idea. However, looks like the app is taking all the memory it can. So even if I set the minheapfreeratio, the no. of gc's at that max heap usage point will constantly increase, till load on the app decreases, I think, thereby still causing the same memory problem. Also, we have plenty of RAM for use. Therefore, I am thinking to increase the -Xmx value. But hey thanks for the idea.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was suggesting that you should increase -Xmx at the same time as tuning the min/max free heap ratio parameters. This will allow the heap to expand when necessary, but you can tune it so that the heap contracts reasonably eagerly, when possible.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The maximum possible value on a 32 bit windows machine is around 1.8 GB for the heap - no matter how much more RAM the machine actually might have.
 
Henry Wong
author
Sheriff
Posts: 23280
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want a even bigger heap (greater than 1.5 gig), you will have to upgrade to a 64 bit JVM. (on a 64 bit OS, of course)

Around 4 gig is when the GC becomes a real problem -- and you really need to be a tuning expert at this point. I do have a couple of clients who are using 8+ gig heaps (with the Sun hotspot JVM), but quite frankly, IMHO, they are not stable environments.

Whatever you do, do *not* use swap space to increase the size of your heap. The algorithms used for GC are not very friendly for paging -- you will thash the JVM.


Finally, if you are willing to pay for it, there are hardware assisted JVMs. I have one client with a 300 gig heap that is running fine with it. (Full Disclosure: I work for the company that produces this JVM)

Henry
[ September 01, 2007: Message edited by: Henry Wong ]
 
Pat Farrell
Rancher
Posts: 4686
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Henry Wong:

Finally, if you are willing to pay for it, there are hardware assisted JVMs. (Full Disclosure: I work for the company that produces this JVM)

[ September 01, 2007: Message edited by: Henry Wong ]


Henry, I've googled for info on hardware JVMs without luck.
While I don't want a blatent advertisment, I sure would like to find more infomation about the idea.

Thanks
Pat
 
Henry Wong
author
Sheriff
Posts: 23280
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pat Farrell:

Henry, I've googled for info on hardware JVMs without luck.
While I don't want a blatent advertisment, I sure would like to find more infomation about the idea.

Thanks
Pat


www.azulsystems.com
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!