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

View file

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

View file

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