Optimize read/write concurrency of mnesia/ets tables
This commit is contained in:
parent
e15e5d1f98
commit
d9470f365f
|
@ -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).
|
||||
|
|
|
@ -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).
|
||||
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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) ->
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue