Set 'read_concurrency' for some ETS tables

This commit is contained in:
Evgeniy Khramtsov 2017-04-05 15:10:18 +03:00
parent 2febbe5ffb
commit 6fa55e7c38
5 changed files with 8 additions and 5 deletions

View File

@ -894,7 +894,8 @@ has_option(Opt) ->
get_option(Opt, fun(_) -> true end, false).
init_module_db_table(Modules) ->
catch ets:new(module_db, [named_table, public, bag]),
catch ets:new(module_db, [named_table, public, bag,
{read_concurrency, true}]),
%% Dirty hack for mod_pubsub
ets:insert(module_db, {mod_pubsub, mnesia}),
ets:insert(module_db, {mod_pubsub, sql}),

View File

@ -189,7 +189,7 @@ run_fold(Hook, Host, Val, Args) ->
%% {stop, Reason}
%%----------------------------------------------------------------------
init([]) ->
ets:new(hooks, [named_table]),
ets:new(hooks, [named_table, {read_concurrency, true}]),
{ok, #state{}}.
%%----------------------------------------------------------------------

View File

@ -201,7 +201,8 @@ init([]) ->
lists:foreach(fun host_up/1, ?MYHOSTS),
ejabberd_hooks:add(host_up, ?MODULE, host_up, 10),
ejabberd_hooks:add(host_down, ?MODULE, host_down, 100),
catch ets:new(?IQTABLE, [named_table, public, ordered_set]),
catch ets:new(?IQTABLE, [named_table, public, ordered_set,
{read_concurrency, true}]),
update_table(),
ejabberd_mnesia:create(?MODULE, iq_response,
[{ram_copies, [node()]},

View File

@ -393,7 +393,7 @@ c2s_handle_info(State, _) ->
init([]) ->
process_flag(trap_exit, true),
lists:foreach(fun(Mod) -> Mod:init() end, get_sm_backends()),
ets:new(sm_iqtable, [named_table, public]),
ets:new(sm_iqtable, [named_table, public, {read_concurrency, true}]),
ejabberd_hooks:add(host_up, ?MODULE, host_up, 50),
ejabberd_hooks:add(host_down, ?MODULE, host_down, 60),
lists:foreach(fun host_up/1, ?MYHOSTS),

View File

@ -85,7 +85,8 @@ init([]) ->
ejabberd_hooks:add(host_down, ?MODULE, stop_modules, 70),
ets:new(ejabberd_modules,
[named_table, public,
{keypos, #ejabberd_module.module_host}]),
{keypos, #ejabberd_module.module_host},
{read_concurrency, true}]),
{ok, {{one_for_one, 10, 1}, []}}.
-spec start_child(module(), binary() | global, opts()) -> ok | {error, any()}.