Skip to content

Commit 2a7d355

Browse files
the-mikedavisdcorbacho
authored andcommitted
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 |
1 parent a32fb8c commit 2a7d355

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

deps/rabbit/src/rabbit_db_queue.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,9 @@ get_in_mnesia(Name) ->
450450
rabbit_mnesia:dirty_read({?MNESIA_TABLE, Name}).
451451

452452
get_in_khepri(Name) ->
453-
case rabbit_khepri:get(khepri_queue_path(Name)) of
454-
{ok, Q} -> {ok, Q};
455-
_ -> {error, not_found}
453+
case ets:lookup(?KHEPRI_PROJECTION, Name) of
454+
[Q] -> {ok, Q};
455+
[] -> {error, not_found}
456456
end.
457457

458458
%% -------------------------------------------------------------------

0 commit comments

Comments
 (0)