[
https://issues.apache.org/jira/browse/PHOENIX-6052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17644219#comment-17644219
]
Aman Poonia commented on PHOENIX-6052:
--------------------------------------
This seems like a good idea. I was looking at the the related code for the same
{code:java}
// code placeholder
private void sendMutations() {
...
do {
htable.batch()
...
mutationCommitTime = EnvironmentEdgeManager.currentTimeMillis() - startTime;
GLOBAL_MUTATION_COMMIT_TIME.update(mutationCommitTime);
} while();
...
}
{code}
This method sendMutation is called thrice for each mutation in sendBatch() and
syscat call happens in sendBatch method
{code:java}
void sendBatch() {
...
long
serverTimestamp =
serverTimeStamps == null ?
validateAndGetServerTimestamp(tableRef,
multiRowMutationState) :
serverTimeStamps[i++];
...
// Phase 1: Send index mutations with the empty column value = "unverified"
sendMutations(unverifiedIndexMutations.entrySet().iterator(), span,
indexMetaDataPtr, false);
// Phase 2: Send data table and other indexes
sendMutations(physicalTableMutationMap.entrySet().iterator(), span,
indexMetaDataPtr, false);
// Phase 3: Send put index mutations with the empty column value =
"verified" and/or delete index mutations
try {
sendMutations(verifiedOrDeletedIndexMutations.entrySet().iterator(), span,
indexMetaDataPtr, true);
} catch (SQLException ex) {
LOGGER.warn(
"Ignoring exception that happened during setting index
verified value to verified=TRUE ",
ex);
}
}
{code}
There are two ways we can add syscat time. either we pass the time taken for
validateAndGetServerTimestamp() to sendMutation and then add that time in each
phase of sendmutation (basically all three times) or instead of measuing the
mutation time from within sendMutation we move that out to sendBatch and time
each invokation of sendMutation and add syscat time with the time taken in
sendMutation
something like
{code:java}
...
long StartTime = EnvironmentEdgeManager.currentTimeMillis();
serverTimestamp = serverTimeStamps == null ?
validateAndGetServerTimestamp(tableRef, multiRowMutationState) :
serverTimeStamps[i++];
long syscatTime = startTime - EnvironmentEdgeManager.currentTimeMillis();
long StartTime = EnvironmentEdgeManager.currentTimeMillis()
sendMutation()
sendMutation()
try {
sendMutation()
} catch(){
}
long endTime = startTime - EnvironmentEdgeManager.currentTimeMillis()
mutationTime = endTime + syscattime
//update the metric{code}
[~shahrs87] [~kadir] [~tkhurana] what do you guys think?
> GLOBAL_MUTATION_COMMIT_TIME metric doesn't include the time spent in syscat
> rpc's
> ---------------------------------------------------------------------------------
>
> Key: PHOENIX-6052
> URL: https://issues.apache.org/jira/browse/PHOENIX-6052
> Project: Phoenix
> Issue Type: Bug
> Components: core
> Affects Versions: 4.14.3
> Reporter: Rushabh Shah
> Assignee: Aman Poonia
> Priority: Major
>
> Currently we measure the metric GLOBAL_MUTATION_COMMIT_TIME as the time spent
> just in htable.batch rpc for base and index tables.
> https://github.com/apache/phoenix/blob/master/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java#L1029-L1136
> We don't measure the time spent in
> MutationState#validateAndGetServerTimestamp which makes rpc to SYSTEM.CATALOG
> table and which is a part of commit phase.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)