DEV Community

Qing
Qing

Posted on

Performance Tuning-Analyzing Hardware Bottlenecks-Memory(1)

This section describes memory parameters.

Image description

memorypool_enable
Parameter description: Specifies whether to enable a memory pool.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range: Boolean

· on indicates that the memory pool is enabled.
· off indicates that the memory pool is disabled.
Default value: off

memorypool_size
Parameter description: Specifies the memory pool size.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from 128 x 1024 to *INT*MAX_/2. The unit is KB.

Default value: 512 MB

enable_memory_limit
Parameter description: Specifies whether to enable the logical memory management module.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range: Boolean

· on indicates that the logical memory management module is enabled.
· off indicates that the logical memory management module is disabled.
Default value: on

Image description

max_process_memory
Parameter description: Specifies the maximum physical memory of a database node.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from 2 x 1024 x 1024 to *INT*MAX_. The unit is KB.

Default value: 12 GB

Setting suggestions:

The value on the database node is determined based on the physical memory of the system and the number of master database nodes deployed on a single node. The recommended calculation formula is as follows: (Physical memory – vm.min_free_kbytes) \ x 0.7 /(1 + Number of primary nodes) This parameter is used to prevent node OOM caused by memory usage increase, ensuring system reliability. vm.min_free_kbytes indicates the OS memory reserved for the kernel to receive and send data. Its value is at least 5% of the total memory. That is, max_process_memory = Physical memory x 0.665 / (1 + Number of primary nodes)

Image description

enable_memory_context_control
Parameter description: Specifies whether to enable the function of checking whether the number of memory contexts exceeds the specified limit. This parameter applies only to the DEBUG version.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Value range: Boolean

· on indicates that the function of checking the number of memory contexts is enabled.
· off indicates that the function of checking the number of memory contexts is disabled.
Default value: off

uncontrolled_memory_context
Parameter description: Specifies which memory texts will not be checked when the enable_memory_context_control parameter is set to on. This parameter applies only to the DEBUG version.

This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.

During the query, the title meaning string “MemoryContext white list:” is added to the beginning of the parameter value.

Value range: a string

Default value: empty

shared_buffers
Parameter description: Specifies the size of shared memory used by openGauss. Increasing the value of this parameter causes openGauss to request more System V shared memory than the default configuration allows.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from 16 to 1073741823. The unit is 8 KB.

The value of shared_buffers must be an integer multiple of BLCKSZ. Currently, BLCKSZ is set to 8 KB. That is, the value of shared_buffers must be an integer multiple of 8 KB. The minimum value changes according to BLCKSZ.

Default value: 8 MB

Setting suggestions:

Set shared_buffers to a value less than 40% of the memory. Set it to a large value for row-store tables and a small value for column-store tables. For column-store tables: shared_buffers = (Memory of a single server/Number of database nodes on the server) x 0.4 x 0.25

If shared_buffers is set to a larger value, increase the value of checkpoint_segments because a longer period of time is required to write a large amount of new or changed data.

segment_buffers
Parameter description: Specifies the memory size of an openGauss segment-paged metadata page.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from 16 to 1073741823. The unit is 8 KB.

The value of segment_buffers_buffers** must be an integer multiple of BLCKSZ. Currently, BLCKSZ is set to 8 KB. That is, the value of segment_buffers must be an integer multiple of 8 KB. The minimum value changes according to the value of BLCKSZ.

Default value: 8 MB

Setting suggestions:

segment_buffers is used to cache the content of segment-paged headers, which is key metadata information. To improve performance, it is recommended that the segment headers of common tables be cached in the buffer and not be replaced. You are advised to set this parameter based on the following formula: Number of tables (including indexes and toast tables) x Number of partitions x 3 + 128. This is because each table (partition) has some extra metadata segments. Generally, a table has three segments. At last, + 128 is added because segment- and page-based tablespace management requires a certain number of buffers.

If this parameter is set to a small value, it takes a long time to create a segment-paged table for the first time. Therefore, you are advised to set this parameter to the recommended value.

bulk_write_ring_size
Parameter description: Specifies the size of the ring buffer used by the operation when a large amount of data is written (for example, the copy operation).

This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from 16384 to 2147483647. The unit is KB.

Default value: 2 GB

Setting suggestions: Increase the value of this parameter on database nodes if a huge amount of data will be imported.

standby_shared_buffers_fraction
Parameter description: Specifies the shared_buffers proportion used on the server where a standby instance is deployed.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Value range: a double-precision floating-point number ranging from 0.1 to 1.0

Default value: 0.3

temp_buffers
Parameter description: Specifies the maximum size of local temporary buffers used by a database session.

This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.

temp_buffers can be modified only before the first use of temporary tables within each session. Subsequent attempts to change the value of this parameter will not take effect on that session.

A session allocates temporary buffers based on the value of temp_buffers. If a large value is set in a session that does not require many temporary buffers, only the overhead of one buffer descriptor is added. If a buffer is used, additional 8192 bytes will be consumed for it.

Value range: an integer ranging from 100 to 1073741823. The unit is 8 KB.

Default value: 1 MB

Top comments (0)