Trigger log points, deprecate lower PUT log points

Only record PUT timings at the Bookie, and trigger them correctly on the
right log point
This commit is contained in:
martinsumner 2017-02-26 19:07:55 +00:00
parent a732650b0c
commit fad9bfbff1
3 changed files with 12 additions and 25 deletions

View file

@ -109,8 +109,7 @@
inker :: pid(),
deferred_delete = false :: boolean(),
waste_path :: string(),
sync_strategy = none,
put_timing :: tuple()}).
sync_strategy = none}).
%%%============================================================================
@ -279,7 +278,6 @@ writer({put_kv, Key, Value}, _From, State) ->
{State#state.last_position, State#state.hashtree},
State#state.binary_mode,
State#state.max_size),
T0 = timer:now_diff(os:timestamp(), SW),
case Result of
roll ->
%% Key and value could not be written
@ -292,15 +290,10 @@ writer({put_kv, Key, Value}, _From, State) ->
_ ->
ok
end,
T1 = timer:now_diff(os:timestamp(), SW) - T0,
Timings = leveled_log:put_timing(journal,
State#state.put_timing,
T0, T1),
{reply, ok, writer, State#state{handle=UpdHandle,
last_position=NewPosition,
last_key=Key,
hashtree=HashTree,
put_timing=Timings}}
hashtree=HashTree}}
end;
writer({mput_kv, []}, _From, State) ->
{reply, ok, writer, State};

View file

@ -136,8 +136,7 @@
clerk :: pid(),
compaction_pending = false :: boolean(),
is_snapshot = false :: boolean(),
source_inker :: pid(),
put_timing :: tuple()}).
source_inker :: pid()}).
%%%============================================================================
@ -415,17 +414,12 @@ put_object(LedgerKey, Object, KeyChanges, State) ->
NewSQN,
Object,
KeyChanges),
T0 = timer:now_diff(os:timestamp(), SW),
case leveled_cdb:cdb_put(ActiveJournal,
JournalKey,
JournalBin) of
ok ->
T1 = timer:now_diff(os:timestamp(), SW) - T0,
UpdPutTimes = leveled_log:put_timing(inker,
State#state.put_timing,
T0, T1),
{ok,
State#state{journal_sqn=NewSQN, put_timing=UpdPutTimes},
State#state{journal_sqn=NewSQN},
byte_size(JournalBin)};
roll ->
SWroll = os:timestamp(),

View file

@ -14,9 +14,9 @@
get_timing/3,
sst_timing/3]).
-define(PUT_LOGPOINT, 20000).
-define(HEAD_LOGPOINT, 50000).
-define(GET_LOGPOINT, 50000).
-define(PUT_LOGPOINT, 10000).
-define(HEAD_LOGPOINT, 20000).
-define(GET_LOGPOINT, 20000).
-define(SST_LOGPOINT, 20000).
-define(LOG_LEVEL, [info, warn, error, critical]).
-define(SAMPLE_RATE, 16).
@ -353,15 +353,15 @@ log_timer(LogReference, Subs, StartTime) ->
put_timing(_Actor, undefined, T0, T1) ->
{1, {T0, T1}, {T0, T1}};
put_timing(Actor, {?PUT_LOGPOINT, {Total0, Total1}, {Max0, Max1}}, T0, T1) ->
RN = random:uniform(?HEAD_LOGPOINT),
case RN > ?HEAD_LOGPOINT div 2 of
RN = random:uniform(?PUT_LOGPOINT),
case RN > ?PUT_LOGPOINT div 2 of
true ->
% log at the timing point less than half the time
LogRef =
case Actor of
bookie -> "B0012";
inker -> "I0019";
journal -> "CDB17"
bookie -> "B0012" %;
% inker -> "I0019";
% journal -> "CDB17"
end,
log(LogRef, [?PUT_LOGPOINT, Total0, Total1, Max0, Max1]),
put_timing(Actor, undefined, T0, T1);