-
Couldn't load subscription status.
- Fork 9.1k
HADOOP-19729. [ABFS][Perf] Network Profiling for Tailing Requests and Killing Bad Connections Proactively #8043
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
base: trunk
Are you sure you want to change the base?
Conversation
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
| } | ||
|
|
||
| public boolean isTailLatencyRequestTimeoutEnabled() { | ||
| return isTailLatencyRequestTimeoutEnabled && isTailLatencyTrackerEnabled |
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.
first check should be for isTailLatencyTrackerEnabled
| return tailLatencyAnalysisWindowInMillis; | ||
| } | ||
|
|
||
| public int getTailLatencyPercentileComputationIntervalInMillis() { |
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.
Name should be shortened
|
|
||
| public static final boolean DEFAULT_FS_AZURE_ENABLE_CREATE_BLOB_IDEMPOTENCY = true; | ||
|
|
||
| public static final boolean DEFAULT_FS_AZURE_ENABLE_TAIL_LATENCY_TRACKER = false; |
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.
Do we not want this feature to be enabled by default ?
| } catch (TimeoutException e) { | ||
| /* Deadline exceeded, abort the request. | ||
| * This will also kill the underlying socket exception in the HttpClient. | ||
| * Connection will be marker stale and won't be returned back to KAC for reuse. |
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.
nit: typo marked
| /** | ||
| * Constant for Static Retry Policy Abbreviation. {@value} | ||
| */ | ||
| public static final String TAIL_LATENCY_TIMEOUT_RETRY_POLICY_ABBREVIATION = "T"; |
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.
Can we make it TL ?
| int significantFigures, | ||
| final AbfsRestOperationType operationType) { | ||
| if (windowSizeMillis <= 0) throw new IllegalArgumentException("windowSizeMillis > 0"); | ||
| if (numberOfSegments <= 0) throw new IllegalArgumentException("bucketDurationMillis > 0"); |
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.
Should be numberOfSegments in exception
| /** Get any percentile over the current sliding window. */ | ||
| public void computeLatency() { | ||
| if (getCurrentTotalCount() < minSampleSize) { | ||
| LOG.debug("[{}] Not enough data to report percentiles. Current total count: {}", |
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.
We can return here itself
| p50 = tmpForMerge.getValueAtPercentile(50); | ||
| p90 = tmpForMerge.getValueAtPercentile(90); | ||
| p99 = tmpForMerge.getValueAtPercentile(99); | ||
| deviation = (int) ((tailLatency - p50)/p50 * 100); |
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.
Chances of division by zero error
| activeSegmentRecorder.getIntervalHistogramInto(tmpForDelta); | ||
| currentSegmentAccumulation.add(tmpForDelta); | ||
|
|
||
| if (currentSegmentAccumulation.getTotalCount() <= 0) { |
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.
Is less than 0 possible for total count? It is incremented always right
| // Next slot is now going to be eradicated. Remove its count from total. | ||
| currentTotalCount.set(currentTotalCount.get() - (completedSegments[currentIdx] == null ? 0 : completedSegments[currentIdx].getTotalCount())); | ||
| // Store an immutable snapshot (make sure we don't mutate the instance after storing) | ||
| completedSegments[currentIdx] = currentSegmentAccumulation; |
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.
how are we making sure that this is immutable after this point ? completedSegments[currentIdx] = currentSegmentAccumulation.copy(); ideally we should create a deep copy of the histogram data so that even if currentSegmentAccumulation is reused or reset for the next segment, the data in completedSegments remains unchanged.
| /** Ensure active bucket is aligned to current time; rotate if we've crossed a boundary. */ | ||
| public void rotateIfNeeded() { | ||
| LOG.debug("[{}] Triggering Histogram Rotation", operationType); | ||
| long now = System.currentTimeMillis(); |
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.
what is the use of the variable now ? We can directly use System.currentTimeMillis(); in expectedStart as we are doing later in line 195
| */ | ||
| private String failureReason; | ||
| private AbfsRetryPolicy retryPolicy; | ||
| private boolean shouldTailLatencyTimeout = true; |
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.
Can be renamed to enableTailLatencyTimeout
| } | ||
|
|
||
| // Update Tail Latency Tracker only for successful requests. | ||
| if (tailLatencyTracker != null && statusCode < HttpURLConnection.HTTP_MULT_CHOICE) { |
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.
Will get updated for -1 status code as well, should be checked between 200 to 300
|
|
||
| @Test | ||
| public void testSlidingWindowHdrHistogram() throws Exception { | ||
| SlidingWindowHdrHistogram histogram = new SlidingWindowHdrHistogram( |
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.
add comment for which value represents what
| // Verify that analysis window is full after full rotation. | ||
| assertThat(histogram.isAnalysisWindowFilled()).isTrue(); | ||
|
|
||
| // Verify that percentiles are not computed due to low deviation |
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.
nit: should be computed ?
Description of PR
Jira: https://issues.apache.org/jira/browse/HADOOP-19729
It has been observed that certain requests taking more time than expected to complete hinders the performance of whole workload. Such requests are known as tailing requests. They can be taking more time due to a number of reasons and the prominent among them is a bad network connection. In Abfs driver we cache network connections and keeping such bad connections in cache and reusing them can be bad for perf.
In this effort we try to identify such connections and close them so that new good connetions can be established and perf can be improved. There are two parts of this effort.
Identifying Tailing Requests: This involves profiling all the network calls and getting percentiles value optimally. By default we consider p99 as the tail latency and all the future requests taking more than tail latency will be considere as Tailing requests.
Proactively Killing Socket Connections: With Apache client, we can now kill the socket connection and fail the tailing request. Such failures will not be thrown back to user and retried immediately without any sleep but from another socket connection.
How was this patch tested?
New tests around both profiling and connection killing added.