Experiment with new cache size algorithm

Remove the jitter probability and make it a smooth function heading
towards the max ache size
This commit is contained in:
martinsumner 2016-11-03 09:19:02 +00:00
parent 94436d8dfd
commit e8a7888397
2 changed files with 10 additions and 7 deletions

View file

@ -162,7 +162,6 @@
-define(SHUTDOWN_WAITS, 60).
-define(SHUTDOWN_PAUSE, 10000).
-define(SNAPSHOT_TIMEOUT, 300000).
-define(JITTER_PROB, 0.01).
-define(CHECKJOURNAL_PROB, 0.2).
-record(state, {inker :: pid(),
@ -780,13 +779,15 @@ maybepush_ledgercache(MaxCacheSize, Cache, Penciller) ->
maybe_withjitter(CacheSize, MaxCacheSize) ->
if
CacheSize > 2 * MaxCacheSize ->
true;
CacheSize > MaxCacheSize ->
R = random:uniform(),
T = 2 * MaxCacheSize - CacheSize,
R = random:uniform(CacheSize),
if
R < ?JITTER_PROB ->
R > T ->
true;
true ->
false
@ -795,6 +796,8 @@ maybe_withjitter(CacheSize, MaxCacheSize) ->
false
end.
load_fun(KeyInLedger, ValueInLedger, _Position, Acc0, ExtractFun) ->
{MinSQN, MaxSQN, OutputTree} = Acc0,
{SQN, Type, PK} = KeyInLedger,

View file

@ -7,12 +7,12 @@
-export([all/0]).
-export([simple_load_with2i/1,
simple_querycount/1,
query_count/1,
rotating_objects/1]).
all() -> [
simple_load_with2i,
simple_querycount,
query_count,
rotating_objects].
@ -41,9 +41,9 @@ simple_load_with2i(_Config) ->
testutil:reset_filestructure().
simple_querycount(_Config) ->
query_count(_Config) ->
RootPath = testutil:reset_filestructure(),
{ok, Book1} = leveled_bookie:book_start(RootPath, 2500, 50000000),
{ok, Book1} = leveled_bookie:book_start(RootPath, 2000, 50000000),
{TestObject, TestSpec} = testutil:generate_testobject("Bucket",
"Key1",
"Value1",