You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a graph-like projection for topic bindings in Khepri
Performance is better than mnesia: 72k msg/s vs. 55k msg/s on my
machine with this PerfTest.
perf-test -p -e amq.topic -t topic -qp q.%d -qpf 1 -qpt 2 -c 3000
This is for two reasons:
* In general, mnesia calls have some overhead for looking up the table
and calling internal routines. Eventually the ETS calls end up being
roughly the same as pure ETS equivalents. This is already noted in
some places in the rabbit codebase.
* The mnesia version of this `trie_match/2` function occurs inside an
`mnesia:async_dirty/2` call - inside a transaction. This has a lot
more overhead from locking the table which is eliminated when
switching to pure-ETS calls. I don't think the transaction has any
practical importance on the results of `trie_match/2` here. Some
races between updates and queries are possible but I think highly
unlikely.
This approach should grow fairly well and be tolerant to binding churn:
the projection of edges is a set so it should handle insertion/
deletions/updates of bindings well.
This replaces a version of topic routing that uses regular expressions
to perform the matching. Regular expressions are much faster at
confirming/denying that a routing key matches a pattern but I suspect
that it won't grow very well as the number of topic bindings increases
because you need to do a full (or at least partial) table scan to find
all of the bindings for the exchange first. If there are many bindings,
I suspect that the lookup of bindings for an exchange will dominate the
running time.
TODO:
* Figure out exactly where this code should belong. It's awkwardly
split between the projection definition and
`rabbit_db_topic_exchange` for now.
* Check the correctness of the graph approach.
* Compare the performance of the graph approach to the regex approach.
0 commit comments