Jitter co-ordination issues
Experiment to try and reoslve jitter co-orsination issue
This commit is contained in:
parent
ac45f95559
commit
34e7ce170a
1 changed files with 10 additions and 4 deletions
|
@ -140,12 +140,13 @@
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
-define(CACHE_SIZE, 1800).
|
-define(CACHE_SIZE, 2000).
|
||||||
-define(JOURNAL_FP, "journal").
|
-define(JOURNAL_FP, "journal").
|
||||||
-define(LEDGER_FP, "ledger").
|
-define(LEDGER_FP, "ledger").
|
||||||
-define(SNAPSHOT_TIMEOUT, 300000).
|
-define(SNAPSHOT_TIMEOUT, 300000).
|
||||||
-define(CHECKJOURNAL_PROB, 0.2).
|
-define(CHECKJOURNAL_PROB, 0.2).
|
||||||
-define(CACHE_SIZE_JITTER, 360).
|
-define(CACHE_SIZE_JITTER, 20).
|
||||||
|
-define(JOURNAL_SIZE_JITTER, 10)
|
||||||
|
|
||||||
-record(state, {inker :: pid(),
|
-record(state, {inker :: pid(),
|
||||||
penciller :: pid(),
|
penciller :: pid(),
|
||||||
|
@ -230,8 +231,9 @@ init([Opts]) ->
|
||||||
% Start from file not snapshot
|
% Start from file not snapshot
|
||||||
{InkerOpts, PencillerOpts} = set_options(Opts),
|
{InkerOpts, PencillerOpts} = set_options(Opts),
|
||||||
{Inker, Penciller} = startup(InkerOpts, PencillerOpts),
|
{Inker, Penciller} = startup(InkerOpts, PencillerOpts),
|
||||||
|
CacheJitter = ?CACHE_SIZE div ?CACHE_SIZE_JITTER,
|
||||||
CacheSize = get_opt(cache_size, Opts, ?CACHE_SIZE)
|
CacheSize = get_opt(cache_size, Opts, ?CACHE_SIZE)
|
||||||
+ erlang:phash2(self()) band ?CACHE_SIZE_JITTER,
|
+ erlang:phash2(self()) band CacheJitter,
|
||||||
leveled_log:log("B0001", [Inker, Penciller]),
|
leveled_log:log("B0001", [Inker, Penciller]),
|
||||||
{ok, #state{inker=Inker,
|
{ok, #state{inker=Inker,
|
||||||
penciller=Penciller,
|
penciller=Penciller,
|
||||||
|
@ -663,7 +665,11 @@ snapshot_store(State, SnapType) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
set_options(Opts) ->
|
set_options(Opts) ->
|
||||||
MaxJournalSize = get_opt(max_journalsize, Opts, 10000000000),
|
MaxJournalSize0 = get_opt(max_journalsize, Opts, 10000000000),
|
||||||
|
JournalSizeJitter = MaxJournalSize0 div ?JOURNAL_SIZE_JITTER,
|
||||||
|
MaxJournalSize = MaxJournalSize0 -
|
||||||
|
erlang:phash2(self()) band JournalSizeJitter,
|
||||||
|
|
||||||
SyncStrat = get_opt(sync_strategy, Opts, sync),
|
SyncStrat = get_opt(sync_strategy, Opts, sync),
|
||||||
WRP = get_opt(waste_retention_period, Opts),
|
WRP = get_opt(waste_retention_period, Opts),
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue