diff --git a/src/emqx_banned.erl b/src/emqx_banned.erl index 175271306..49a698384 100644 --- a/src/emqx_banned.erl +++ b/src/emqx_banned.erl @@ -43,7 +43,8 @@ mnesia(boot) -> {type, set}, {disc_copies, [node()]}, {record_name, banned}, - {attributes, record_info(fields, banned)}]); + {attributes, record_info(fields, banned)}, + {storage_properties, [{ets, [{read_concurrency, true}]}]}]); mnesia(copy) -> ok = ekka_mnesia:copy_table(?TAB). diff --git a/src/emqx_router.erl b/src/emqx_router.erl index 8cd0d4d42..2ac656d56 100644 --- a/src/emqx_router.erl +++ b/src/emqx_router.erl @@ -54,7 +54,9 @@ mnesia(boot) -> {type, bag}, {ram_copies, [node()]}, {record_name, route}, - {attributes, record_info(fields, route)}]); + {attributes, record_info(fields, route)}, + {storage_properties, [{ets, [{read_concurrency, true}, + {write_concurrency, true}]}]}]); mnesia(copy) -> ok = ekka_mnesia:copy_table(?ROUTE). diff --git a/src/emqx_router_helper.erl b/src/emqx_router_helper.erl index 5431c9900..7bacddd4c 100644 --- a/src/emqx_router_helper.erl +++ b/src/emqx_router_helper.erl @@ -53,7 +53,8 @@ mnesia(boot) -> {type, set}, {ram_copies, [node()]}, {record_name, routing_node}, - {attributes, record_info(fields, routing_node)}]); + {attributes, record_info(fields, routing_node)}, + {storage_properties, [{ets, [{read_concurrency, true}]}]}]); mnesia(copy) -> ok = ekka_mnesia:copy_table(?ROUTING_NODE). diff --git a/src/emqx_sm_registry.erl b/src/emqx_sm_registry.erl index 659b3a92b..b503d71c8 100644 --- a/src/emqx_sm_registry.erl +++ b/src/emqx_sm_registry.erl @@ -69,9 +69,11 @@ init([]) -> {type, bag}, {ram_copies, [node()]}, {record_name, global_session}, - {attributes, record_info(fields, global_session)}]), + {attributes, record_info(fields, global_session)}, + {storage_properties, [{ets, [{read_concurrency, true}, + {write_concurrency, true}]}]}]), ok = ekka_mnesia:copy_table(?TAB), - ekka:monitor(membership), + _ = ekka:monitor(membership), {ok, #{}}. handle_call(Req, _From, State) -> diff --git a/src/emqx_trie.erl b/src/emqx_trie.erl index f5dfa93fe..569de9092 100644 --- a/src/emqx_trie.erl +++ b/src/emqx_trie.erl @@ -36,16 +36,21 @@ %% @doc Create or replicate trie tables. -spec(mnesia(boot | copy) -> ok). mnesia(boot) -> + %% Optimize + StoreProps = [{ets, [{read_concurrency, true}, + {write_concurrency, true}]}], %% Trie table ok = ekka_mnesia:create_table(?TRIE, [ {ram_copies, [node()]}, {record_name, trie}, - {attributes, record_info(fields, trie)}]), + {attributes, record_info(fields, trie)}, + {storage_properties, StoreProps}]), %% Trie node table ok = ekka_mnesia:create_table(?TRIE_NODE, [ {ram_copies, [node()]}, {record_name, trie_node}, - {attributes, record_info(fields, trie_node)}]); + {attributes, record_info(fields, trie_node)}, + {storage_properties, StoreProps}]); mnesia(copy) -> %% Copy trie table