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

Commita8828ef

Browse files
committed
Fine tune PTRACK_BUF_SIZE used for ptrack checkpoints.
8k of 64 bit LSNs is 64 KB, which looks like a reasonablebuffer size for disk writes. On fast NVMe SSD it givesaround 20% increase in ptrack checkpoint speed comparedto PTRACK_BUF_SIZE == 1000, i.e. 8 KB writes.Also use proper types for writesz and PTRACK_BUF_SIZEwhile on it
1 parentd16e84b commita8828ef

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

‎engine.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ ptrackCheckpoint(void)
430430

431431
if (j==PTRACK_BUF_SIZE)
432432
{
433-
intwritesz=sizeof(buf);/* Up to ~2 GB for buffer size seems
433+
size_twritesz=sizeof(buf);/* Up to ~2 GB for buffer size seems
434434
* to be more than enough, so never
435435
* going to overflow. */
436436

@@ -439,7 +439,7 @@ ptrackCheckpoint(void)
439439
* takes into account all paddings for us.
440440
*/
441441
ptrack_write_chunk(ptrack_tmp_fd,&crc, (char*)buf,writesz);
442-
elog(DEBUG5,"ptrack checkpoint: i "UINT64_FORMAT", j "UINT64_FORMAT", writesz %d PtrackContentNblocks "UINT64_FORMAT,
442+
elog(DEBUG5,"ptrack checkpoint: i "UINT64_FORMAT", j "UINT64_FORMAT", writesz %zu PtrackContentNblocks "UINT64_FORMAT,
443443
i,j,writesz, (uint64)PtrackContentNblocks);
444444

445445
j=0;
@@ -449,10 +449,10 @@ ptrackCheckpoint(void)
449449
/* Write if anythig left */
450450
if ((i+1) %PTRACK_BUF_SIZE!=0)
451451
{
452-
intwritesz=sizeof(pg_atomic_uint64)*j;
452+
size_twritesz=sizeof(pg_atomic_uint64)*j;
453453

454454
ptrack_write_chunk(ptrack_tmp_fd,&crc, (char*)buf,writesz);
455-
elog(DEBUG5,"ptrack checkpoint: final i "UINT64_FORMAT", j "UINT64_FORMAT", writesz %d PtrackContentNblocks "UINT64_FORMAT,
455+
elog(DEBUG5,"ptrack checkpoint: final i "UINT64_FORMAT", j "UINT64_FORMAT", writesz %zu PtrackContentNblocks "UINT64_FORMAT,
456456
i,j,writesz, (uint64)PtrackContentNblocks);
457457
}
458458

‎engine.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@
3131
/* Used for atomical crash-safe update of ptrack.map */
3232
#definePTRACK_PATH_TMP "global/ptrack.map.tmp"
3333

34-
#definePTRACK_BUF_SIZE 1000
34+
/*
35+
* 8k of 64 bit LSNs is 64 KB, which looks like a reasonable
36+
* buffer size for disk writes. On fast NVMe SSD it gives
37+
* around 20% increase in ptrack checkpoint speed compared
38+
* to PTRACK_BUF_SIZE == 1000, i.e. 8 KB writes.
39+
*/
40+
#definePTRACK_BUF_SIZE ((uint64) 8000)
3541

3642
/* Ptrack magic bytes */
3743
#definePTRACK_MAGIC "ptk"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp