Browse Source

Remove write concurrency on ETS.

Roberto Ostinelli 3 years ago
parent
commit
6918303b2a
2 changed files with 24 additions and 8 deletions
  1. 1 1
      src/syn_backbone.erl
  2. 23 7
      test/syn_benchmark.erl

+ 1 - 1
src/syn_backbone.erl

@@ -152,7 +152,7 @@ ensure_table_exists(TableId, Scope) ->
             %% regarding decentralized_counters: <https://blog.erlang.org/scalable-ets-counters/>
             ets:new(TableName, [
                 ordered_set, public, named_table,
-                {read_concurrency, true}, {write_concurrency, true}, {decentralized_counters, true}
+                {read_concurrency, true}, {decentralized_counters, true}
             ]),
             ok;
 

+ 23 - 7
test/syn_benchmark.erl

@@ -26,7 +26,21 @@
 -module(syn_benchmark).
 
 %% API
--compile([export_all]).
+-export([
+    start/0,
+    start_processes/1,
+    process_loop/0,
+    register_on_node/3,
+    do_register_on_node/2,
+    unregister_on_node/3,
+    do_unregister_on_node/2,
+    wait_registration_propagation/1,
+    wait_unregistration_propagation/1
+]).
+-export([
+    start_profiling/0,
+    stop_profiling/0
+]).
 
 %% ===================================================================
 %% API
@@ -76,9 +90,6 @@ start() ->
         maps:put(Node, Pids, Acc)
     end, #{}, NodesInfo),
 
-%%    {ok, P} = eprof:start(),
-%%    eprof:start_profiling(erlang:processes() -- [P]),
-
     %% start registration
     lists:foreach(fun({Node, FromName, _ToName}) ->
         Pids = maps:get(Node, PidsMap),
@@ -101,9 +112,6 @@ start() ->
     RegistrationRate = ProcessCount / RegTakenTime,
     io:format("====> Registeration rate (with propagation): ~p/sec.~n~n", [RegistrationRate]),
 
-%%    eprof:stop_profiling(),
-%%    eprof:analyze(total),
-
     timer:sleep(1000),
 
     %% start unregistration
@@ -228,3 +236,11 @@ wait_unregistration_propagation([{_Node, _FromName, ToName} | NodeInfosTail] = N
             timer:sleep(50),
             wait_unregistration_propagation(NodesInfo)
     end.
+
+start_profiling() ->
+    {ok, P} = eprof:start(),
+    eprof:start_profiling(erlang:processes() -- [P]).
+
+stop_profiling() ->
+    eprof:stop_profiling(),
+    eprof:analyze(total).