From: Pavan Deolasee Date: Thu, 5 May 2016 09:55:39 +0000 (+0530) Subject: Make minimum values of shared_queues and shared_queue_size GUC parameters X-Git-Tag: XL9_5_R1_1~11 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=df16e34abb020b92908b1f476079afbb190e547d;p=postgres-xl.git Make minimum values of shared_queues and shared_queue_size GUC parameters dependent on other settings shared_queue_size is dependent on the number of datanodes in the cluster since each datanode may attach itself as a consumer of the shared queue. So the shared_queue_size now signifies per-datanode value and the actual value used will be (max_datanodes * shared_queue_size). Existing users should modify their settings after taking this into consideration. Similarly, shared_queues highly depends on the number of concurrent queries. We now conservatively set this to at least 1/4th of max_connections or user specified value, whichever is higher. --- diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 0f419533ec..7108fb35ff 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -2943,7 +2943,8 @@ static struct config_int ConfigureNamesInt[] = */ { {"shared_queues", PGC_POSTMASTER, RESOURCES_MEM, - gettext_noop("Sets the number of shared memory queues used by the distributed executor."), + gettext_noop("Sets the number of shared memory queues used by the " + "distributed executor, minimum 1/4 of max_connections."), NULL }, &NSQueues, @@ -2953,12 +2954,13 @@ static struct config_int ConfigureNamesInt[] = { {"shared_queue_size", PGC_POSTMASTER, RESOURCES_MEM, - gettext_noop("Sets the amount of memory allocated for a shared memory queue."), + gettext_noop("Sets the amount of memory allocated for a shared" + " memory queue per datanode."), NULL, GUC_UNIT_KB }, &SQueueSize, - 64, 1, MAX_KILOBYTES, + 32, 1, MAX_KILOBYTES, NULL, NULL, NULL }, diff --git a/src/include/pgxc/squeue.h b/src/include/pgxc/squeue.h index c0a9807e43..5d5e7136bd 100644 --- a/src/include/pgxc/squeue.h +++ b/src/include/pgxc/squeue.h @@ -25,9 +25,9 @@ extern PGDLLIMPORT int NSQueues; extern PGDLLIMPORT int SQueueSize; /* Fixed size of shared queue, maybe need to be GUC configurable */ -#define SQUEUE_SIZE ((long) SQueueSize * 1024L) +#define SQUEUE_SIZE ((long) SQueueSize * MaxDataNodes * 1024L) /* Number of shared queues, maybe need to be GUC configurable */ -#define NUM_SQUEUES ((long) NSQueues) +#define NUM_SQUEUES Max((long) NSQueues, MaxConnections / 4) #define SQUEUE_KEYSIZE (64)