]> granicus.if.org Git - ejabberd/commitdiff
Set 'read_concurrency' for some ETS tables
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Wed, 5 Apr 2017 12:10:18 +0000 (15:10 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Wed, 5 Apr 2017 12:10:18 +0000 (15:10 +0300)
src/ejabberd_config.erl
src/ejabberd_hooks.erl
src/ejabberd_local.erl
src/ejabberd_sm.erl
src/gen_mod.erl

index fbfbb49829ae20b6a04e937c01eec993b1635eb9..791460dc2443b8740205dbbaa80c314b27c1f1c4 100644 (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}),
index 602ac577fe1160372986682226f94514d3c7ee05..22e54d66aeebc2a1ecd5cd269b5d7b230b8170f0 100644 (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{}}.
 
 %%----------------------------------------------------------------------
index d2f1b20dbcb5a25e172ac86ee88834c0300188c7..00ce222743bf79fcb600e3c59c1462304fb8e962 100644 (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()]},
index 1600a2c923b1e0e67450965791bae78e501a14bd..2b6dd2e3727905eaff8f36241f6f61d620b431da 100644 (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),
index ef000635d72e00b2c596bf054d7fbb4524c08f81..4b845a386204753d4012931a96630ef6a2db0610 100644 (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()}.