SlideShare a Scribd company logo
All Oracle DBAs have to know about
            Unix Memory Monitoring
                                              2006-11-14

                        Copyright © 2005 TietoEnator Corporation
Example 1




            Copyright © 2004 TietoEnator Corporation
Example 2




            Copyright © 2004 TietoEnator Corporation
Example 3




            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

                                          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




                                                Copyright © 2004 TietoEnator Corporation
Single process virtual address space
“Dream world”
       00000000                          0x00000000
     TEXT (CODE)
      - 175MB -                          - 175MB -
       0AEA8000                          0x0AEA8000
   TEXT Variable part
       0AEA8000                          0x0AEA8000
      HEAP (PGA)
      - 849 MB-                          - 849 MB-
       40000000                          0x40000000
  Dynamically loaded
      40000000                           0x40000000
   Libraries (CODE)
     - 256 MB -                          - 256 MB -
   DLL Variable part
      50000000                           0x50000000
    Shared Memory
  BFFE3000(1,75GB)                0xBFFE3000(1,75GB)

     Stack area +
   FFFFFFFF (1GB)                     0xFFFFFFFF (1GB)


                        DEMO
                               pmap


                                            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




                                                               Copyright © 2004 TietoEnator Corporation
Single process virtual memory translation
“Dream world”                                        “Real World”
                                      RAM on DB Server
                                      Random Access Memory
       00000000
     TEXT (CODE)
      - 175MB -
       0AEA8000
   TEXT Variable part
       0AEA8000
      HEAP (PGA)
      - 849 MB-
       40000000            VM
   Dynamically loaded   Translation
       40000000
    Libraries (CODE)
      - 256 MB -
    DLL Variable part
       50000000
    Shared Memory
  BFFE3000(1,75GB)

     Stack area +
   FFFFFFFF (1GB)


                                      SWAP Space on disk                                FS


                                             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


                                           Copyright © 2004 TietoEnator Corporation
Single process virtual address space
          One copy per process (W)   One copy per server (R/O)
    TEXT (CODE)

  TEXT Variable part

     HEAP (PGA)

  Dynamically loaded
   Libraries (CODE)                  One copy per Instance (W)
   DLL Variable part
   Shared Memory

      Stack area




                                           Copyright © 2004 TietoEnator Corporation
Main memory consumption areas
       Process Private Area (W)   Static Code (R/O)
       PGA                        Oracle executables

       Runtime size is variable   Runtime size is constant




                                  Shared Memory (W)
                                  Oracle SGA

                                  Runtime size is constant




                                         Copyright © 2004 TietoEnator Corporation
RAM utilization and swap subsystem
                                                 “Real World”
RAM (size is limited)
  Process Private Area (W)                                            Static Code (R/O)
  PGA                                                                 Oracle executables
                                       ……..
  Runtime size is variable                                            Constant Size


   Shared Memory (W)
   Oracle SGA
   Runtime size is constant



                              Swap Process    Swap out
       Swap in

Disk


                              SWAP Space                                             FS



                                                   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




                                                  Copyright © 2004 TietoEnator Corporation
RAM utilization and swap subsystem
                                                 “Real World”
RAM (size is limited)
  Process Private Area (W)                                            Static Code (R/O)
  PGA                                                                 Oracle executables
                                       ……..
  Runtime size is variable                                            Constant Size


   Shared Memory (W)
   Oracle SGA
   Runtime size is constant



                              Swap Process    Swap out
       Swap in

Disk


                              SWAP Space                                             FS



                                                   Copyright © 2004 TietoEnator Corporation
Resident size of the process (RSS)
                   00000000
                 TEXT (CODE)
                  - 175MB -
                   0AEA8000                          SWAP
               TEXT Variable part
                   0AEA8000                                 or
                  HEAP (PGA)
                  - 849 MB-
                   40000000                              DISK
   RAM
              Dynamically loaded
                  40000000
               Libraries (CODE)
                 - 256 MB -                                  or
               DLL Variable part
                  50000000
                                           NOT
                Shared Memory
              BFFE3000(1,75GB)        ALLOCATED
                  Stack area
               FFFFFFFF (1GB)




                                    Copyright © 2004 TietoEnator Corporation
