Make minimum values of shared_queues and shared_queue_size GUC parameters
authorPavan Deolasee <pavan.deolasee@gmail.com>
Thu, 5 May 2016 09:55:39 +0000 (15:25 +0530)
committerPavan Deolasee <pavan.deolasee@gmail.com>
Thu, 5 May 2016 09:55:39 +0000 (15:25 +0530)
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.

src/backend/utils/misc/guc.c
src/include/pgxc/squeue.h

index 0f419533ece9c3cbd87685ceed0339eeec6a7104..7108fb35ffc1ba48b440379843d85b60df03c377 100644 (file)
@@ -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
        },
 
index c0a9807e43d71b4b5b0a6ee9e17206cb6e760030..5d5e7136bd64510f0be3661ff3ede3a124f2fde3 100644 (file)
@@ -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)