From 0691d7ff9ae7b1cb996581a85664eaed656f22ac Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Wed, 12 Oct 2022 10:40:50 +0800 Subject: [PATCH 1/5] enh: code optimization for insert_req statistics --- source/dnode/vnode/src/vnd/vnodeSvr.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 2482ca1a5a..fe0403e763 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -819,11 +819,12 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq int32_t tsize, ret; SEncoder encoder = {0}; SArray *newTbUids = NULL; + SVStatis statis = {0}; terrno = TSDB_CODE_SUCCESS; pRsp->code = 0; pSubmitReq->version = version; - atomic_fetch_add_64(&pVnode->statis.nBatchInsert, 1); + statis.nBatchInsert = 1; #ifdef TD_DEBUG_PRINT_ROW vnodeDebugPrintSubmitMsg(pVnode, pReq, __func__); @@ -943,18 +944,21 @@ _exit: taosArrayDestroyEx(submitRsp.pArray, tFreeSSubmitBlkRsp); - atomic_fetch_add_64(&pVnode->statis.nInsert, submitRsp.numOfRows); - atomic_fetch_add_64(&pVnode->statis.nInsertSuccess, submitRsp.affectedRows); - // TODO: the partial success scenario and the error case // => If partial success, extract the success submitted rows and reconstruct a new submit msg, and push to level // 1/level 2. // TODO: refactor if ((terrno == TSDB_CODE_SUCCESS) && (pRsp->code == TSDB_CODE_SUCCESS)) { - atomic_fetch_add_64(&pVnode->statis.nBatchInsertSuccess, 1); + statis.nBatchInsertSuccess = 1; tdProcessRSmaSubmit(pVnode->pSma, pReq, STREAM_INPUT__DATA_SUBMIT); } + // N.B not strict as the following update steps is not atomic + atomic_add_fetch_64(&pVnode->statis.nInsert, submitRsp.numOfRows); + atomic_add_fetch_64(&pVnode->statis.nInsertSuccess, submitRsp.affectedRows); + atomic_add_fetch_64(&pVnode->statis.nBatchInsertSuccess, statis.nBatchInsertSuccess); + atomic_add_fetch_64(&pVnode->statis.nBatchInsert, statis.nBatchInsert); + vDebug("vgId:%d, submit success, index:%" PRId64, pVnode->config.vgId, version); return 0; } From 0d50e5933b17dbb0c6977023ca97670ef7ac6ae0 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Wed, 12 Oct 2022 10:46:18 +0800 Subject: [PATCH 2/5] enh: code optimization for insert_req statistics --- source/dnode/vnode/src/vnd/vnodeSvr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index fe0403e763..d4dc7b49b0 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -956,8 +956,8 @@ _exit: // N.B not strict as the following update steps is not atomic atomic_add_fetch_64(&pVnode->statis.nInsert, submitRsp.numOfRows); atomic_add_fetch_64(&pVnode->statis.nInsertSuccess, submitRsp.affectedRows); - atomic_add_fetch_64(&pVnode->statis.nBatchInsertSuccess, statis.nBatchInsertSuccess); atomic_add_fetch_64(&pVnode->statis.nBatchInsert, statis.nBatchInsert); + atomic_add_fetch_64(&pVnode->statis.nBatchInsertSuccess, statis.nBatchInsertSuccess); vDebug("vgId:%d, submit success, index:%" PRId64, pVnode->config.vgId, version); return 0; From 553394ca7fd507fd3701b51756fee273d5a4a7dd Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Wed, 12 Oct 2022 10:47:31 +0800 Subject: [PATCH 3/5] enh: code optimization for insert_req statistics --- source/dnode/vnode/src/vnd/vnodeSvr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index d4dc7b49b0..bcc3fbd4d5 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -953,7 +953,7 @@ _exit: tdProcessRSmaSubmit(pVnode->pSma, pReq, STREAM_INPUT__DATA_SUBMIT); } - // N.B not strict as the following update steps is not atomic + // N.B. not strict as the following update steps is not atomic atomic_add_fetch_64(&pVnode->statis.nInsert, submitRsp.numOfRows); atomic_add_fetch_64(&pVnode->statis.nInsertSuccess, submitRsp.affectedRows); atomic_add_fetch_64(&pVnode->statis.nBatchInsert, statis.nBatchInsert); From 488b4f31fd04dc6e358c5e7773a6161b2b9b3950 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Wed, 12 Oct 2022 10:51:18 +0800 Subject: [PATCH 4/5] enh: code optimization for insert_req statistics --- source/dnode/vnode/src/vnd/vnodeSvr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index bcc3fbd4d5..131327976f 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -953,7 +953,7 @@ _exit: tdProcessRSmaSubmit(pVnode->pSma, pReq, STREAM_INPUT__DATA_SUBMIT); } - // N.B. not strict as the following update steps is not atomic + // N.B. not strict as the following procedure is not atomic atomic_add_fetch_64(&pVnode->statis.nInsert, submitRsp.numOfRows); atomic_add_fetch_64(&pVnode->statis.nInsertSuccess, submitRsp.affectedRows); atomic_add_fetch_64(&pVnode->statis.nBatchInsert, statis.nBatchInsert); From a166882c3e6b9ce4a1717bcce068121cc2a60ebc Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 13 Oct 2022 11:00:59 +0800 Subject: [PATCH 5/5] docs: clarify generated value range of min/max. (#17324) --- docs/en/14-reference/05-taosbenchmark.md | 6 +++--- docs/zh/14-reference/05-taosbenchmark.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/en/14-reference/05-taosbenchmark.md b/docs/en/14-reference/05-taosbenchmark.md index bde5e33034..d95086d4c4 100644 --- a/docs/en/14-reference/05-taosbenchmark.md +++ b/docs/en/14-reference/05-taosbenchmark.md @@ -5,7 +5,7 @@ toc_max_heading_level: 4 description: "taosBenchmark (once called taosdemo ) is a tool for testing the performance of TDengine." --- -## Introduction +# Introduction taosBenchmark (formerly taosdemo ) is a tool for testing the performance of TDengine products. taosBenchmark can test the performance of TDengine's insert, query, and subscription functions and simulate large amounts of data generated by many devices. taosBenchmark can be configured to generate user defined databases, supertables, subtables, and the time series data to populate these for performance benchmarking. taosBenchmark is highly configurable and some of the configurations include the time interval for inserting data, the number of working threads and the capability to insert disordered data. The installer provides taosdemo as a soft link to taosBenchmark for compatibility with past users. @@ -334,9 +334,9 @@ The configuration parameters for specifying super table tag columns and data col - **name** : The name of the column, if used together with count, e.g. "name": "current", "count":3, then the names of the 3 columns are current, current_2. current_3. -- **min**: The minimum value of the column/label of the data type. +- **min**: The minimum value of the column/label of the data type. The generated value will equal or large than the minimum value. -- **max**: The maximum value of the column/label of the data type. +- **max**: The maximum value of the column/label of the data type. The generated value will less than the maxium value. - **values**: The value field of the nchar/binary column/label, which will be chosen randomly from the values. diff --git a/docs/zh/14-reference/05-taosbenchmark.md b/docs/zh/14-reference/05-taosbenchmark.md index 6a6d9e3878..9f4f728f78 100644 --- a/docs/zh/14-reference/05-taosbenchmark.md +++ b/docs/zh/14-reference/05-taosbenchmark.md @@ -334,9 +334,9 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) - **name** : 列的名字,若与 count 同时使用,比如 "name":"current", "count":3, 则 3 个列的名字分别为 current, current_2. current_3。 -- **min** : 数据类型的 列/标签 的最小值。 +- **min** : 数据类型的 列/标签 的最小值。生成的值将大于或等于最小值。 -- **max** : 数据类型的 列/标签 的最大值。 +- **max** : 数据类型的 列/标签 的最大值。生成的值将小于最小值。 - **values** : nchar/binary 列/标签的值域,将从值中随机选择。