Alter logging to help understand performance factors

Change logging of the snapshots to better understand performance
This commit is contained in:
martinsumner 2017-03-06 10:17:51 +00:00
parent b1e12a3bc5
commit 5c2f05858d
4 changed files with 13 additions and 7 deletions

View file

@ -644,7 +644,6 @@ bucket_stats(State, Bucket, Tag) ->
{LedgerSnapshot, LedgerCache}, {LedgerSnapshot, LedgerCache},
_JournalSnapshot} = snapshot_store(State, ledger, no_lookup), _JournalSnapshot} = snapshot_store(State, ledger, no_lookup),
Folder = fun() -> Folder = fun() ->
leveled_log:log("B0004", [cache_size(LedgerCache)]),
load_snapshot(LedgerSnapshot, LedgerCache), load_snapshot(LedgerSnapshot, LedgerCache),
StartKey = leveled_codec:to_ledgerkey(Bucket, null, Tag), StartKey = leveled_codec:to_ledgerkey(Bucket, null, Tag),
EndKey = leveled_codec:to_ledgerkey(Bucket, null, Tag), EndKey = leveled_codec:to_ledgerkey(Bucket, null, Tag),
@ -848,10 +847,12 @@ snapshot_store(State, SnapType) ->
snapshot_store(State, SnapType, undefined). snapshot_store(State, SnapType, undefined).
snapshot_store(State, SnapType, Query) -> snapshot_store(State, SnapType, Query) ->
SW = os:timestamp(),
PCLopts = #penciller_options{start_snapshot=true, PCLopts = #penciller_options{start_snapshot=true,
source_penciller=State#state.penciller}, source_penciller=State#state.penciller},
{ok, LedgerSnapshot} = leveled_penciller:pcl_start(PCLopts), {ok, LedgerSnapshot} = leveled_penciller:pcl_start(PCLopts),
LedgerCache = readycache_forsnapshot(State#state.ledger_cache, Query), LedgerCache = readycache_forsnapshot(State#state.ledger_cache, Query),
leveled_log:log_timer("B0004", [cache_size(LedgerCache)], SW),
case SnapType of case SnapType of
store -> store ->
InkerOpts = #inker_options{start_snapshot=true, InkerOpts = #inker_options{start_snapshot=true,

View file

@ -35,7 +35,7 @@
{"B0003", {"B0003",
{info, "Bookie closing for reason ~w"}}, {info, "Bookie closing for reason ~w"}},
{"B0004", {"B0004",
{info, "Length of increment in snapshot is ~w"}}, {info, "Initialised PCL clone and length of increment in snapshot is ~w"}},
{"B0005", {"B0005",
{info, "LedgerSQN=~w at startup"}}, {info, "LedgerSQN=~w at startup"}},
{"B0006", {"B0006",
@ -59,9 +59,9 @@
{info, "Get timing for result ~w is sample ~w total ~w and max ~w"}}, {info, "Get timing for result ~w is sample ~w total ~w and max ~w"}},
{"P0001", {"P0001",
{info, "Ledger snapshot ~w registered"}}, {debug, "Ledger snapshot ~w registered"}},
{"P0003", {"P0003",
{info, "Ledger snapshot ~w released"}}, {debug, "Ledger snapshot ~w released"}},
{"P0004", {"P0004",
{info, "Remaining ledger snapshots are ~w"}}, {info, "Remaining ledger snapshots are ~w"}},
{"P0005", {"P0005",
@ -129,7 +129,9 @@
{"P0035", {"P0035",
{info, "Startup with Manifest SQN of ~w"}}, {info, "Startup with Manifest SQN of ~w"}},
{"P0036", {"P0036",
{info, "Garbage collection on mnaifest removes key for filename ~s"}}, {info, "Garbage collection on manifest removes key for filename ~s"}},
{"P0037",
{info, "Merging of penciller L0 tree to size ~w complete"}},
{"PC001", {"PC001",
{info, "Penciller's clerk ~w started with owner ~w"}}, {info, "Penciller's clerk ~w started with owner ~w"}},

View file

@ -397,6 +397,7 @@ handle_call({fetch_keys, StartKey, EndKey, AccFun, InitAcc, MaxKeys},
_From, _From,
State=#state{snapshot_fully_loaded=Ready}) State=#state{snapshot_fully_loaded=Ready})
when Ready == true -> when Ready == true ->
SW = os:timestamp(),
L0AsList = L0AsList =
case State#state.levelzero_astree of case State#state.levelzero_astree of
undefined -> undefined ->
@ -407,7 +408,9 @@ handle_call({fetch_keys, StartKey, EndKey, AccFun, InitAcc, MaxKeys},
List -> List ->
List List
end, end,
leveled_log:log_timer("P0037",
[length(L0AsList)],
SW),
SetupFoldFun = SetupFoldFun =
fun(Level, Acc) -> fun(Level, Acc) ->
Pointers = leveled_pmanifest:range_lookup(State#state.manifest, Pointers = leveled_pmanifest:range_lookup(State#state.manifest,

View file

@ -289,12 +289,12 @@ release_snapshot(Manifest, Pid) ->
{SnapList0, MinSnapSQN} = lists:foldl(FilterFun, {SnapList0, MinSnapSQN} = lists:foldl(FilterFun,
{[], infinity}, {[], infinity},
Manifest#manifest.snapshots), Manifest#manifest.snapshots),
leveled_log:log("P0004", [SnapList0]),
case SnapList0 of case SnapList0 of
[] -> [] ->
Manifest#manifest{snapshots = SnapList0, Manifest#manifest{snapshots = SnapList0,
min_snapshot_sqn = 0}; min_snapshot_sqn = 0};
_ -> _ ->
leveled_log:log("P0004", [SnapList0]),
Manifest#manifest{snapshots = SnapList0, Manifest#manifest{snapshots = SnapList0,
min_snapshot_sqn = MinSnapSQN} min_snapshot_sqn = MinSnapSQN}
end. end.