resource_control: add ru details in ExecDetails#1070
resource_control: add ru details in ExecDetails#1070bufferflies merged 2 commits intotikv:masterfrom
Conversation
|
@nolouch @bufferflies PTAL |
|
/cc @JmPotato As we add ru metrics into ExecDetails, seems we can let |
| } | ||
|
|
||
| consumption, penalty, priority, err := resourceControlInterceptor.OnRequestWait(ctx, resourceGroupName, reqInfo) | ||
| consumption, penalty, waitDuration, priority, err := resourceControlInterceptor.OnRequestWait(ctx, resourceGroupName, reqInfo) |
There was a problem hiding this comment.
how about use one struct ?
There was a problem hiding this comment.
Not sure if there is a best practice. The different between tuple and struct is not large, I see many other functions return multiple parameters.
| if stmtExec := ctx.Value(util.ExecDetailsKey); stmtExec != nil { | ||
| detail := stmtExec.(*util.ExecDetails) | ||
| atomic.AddInt64(&detail.MilliRRU, int64(consumption.RRU*1000.0)) | ||
| atomic.AddInt64(&detail.MilliRRU, int64(consumption.RRU*1000.0)) |
There was a problem hiding this comment.
why it needs to retry again?
util/execdetails.go
Outdated
| WaitRUDuration int64 | ||
| // total read ans write ru in 1/1000 | ||
| MilliRRU int64 | ||
| MilliWRU int64 |
There was a problem hiding this comment.
where does it use in this pr?
| return | ||
| } | ||
| if stmtExec := ctx.Value(util.ExecDetailsKey); stmtExec != nil { | ||
| detail := stmtExec.(*util.ExecDetails) |
There was a problem hiding this comment.
Does it maybe nil in some scenario?
There was a problem hiding this comment.
No. If the value exists, it should not be nil, otherwise the context value should not exist.
| detail := stmtExec.(*util.ExecDetails) | ||
| atomic.AddInt64(&detail.MilliRRU, int64(consumption.RRU*1000.0)) | ||
| atomic.AddInt64(&detail.MilliWRU, int64(consumption.WRU*1000.0)) | ||
| if waitDuration > time.Duration(0) { |
There was a problem hiding this comment.
what‘s the different if remove this condition? I think zero doesn't need to treat alone.
There was a problem hiding this comment.
Because the Duration is always 0 in OnResponse call, it's a very frequent value, so not need to do the atomic operation in this case. Though, the performance difference should be quite low.
|
Rest LGTM, you need to sync the upstream. |
util/execdetails.go
Outdated
| WaitPDRespDuration int64 | ||
| WaitRUDuration int64 | ||
| // total read ans write ru in 1/1000 | ||
| MilliRRU int64 |
There was a problem hiding this comment.
Is Milli for precision? I think it correspond to milliseconds, but this is multiplied by 1000.
There was a problem hiding this comment.
Yes. naming similar to millisecond, not sure if it is the correct naming.
…ikv#1032) Signed-off-by: zzm <zhouzemin@pingcap.com>
Signed-off-by: glorv <glorvs@163.com>
* collecting the RU information by pasing point through context.Value (tikv#1032) Signed-off-by: zzm <zhouzemin@pingcap.com> * add ruWaitDuration to RUDetails and update pd-client Signed-off-by: glorv <glorvs@163.com> --------- Signed-off-by: zzm <zhouzemin@pingcap.com> Signed-off-by: glorv <glorvs@163.com> Co-authored-by: zzm <zhouzemin@pingcap.com> Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
* collecting the RU information by pasing point through context.Value (tikv#1032) Signed-off-by: zzm <zhouzemin@pingcap.com> * add ruWaitDuration to RUDetails and update pd-client Signed-off-by: glorv <glorvs@163.com> --------- Signed-off-by: zzm <zhouzemin@pingcap.com> Signed-off-by: glorv <glorvs@163.com> Co-authored-by: zzm <zhouzemin@pingcap.com>
…#1151) * resource_control: add ru details in ExecDetails (#1070) * collecting the RU information by pasing point through context.Value (#1032) Signed-off-by: zzm <zhouzemin@pingcap.com> * add ruWaitDuration to RUDetails and update pd-client Signed-off-by: glorv <glorvs@163.com> --------- Signed-off-by: zzm <zhouzemin@pingcap.com> Signed-off-by: glorv <glorvs@163.com> Co-authored-by: zzm <zhouzemin@pingcap.com> * use latest pd-client of release-7.5 Signed-off-by: nolouch <nolouch@gmail.com> --------- Signed-off-by: zzm <zhouzemin@pingcap.com> Signed-off-by: glorv <glorvs@163.com> Signed-off-by: nolouch <nolouch@gmail.com> Co-authored-by: glorv <glorvs@163.com> Co-authored-by: zzm <zhouzemin@pingcap.com>
* collecting the RU information by pasing point through context.Value (tikv#1032) Signed-off-by: zzm <zhouzemin@pingcap.com> * add ruWaitDuration to RUDetails and update pd-client Signed-off-by: glorv <glorvs@163.com> --------- Signed-off-by: zzm <zhouzemin@pingcap.com> Signed-off-by: glorv <glorvs@163.com> Co-authored-by: zzm <zhouzemin@pingcap.com> Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
* collecting the RU information by pasing point through context.Value (tikv#1032) Signed-off-by: zzm <zhouzemin@pingcap.com> * add ruWaitDuration to RUDetails and update pd-client Signed-off-by: glorv <glorvs@163.com> --------- Signed-off-by: zzm <zhouzemin@pingcap.com> Signed-off-by: glorv <glorvs@163.com> Co-authored-by: zzm <zhouzemin@pingcap.com> Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
* collecting the RU information by pasing point through context.Value (tikv#1032) Signed-off-by: zzm <zhouzemin@pingcap.com> * add ruWaitDuration to RUDetails and update pd-client Signed-off-by: glorv <glorvs@163.com> --------- Signed-off-by: zzm <zhouzemin@pingcap.com> Signed-off-by: glorv <glorvs@163.com> Co-authored-by: zzm <zhouzemin@pingcap.com> Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
) (tikv#1151) * resource_control: add ru details in ExecDetails (tikv#1070) * collecting the RU information by pasing point through context.Value (tikv#1032) Signed-off-by: zzm <zhouzemin@pingcap.com> * add ruWaitDuration to RUDetails and update pd-client Signed-off-by: glorv <glorvs@163.com> --------- Signed-off-by: zzm <zhouzemin@pingcap.com> Signed-off-by: glorv <glorvs@163.com> Co-authored-by: zzm <zhouzemin@pingcap.com> * use latest pd-client of release-7.5 Signed-off-by: nolouch <nolouch@gmail.com> --------- Signed-off-by: zzm <zhouzemin@pingcap.com> Signed-off-by: glorv <glorvs@163.com> Signed-off-by: nolouch <nolouch@gmail.com> Co-authored-by: glorv <glorvs@163.com> Co-authored-by: zzm <zhouzemin@pingcap.com> Signed-off-by: zzm <zhouzemin@pingcap.com>
* collecting the RU information by pasing point through context.Value (tikv#1032) Signed-off-by: zzm <zhouzemin@pingcap.com> * add ruWaitDuration to RUDetails and update pd-client Signed-off-by: glorv <glorvs@163.com> --------- Signed-off-by: zzm <zhouzemin@pingcap.com> Signed-off-by: glorv <glorvs@163.com> Co-authored-by: zzm <zhouzemin@pingcap.com> Signed-off-by: iosmanthus <myosmanthustree@gmail.com> Signed-off-by: zzm <zhouzemin@pingcap.com>
* collecting the RU information by pasing point through context.Value (tikv#1032) Signed-off-by: zzm <zhouzemin@pingcap.com> * add ruWaitDuration to RUDetails and update pd-client Signed-off-by: glorv <glorvs@163.com> --------- Signed-off-by: zzm <zhouzemin@pingcap.com> Signed-off-by: glorv <glorvs@163.com> Co-authored-by: zzm <zhouzemin@pingcap.com> Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
cherry-pick #1032 to master and add
RUWaitDurationto RUDetails. RUDetails is used in recording executing log and slow log in tidb.