-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HADOOP-19362. RPC metrics should be updated correctly when call is defered. #7224
base: trunk
Are you sure you want to change the base?
Conversation
24c1de0
to
9bee480
Compare
9bee480
to
e201bfc
Compare
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@Hexiaoqiao @KeeProMise @haiyang1987 Sir, could you please help review this PR when you are free ? Thanks a lot. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hfutatzhanghb Hi, thanks for your contribution! leave some comments.
*/ | ||
void updateDeferredMetrics(Call call, String name, long processingTime) { | ||
long completionTimeNanos = Time.monotonicNowNanos(); | ||
long arrivalTimeNanos = call.timestampNanos; | ||
|
||
ProcessingDetails details = call.getProcessingDetails(); | ||
long waitTime = | ||
details.get(Timing.LOCKWAIT, rpcMetrics.getMetricsTimeUnit()); | ||
long responseTime = | ||
details.get(Timing.RESPONSE, rpcMetrics.getMetricsTimeUnit()); | ||
rpcMetrics.addRpcLockWaitTime(waitTime); | ||
rpcMetrics.addRpcProcessingTime(processingTime); | ||
rpcMetrics.addRpcResponseTime(responseTime); | ||
rpcMetrics.addDeferredRpcProcessingTime(processingTime); | ||
rpcDetailedMetrics.addDeferredProcessingTime(name, processingTime); | ||
// don't include lock wait for detailed metrics. | ||
processingTime -= waitTime; | ||
rpcDetailedMetrics.addProcessingTime(name, processingTime); | ||
|
||
// Overall processing time is from arrival to completion. | ||
long overallProcessingTime = rpcMetrics.getMetricsTimeUnit() | ||
.convert(completionTimeNanos - arrivalTimeNanos, TimeUnit.NANOSECONDS); | ||
rpcDetailedMetrics.addOverallProcessingTime(name, overallProcessingTime); | ||
callQueue.addResponseTime(name, call, details); | ||
if (isLogSlowRPC()) { | ||
logSlowRpcCalls(name, call, details); | ||
} | ||
if (details.getReturnStatus() == RpcStatusProto.SUCCESS) { | ||
rpcMetrics.incrRpcCallSuccesses(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some duplicate code in this method and updateMetrics; we can extract the common code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KeeProMise Sir, thanks for your reviewing. This is a good suggestion, but i am worrying about the code readability will not be good. What's your opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hfutatzhanghb got it.
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine2.java
Outdated
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
private static final ThreadLocal<Long> CUR_CALL_STARTNANOS = new ThreadLocal<Long>(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CUR_CALL_STARTNANOS Can it be deleted directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Have fixed~ Thanks a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hfutatzhanghb LGTM.
Hi, @Hexiaoqiao if you have time, please help to take a look at this PR, thanks!
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. +1. Thanks @hfutatzhanghb and @KeeProMise
Description of PR
Currently, RPC processing metrics and some other metrics were not updated when a RpcCall was defered.
This will cause FairCallQueue not works well. So, We should take defered calls as normal calls.