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

Commit6810e26

Browse files
committed
Some experimates with multimaster performance
1 parent151af9e commit6810e26

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

‎contrib/multimaster/bgwpool.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ typedef struct
1616
intid;
1717
}BgwPoolExecutorCtx;
1818

19+
size_tn_snapshots;
20+
size_tn_active;
21+
1922
staticvoidBgwPoolMainLoop(Datumarg)
2023
{
2124
BgwPoolExecutorCtx*ctx= (BgwPoolExecutorCtx*)arg;
@@ -35,6 +38,7 @@ static void BgwPoolMainLoop(Datum arg)
3538
size=*(int*)&pool->queue[pool->head];
3639
Assert(size<pool->size);
3740
work=palloc(size);
41+
pool->active-=1;
3842
if (pool->head+size+4>pool->size) {
3943
memcpy(work,pool->queue,size);
4044
pool->head=INTALIGN(size);
@@ -68,6 +72,7 @@ void BgwPoolInit(BgwPool* pool, BgwPoolExecutor executor, char const* dbname, si
6872
pool->head=0;
6973
pool->tail=0;
7074
pool->size=queueSize;
75+
pool->active=0;
7176
strcpy(pool->dbname,dbname);
7277
}
7378

@@ -106,6 +111,9 @@ void BgwPoolExecute(BgwPool* pool, void* work, size_t size)
106111
PGSemaphoreLock(&pool->overflow);
107112
SpinLockAcquire(&pool->lock);
108113
}else {
114+
pool->active+=1;
115+
n_snapshots+=1;
116+
n_active+=pool->active;
109117
*(int*)&pool->queue[pool->tail]=size;
110118
if (pool->size-pool->tail >=size+4) {
111119
memcpy(&pool->queue[pool->tail+4],work,size);

‎contrib/multimaster/bgwpool.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ typedef struct
1818
size_thead;
1919
size_ttail;
2020
size_tsize;
21+
size_tactive;
2122
boolproducerBlocked;
2223
chardbname[MAX_DBNAME_LEN];
2324
char*queue;

‎contrib/multimaster/multimaster.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#include"bytebuf.h"
55

66
#defineXTM_TRACE(fmt, ...)
7-
#defineXTM_INFO(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
8-
//#define XTM_INFO(fmt, ...)
7+
//#define XTM_INFO(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
8+
#defineXTM_INFO(fmt, ...)
99

1010
externintMMStartReceivers(char*nodes,intnode_id);
1111
externvoidMMBeginTransaction(void);

‎contrib/multimaster/receiver_raw.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ receiver_raw_main(Datum main_arg)
269269
WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,
270270
receiver_idle_time*1L);
271271
ResetLatch(&MyProc->procLatch);
272-
273272
/* Process signals */
274273
if (got_sighup)
275274
{

‎contrib/multimaster/tests/dtmbench‎

6.17 KB
Binary file not shown.

‎contrib/multimaster/tests/dtmbench.cpp‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,9 @@ int main (int argc, char* argv[])
200200
"\t-r N\tnumber of readers (1)\n"
201201
"\t-w N\tnumber of writers (10)\n"
202202
"\t-a N\tnumber of accounts (100000)\n"
203-
"\t-s N\tperform updates starting from this id (1)\n"
204-
"\t-d N\tperform updates in this diapason (100000)\n"
205203
"\t-n N\tnumber of iterations (1000)\n"
206204
"\t-c STR\tdatabase connection string\n"
207-
"\t-i\tinitializedatanase\n");
205+
"\t-i\tinitializedatabase\n");
208206
return1;
209207
}
210208

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp