External Performance   «Prev  Next»
Lesson 6Memory usage and Oracle database performance
Objective Describe how OS memory is managed.

Memory Usage and Oracle Database Performance

Memory within an OS environment consists of RAM "Random Access Memory" chips. A database server also contains a memory region. RAM memory is faster than disk and most RAM chips can read information in nanoseconds. Describe how OS memory is managed to improve Oracle database performance .
  1. Physical Memory Allocation:
    1. The OS assigns physical memory to the Oracle database server process.
    2. Oracle's System Global Area (SGA) and Program Global Area (PGA) reside in physical memory.
    3. The SGA holds shared memory structures like the buffer cache, shared pools, and redo log buffers.
    4. The PGA stores session-specific information like cursors and sort areas.
  2. Virtual Memory Management:
    1. Virtual memory allows the OS to manage memory efficiently, even when physical memory is limited.
    2. Oracle uses virtual memory to create a virtual address space for each database process.
    3. Virtual addresses are translated into physical addresses by the OS's memory management unit (MMU).
  3. Buffer Cache Management:
    1. The buffer cache is a critical part of the SGA and stores frequently accessed data blocks in memory.
    2. The OS helps manage the buffer cache by flushing dirty buffers to disk when physical memory is needed for other processes.
    3. Oracle's Buffer Cache Advisory feature provides recommendations for buffer cache sizing and management.
  4. Paged Memory Management:
    1. The OS divides physical memory into fixed-size pages, typically 4KB or 8KB in size.
    2. When a process needs to access data from disk, the OS loads the relevant pages into physical memory.
    3. If a page is not currently in memory, the OS must perform a page fault, which can cause performance overhead.
    4. Oracle uses Large Pages (also known as Huge Pages) to reduce the number of page faults and improve performance.
  5. Memory Protection:
    • The OS provides memory protection mechanisms to prevent processes from accessing memory that they are not authorized to access.
    • Oracle uses these mechanisms to protect its memory structures from being corrupted by other processes.
  6. Workload Management:
    • The OS can be configured to prioritize certain processes or workloads over others.
    • This can be useful for ensuring that Oracle database processes have the resources they need to perform optimally.
  7. NUMA (Non-Uniform Memory Access) Awareness:
    • NUMA systems have multiple memory controllers and CPUs, with varying latencies for accessing memory from different controllers.
    • The OS can be configured to allocate memory to Oracle processes in a NUMA-aware manner, reducing memory access latencies.
  8. Memory Allocation Policies:
    • The OS provides various memory allocation policies, such as first-fit, best-fit, and worst-fit.
    • Oracle can be configured to use a specific memory allocation policy to optimize memory usage and performance.
Memory within an OS environment consists of Random Access Memory (RAM) chips. Like the SIMS chip on your PC provides you with 64 megabytes of RAM, your database server also contains a memory region.
As we all know, RAM memory is 10,000 times faster than disk, and most RAM chips can read information in nanoseconds (billionths of a second).

Managing Memory Demands

The operating system manages the shared memory resource. Whenever the demands for RAM memory exceed the physical memory capacity, the OS swaps some of the memory contents onto disk and frees memory for other tasks.
The OS allocates memory as requested, adding new memory segments from low memory to high memory. Here is how it works:

Heavy Paging Causes Slow Database Performance

Paging, also known as virtual memory paging, is a process by which the operating system moves data from the computer's RAM (Random Access Memory) to the hard disk to free up memory for other processes. When an Oracle database is paged out, its performance can be impacted in several ways. Here are some ways that paging can affect the performance of an Oracle Database:
  1. Slower response time: Paging causes slower response times for Oracle database operations because data must be retrieved from the disk instead of from the RAM. This can result in longer query times and slower transaction processing.
  2. Increased I/O: Paging increases the amount of I/O (input/output) activity on the system because data must be read from or written to the hard disk. This can result in higher disk usage and slower performance.
  3. Resource contention: Paging can cause resource contention on the system because multiple processes are competing for the same disk and memory resources. This can lead to increased wait times and slower performance.
  4. Poor cache hit ratio: Paging can result in a lower cache hit ratio, which is the percentage of data that is retrieved from cache instead of from the disk. A low cache hit ratio means that more data must be retrieved from the disk, which slows down performance.
  5. Increased CPU usage: Paging can increase CPU usage because the operating system must manage the process of moving data between the RAM and the hard disk. This can result in slower performance and reduced capacity for other tasks.

To mitigate the performance impact of paging on an Oracle database, it is recommended to:
  1. Allocate sufficient RAM to the database server to minimize the need for paging.
  2. Monitor the paging activity of the database server to detect any issues.
  3. Tune the Oracle database parameters to optimize performance, such as the buffer cache size and the sort area size.
  4. Monitor and optimize the I/O subsystem to reduce disk I/O and improve performance.
  5. Regularly analyze and tune the SQL queries to reduce their impact on system resources

In summary, paging can have a significant impact on the performance of an Oracle database, resulting in slower response times, increased I/O, resource contention, poor cache hit ratio, and increased CPU usage. By allocating sufficient memory, monitoring paging activity, tuning database parameters, optimizing the I/O subsystem, and analyzing SQL queries, the performance impact of paging can be minimized, and the database can perform optimally.

Paging and performance

The process of paging can greatly slow down the performance of an Oracle database, since paged-out memory segments are unavailable to the database. We will cover the monitoring of memory in a later module.
The next lesson looks at CPU usage within Oracle.

SEMrush Software