Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit08882ce

Browse files
Reduce CPU utilisation of WALSender process. Process was using 10% CPU
doing nothing, caused by naptime specified in milliseconds yet units ofpg_usleep() parameter is microseconds. Correctly specifying unitsreduces call frequency by 1000. Reduction in CPU consumption verified.
1 parent16a4186 commit08882ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/backend/replication/walsender.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*
3131
*
3232
* IDENTIFICATION
33-
* $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.10 2010/03/16 09:09:55 heikki Exp $
33+
* $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.11 2010/03/24 20:11:12 sriggs Exp $
3434
*
3535
*-------------------------------------------------------------------------
3636
*/
@@ -67,7 +67,7 @@ boolam_walsender = false;/* Am I a walsender process ? */
6767
intMaxWalSenders=0;/* the maximum number of concurrent walsenders */
6868
intWalSndDelay=200;/* max sleep time between some actions */
6969

70-
#defineNAPTIME_PER_CYCLE100/* max sleep time between cycles (100ms) */
70+
#defineNAPTIME_PER_CYCLE100000L/* max sleep time between cycles (100ms) */
7171

7272
/*
7373
* These variables are used similarly to openLogFile/Id/Seg/Off,
@@ -396,7 +396,7 @@ WalSndLoop(void)
396396
* sleep into NAPTIME_PER_CYCLE (ms) increments, and check for
397397
* interrupts after each nap.
398398
*/
399-
remain=WalSndDelay;
399+
remain=WalSndDelay*1000L;
400400
while (remain>0)
401401
{
402402
if (got_SIGHUP||shutdown_requested||ready_to_stop)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp