diff options
| author | Michael Davis <mcarsondavis@gmail.com> | 2023-03-20 11:21:14 -0500 |
|---|---|---|
| committer | Diana Parra Corbacho <dparracorbac@vmware.com> | 2023-05-12 11:31:16 +0200 |
| commit | b7b98a049b53ee32f8627961def7164e5f613160 (patch) | |
| tree | b7f1d93ab0270b234eceb3b8c1434c7906548c0f | |
| parent | 117aa475ec69bd5a3ff520b386649a3a49b0a994 (diff) | |
| download | rabbitmq-server-git-b7b98a049b53ee32f8627961def7164e5f613160.tar.gz | |
Khepri: Use queue projection for rabbit_db_queue:get/1
This change uses the Khepri projection for queues for
rabbit_db_queue:get/1 and rabbit_db_queue:get_durable/1.
Switching to the projection here for 'get's improves performance for
any operation that needs to look up a queue. For example, importing
a set of 100k classic queues takes a noticeably smaller amount of time.
| Q getting function | Time to import 100k classic queues (secs) |
|--- |--- |
| rabbit_khepri:get/1 | 19.20 |
| ets:lookup/2 | 15.71 |
| (mnesia) | 14.96 |
| -rw-r--r-- | deps/rabbit/src/rabbit_db_queue.erl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/deps/rabbit/src/rabbit_db_queue.erl b/deps/rabbit/src/rabbit_db_queue.erl index 3236656620..edb8ded5fe 100644 --- a/deps/rabbit/src/rabbit_db_queue.erl +++ b/deps/rabbit/src/rabbit_db_queue.erl @@ -450,9 +450,9 @@ get_in_mnesia(Name) -> rabbit_mnesia:dirty_read({?MNESIA_TABLE, Name}). get_in_khepri(Name) -> - case rabbit_khepri:get(khepri_queue_path(Name)) of - {ok, Q} -> {ok, Q}; - _ -> {error, not_found} + case ets:lookup(?KHEPRI_PROJECTION, Name) of + [Q] -> {ok, Q}; + [] -> {error, not_found} end. %% ------------------------------------------------------------------- |
