Monday, March 23, 2026

Which is better for minimizing swap usage? ASMM vs AMM

Which is better for minimizing swap usage?


 AMM (Automatic Memory Management)

  • MEMORY_TARGET 

 ASMM (Automatic Shared Memory Management) 

  • SGA_TARGET


In most real-world Oracle deployments, using manual memory management (i.e., SGA_TARGET + PGA_AGGREGATE_TARGET) results in lower swap usage than MEMORY_TARGET / MEMORY_MAX_TARGET.


Why MEMORY_TARGET causes more swap usage

Automatic Memory Management (AMM), which uses:


MEMORY_TARGET

MEMORY_MAX_TARGET


requires a Linux system to allocate a large shared memory segment plus additional OS memory for management.

On Linux, AMM uses /dev/shm (tmpfs), and if its size is less than MEMORY_TARGET, Oracle falls back to regular pages, increasing swap pressure.

Problems with MEMORY_TARGET:


Tends to cause kernel swapping due to dynamic resizing of SGA/PGA.

Additional overhead for memory rebalancing.

On NUMA servers, AMM can mismatch memory locality → more swap.

Oracle itself recommends NOT using AMM on production systems.


Oracle Docs: AMM is mainly recommended for small dev/test systems, not production.


Why SGA_TARGET results in lower swap usage

SGA_TARGET uses Automatic Shared Memory Management (ASMM).

Memory is allocated in huge pages (if enabled), giving performance and eliminating swap spikes.

With:


SGA_TARGET (or even SGA_MAX_SIZE)

PGA_AGGREGATE_TARGET


Oracle uses memory more predictably:


Benefits:


Stable memory footprint → no resizing storms.

Huge Pages support → swap is effectively zero.

No tmpfs (/dev/shm) dependency.

Fits well with modern Linux kernel memory management.


Oracle recommends ASMM for production databases.


Winner for swap control: SGA_TARGET (ASMM) If your goal is:

  •  avoid swap
  •  maintain predictable memory usage
  •  use huge pages
  •  ensure performance stability

Use SGA_TARGET + PGA_AGGREGATE_TARGET (ASMM).


Recommended Production Setup:


MEMORY_TARGET=0

MEMORY_MAX_TARGET=0


SGA_TARGET=<value>

SGA_MAX_SIZE=<value>


PGA_AGGREGATE_TARGET=<value>


Enable Huge Pages on Linux for optimal performance.


No comments:

Post a Comment

HA (High Availability ) vs DR (Disaster Recovery) – What’s the Difference ?

  HA vs DR – What’s the Difference? HA and DR solve different problems. Many outages happen because teams assume one replaces the other. 1. ...