Editing ResourceManager Offline
- Open the profile for offline editing through the Profile Manager using Studio by clicking the Profile Manager pane. Right-click the Profilenode and select Open Profile from the pop-up menu. Select the desired profile and click the Open button
- Navigate to Fiorano > etc > ResourceManager node in the Profile Manager pane.
In the Properties of ResourceManager panel, set the value of MaxMemoryThresholdAllowed as per requirements.
4. Right-click the FioranoMQ node and select Save from the pop-up menu.
MBean in Server Profile
ResourceManager is a new MBean that has been added to the server profile. This takes care of the memory management in the server from the very start. From FioranoMQ, memory management has been introduced in the MQ Server to save the server from reaching OutOfMemory under any circumstances. Irrespective of the maximum heap memory specified by the user (-Xmx), while launching the server the MQ allocates only 80% of the memory when creating any new connections or new destinations.
The value 80% (0.8) is User configurable and can be set through MaxMemoryThresholdAllowed property as explained above. It is possible to change this while online through JMX. When the server uses an amount that is above the specified Server Max Heap memory, the MQ Server stops accepting new connections and stops creating Queues/Topics.
All clients trying to connect to the server after its memory has crossed the threshold value receive the ResourceOverFlown Exception. This exception is derived from the RuntimeException. At the time this situation occurs in the server, information about the availability of Server Memory can be accessed through the server logs. An example log is displayed below: :
Until the garbage collector clears the memory or the memory used by the server goes below the threshold limit, no additional connections are accepted by the server and no destinations created. To allow the creation of additional connections and/or destinations, either the server heap memory is increased or the threshold value in the Properties of ResourceManager is increased.
To change the Heap Size
In the fmq.conf file present under fmq\bin, a User can see the following codes:
These codes are the java runtime arguments taken care of while starting the server.
-Xms indicates the minimum size of java virtual machine heap memory and –Xmx indicates the maximum size that can be allocated to heap memory. Once FioranoMQ server is started, it is not possible to change these values. Therefore, these values should be kept as high as possible. In general, it is not preferable to keep more than 3/4 of the RAM memory as heap size for the JJVM.
The values -Xms128m indicates that the initial amount of heap memory allocated will be 128 MB of RAM. -Xmx256m indicates the maximum amount of memory allocated will be 256 MB of RAM.
To set initial amount of memory as 512 MB and maximum amount of memory as 2000 MB (2 GigaBytes) set the JVM arguments in fmq.conf as shown below:
Once the server memory is cleared or the memory is cleaned by Garbage Collector, another message appears in the logs indicating that the server is back in the 'safe' state.
When the used memory exceeds the maximum allowed memory (Max Memory * Threshold) these messages occur on server logs. Any client trying to connect to the server at this state gets a ResourceOverflownException. Once the used memory goes below the maximum allowed memory, the MQ Server starts accepting connections and creating destinations once again.
The Threshold ratio can be configured by the User using Profile (Offline) or usingJMX (Online).
JMX Notification
Any JMX Listener listening on ObjectName Fiorano.jmx.notifications:ServiceType=EventManager,Name=ResourceEventManager, receives notifications when the server runs low on Memory as well as when the server recovers from a low Memory situation.
The user can use the sample present in %FMQ_DIR%\samples\JMX\JMXNotifications.java. This sample listens for JMX events published in the MQ Server.