When I upload a big file through java application running on Websphere Application Server , I got OutOfMemoryError , as given below
JVMDUMP013I Processed Dump Event "uncaught", detail "java/lang/OutOfMemoryError".
Also memory leak is a common memory problem that also leads to OutOfMemory error. In Java , memory leaks can not happen as it has automatic Garbage Collection (GC). GC removes unused objects that are not referenced anymore. But if an object is not used, but is still referenced, GC does not remove it, which leads to memory leaks in JVM .
Due to the above memory leak or large objects error , the performance of the application server may decline or WAS may be crashed with OutOfMemory error. . Please check the error message java.lang.OutOfMemoryError” in the WAS log file ( i.e. native_stderr.log)
One of Solution to the above error :
When I increase the JVM Heap Size , the problem got solved . Now let us see , how to increase JVM Heap Size in Websphere Application Server
You can solve the problem in two ways
i) Using the IBM console
ii) By changing the server.index file directly
i). To tune the JVM Max Heap size using the IBM console
1. Open the WebSphere Application Server administrative console, http://hostname:port/ibm/console, and log in.
2. Expand Servers -> Application servers -> server1 -> Java and Process Management -> Process Definition -> Java Virtual Machine.
4. Click Apply and click Save .
Restart WebSphere Application Server.
ii). By changing the server.xml file directly
Open the server.xml file located in the following directory
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config/cells/YourSrverNode01Cell/nodes/YourServerNode01/servers/server1
You may get the following lines related to JVM entries ...
<processDefinitions xmi:type="processexec:JavaProcessDef" xmi:id="JavaProcessDef_1268723379271" workingDirectory="${USER_INSTALL_ROOT}" executableTargetKind="JAVA_CLASS" executableTarget="com.ibm.ws.runtime.WsServer" >
<execution xmi:id="ProcessExecution_1268723379271" processPriority="20" runAsUser="" runAsGroup=""/> <ioRedirect xmi:id="OutputRedirect_1268723379271" stdoutFilename="${SERVER_LOG_ROOT}/native_stdout.log" stderrFilename="${SERVER_LOG_ROOT}/native_stderr.log"/ >
<monitoringPolicy xmi:id="MonitoringPolicy_1268723379271" maximumStartupAttempts="3" pingInterval="60" pingTimeout="300" autoRestart="true" nodeRestartState="STOPPED"/ >
<jvmEntries xmi:id="JavaVirtualMachine_1268723379271" verboseModeClass="false" verboseModeGarbageCollection="false" verboseModeJNI="false" initialHeapSize="250" maximumHeapSize="512" runHProf="false" debugMode="false" debugArgs="-Djava.compiler=NONE -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777" disableJIT="false"/ >
</processDefinitions >
Change the initialHeapSize to new larger value (i.e. 512 or 1024) and maximumHeapSize to new larger value (i.e. 2048) . If there is no parameters , you can add the two parameters (initialHeapSize="512" maximumHeapSize="2048") with value after verboseModeJNI="false" . Now save the server.xml file
Note : Changing the Max Heap Size to very larger value that is more than half of the total RAM , may result the following error when we start the WAS ,
VMJ9GC028E Option too large: '-Xmx4096m'
JVMJ9VM015W Initialization error for library j9gc23(2): Failed to initialize, parsing command line
Could not create the Java virtual machine.
Then you have to reduce the max heap size value using the IInd method ..(i.e. change server.xml file directly)
Tuning the max heap size
Setting the JVM heap size directly relates to the number of server instances need to be started on a specific node and the total RAM available on that machine. The total value of all server JVM heap sizes on a specific node must be less than half of the total RAM of that computer. To determine the max heap size , you can use the following equation
max_heap_size = Total_RAM / 2 / no_of_servers_instance
For example, to support two servers instance on a machine with 4 GB of RAM:
max_heap_size = 4 GB / 2 / 2
=2 GB / 2 = 1 GB
The maximum heap size is 1 GB for each server instance.
Default maximum heap size is 250 MB
Increasing the minimum heap size & maximum heap size can improve the start-up of application server. The number of garbage collection (GC) occurrences are reduced and a 10% gain in performance is realized.
How to determine Max Heap Size is too large or too small for your application.? If GC takes a so long time to clean up objects with large heap, you can reduce the maximum heap size. If GC frequency is too high, the heap may be too small for the application and GC needs to run frequently, so you may increase the maximum heap size.
V.Good info. thanks for your efforts ...!
ReplyDeleteMuchas Gracias Amigo, Me fue de gran Ayuda, Fuiste muy didactico.
ReplyDeletethnx for very good info....and pls keep these kind of info for long ago
ReplyDeletethnx for very good info....and pls keep these kind of info for long ago
ReplyDeletevery good info, thanks.
ReplyDeleteawesome explanation .Thanks
ReplyDeleteNice explanation....and follow http://tech-sris.blogspot.in for latest computer tips and tricks
ReplyDeleteplease share your what's up numbers ,i wantto create new what's up group it's issues purpose.this is my what's up number "8015212634"
ReplyDeleteGot a lot of information, Thank you so much. I was looking for a tool that can help me to understand the amount of memory wasted by the application due to inefficient programming and this tool Heap Hero has given the exact functinalities that I was looking for.
ReplyDeleteThank you so much for the solution, it saves me I must need to submit my Btec assignment help to one of my client but this memory error won't let me do it. Your post save me!
ReplyDeleteThis is the most helpful post thanks for sharing it with us. Top gun maverick jacket
ReplyDeleteThank you for your contribution. Your article contains useful information, which I will pass on to others. If you're looking for a free tool to help you check your Kohi Clicking, I have a tool that will test your click speed and give you the result.
ReplyDeleteThe game app development team has done an outstanding job! The graphics, gameplay mechanics, and overall experience are top-notch. It's clear they put a lot of effort into creating an addictive and immersive gaming experience.
ReplyDeleteAssignment Help Georgia aims to empower students to achieve academic success, offering them the guidance and support they need to excel in their studies. Whether it’s essay writing, research papers, or complex projects, the service stands as a reliable partner in Georgia’s academic journey. So wait no more and start using the services of Assignment Help Georgia right away.
ReplyDeleteAssignment Help Georgia