[Packer01] Intimate Shared Memory

来源:百度文库 编辑:神马文学网 时间:2024/04/28 01:38:30

Intimate Shared Memory

Allmajor databases use shared memory for database buffer caches, SQLstatement caching, and other uses. Solaris offers a special form ofshared memory called intimate shared memory (ISM) with features of particular benefit to databases. ISM was introduced in Solaris 2.2.

ISM offers the following major benefits:

  • Processes attaching to the ISM segment share virtual-to-physical address data structures related to the shared memory segment, saving kernel memory and improving performance.

  • Pages are locked, significantly improving performance by reducing the kernel code path as well as preventing pages from being swapped out.

  • As of Solaris 2.6, ISM memory can take advantage of large pages (up to 4 Mbytes) supported in the UltraSPARC Memory Management Unit (MMU), resulting in a performance benefit that increases with the shared memory size. For example, since Solaris pages are typically 8 Kbytes in size, a 3.5-Gbyte database cache would require 458,752 kernel memory pointers. With 4-Mbyte pages, the number of pointers is reduced by a factor of 512, to just 896.

  • Since Solaris 2.6, swap space is not required to back the ISM segment, saving disk space. Swap is unnecessary since the memory is locked.

Figure 3.1 illustrates address translation for a regular shared memory segment.

Figure 3.1. Regular shared memory address translation


As the figure demonstrates, each process maintains its own address translation structures.

Figure 3.2 illustrates address translation for an ISM segment.

Figure 3.2. ISM address translation


Sharingthe same address translation structures among all processes attachingto an ISM segment introduces efficiencies that lead to memory and CPUtime savings.

ISM is invoked programmatically by addition of the parameterSHM_SHARE_MMU to theshmat (2) call.

Allthe major relational databases take advantage of ISM. Note that anattempted ISM attach can fail, though, if insufficient contiguousphysical memory is available. Most of the database products will notesuch a failure in their error log file and quietly attach regularshared memory. The result can be an unexpected drop in performance.