4 WebLogic Server Cooperative Memory Management in Oracle Exalogic Elastic Cloud Environments

WebLogic Server uses Cooperative Memory Management to promote effective memory utilization by WebLogic Server resources.

This chapter includes the following sections:

What is Cooperative Memory Management?

Cooperative Memory Management (CMM) is a WebLogic feature for Exalogic Elastic Cloud environments that promotes effective memory utilization by allowing WebLogic Server resources to adjust memory utilization based on the memory utilization of the whole machine.

When CMM is enabled, the memory usage of the operating system is monitored and a relative pressure level is published by a memory pressure agent. The published pressure level ranges from 0 (no pressure) through 10, with 10 being the highest pressure level (severe overload). WebLogic Server resources that have registered a memory pressure listener react to changes in the memory pressure levels by writing an INFO message to the server log and appropriately managing server resources to increase or decrease the utilization of available memory.

In high or rising memory pressure conditions, resources registered with the memory pressure agent implement strategies to reduce memory utilization to prevent server overload such as:

  • Reducing the size of caches

  • Compressing in-memory data that can be compressed

  • Rejecting new work

  • Implements graceful server recovery by temporarily degrading performance and reducing system thrashing.

Any actions taken by a server at a given pressure level remain in effect until the measured memory pressure by the agent changes. For example, if the data source memory pressure listener receives a pressure reading of 4, the available statement cache size is reduced to 60 percent. In order for the actual amount of statement cache used to improve to 75 percent, the memory pressure level reported by the memory pressure agent must change to 2, see Default Memory Pressure Cache Size Weights..

Using CMM in Your Environment

CMM is only available for use in Exalogic Elastic Cloud environments. See "Exalogic Elastic Cloud Software" in Licensing Information.

To enable CMM in your environment:

  • If not present, add the following to your ${DOMAIN_HOME}/bin/startWebLogic.sh script used to start the WebLogic Servers in your environment. For example:

    . . .
    if [ -f ${WL_HOME}/server/bin/saveMemory.sh ] ; then
          . ${WL_HOME}/server/bin/saveMemory.sh
    fi
    . . .
    

    Create a saveMemory.sh file located at ${WL_HOME}/server/bin/ that contains the following:

    #!/bin/sh
    # The following flag is used to enable CMM
    export SAVE_MEMORY=true
    
  • Ensure all servers in your environment use Exalogic optimizations, see Enabling Exalogic Optimizations.

  • Restart all servers in your environment to enable the changes.

CMM for WebLogic Data Sources

WebLogic Server data sources can be configured to respond to memory pressure events by making configurable adjustments to statement cache sizes and the shrinking of connection pools:

Memory Management for Statement Cache Size

When a non-zero memory pressure state change is received, the prepared statement caches for all deployed datasources are adjusted according to the configured mapping of memory pressure level to percent cache size. By default, WebLogic datasources have a statement cache size of 10 for every pooled JDBC connection.

Note:

Datasource configurations that have disabled the statement cache (by setting the cache size to 0) or are using the Oracle JDBC driver statement cache are not affected by memory pressure events.

The default memory pressure level to cache size weights are graduated as described in the following table:

Table 4-1 Default Memory Pressure Cache Size Weights

Level Cache Size, %

0

100

1

90

2

80

3

70

4

60

5

50

6

40

7

30

8

20

9

10

10

0


The default statement cache weights can be changed at server start time by setting the following Java system property:

-Dweblogic.jdbc.cmm.statementCacheWeights=weights

where weights is one or more name/value pair s of the form level=percent reduction, level=percent reduction,…

Using this notation the default weights are as follows:

1=10,2=10,3=10,4=10,5=10,6=10,7=10,8=10,9=10,10=10

The percentages are cumulative and the sum must be equal to or less than 100. At each level the percentage value indicates how much the configured cache size is reduced.

Example

The following example shows statement cache sizes corresponding to the various memory pressure levels when the server is started with the system property:

-Dweblogic.jdbc.cmm.statementCacheWeights=2=20,4=20,6=20,8=20,10=20

Table 4-2 Example Memory Pressure Cache Size Weights

Level Cache Size, %

0

100

1

100

2

80

3

80

4

60

5

60

6

40

7

40

8

20

9

20

10

0


Memory Management for Shrinking Data Sources

Upon receiving a memory pressure level event where the pressure level is greater than the pool shrink threshold (8 by default), WebLogic Server issues a shrink operation to all deployed datasources. The shrink operations action is a one-time event initiated on every memory pressure level event where the memory pressure level exceeds the threshold value.

The default shrink threshold can be modified at server start time by setting the following Java system property:

-Dweblogic.jdbc.cmm.shrinkThreshold=value

Where value is an integer in the range 0 to 10.