DBAtlas · Database operations atlas

Memory pressure / OOM

Server memory is running out, the system is swapping, or the OOM killer is active. First determine who is consuming the memory: allocated memory (buffer pool/SGA), session memory (work_mem/PGA), the OS overall, or a Redis-specific situation?

Who is consuming the memory?

Separate the source of memory pressure by layer. Is the allocated (fixed) memory too large, is per-session memory exploding, is a non-DB process eating it, or is Redis's own memory management at play?

SELECT component, ROUND(current_size/1024/1024) AS mb FROM v$memory_dynamic_components WHERE current_size>0 ORDER BY current_size DESC;
  • Allocated memory (buffer pool / SGA) dominates
  • Session memory (work_mem / PGA) is exploding
  • A non-DB process / the OS overall
  • Redis-specific (maxmemory / eviction / fragmentation)

Does the total configured memory exceed physical RAM?

If fixed allocated memory is large, there are two possibilities: either the configured total (buffer pool + sessions + OS) exceeds physical RAM (over-commit), or the size is reasonable but the cache hit ratio is still low. Add up the settings and compare them with RAM.

SHOW PARAMETER sga_target;  SHOW PARAMETER pga_aggregate_target;
SELECT ROUND(value/1024/1024/1024,1) AS host_ram_gb FROM v$osstat WHERE stat_name='PHYSICAL_MEMORY_BYTES';
  • Yes, the configured total exceeds RAM (over-commit)
  • No, the size is reasonable but the cache hit ratio is low

Root cause: Memory over-commit

The sum of buffer pool/SGA + session memory + OS needs exceeds physical RAM. The system is swapping, or the OOM killer is killing the process.

Root cause: Insufficient cache (low cache hit ratio)

Allocated memory does not exceed RAM but is small relative to the working set; the buffer cache hit ratio is low and the DB constantly reads from disk.

Root cause: Session memory explosion

Per-session memory such as work_mem/PGA, multiplied by high concurrency, exhausts RAM. Each sort/hash operation can allocate this memory separately.

Root cause: Redis memory management

In Redis, used_memory has hit maxmemory, eviction is active, or fragmentation is high (used_memory_rss >> used_memory). The policy and fragmentation must be addressed.

Root cause: Non-DB memory consumption

The memory is consumed not by the database but by the OS overall or a neighboring process: another application, file system cache pressure, or a leaking helper process.

Open in DBAtlas →