Memory and Resource Management with Resource Queues Avoid memory errors and manage Greenplum Database resources. Resource groups are a newer resource management scheme that enforces memory, CPU, and concurrent transaction limits in Greenplum Database. The Managing Resources topic provides a comparison of the resource queue and the resource group management schemes. Refer to Using Resource Groups for configuration and usage information for this resource management scheme.

Memory management has a significant impact on performance in a Greenplum Database cluster. The default settings are suitable for most environments. Do not change the default settings until you understand the memory characteristics and usage on your system.

Resolving Out of Memory Errors

An out of memory error message identifies the Greenplum segment, host, and process that experienced the out of memory error. For example:Out of memory (seg27 host.example.com pid=47093) VM Protect failed to allocate 4096 bytes, 0 MB available

Some common causes of out-of-memory conditions in Greenplum Database are:

Following are possible solutions to out of memory conditions:

Adding segment hosts to the cluster will not in itself alleviate out of memory problems. The memory used by each query is determined by the statement_mem parameter and it is set when the query is invoked. However, if adding more hosts allows decreasing the number of segments per host, then the amount of memory allocated in gp_vmem_protect_limit can be raised.

Low Memory Queries

A low statement_mem setting (for example, in the 1-3MB range) has been shown to increase the performance of queries with low memory requirements. Use the statement_mem server configuration parameter to override the setting on a per-query basis. For example: SET statement_mem='2MB';

Configuring Memory for Greenplum Database

Most out of memory conditions can be avoided if memory is thoughtfully managed.

It is not always possible to increase system memory, but you can prevent out-of-memory conditions by configuring memory use correctly and setting up resource queues to manage expected workloads.

It is important to include memory requirements for mirror segments that become primary segments during a failure to ensure that the cluster can continue when primary segments or segment hosts fail.

The following are recommended operating system and Greenplum Database memory settings:

Example Memory Configuration Calculations

vm.overcommit_ratio calculation gp_vmem = ((SWAP + RAM) – (7.5GB + 0.05 * RAM)) / 1.7 = ((64 + 256) - (7.5 + 0.05 * 256)) / 1.7 = 176 vm.overcommit_ratio = (RAM - (0.026 * gp_vmem)) / RAM = (256 - (0.026 * 176)) / 256 = .982 Set vm.overcommit_ratio to 98.

gp_vmem_protect_limit calculation gp_vmem_protect_limit = gp_vmem / maximum_acting_primary_segments = 176 / 11 = 16GB = 16384MB

Configuring Resource Queues

Greenplum Database resource queues provide a powerful mechanism for managing the workload of the cluster. Queues can be used to limit both the numbers of active queries and the amount of memory that can be used by queries in the queue. When a query is submitted to Greenplum Database, it is added to a resource queue, which determines if the query should be accepted and when the resources are available to execute it.