Resident size of the process (RSS)




                             Copyright © 2004 TietoEnator Corporation
Resident size of the process (RSS)
            RSS Part
                   00000000
                 TEXT (CODE)
                  - 175MB -
                   0AEA8000
               TEXT Variable part
                   0AEA8000
                  HEAP (PGA)
                  - 849 MB-
                   40000000
               Dynamically loaded
                   40000000
                Libraries (CODE)
                  - 256 MB -
                DLL Variable part
                   50000000
                 Shared Memory
               BFFE3000(1,75GB)

                   Stack area
                FFFFFFFF (1GB)

                               VSIZE Part



                                        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)



                                             Copyright © 2004 TietoEnator Corporation
Unix system memory components
Server dedicated to run Oracle Instance



RAM
            Process Private Area (W)   Static
            PGA                        Code
                         ……..          (R/O)
  Kernel    Runtime size is variable
                                       Oracle
    &                                  exe         File System
 System     Shared Memory (W)          Constant       Buffers
Processes   Oracle SGA                 Size
            Runtime size is constant




                                                  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




                                                    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)




                                           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)
RAM
            Process Private Area (W)   Static
            PGA                        Code
                         ……..          (R/O)
  Kernel    Runtime size is variable
                                       Oracle
    &                                  exe         File System
 System     Shared Memory (W)          Constant       Buffers
Processes   Oracle SGA                 Size
            Runtime size is constant


                                                  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




                                          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)




                                                            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


                                   Copyright © 2004 TietoEnator Corporation
Thank you for your attention …
Q&A




                                 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



                                        Copyright © 2004 TietoEnator Corporation

More Related Content

What's hot (20)

PDF
Oracle Exadata Performance: Latest Improvements and Less Known Features
Tanel Poder
 
DOC
Migrating from Single Instance to RAC Data guard
Fuad Arshad
 
PPSX
Oracle 11g R2 RAC implementation and concept
Santosh Kangane
 
PDF
What we unlearned_and_learned_by_moving_from_m9000_to_ssc_ukoug2014
Philippe Fierens
 
PPTX
MIgrating from Single Instance to RAC via Dataguard
Fuad Arshad
 
PDF
Performance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Kristofferson A
 
PPTX
Oracle Exadata X2-8: A Critical Review
Texas Memory Systems, and IBM Company
 
PPT
Sun Oracle Exadata V2 For OLTP And DWH
Mark Rabne
 
PDF
Oda as an enterprise solution at walgreens oow 2012 v7
Fuad Arshad
 
PPTX
Oracle Database Appliance RAC in a box Some Strings Attached
Fuad Arshad
 
PDF
How to Modernize Your Database Platform to Realize Consolidation Savings
Isaac Christoffersen
 
PDF
Oracle Exadata 1Z0-485 Certification
Exadatadba
 
PDF
Understanding Oracle RAC 11g Release 2 Internals
Markus Michalewicz
 
PDF
Oracle Flex ASM - What’s New and Best Practices by Jim Williams
Markus Michalewicz
 
PDF
Exadata Patching Demystified
Enkitec
 
PDF
MySQL Cluster Performance Tuning - 2013 MySQL User Conference
Severalnines
 
PDF
Oracle 11g R2 RAC setup on rhel 5.0
Santosh Kangane
 
PPT
Customer overview oracle solaris cluster, enterprise edition
solarisyougood
 
PDF
RMAN best practices for RAC
Syed Hussain
 
ODP
Exadata
talek
 
Oracle Exadata Performance: Latest Improvements and Less Known Features
Tanel Poder
 
Migrating from Single Instance to RAC Data guard
Fuad Arshad
 
Oracle 11g R2 RAC implementation and concept
Santosh Kangane
 
