Friday, March 21

OOM

what is out of memory issues in weblogic?why we get out of memory isuues in weblogic?if we get those issues how can we resolve it?

  • Maheshkumar Subbaiyan 1. Memory size of the JVM = Heap Memomry + Native Memory

    Heap Memeory - Its used by application

    Native Memory - Its uused by JVM internal purpose like running GC,creating threads..etc.

    So OutOfMeomry can happen on either Heap or Native memory.

    a.) Heap Memory issues can be given by bad code - like code doesn't relese the memory properly and it will have reference to the object which is no more used - so we need to enable the heap dump to get the information gather the memory foot prints in the heap.

    We can enable the heapdump on using below parameter as a startup argument

    -XX:+HeapDumpOnOutOfMemoryError

    The above command will create a dump which can be analyzed using MAT tool, this tool will say which objects are holding more memory then we can work with development team to get the code fixed.

    Sometime may the app needs more heap memory,so we can fix this issue by increasing the heap size.

    b.) Native Memory issue can be given by third party library code or jndi - so this needs to be worked with that third party code owner to get the issue fixed.

    2. OutofMemory errros are different for different JVM/JDK.

    Sun HotSpot - OutOfMemory error can happen on Heap memory,Perm generation and Native memory

    Jrockit - OutOfMemory error can happen on Heap memory and Native Memory as there is a no perm generation in jrockit which is part of Native memory itself.
  • Suneel Kumar N Types of Out Of Memory:
    There are different kinds of memory limits inside the Java Virtual Machine. 
    1)) java.lang.OutOfMemoryError: PermGen space

    If you get the error message: java.lang.OutOfMemoryError: PermGen space this means that you have exceeded Java's default 64Mb block for loading class files. This can happen if too many plug-in’s are installed. You may want to increase the PermGen memory size to suit your needs.
    In the following sample, the blue parameter shows how the PermGen Memory has been set to 192 megabytes. This value should be set depending on your memory requirements. 192m should be sufficient for Confluence even when many plugins are installed.
    JAVA_OPTS="-Xms128m -Xmx1024m -XX:MaxPermSize=192m -
    2)) java.lang.OutOfMemoryError: Java Heap Space
    Heap space memory errors occur when the application has to deal with large amounts of data or users. These errors will contain only a java.lang.OutOfMemoryError, e.g. without the reference to PermGen space as above. You should try to increase the heap size to solve this problem. This requires configuring the Xmx and Xms parameters. In the following example, the maximum heap size is set to 1024 megabytes. This should be enough for small to medium deployments.
    JAVA_OPTS="-Xms128m -Xmx1024m -XX:MaxPermSize=256m 
    Deployments with high usage patterns may require additional memory. For high-usage deployments, it is recommended to set both Xms and Xmx as the same value (eg. -Xms1024m -Xmx1024m), provided the memory is available. On the other hand, adding too much memory can also cause problems (see below), so you should increment memory carefully, for example in increments of 128 megabytes.
    3)) OutOfMemoryError: unable to create new native thread
    This error occurs when the operating system is unable to create new threads. This is due to the JVM Heap taking up the available RAM.
    Big heaps take away from the space that can be allocated for the stack of a new thread
    For 32bit Linux generally the maximum heap size of the JVM cannot be greater than 2GB. Windows systems will typically split the available physical memory 50:50 as Application and Kernel/System space, so please do not allocate an amount exceeding or approaching that split. The size of the stack per thread can also contribute to this problem. The stack size can reduce the number of threads that can be created. To fix this problem, you should reduce the size of your JVM Heap and also the size of the stack per thread.
    The stack size can be changed with the following (example) parameter:
    "-Xss512k"
    4)) OutOfMemoryError: GC overhead limit exceeded
    This error indicates that the JVM took too long to free up memory during its GC process. This error can be thrown from the Serial, Parallel or Concurrent collectors. It often means that the Xmx value is too high - you might consider lowering it. See Garbage Collector Performance Issues for more details. For more severe and persistent performance issues relating to GC, it is recommended to change to a parallel collector, and to ensure that Confluence has access to the memory demanded by its users.
    The parallel collector will throw an OutOfMemoryError if too much time is being spent in garbage collection: if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError will be thrown. This feature is designed to prevent applications from running for an extended period of time while making little or no progress because the heap is too small. If necessary, this feature can be disabled by adding the option -XX:-UseGCOverheadLimit to the command line.
    This kind of OutOfMemoryError can be caused if user requests drown the available resources in the JVM. When this occurs, performance will degrade aggressively. This will eventually require a restart or the application may recover. 
    5)) OutOfMemoryError: Requested array size exceeds VM limit
    The detail message Requested array size exceeds VM limit indicates that the application (or APIs used by that application) attempted to allocate an array that is larger than the heap size. For example, if an application attempts to allocate an array of 512MB but the maximum heap size is 256MB then OutOfMemoryError will be thrown with the reason Requested array size exceeds VM limit. In most cases the problem is either a configuration issue (heap size too small), or a bug that results in an application attempting to create a huge array, for example, when the number of elements in the array are computed using an algorithm that computes an incorrect size.
    java.lang.OutOfMemoryError: Required array size too large

1 comment:

  1. Ever wanted to get free YouTube Views?
    Did you know you can get them AUTOMATICALLY AND ABSOLUTELY FOR FREE by using Add Me Fast?

    ReplyDelete