insert慢

从哪里能确定是网络的问题?

https://docs.pingcap.com/zh/tidb/stable/exporting-grafana-snapshots#将-grafana-监控数据导出成快照 导出下监控快照 overview,pd,tidb ,tikv detail

apply 和 commit log 这块都没问题,写入也正常


这个地方还有异常,这个地方的问题,只能看日志来确定了

gRPC 就是网络请求这块的… 从你贴图上来看,有偶发性的问题

通过这块可以查阅 IO 的情况
Overview > System Info > IO Util

稍等,我把监控快照收集一下吧。

我把overview的监控快照收集一下

这个是版本读取的,按图上来看是正常的

还有两个指标
grafana → TiKV-Details

Scheduler - prewrite

  • Scheduler command duration:执行 prewrite 命令所需花费的时间,正常情况下,应该小于 1s
  • Scheduler latch wait duration:由于 latch wait 造成的时间开销,正常情况下,应该小于 1s

可以观测下实际的情况

收集信息的是,面板数量一直出不来,要一直等吗?

相关监控快照。

就这一个insert 慢,不是一直都有吧

指标都正常呢

这个insert有什么特殊的么?不会是一个宽表,或者其中某个字符串是json或者text类型的吧

我这边prewrite也有这个情况,总执行2.30s,prewrite 2.29s,不过我那个是大批量执行多条insert,锁冲突比较严重

看dashboard的慢查询信息,不是一直都有

不是宽表,字段内容就是普通的数据。没有特殊的。

你好,我想确认下,这种情况主要看哪几个指标呢?

指标都在上面告知你拉
如果你想知道更详细的,可以参考下面的帖子

那我这个指标都正常,但是21s,是啥原因呢

慢sql日志内容发下

Time: 2021-11-24T21:01:06.310736278+08:00

Txn_start_ts: 429328654982184966

User@Host: face[face] @ xx.xx.xx.xx [xx.xx.xx.xx]

Conn_ID: 4193892

Query_time: 20.056996458

Parse_time: 0.000096199

Compile_time: 0.000104568

Rewrite_time: 0.000075352

Prewrite_time: 20.055750885 Wait_prewrite_binlog_time: 0.000000429 Commit_time: 0.000709949 Get_commit_ts_time: 0.000114714 Commit_backoff_time: 0.052 Backoff_types: [tikvRPC regionMiss] Write_keys: 2 Write_size: 482 Prewrite_region: 3

DB: face_auth

Is_internal: false

Digest: f9f95dce1fde015d43e321ccc56c34689d6d9d14f448f2602e6822d793467c85

Num_cop_tasks: 0

Mem_max: 3631

Prepared: false

Plan_from_cache: false

Has_more_results: false

KV_total: 20.004409508

PD_total: 0.000347744

Backoff_total: 0.052

Write_sql_response_total: 0

Succ: true

Plan: tidb_decode_plan(‘PfA8MAkyN18xCTAJMAlOL0EJMAl0aW1lOjk5Ljc0NcK1cywgbG9vcHM6MQkzLjU0NTg5ODQzNzUgS0IJTi9BCg==’)

use face_auth;
INSERT INTO t_face_log ( id, insert_time, update_time, cipher_token, auth_code, cipher_pass, channel_code, company_code, sup_pref_code, check_code, name, cert_no, cert_type_code, threshold, service_code, source_info, update_period, res_code, res_msg, authentication_id, auth_result, source_code, charge_flag, update_date, data_period, score, auth_time, req_time, res_time, call_period, esign, status ) VALUES ( ‘5dfb923dcfc542159c2a7d8f847004cf’, ‘2021-11-24 21:00:46’, ‘2021-11-24 21:00:46’, ‘0010000001622443831402’, ‘admin’, ‘a77bb74868a03445187e91e97e7e7d08’, ‘001’, ‘000000’, 650000, ‘d63b2f8c2e07202a471c9cf906c82c3b’, ‘123’, ‘652829199606181919’, 111, 0.9, ‘101’, ‘01’, 0, ‘200’, ‘成功’, ‘9bc335d7b87f3d3826ed034dd865654a’, ‘10001’, ‘01’, ‘1’, ‘2021-11-24 00:00:00’, ‘2027-11-23 00:00:00’, 0.830, ‘2021-11-24 21:00:46’, ‘2021-11-24 21:00:45’, ‘2021-11-24 21:00:46’, 1166, ‘’, ‘1’ );