What we unlearned_and_learned_by_moving_from_m9000_to_ssc_ukoug2014
Philippe Fierens
 
MIgrating from Single Instance to RAC via Dataguard
Fuad Arshad
 
Performance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Kristofferson A
 
Oracle Exadata X2-8: A Critical Review
Texas Memory Systems, and IBM Company
 
Sun Oracle Exadata V2 For OLTP And DWH
Mark Rabne
 
Oda as an enterprise solution at walgreens oow 2012 v7
Fuad Arshad
 
Oracle Database Appliance RAC in a box Some Strings Attached
Fuad Arshad
 
How to Modernize Your Database Platform to Realize Consolidation Savings
Isaac Christoffersen
 
Oracle Exadata 1Z0-485 Certification
Exadatadba
 
Understanding Oracle RAC 11g Release 2 Internals
Markus Michalewicz
 
Oracle Flex ASM - What’s New and Best Practices by Jim Williams
Markus Michalewicz
 
Exadata Patching Demystified
Enkitec
 
MySQL Cluster Performance Tuning - 2013 MySQL User Conference
Severalnines
 
Oracle 11g R2 RAC setup on rhel 5.0
Santosh Kangane
 
Customer overview oracle solaris cluster, enterprise edition
solarisyougood
 
RMAN best practices for RAC
Syed Hussain
 
Exadata
talek
 

Viewers also liked (20)

PDF
Benchmarking Oracle I/O Performance with Orion by Alex Gorbachev
Alex Gorbachev
 
PPTX
You most probably dont need an RMAN catalog database
Yury Velikanov
 
PDF
Presentation disaster recovery for oracle fusion middleware with the zfs st...
xKinAnx
 
PDF
Em13c features- HotSos 2016
Kellyn Pot'Vin-Gorman
 
PDF
Advanced Shell Scripting for Oracle professionals
Andrejs Vorobjovs
 
PPTX
Em13c New Features- One of Two
Kellyn Pot'Vin-Gorman
 
PPTX
Upgrading Em13c Collaborate 2016
Kellyn Pot'Vin-Gorman
 
PPTX
Em13c New Features- Two of Two
Kellyn Pot'Vin-Gorman
 
PPTX
Oracle Database 12.1.0.2: New Features
Deiby Gómez
 
PDF
Enterprise manager 13c
MarketingArrowECS_CZ
 
DOC
Understand
Tuấn Đông
 
PPTX
Oracle AWR Data mining
Yury Velikanov
 
PPTX
10 Problems with your RMAN backup script
Yury Velikanov
 
PDF
Tối ưu-cau-lệnh-oracle-sql
Viet Tran
 
PDF
Ebook oracle-thuc-hanh-nguyen-huu-trong
ngobacuong
 
PDF
OOW16 - Oracle Enterprise Manager 13c Cloud Control for Managing Oracle E-Bus...
vasuballa
 
PPTX
AWR DB performance Data Mining - Collaborate 2015
Yury Velikanov
 
PDF
Oracle Database In-Memory Meets Oracle RAC
Markus Michalewicz
 
PDF
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Markus Michalewicz
 
PPTX
Nhom 16 big data
Duy Phan
 
Benchmarking Oracle I/O Performance with Orion by Alex Gorbachev
Alex Gorbachev
 
You most probably dont need an RMAN catalog database
Yury Velikanov
 
Presentation disaster recovery for oracle fusion middleware with the zfs st...
xKinAnx
 
Em13c features- HotSos 2016
Kellyn Pot'Vin-Gorman
 
Advanced Shell Scripting for Oracle professionals
Andrejs Vorobjovs
 
Em13c New Features- One of Two
Kellyn Pot'Vin-Gorman
 
Upgrading Em13c Collaborate 2016
Kellyn Pot'Vin-Gorman
 
Em13c New Features- Two of Two
Kellyn Pot'Vin-Gorman
 
Oracle Database 12.1.0.2: New Features
Deiby Gómez
 
Enterprise manager 13c
MarketingArrowECS_CZ
 
