Skip to main content

Out of Memory issue in Weblogic

Its one of the scary part i came across when the clients came across with out of memory error. The application was pushing around 40,000 messages to the queue and all the messages have been holded in the memory and finalyy ended up with Out of Memory exception.


There are WebLogic settings that take care of this issue. You can set the server to only load up the first N number of messages or X number of bytes to avoid OOM issues. These can be set up by going to the JMSServer config -> Thresholds and Quotas and configure bytes paging or message paging (or both).

Recommendation:
Set Bytes Threshold High to 1048576, set Bytes Threshold Low to 524288, and set Bytes Paging Enabled to true. Set Messages Threshold High to 1000, set Messsages Threshold Low to 500 and set Messages Paging Enabled
to true. This will ensure there is never more than 1 GB and no more than 1000 JMS messages in RAM.

Few forums that would help :
http://forums.bea.com/thread.jspa?threadID=570000795

Few reasons why OutOfMemory error could occur and their related solution.

1. When the producers are faster than consumers.


Quotas can be used to help this situation. Your sender will then receive ResourceAllocationExceptions and the server will stay up.

2. Cache-related OutOfMemoryErrors.

A very important point to consider when setting size is that the heap must be large enough to hold bean instances for all defined EJB caches.
A possible solution for the OutOfMemoryError is to decrease so that the cache removes or passivates beans,before the JVM throws an OutOfMemoryError because the heap is full.
Ref : https://support.bea.com/application_content/product_portlets/support_patterns/wls/InvestigatingCacheFullExceptionForEntityAndStatefulSessionBeansPattern.html


3. Handling the OutOfMemoryErrors.

Message quotas prevent a WebLogic JMS server from filling up with messages and possibly running out of memory, causing unexpected results. Unless the "Blocking Sends" feature has been implemented, when you reach your quota, JMS prevents further sends with a ResourceAllocationException (rather than blocking). You can set quotas on individual destinations or on a server as a whole.

The thresholds are not flow control - though they would be better suited to that application than the quotas. The thresholds are simply settings that when exceeded cause a message to be logged to the console to let you know that you are falling behind.
WebLogic JMS also has a flow control feature that enables a JMS server or destination to slow down message producers when it is becoming overloaded. Specifically, when a JMS server/destination exceeds its specified bytes or messages thresholds, it instructs producers to limit their message flow.

Ref : http://edocs.bea.com/wls/docs81/faq/jms.html#260519


DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

Comments

Popular posts from this blog

Asynchronous Vs. Synchronous Communications

Synchronous (One thread):   1 thread -> |<---A---->||<----B---------->||<------C----->| Synchronous (multi-threaded):   thread A -> |<---A---->| \ thread B ------------> ->|<----B---------->| \ thread C ----------------------------------> ->|<------C----->|

WebSphere MQ Interview Questions

What is MQ and what does it do? Ans. MQ stands for MESSAGE QUEUEING. WebSphere MQ allows application programs to use message queuing to participate in message-driven processing. Application programs can communicate across different platforms by using the appropriate message queuing software products. What is Message driven process? Ans . When messages arrive on a queue, they can automatically start an application using triggering. If necessary, the applications can be stopped when the message (or messages) have been processed. What are advantages of the MQ? Ans. 1. Integration. 2. Asynchrony 3. Assured Delivery 4. Scalability. How does it support the Integration? Ans. Because the MQ is independent of the Operating System you use i.e. it may be Windows, Solaris,AIX.It is independent of the protocol (i.e. TCP/IP, LU6.2, SNA, NetBIOS, UDP).It is not required that both the sender and receiver should be running on the same platform What is Asynchrony? Ans. With messag

Advantages & Disadvantages of Synchronous / Asynchronous Communications?

  Asynchronous Communication Advantages: Requests need not be targeted to specific server. Service need not be available when request is made. No blocking, so resources could be freed.  Could use connectionless protocol Disadvantages: Response times are unpredictable. Error handling usually more complex.  Usually requires connection-oriented protocol.  Harder to design apps Synchronous Communication Advantages: Easy to program Outcome is known immediately  Error recovery easier (usually)  Better real-time response (usually) Disadvantages: Service must be up and ready. Requestor blocks, held resources are “tied up”.  Usually requires connection-oriented protocol