Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
perf(slog): Use a special thread pool for slog write callback (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
foreverneverer authored Jul 24, 2020
1 parent 9d1059e commit 113e7e6
Show file tree
Hide file tree
Showing 64 changed files with 304 additions and 68 deletions.
6 changes: 5 additions & 1 deletion include/dsn/dist/replication/replication.codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ DEFINE_THREAD_POOL_CODE(THREAD_POOL_LOCAL_APP)
DEFINE_THREAD_POOL_CODE(THREAD_POOL_REPLICATION_LONG)
DEFINE_THREAD_POOL_CODE(THREAD_POOL_COMPACT)
DEFINE_THREAD_POOL_CODE(THREAD_POOL_INGESTION)
DEFINE_THREAD_POOL_CODE(THREAD_POOL_SLOG)

#define DEFINE_STORAGE_WRITE_RPC_CODE(x, allow_batch, is_idempotent) \
DEFINE_STORAGE_RPC_CODE( \
Expand Down Expand Up @@ -65,7 +66,6 @@ MAKE_EVENT_CODE_AIO(LPC_AIO_TEST, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE_AIO(LPC_AIO_IMMEDIATE_CALLBACK, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE_AIO(LPC_WRITE_REPLICATION_LOG_COMMON, TASK_PRIORITY_HIGH)
MAKE_EVENT_CODE_AIO(LPC_WRITE_REPLICATION_LOG_PRIVATE, TASK_PRIORITY_HIGH)
MAKE_EVENT_CODE_AIO(LPC_WRITE_REPLICATION_LOG_SHARED, TASK_PRIORITY_HIGH)
MAKE_EVENT_CODE(LPC_QUERY_CONFIGURATION_ALL, TASK_PRIORITY_HIGH)
MAKE_EVENT_CODE(LPC_MEM_RELEASE, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE(LPC_CREATE_CHILD, TASK_PRIORITY_COMMON)
Expand Down Expand Up @@ -185,6 +185,10 @@ MAKE_EVENT_CODE(LPC_REPLICATION_LONG_COMMON, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE(LPC_REPLICATION_LONG_HIGH, TASK_PRIORITY_HIGH)
#undef CURRENT_THREAD_POOL

#define CURRENT_THREAD_POOL THREAD_POOL_SLOG
MAKE_EVENT_CODE_AIO(LPC_WRITE_REPLICATION_LOG_SHARED, TASK_PRIORITY_HIGH)
#undef CURRENT_THREAD_POOL

// bulk load ingestion request
namespace dsn {
namespace apps {
Expand Down
8 changes: 6 additions & 2 deletions src/failure_detector/test/config-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ run = true
ports =
count = 1
delay_seconds = 1
pools = THREAD_POOL_DEFAULT, THREAD_POOL_DLOCK, THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG, THREAD_POOL_FDS_SERVICE
pools = THREAD_POOL_DEFAULT, THREAD_POOL_DLOCK, THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG, THREAD_POOL_FDS_SERVICE,THREAD_POOL_SLOG

[apps.server]
type = test
arguments =
ports = 20101
run = false
count = 0
pools = THREAD_POOL_DEFAULT, THREAD_POOL_REPLICATION
pools = THREAD_POOL_DEFAULT, THREAD_POOL_REPLICATION,THREAD_POOL_SLOG

[apps.test_worker]
type = worker
Expand Down Expand Up @@ -99,6 +99,10 @@ worker_count = 8
[threadpool.THREAD_POOL_DLOCK]
partitioned = true

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[zookeeper]
hosts_list = localhost:12181
timeout_ms = 30000
Expand Down
4 changes: 2 additions & 2 deletions src/failure_detector/test/config-whitelist-test-failed.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ run = true
ports =
count = 1
delay_seconds = 1
pools = THREAD_POOL_DEFAULT, THREAD_POOL_DLOCK, THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG, THREAD_POOL_FDS_SERVICE
pools = THREAD_POOL_DEFAULT, THREAD_POOL_DLOCK, THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG, THREAD_POOL_FDS_SERVICE,THREAD_POOL_SLOG

[apps.server]
type = test
arguments =
ports = 20101
run = false
count = 0
pools = THREAD_POOL_DEFAULT, THREAD_POOL_REPLICATION
pools = THREAD_POOL_DEFAULT, THREAD_POOL_REPLICATION,THREAD_POOL_SLOG

[apps.test_worker]
type = worker
Expand Down
4 changes: 2 additions & 2 deletions src/failure_detector/test/config-whitelist-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ run = true
ports =
count = 1
delay_seconds = 1
pools = THREAD_POOL_DEFAULT, THREAD_POOL_DLOCK, THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG, THREAD_POOL_FDS_SERVICE
pools = THREAD_POOL_DEFAULT, THREAD_POOL_DLOCK, THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG, THREAD_POOL_FDS_SERVICE,THREAD_POOL_SLOG

[apps.server]
type = test
arguments =
ports = 20101
run = false
count = 0
pools = THREAD_POOL_DEFAULT, THREAD_POOL_REPLICATION
pools = THREAD_POOL_DEFAULT, THREAD_POOL_REPLICATION,THREAD_POOL_SLOG

[apps.test_worker]
type = worker
Expand Down
2 changes: 1 addition & 1 deletion src/replica/backup/test/config-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ run = true

[apps.replica]
type = replica
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_SLOG

[core]
tool = nativerun
Expand Down
2 changes: 1 addition & 1 deletion src/replica/bulk_load/test/config-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type = replica
run = true
count = 1
ports = 54321
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_LOCAL_SERVICE
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_LOCAL_SERVICE,THREAD_POOL_SLOG

[core]
;tool = simulator
Expand Down
6 changes: 5 additions & 1 deletion src/replica/duplication/test/config-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ run = true

[apps.replica]
type = replica
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_SLOG

[core]
tool = nativerun
Expand All @@ -19,6 +19,10 @@ worker_count = 2
name = default
partitioned = false

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
name = replica
partitioned = true
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.client]
type = client
Expand Down Expand Up @@ -63,6 +63,10 @@ name = default
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
name = replication
partitioned = true
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/test/case-000.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.c]
type = client
Expand Down Expand Up @@ -70,6 +70,10 @@ worker_priority = THREAD_xPRIORITY_LOWEST
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
partitioned = true
worker_priority = THREAD_xPRIORITY_LOWEST
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/test/case-001.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.c]
type = client
Expand Down Expand Up @@ -70,6 +70,10 @@ worker_priority = THREAD_xPRIORITY_LOWEST
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
partitioned = true
worker_priority = THREAD_xPRIORITY_LOWEST
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/test/case-002.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.c]
type = client
Expand Down Expand Up @@ -70,6 +70,10 @@ worker_priority = THREAD_xPRIORITY_LOWEST
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
partitioned = true
worker_priority = THREAD_xPRIORITY_LOWEST
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/test/case-003.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.c]
type = client
Expand Down Expand Up @@ -70,6 +70,10 @@ worker_priority = THREAD_xPRIORITY_LOWEST
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
partitioned = true
worker_priority = THREAD_xPRIORITY_LOWEST
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/test/case-004.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.c]
type = client
Expand Down Expand Up @@ -70,6 +70,10 @@ worker_priority = THREAD_xPRIORITY_LOWEST
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
partitioned = true
worker_priority = THREAD_xPRIORITY_LOWEST
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/test/case-005.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.c]
type = client
Expand Down Expand Up @@ -70,6 +70,10 @@ worker_priority = THREAD_xPRIORITY_LOWEST
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
partitioned = true
worker_priority = THREAD_xPRIORITY_LOWEST
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/test/case-006.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.c]
type = client
Expand Down Expand Up @@ -71,6 +71,10 @@ worker_priority = THREAD_xPRIORITY_LOWEST
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
partitioned = true
worker_priority = THREAD_xPRIORITY_LOWEST
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/test/case-100.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.c]
type = client
Expand Down Expand Up @@ -71,6 +71,10 @@ worker_priority = THREAD_xPRIORITY_LOWEST
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
partitioned = true
worker_priority = THREAD_xPRIORITY_LOWEST
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/test/case-101.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.c]
type = client
Expand Down Expand Up @@ -71,6 +71,10 @@ worker_priority = THREAD_xPRIORITY_LOWEST
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
partitioned = true
worker_priority = THREAD_xPRIORITY_LOWEST
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/test/case-102.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.c]
type = client
Expand Down Expand Up @@ -71,6 +71,10 @@ worker_priority = THREAD_xPRIORITY_LOWEST
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
partitioned = true
worker_priority = THREAD_xPRIORITY_LOWEST
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/test/case-103.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.c]
type = client
Expand Down Expand Up @@ -71,6 +71,10 @@ worker_priority = THREAD_xPRIORITY_LOWEST
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
partitioned = true
worker_priority = THREAD_xPRIORITY_LOWEST
Expand Down
6 changes: 5 additions & 1 deletion src/replica/storage/simple_kv/test/case-104.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arguments =
ports = 34801
run = true
count = 3
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_SLOG

[apps.c]
type = client
Expand Down Expand Up @@ -71,6 +71,10 @@ worker_priority = THREAD_xPRIORITY_LOWEST
partitioned = false
worker_priority = THREAD_xPRIORITY_LOWEST

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_REPLICATION]
partitioned = true
worker_priority = THREAD_xPRIORITY_LOWEST
Expand Down
Loading

0 comments on commit 113e7e6

Please sign in to comment.