Understand
Tuấn Đông
 
Oracle AWR Data mining
Yury Velikanov
 
10 Problems with your RMAN backup script
Yury Velikanov
 
Tối ưu-cau-lệnh-oracle-sql
Viet Tran
 
Ebook oracle-thuc-hanh-nguyen-huu-trong
ngobacuong
 
OOW16 - Oracle Enterprise Manager 13c Cloud Control for Managing Oracle E-Bus...
vasuballa
 
AWR DB performance Data Mining - Collaborate 2015
Yury Velikanov
 
Oracle Database In-Memory Meets Oracle RAC
Markus Michalewicz
 
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Markus Michalewicz
 
Nhom 16 big data
Duy Phan
 
Ad

Similar to All Oracle DBAs have to know about Unix Memory Monitoring (20)

PDF
Process' Virtual Address Space in GNU/Linux
Varun Mahajan
 
PPTX
Windows memory management
Tech_MX
 
PDF
Chap4
Premmraj
 
PPT
Sga internals
sergkosko
 
PDF
Memory
Mohd Arif
 
PDF
Perl Memory Use 201209
Tim Bunce
 
PDF
Basics of JVM Tuning
Vladislav Gangan
 
PPSX
Memory management in sql server
Prashant Kumar
 
PDF
Perl Memory Use 201207 (OUTDATED, see 201209 )
Tim Bunce
 
PDF
The walking 0xDEAD
Carlos Garcia Prado
 
PPTX
Advanced Windows Debugging
Bala Subra
 
PPTX
Memory Management in System Designing.pptx
errvmaurya563
 
PPT
Ch8
tech2click
 
PPTX
Operating system memory management
rprajat007
 
PDF
Operating system Memory management
Shashank Asthana
 
DOCX
Operating system
Hussain Ahmady
 
PPT
My cool new Slideshow!
manishamorya
 
PDF
operating system (everthing about machines)
ShaliniVerma655521
 
DOCX
Operating system
Muhammad Baqar Kazmi
 
PPTX
B.Tech. Computer Science Engineering OS Notes Unit 3
likatif784
 
Process' Virtual Address Space in GNU/Linux
Varun Mahajan
 
Windows memory management
Tech_MX
 
Chap4
Premmraj
 
Sga internals
sergkosko
 
Memory
Mohd Arif
 
Perl Memory Use 201209
Tim Bunce
 
Basics of JVM Tuning
Vladislav Gangan
 
Memory management in sql server
Prashant Kumar
 
Perl Memory Use 201207 (OUTDATED, see 201209 )
Tim Bunce
 
The walking 0xDEAD
Carlos Garcia Prado
 
Advanced Windows Debugging
Bala Subra
 
Memory Management in System Designing.pptx
errvmaurya563
 
Operating system memory management
rprajat007
 
Operating system Memory management
Shashank Asthana
 
Operating system
Hussain Ahmady
 
My cool new Slideshow!
manishamorya
 
operating system (everthing about machines)
ShaliniVerma655521
 
Operating system
Muhammad Baqar Kazmi
 
B.Tech. Computer Science Engineering OS Notes Unit 3
likatif784
 
Ad

More from Yury Velikanov (6)

PDF
RAC Attack 12c Installation Instruction
Yury Velikanov
 
DOCX
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Yury Velikanov
 
PPTX
Oracle e-Business Suite & RAC 11GR2
Yury Velikanov
 
PDF
You most probably dont need rman catalog database white paper
Yury Velikanov
 
PDF
Yury's CV as of 2013.03.31
Yury Velikanov
 
PDF
10 Problems with your RMAN backup script - whitepaper
Yury Velikanov
 
RAC Attack 12c Installation Instruction
Yury Velikanov
 
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Yury Velikanov
 
Oracle e-Business Suite & RAC 11GR2
Yury Velikanov
 
You most probably dont need rman catalog database white paper
Yury Velikanov
 
Yury's CV as of 2013.03.31
Yury Velikanov
 
10 Problems with your RMAN backup script - whitepaper
Yury Velikanov
 

Recently uploaded (20)

PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
July Patch Tuesday
Ivanti
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
July Patch Tuesday
Ivanti
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 

All Oracle DBAs have to know about Unix Memory Monitoring

  • 1. All Oracle DBAs have to know about Unix Memory Monitoring 2006-11-14 Copyright © 2005 TietoEnator Corporation
  • 2. Example 1 Copyright © 2004 TietoEnator Corporation
  • 3. Example 2 Copyright © 2004 TietoEnator Corporation
  • 4. Example 3 Copyright © 2004 TietoEnator Corporation
  • 5. 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 Copyright © 2004 TietoEnator Corporation
  • 6. 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 Copyright © 2004 TietoEnator Corporation
  • 7. Single process virtual address space “Dream world” 00000000 0x00000000 TEXT (CODE) - 175MB - - 175MB - 0AEA8000 0x0AEA8000 TEXT Variable part 0AEA8000 0x0AEA8000 HEAP (PGA) - 849 MB- - 849 MB- 40000000 0x40000000 Dynamically loaded 40000000 0x40000000 Libraries (CODE) - 256 MB - - 256 MB - DLL Variable part 50000000 0x50000000 Shared Memory BFFE3000(1,75GB) 0xBFFE3000(1,75GB) Stack area + FFFFFFFF (1GB) 0xFFFFFFFF (1GB) DEMO pmap Copyright © 2004 TietoEnator Corporation
  • 8. 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 Copyright © 2004 TietoEnator Corporation
  • 9. Single process virtual memory translation “Dream world” “Real World” RAM on DB Server Random Access Memory 00000000 TEXT (CODE) - 175MB - 0AEA8000 TEXT Variable part 0AEA8000 HEAP (PGA) - 849 MB- 40000000 VM Dynamically loaded Translation 40000000 Libraries (CODE) - 256 MB - DLL Variable part 50000000 Shared Memory BFFE3000(1,75GB) Stack area + FFFFFFFF (1GB) SWAP Space on disk FS Copyright © 2004 TietoEnator Corporation
  • 10. 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 Copyright © 2004 TietoEnator Corporation
  • 11. Single process virtual address space One copy per process (W) One copy per server (R/O) TEXT (CODE) TEXT Variable part HEAP (PGA) Dynamically loaded Libraries (CODE) One copy per Instance (W) DLL Variable part Shared Memory Stack area Copyright © 2004 TietoEnator Corporation
  • 12. Main memory consumption areas Process Private Area (W) Static Code (R/O) PGA Oracle executables Runtime size is variable Runtime size is constant Shared Memory (W) Oracle SGA Runtime size is constant Copyright © 2004 TietoEnator Corporation
  • 13. RAM utilization and swap subsystem “Real World” RAM (size is limited) Process Private Area (W) Static Code (R/O) PGA Oracle executables …….. Runtime size is variable Constant Size Shared Memory (W) Oracle SGA Runtime size is constant Swap Process Swap out Swap in Disk SWAP Space FS Copyright © 2004 TietoEnator Corporation
  • 14. 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 Copyright © 2004 TietoEnator Corporation
  • 15. RAM utilization and swap subsystem “Real World” RAM (size is limited) Process Private Area (W) Static Code (R/O) PGA Oracle executables …….. Runtime size is variable Constant Size Shared Memory (W) Oracle SGA Runtime size is constant Swap Process Swap out Swap in Disk SWAP Space FS Copyright © 2004 TietoEnator Corporation
  • 16. Resident size of the process (RSS) 00000000 TEXT (CODE) - 175MB - 0AEA8000 SWAP TEXT Variable part 0AEA8000 or HEAP (PGA) - 849 MB- 40000000 DISK RAM Dynamically loaded 40000000 Libraries (CODE) - 256 MB - or DLL Variable part 50000000 NOT Shared Memory BFFE3000(1,75GB) ALLOCATED Stack area FFFFFFFF (1GB) Copyright © 2004 TietoEnator Corporation
  • 17. Resident size of the process (RSS) Copyright © 2004 TietoEnator Corporation
  • 18. Resident size of the process (RSS) RSS Part 00000000 TEXT (CODE) - 175MB - 0AEA8000 TEXT Variable part 0AEA8000 HEAP (PGA) - 849 MB- 40000000 Dynamically loaded 40000000 Libraries (CODE) - 256 MB - DLL Variable part 50000000 Shared Memory BFFE3000(1,75GB) Stack area FFFFFFFF (1GB) VSIZE Part Copyright © 2004 TietoEnator Corporation
  • 19. 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) Copyright © 2004 TietoEnator Corporation
  • 20. Unix system memory components Server dedicated to run Oracle Instance RAM Process Private Area (W) Static PGA Code …….. (R/O) Kernel Runtime size is variable Oracle & exe File System System Shared Memory (W) Constant Buffers Processes Oracle SGA Size Runtime size is constant Copyright © 2004 TietoEnator Corporation
  • 21. 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 Copyright © 2004 TietoEnator Corporation
  • 22. 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) Copyright © 2004 TietoEnator Corporation
  • 23. 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) RAM Process Private Area (W) Static PGA Code …….. (R/O) Kernel Runtime size is variable Oracle & exe File System System Shared Memory (W) Constant Buffers Processes Oracle SGA Size Runtime size is constant Copyright © 2004 TietoEnator Corporation
  • 24. 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 Copyright © 2004 TietoEnator Corporation
  • 25. 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) Copyright © 2004 TietoEnator Corporation
  • 26. 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 Copyright © 2004 TietoEnator Corporation
  • 27. Thank you for your attention … Q&A Copyright © 2004 TietoEnator Corporation
  • 28. 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 Copyright © 2004 TietoEnator Corporation

Editor's Notes

  • #2: From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Seema Singh Sent: Thursday, May 06, 2004 3:46 PM To: oracle-l@xxxxxxxxxxxxx Subject: How much Max oracle memory (SGA)can be allocated on SUN SOLARIS if RAM =1.5gb Hi How much maximum SGA we can allocate if MEMORY on SUN Solaris is 1.5gb? When sga alloacted to 220mb, top command show 46mb free.when I bumped sga to 225mb it&apos;s still showing 46m is free. thx-seema ANSWER: Seema It is quite normal to have free memory to hover around this low. Read on if you are interested in knowing why. From Solaris 2.6 onwards Virtual Memory Manager will use as much as memory available, to benefit file system random IO. If you have heavy random file system activity then the memory can be filled with these file pages. This might not be well suited for database environments. Paging kicks-in when free memory falls below lotfree kernel parameter. Swapping and paging, can page out the process exec pages, heap and stack, even though the physical memory is filled with file pages (Whether SGA can be swapped/paged depends upon ISM-Intimate Shared Memory use, as the shared memory segments are locked if ISM is used ). This can create application performance issues, including database performance issues. Both background and server processes are susceptible to be paged out, if there is massive random IO. Solaris 2.6+ introduced priority_paging to alleviate this. If priority paging is enabled, then the paging daemon pages the file pages when the free memory falls below a new parameter cachefree which is higher than lotfree. This paging will differentiate between file pages and anonymous pages and so the file pages will be paged out before process&apos; pages are considered. Solaris 2.8 introduces cyclical page cache, where the file and anonymous pages are handled differently. So, this issues should not exists in 2.8. Point is, as long as you have priority_paging enabled in 2.6, (In 2.7 it is enabled by default) you don&apos;t need to be concerned. I would be concerned only if there is paging/swapping for anonymous pages. Memstat can tell you what is being paged/swapped, if you are in 2.8. I am not suggesting you to increase the SGA, by any means. That shoud be decided by database/app behavior, not just by this.. HTH Thanks Riyaj &quot;Re-yas&quot; Shamsudeen Certified Oracle DBA