-
Notifications
You must be signed in to change notification settings - Fork 5.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
*: add max/avg cop response time for TableReader, IndexReader and IndexLookupReader. #12003
Conversation
…tidb into dev/add_cop_resp_time
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.
The execution format in Cop task is proc max:%v, min:%v, p80:%v, p95:%v, rows:%v, iters:%v, tasks:%v
Could you unify them?
/run-unit-test |
Codecov Report
@@ Coverage Diff @@
## master #12003 +/- ##
===========================================
Coverage 81.3524% 81.3524%
===========================================
Files 453 453
Lines 97450 97450
===========================================
Hits 79278 79278
Misses 12510 12510
Partials 5662 5662 |
/run-all-tests |
util/execdetails/execdetails.go
Outdated
} | ||
|
||
// RecordOneCopTask record once cop response time to update maxCopRespTime | ||
func (rrs *ReaderRuntimeStats) RecordOneCopTask(t time.Duration) { |
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.
no need to export this function.
defer e.mu.Unlock() | ||
stats, exists := e.readerStats[planID] | ||
if !exists { | ||
stats = &ReaderRuntimeStats{copRespTime: make([]time.Duration, 0, 20)} |
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.
Just curious, why setting the slice capacity to 20
?
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.
Just a casual value.
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 you have any idea or just set it zero.
planner/core/common_plans.go
Outdated
} | ||
switch p.(type) { | ||
case *PhysicalTableReader, *PhysicalIndexReader, *PhysicalIndexLookUpReader: | ||
if runtimeStatsColl.GetReaderStats(explainID) != nil { |
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.
if runtimeStatsColl.GetReaderStats(explainID) != nil { | |
if s := runtimeStatsColl.GetReaderStats(explainID); s != nil { |
planner/core/common_plans.go
Outdated
switch p.(type) { | ||
case *PhysicalTableReader, *PhysicalIndexReader, *PhysicalIndexLookUpReader: | ||
if runtimeStatsColl.GetReaderStats(explainID) != nil { | ||
analyzeInfo += ", " + runtimeStatsColl.GetReaderStats(explainID).String() |
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.
analyzeInfo += ", " + runtimeStatsColl.GetReaderStats(explainID).String() | |
analyzeInfo += ", " + s.String() |
em, no |
util/execdetails/execdetails.go
Outdated
sort.Slice(rrs.copRespTime, func(i, j int) bool { | ||
return rrs.copRespTime[i] < rrs.copRespTime[j] | ||
}) | ||
s := "cop resp time " |
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 shorter? How about the same form as proc time
and call it rpc time
?
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.
That's OK.
In mocktikv. It doesn't have tidb(localhost:4000) > desc analyze select /*+ read_from_storage(tiflash[lineitem]) */ * from lineitem;
+-------------------+------------+--------------+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+-----$-----------------+
| id | count | task | operator info | execution info | memo$y |
+-------------------+------------+--------------+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+-----$-----------------+
| TableReader_5 | 6001215.00 | root | data:TableScan_4 | time:50.560209007s, loops:5862, rows:6001215, cop resp time max:23.160214791s, min:3.868990591s, avg:10.995373571s, p80:22.553894442s, p95:22.684954285s | 163.83687496185303 MB |
| └─TableScan_4 | 6001215.00 | cop[tiflash] | table:lineitem, range:[-inf,+inf], keep order:false | proc max:1.176744s, min:382.01ms, p80:1.03543s, p95:1.093618s, rows:6001215, iters:796, tasks:63 | N/A |
+-------------------+------------+--------------+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+
2 rows in set (50.81 sec) |
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
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
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
Your auto merge job has been accepted, waiting for 12009, 12085 |
@zz-jason Prev auto-merge job caused conflicts. The approvement is dismissed by merge master. |
/merge |
/run-all-tests |
What problem does this PR solve?
fix #12148
When
explain analyze
only shows the running time in coprocessor, but it doesn't consider the network trans time, encode time in coprocessor and decode time in tidb. So this PR adds a max coprocessor response time to fetch more information.Check List
Tests
Code changes
Side effects