Skip to content

Commit

Permalink
Merge pull request #141 from AdRoll/main
Browse files Browse the repository at this point in the history
Ets tweaks for improving performance
  • Loading branch information
uwiger authored Jan 18, 2023
2 parents 66c287e + 79f5e17 commit 8dabf3f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/exometer_admin.erl
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,12 @@ create_reporter_tabs() ->
create_ets_tabs() ->
case ets:info(?EXOMETER_SHARED, name) of
undefined ->
[ets:new(T, [public, named_table, set, {keypos,2}])
[ets:new(T, [public, named_table, set, {keypos,2}, {read_concurrency, true}, {write_concurrency, true}, {decentralized_counters, true}])
|| T <- tables()],
ets:new(?EXOMETER_SHARED, [public, named_table, ordered_set,
{keypos, 2}]),
ets:new(?EXOMETER_ENTRIES, [public, named_table, ordered_set,
{keypos, 2}]),
{keypos, 2}, {read_concurrency, true}, {write_concurrency, true}]),
ets:new(?EXOMETER_REPORTERS, [public, named_table, set,
{keypos, 2}]),
ets:new(?EXOMETER_SUBS, [public, named_table, ordered_set,
Expand Down
2 changes: 1 addition & 1 deletion src/exometer_cache.erl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ update_tref(Name, TRef) ->
ensure_table() ->
case ets:info(?TABLE, name) of
undefined ->
ets:new(?TABLE, [set, public, named_table, {keypos, 2}]);
ets:new(?TABLE, [set, public, named_table, {keypos, 2}, {read_concurrency, true}, {write_concurrency, true}]);
_ ->
true
end.
Expand Down
4 changes: 2 additions & 2 deletions src/exometer_uniform.erl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ behaviour() ->

probe_init(Name, _Type, Options) ->
St = process_opts(#st { name = Name }, [ {percentiles, [ 50, 75, 90, 95, 99, 999 ]} ] ++ Options),
EtsRef = ets:new(uniform, [ set, { keypos, 2 } ]),
EtsRef = ets:new(uniform, [ set, {keypos, 2}, {read_concurrency, true}, {write_concurrency, true} ]),

%% Setup random seed, if not already done.
case get(random_seed) of
Expand Down Expand Up @@ -105,7 +105,7 @@ probe_update(Value, St) ->

probe_reset(St) ->
ets:delete(St#st.ets_ref),
EtsRef = ets:new(uniform, [ set, { keypos, 2 } ]),
EtsRef = ets:new(uniform, [ set, { keypos, 2 }, {read_concurrency, true}, {write_concurrency, true} ]),
{ok, St#st { ets_ref = EtsRef, cur_sz = 0 }}.

probe_sample(_St) ->
Expand Down

0 comments on commit 8dabf3f

Please sign in to comment.