From fab514f643bfb5f7c9465d5548e33f7b5be285d7 Mon Sep 17 00:00:00 2001 From: Felix Huettner Date: Mon, 14 Mar 2022 14:58:36 +0100 Subject: [PATCH] Enable write_concurrency for file handle cache stats During most of the time the file_handle_cache_stats ets table is used for writing only. By enabeling `write_concurrency` on the table we allow different values to be written concurrently without taking a global lock. There the only codepath reading from the ets table is run on the `collect_statistics_interval` interval and reads the whole table. So we can assume we are not blocking any large amount of concurrent reads. --- deps/rabbit_common/src/file_handle_cache_stats.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/rabbit_common/src/file_handle_cache_stats.erl b/deps/rabbit_common/src/file_handle_cache_stats.erl index c5122112fa..e21dd40a51 100644 --- a/deps/rabbit_common/src/file_handle_cache_stats.erl +++ b/deps/rabbit_common/src/file_handle_cache_stats.erl @@ -21,7 +21,7 @@ -define(COUNT_TIME_BYTES, [io_read, io_write]). init() -> - _ = ets:new(?TABLE, [public, named_table]), + _ = ets:new(?TABLE, [public, named_table, {write_concurrency,true}]), [ets:insert(?TABLE, {{Op, Counter}, 0}) || Op <- ?COUNT_TIME_BYTES, Counter <- [count, bytes, time]], [ets:insert(?TABLE, {{Op, Counter}, 0}) || Op <- ?COUNT_TIME,