aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2010-03-24 20:11:12 +0000
committerSimon Riggs <simon@2ndQuadrant.com>2010-03-24 20:11:12 +0000
commit08882ce74cd6775bd8446eb7343c61a3e5648620 (patch)
tree31b260f3ac819933082f250864d165f65b90f2a6 /src
parent16a4186d6aab46953f03f52b7a6d9ede7c89eaf7 (diff)
downloadpostgresql-08882ce74cd6775bd8446eb7343c61a3e5648620.tar.gz
postgresql-08882ce74cd6775bd8446eb7343c61a3e5648620.zip
Reduce CPU utilisation of WALSender process. Process was using 10% CPU
doing nothing, caused by naptime specified in milliseconds yet units of pg_usleep() parameter is microseconds. Correctly specifying units reduces call frequency by 1000. Reduction in CPU consumption verified.
Diffstat (limited to 'src')
-rw-r--r--src/backend/replication/walsender.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 0a648e72e17..fa0b363054c 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -30,7 +30,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.10 2010/03/16 09:09:55 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.11 2010/03/24 20:11:12 sriggs Exp $
*
*-------------------------------------------------------------------------
*/
@@ -67,7 +67,7 @@ bool am_walsender = false; /* Am I a walsender process ? */
int MaxWalSenders = 0; /* the maximum number of concurrent walsenders */
int WalSndDelay = 200; /* max sleep time between some actions */
-#define NAPTIME_PER_CYCLE 100 /* max sleep time between cycles (100ms) */
+#define NAPTIME_PER_CYCLE 100000L /* max sleep time between cycles (100ms) */
/*
* These variables are used similarly to openLogFile/Id/Seg/Off,
@@ -396,7 +396,7 @@ WalSndLoop(void)
* sleep into NAPTIME_PER_CYCLE (ms) increments, and check for
* interrupts after each nap.
*/
- remain = WalSndDelay;
+ remain = WalSndDelay * 1000L;
while (remain > 0)
{
if (got_SIGHUP || shutdown_requested || ready_to_stop)