summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2016-05-05 09:55:39 +0000
committerPavan Deolasee2016-10-18 10:05:07 +0000
commitdecc2d6a71f688de6ae966f4ed8cfeadc11eb367 (patch)
treec0abc4c46a74cd235da2d58ba3437d6e1e768d10
parent82696b10ea2c9fcbb600019f604bb62daf0941b0 (diff)
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.
-rw-r--r--src/backend/utils/misc/guc.c8
-rw-r--r--src/include/pgxc/squeue.h4
2 files changed, 7 insertions, 5 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index d24a5a4e99..2a595fb336 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -2941,7 +2941,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,
@@ -2951,12 +2952,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)