Skip to content

Commit 5123680

Browse files
committed
QQ: default to compressed mem tables and set a wal max entries default
Compressed ETS tables may introduce a small throughput penalty (low single digit %) but can reduce peak Ra memory use by 30-50%. Also set a default wal_max_entries value to avoid mem tables growing too large when using very small message sizes (as more than 1M tiny messages can easily fit into one WAL file). Ra 2.10.1 has a type spec fix needed.
1 parent 078f4b3 commit 5123680

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

MODULE.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ erlang_package.hex_package(
349349
name = "ra",
350350
build_file = "@rabbitmq-server//bazel:BUILD.ra",
351351
pkg = "ra",
352-
sha256 = "0c9c02e8db48a9ed8f9b56e3b105dc25c72fde01c3dc07e2dc4f0618545595cd",
353-
version = "2.10.0",
352+
sha256 = "ab0e53c69b6964b237d94a3ac8f2ae5ba5cdc2dc9ef73ef3731d85f0c01d35d0",
353+
version = "2.10.1",
354354
)
355355

356356
erlang_package.git_package(

deps/rabbit/src/rabbit_ra_systems.erl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
-define(COORD_WAL_MAX_SIZE_B, 64_000_000).
2525
-define(QUORUM_AER_MAX_RPC_SIZE, 16).
26+
-define(QUORUM_DEFAULT_WAL_MAX_ENTRIES, 500_000).
2627

2728
-spec setup() -> ok | no_return().
2829

@@ -111,13 +112,22 @@ get_config(quorum_queues = RaSystem) ->
111112
DefaultConfig = get_default_config(),
112113
Checksums = application:get_env(rabbit, quorum_compute_checksums, true),
113114
WalChecksums = application:get_env(rabbit, quorum_wal_compute_checksums, Checksums),
114-
SegmentChecksums = application:get_env(rabbit, quorum_segment_compute_checksums, Checksums),
115+
SegmentChecksums = application:get_env(rabbit, quorum_segment_compute_checksums,
116+
Checksums),
117+
WalMaxEntries = case DefaultConfig of
118+
#{wal_max_entries := MaxEntries}
119+
when is_integer(MaxEntries) ->
120+
MaxEntries;
121+
_ ->
122+
?QUORUM_DEFAULT_WAL_MAX_ENTRIES
123+
end,
115124
AERBatchSize = application:get_env(rabbit, quorum_max_append_entries_rpc_batch_size,
116125
?QUORUM_AER_MAX_RPC_SIZE),
117-
CompressMemTables = application:get_env(rabbit, quorum_compress_mem_tables, false),
126+
CompressMemTables = application:get_env(rabbit, quorum_compress_mem_tables, true),
118127
DefaultConfig#{name => RaSystem,
119128
default_max_append_entries_rpc_batch_size => AERBatchSize,
120129
wal_compute_checksums => WalChecksums,
130+
wal_max_entries => WalMaxEntries,
121131
segment_compute_checksums => SegmentChecksums,
122132
compress_mem_tables => CompressMemTables};
123133
get_config(coordination = RaSystem) ->

rabbitmq-components.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ dep_khepri = hex 0.13.0
123123
dep_khepri_mnesia_migration = hex 0.4.0
124124
dep_looking_glass = git https://github.com/rabbitmq/looking_glass.git main
125125
dep_prometheus = hex 4.11.0
126-
dep_ra = hex 2.10.0
126+
dep_ra = hex 2.10.1
127127
dep_ranch = hex 2.1.0
128128
dep_recon = hex 2.5.3
129129
dep_redbug = hex 2.0.7

0 commit comments

Comments
 (0)