all oracle dbas have to know about unix memory monitoring

28
Copyright © 2005 TietoEnator Corporation All Oracle DBAs have to know about Unix Memory Monitoring 2006-11-14

Upload: yury-velikanov

Post on 05-Sep-2014

4.086 views

Category:

Technology


3 download

DESCRIPTION

This is one of my old presentations. I have presented it back in 2006. While most of the stuff is correct I do not exclude that it has some bugs. Let me know if you found any.

TRANSCRIPT

Page 1: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2005 TietoEnator Corporation

All Oracle DBAs have to know about Unix Memory Monitoring

2006-11-14

Page 2: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Example 1

Page 3: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Example 2

Page 4: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Example 3

Page 5: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Main questions …

Do I have a memory shortage ? How many memory is utilized currently ?

Why answers are not obvious?

Doesn't focus on particular Unix platform

Gives general idea of memory management

Page 6: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Content

Concepts of Unix memory management– Single process virtual address space & main components– Unix swap subsystem– Unix system memory components– Why it is difficult to say how many memory is utilized

Possible answers– Do I have a memory shortage ?– How many memory is utilized currently ?

Oracle & Memory utilization

Page 7: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

00000000- 175MB -0AEA8000

0AEA8000- 849 MB-40000000

40000000- 256 MB -50000000

BFFE3000(1,75GB)

FFFFFFFF (1GB)

Single process virtual address space“Dream world”

TEXT (CODE)

TEXT Variable part

HEAP (PGA)

Dynamically loaded Libraries (CODE)

DLL Variable part

Shared Memory

Stack area +

0x00000000- 175MB -0x0AEA8000

0x0AEA8000- 849 MB-0x40000000

0x40000000- 256 MB -0x50000000

0xBFFE3000(1,75GB)

0xFFFFFFFF (1GB)

DEMOpmap

Page 8: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Single process virtual memory “Dream world”

Components order and size of memory regions are dependent on used platform and Oracle version

Main components– Text (constant/variable parts)

oracle – executable in case of client process– Heap

PGA – Program Global Area– Sort/Hash area– Program variables

– Libraries (constant/variable parts) OS/Oracle libraries Example: JVM libraries in case of java call within DB

– Shared Memory SGA (shared pool, buffers cache, etc)

– Stack area Each area have strict boundaries for current installation/configuration

Page 9: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

00000000- 175MB -0AEA8000

0AEA8000- 849 MB-40000000

40000000- 256 MB -50000000

BFFE3000(1,75GB)

FFFFFFFF (1GB)

Single process virtual memory translation“Dream world” “Real World”

TEXT (CODE)

TEXT Variable part

HEAP (PGA)

Dynamically loaded Libraries (CODE)

DLL Variable part

Shared Memory

Stack area +

RAM on DB ServerRandom Access Memory

SWAP Space on disk

VM Translation

FS

Page 10: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Single process virtual memory translation

Single process see continues memory space

OS translate process space to physical locations

Some parts of virtual process space are shared across all running processes

– OS/Oracle code– SGA

Some memory areas are private for each process

Page 11: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Single process virtual address space

TEXT (CODE)

TEXT Variable part

HEAP (PGA)

Dynamically loaded Libraries (CODE)

DLL Variable part

Shared Memory

Stack area

One copy per server (R/O)

One copy per Instance (W)

One copy per process (W)

Page 12: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Main memory consumption areasStatic Code (R/O)Oracle executables

Runtime size is constant

Shared Memory (W)Oracle SGA

Runtime size is constant

Process Private Area (W)PGA

Runtime size is variable

Page 13: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

RAM (size is limited)RAM (size is limited)

RAM utilization and swap subsystem “Real World”

Static Code (R/O)Oracle executablesConstant Size

Shared Memory (W)Oracle SGARuntime size is constant

……..

Process Private Area (W)PGARuntime size is variable

DiskDisk

SWAP Space FS

Swap Process Swap outSwap in

Page 14: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Swap subsystem

Allow processes to utilize more memory then available in the system Swap process swap out inactive parts of the memory

On some platforms OS reserve swap space at the time RAM area is allocated

– This is why Oracle recommends to create 2 times swap space then RAM installed on the server

– Because of that used Swap space can’t be used as general indicator of memory shortage

Intensive swap out-s is good indicator of memory shortage

Page 15: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

RAM (size is limited)RAM (size is limited)

RAM utilization and swap subsystem “Real World”

Static Code (R/O)Oracle executablesConstant Size

Shared Memory (W)Oracle SGARuntime size is constant

……..

Process Private Area (W)PGARuntime size is variable

DiskDisk

SWAP Space FS

Swap Process Swap outSwap in

Page 16: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

00000000- 175MB -0AEA8000

0AEA8000- 849 MB-40000000

40000000- 256 MB -50000000

BFFE3000(1,75GB)

FFFFFFFF (1GB)

Resident size of the process (RSS)

TEXT (CODE)

TEXT Variable part

HEAP (PGA)

Dynamically loaded Libraries (CODE)

DLL Variable part

Shared Memory

Stack area

RAMRAM

SWAPSWAP

or or

DISKDISK

or or

NOT NOT ALLOCATEDALLOCATED

Page 17: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Resident size of the process (RSS)

Page 18: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Resident size of the process (RSS)

00000000- 175MB -0AEA8000

0AEA8000- 849 MB-40000000

40000000- 256 MB -50000000

BFFE3000(1,75GB)

FFFFFFFF (1GB)

TEXT (CODE)

TEXT Variable part

HEAP (PGA)

Dynamically loaded Libraries (CODE)

DLL Variable part

Shared Memory

Stack area

RSS Part

VSIZE Part

Page 19: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

How many memory utilized? [OS view]

OS Tools reflect different information on different platforms

In general ps, top and other utilities– doesn’t reflect Size of Process Private area correctly– Include shared parts of the process

We can’t get figure how many memory utilized by adding all RSS or VSIZE values

pmap like utility can be used (on single process basis)

Page 20: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Unix system memory componentsServer dedicated to run Oracle Instance

RAMRAMStatic Code (R/O)Oracle exeConstant Size

Shared Memory (W)Oracle SGARuntime size is constant

……..

Process Private Area (W)PGARuntime size is variable

File SystemBuffers

Kernel&

SystemProcesses

Page 21: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

How many memory is free? [OS View]

Can we rely on free memory figure from top and others tools?

The file system cache uses all available free memory to buffer files on the file system

On most systems, the amount of free memory is almost zero

file system cache used memory freed first of all if there are memory shortage

Free memory figure doesn’t represent available memory in the system

Page 22: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Do I have a memory shortage ?

Free memory indicator– Because of file system cache almost useless– If free memory is close to 0 don’t worry

Swapping activities– One of the best OS level indicators – Swap out (so), Page out (po), Scan-rate (sr)

Page 23: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

How many memory is utilized currently ?

Constant memory areas– Kernel & OS Processes– Static Code (executables & libraries)– Shared Memory (SGA)

Variable memory areas– File System Buffers (freed on demand)– Process Private Area (PGA)

RAMRAMStatic Code (R/O)Oracle exeConstant Size

Shared Memory (W)Oracle SGARuntime size is constant

……..

Process Private Area (W)PGARuntime size is variable

File SystemBuffers

Kernel&

SystemProcesses

Page 24: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

How to see used PGA size? Easily can be retrieved from database

Tuned using DB parameters– pga_aggregate_target– sort_area_size/hash_area_size– SGA

Page 25: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Oracle & Memory utilization

In general Oracle doesn't return used memory back to OS Shared server configuration

– UGA located in shared pool PGA is NOT !– Single call runtime variables located in PGA

Background processes– Job processes– Parallel processes

SGA_MAX_SIZE– Oracle Reserves memory straight after instance startup

Oracle on 32bit platform– Can’t address more then 4GB memory – By default 1.7GB big SGA allowed, increase up to 2.7 GB (Note:200266.1)– Very Large Memory (VLM) up to 64GB (Note:260152.1)

Heapdump could be used to troubleshoot memory related problems– oradebug dump heapdump 5 (Note:174555.1)

Page 26: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Conclusion

Do I have a memory shortage ?– Free memory is not a good metric– Swap size not always good to consider– Swap outs is one reliable indicator

How many memory is utilized currently ?– Difficult to see from Unix side– Variable part could be retrieved from Oracle– There some problems to consider

Page 27: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Thank you for your attention …Q & A

Page 28: All Oracle DBAs have to know about Unix Memory Monitoring

Copyright © 2004 TietoEnator Corporation

Tools to calculate memory usage [OS View]

ipcs : Shared memory information

ipcs -m pmap : Memory map for a particular process

pmap <pid> [cat /proc/<pid>/maps] ps : Memory information for list of the processes

ps -u oraenv01 -o pid,vsize,rss,cmdtop top : General memory utilization information

top [cat /proc/meminfo] vmstat, sar : Swap activities indicators