24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-10 21:47:01 +02:00

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). get_option(Opt, fun(_) -> true end, false).
init_module_db_table(Modules) -> 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 %% Dirty hack for mod_pubsub
ets:insert(module_db, {mod_pubsub, mnesia}), ets:insert(module_db, {mod_pubsub, mnesia}),
ets:insert(module_db, {mod_pubsub, sql}), ets:insert(module_db, {mod_pubsub, sql}),

View File

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

View File

@ -201,7 +201,8 @@ init([]) ->
lists:foreach(fun host_up/1, ?MYHOSTS), lists:foreach(fun host_up/1, ?MYHOSTS),
ejabberd_hooks:add(host_up, ?MODULE, host_up, 10), ejabberd_hooks:add(host_up, ?MODULE, host_up, 10),
ejabberd_hooks:add(host_down, ?MODULE, host_down, 100), 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(), update_table(),
ejabberd_mnesia:create(?MODULE, iq_response, ejabberd_mnesia:create(?MODULE, iq_response,
[{ram_copies, [node()]}, [{ram_copies, [node()]},

View File

@ -393,7 +393,7 @@ c2s_handle_info(State, _) ->
init([]) -> init([]) ->
process_flag(trap_exit, true), process_flag(trap_exit, true),
lists:foreach(fun(Mod) -> Mod:init() end, get_sm_backends()), 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_up, ?MODULE, host_up, 50),
ejabberd_hooks:add(host_down, ?MODULE, host_down, 60), ejabberd_hooks:add(host_down, ?MODULE, host_down, 60),
lists:foreach(fun host_up/1, ?MYHOSTS), lists:foreach(fun host_up/1, ?MYHOSTS),

View File

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