隨筆之TDengine基準測試示例

文章目錄

    • 一、基本信息
    • 二、基準測試策略
    • 三、基準測試過程
      • 1. 模擬高并發寫入場景
      • 2. 模擬并發查詢場景
    • 四、基準測試結論

一、基本信息

  • TDengine 版本:3.3.6.13(目前最新版本)
  • 服務器配置:16核CPU,32GB內存,高IO 1000GB存

二、基準測試策略

  • 測試數據庫:
    • 數據庫:test
    • 超級表:meters(含字段 ts, current, voltage, phase 和標簽 groupid, location)
  • 測試工具:taosBenchmark(TDengine 自帶的性能測試工具)
  • 測試目標??:
    • 模擬高并發寫入場景,評估數據庫的寫入性能。
    • 模擬并發查詢場景,評估數據庫的查詢性能。

三、基準測試過程

1. 模擬高并發寫入場景

root@sjfwq-v1-p-0-107:~# taosBenchmark -y
[07/21 11:48:25.593007] INFO: client version: 3.3.6.13Connect mode is : Native[07/21 11:48:26.910499] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.188987] INFO: command to create database: <CREATE DATABASE IF NOT EXISTS test PRECISION 'ms';>
[07/21 11:48:27.189020] SUCC: created database (test)
[07/21 11:48:27.189332] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.191098] INFO: stable meters does not exist, will create one
[07/21 11:48:27.191125] INFO: create stable: <CREATE TABLE IF NOT EXISTS test.meters (ts TIMESTAMP,current float,voltage int,phase float) TAGS (groupid int,location binary(24))>
[07/21 11:48:27.191389] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.200606] INFO: generate stable<meters> columns data with lenOfCols<80> * prepared_rand<20000>
[07/21 11:48:27.219827] INFO: restful connect -> convertServAddr host=localhost port:6041 to serv_addr=0x2ad77f24 iface=0 
[07/21 11:48:27.219839] INFO: start creating 10000 table(s) with 8 thread(s)
[07/21 11:48:27.220192] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.220668] INFO: thread[0] start creating table from 0 to 1249
[07/21 11:48:27.220788] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.221215] INFO: thread[1] start creating table from 1250 to 2499
[07/21 11:48:27.221367] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.221881] INFO: thread[2] start creating table from 2500 to 3749
[07/21 11:48:27.221922] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.222315] INFO: thread[3] start creating table from 3750 to 4999
[07/21 11:48:27.222393] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.223102] INFO: thread[4] start creating table from 5000 to 6249
[07/21 11:48:27.223197] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.223581] INFO: thread[5] start creating table from 6250 to 7499
[07/21 11:48:27.223683] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.224055] INFO: thread[6] start creating table from 7500 to 8749
[07/21 11:48:27.224163] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.225133] INFO: thread[7] start creating table from 8750 to 9999
[07/21 11:48:27.662916] SUCC: Spent 0.4430 seconds to create 10000 table(s) with 8 thread(s) speed: 22573 tables/s, already exist 0 table(s), actual 10000 table(s) pre created, 0 table(s) will be auto created
[07/21 11:48:27.663173] INFO: init pthread_join 0 ...
[07/21 11:48:27.663240] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.663282] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.663320] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.663243] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.663362] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.663362] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.663409] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.663418] SUCC: host:(null) port:0  connect successfully.
[07/21 11:48:27.663853] INFO: init pthread_join 1 ...
[07/21 11:48:27.663864] INFO: init pthread_join 2 ...
[07/21 11:48:27.663949] INFO: init pthread_join 3 ...
[07/21 11:48:27.663956] INFO: init pthread_join 4 ...
[07/21 11:48:27.663983] INFO: init pthread_join 5 ...
[07/21 11:48:27.664106] INFO: init pthread_join 6 ...
[07/21 11:48:27.664125] INFO: init pthread_join 7 ...
[07/21 11:48:27.664188] INFO: Estimate memory usage: 12.20MB
[07/21 11:48:27.664196] INFO: run insert thread. real nthread=8
[07/21 11:48:27.664234] INFO: thread[0] start progressive inserting into table from 0 to 1250
[07/21 11:48:27.664255] INFO: thread[1] start progressive inserting into table from 1250 to 2500
[07/21 11:48:27.664278] INFO: thread[2] start progressive inserting into table from 2500 to 3750
[07/21 11:48:27.664295] INFO: thread[3] start progressive inserting into table from 3750 to 5000
[07/21 11:48:27.664323] INFO: thread[4] start progressive inserting into table from 5000 to 6250
[07/21 11:48:27.664358] INFO: thread[5] start progressive inserting into table from 6250 to 7500
[07/21 11:48:27.664381] INFO: thread[6] start progressive inserting into table from 7500 to 8750
[07/21 11:48:27.664388] INFO: pthread_join 0 ...
[07/21 11:48:27.664401] INFO: thread[7] start progressive inserting into table from 8750 to 10000
[07/21 11:48:52.467670] SUCC: thread[1] progressive mode, completed total inserted rows: 12500000, 537815.02 records/second
[07/21 11:48:52.528920] SUCC: thread[3] progressive mode, completed total inserted rows: 12500000, 535889.46 records/second
[07/21 11:48:52.644246] SUCC: thread[7] progressive mode, completed total inserted rows: 12500000, 534693.89 records/second
[07/21 11:48:52.693441] SUCC: thread[4] progressive mode, completed total inserted rows: 12500000, 533009.17 records/second
[07/21 11:48:52.753257] SUCC: thread[0] progressive mode, completed total inserted rows: 12500000, 532702.66 records/second
[07/21 11:48:52.753402] INFO: pthread_join 1 ...
[07/21 11:48:52.753416] INFO: pthread_join 2 ...
[07/21 11:48:52.772948] SUCC: thread[5] progressive mode, completed total inserted rows: 12500000, 532017.61 records/second
[07/21 11:48:52.879224] SUCC: thread[6] progressive mode, completed total inserted rows: 12500000, 529537.68 records/second
[07/21 11:48:53.156213] SUCC: thread[2] progressive mode, completed total inserted rows: 12500000, 524104.91 records/second
[07/21 11:48:53.156314] INFO: pthread_join 3 ...
[07/21 11:48:53.156329] INFO: pthread_join 4 ...
[07/21 11:48:53.156374] INFO: pthread_join 5 ...
[07/21 11:48:53.156401] INFO: pthread_join 6 ...
[07/21 11:48:53.156413] INFO: pthread_join 7 ...
[07/21 11:48:53.157329] SUCC: Spent 25.492230 (real 23.476738) seconds to insert rows: 100000000 with 8 thread(s) into test 3922763.92 (real 4259535.55) records/second
[07/21 11:48:53.157361] SUCC: insert delay, min: 8.7650ms, avg: 18.7814ms, p90: 17.1450ms, p95: 29.5320ms, p99: 366.1130ms, max: 670.7390ms
[07/21 11:48:53.157378] INFO: free resource and exit ... 

結果解讀:

  • 數據庫初始化與表創建測試?:創建超級表、子表創建 (10,000張),耗時:??0.443秒??,??22,573表/秒??
  • 數據寫入測試?:數據量(1億行),寫入線程(8線程),總耗時(??25.49秒??),寫入吞吐量(??3,922,764行/秒??),平均延遲(18.78ms)

2. 模擬并發查詢場景

root@sjfwq-v1-p-0-107:~/taosBenchmark# taosBenchmark -f query.json 
[07/21 17:02:22.358884] INFO: query.json
{"filetype":	"query","cfgdir":	"/etc/taos","host":	"127.0.0.1","port":	6030,"user":	"root","password":	"taosdata","confirm_parameter_prompt":	"no","continue_if_fail":	"yes","databases":	"test","query_times":	10,"query_mode":	"taosc","specified_table_query":	{"query_interval":	1,"threads":	3,"sqls":	[{"sql":	"select last_row(*) from meters","result":	"./query_res0.txt"}, {"sql":	"select count(*) from d0","result":	"./query_res1.txt"}]}
}
[07/21 17:02:22.359004] INFO: read host from json: 127.0.0.1 .
[07/21 17:02:22.359011] INFO: read user from json: root .
[07/21 17:02:22.359013] INFO: read password from json: ** .
[07/21 17:02:22.408407] INFO: client version: 3.3.6.13Connect mode is : Native[07/21 17:02:22.411254] INFO: Set engine cfgdir successfully, dir:/etc/taos
[07/21 17:02:23.693357] SUCC: host:127.0.0.1 port:0  connect successfully.
[07/21 17:02:23.722231] SUCC: host:127.0.0.1 port:0  connect successfully.
[07/21 17:02:23.722993] SUCC: host:127.0.0.1 port:0  connect successfully.
complete query with 3 threads and 30 sql 1 spend 3.845735s QPS: 7.801 query delay avg: 0.382693s min: 0.367124s max: 0.419617s p90: 0.395527s p95: 0.416581s p99: 0.419617s SQL command: select last_row(*) from meters 
[07/21 17:02:27.569303] SUCC: host:127.0.0.1 port:0  connect successfully.
[07/21 17:02:27.569746] SUCC: host:127.0.0.1 port:0  connect successfully.
[07/21 17:02:27.570143] SUCC: host:127.0.0.1 port:0  connect successfully.
[07/21 17:02:27.572642] INFO: do sleep 1ms ...
[07/21 17:02:27.573148] INFO: do sleep 1ms ...
[07/21 17:02:27.573166] INFO: do sleep 1ms ...
[07/21 17:02:27.574560] INFO: do sleep 1ms ...
[07/21 17:02:27.577159] INFO: do sleep 1ms ...
[07/21 17:02:27.577603] INFO: do sleep 1ms ...
[07/21 17:02:27.577804] INFO: do sleep 1ms ...
[07/21 17:02:27.579129] INFO: do sleep 1ms ...
[07/21 17:02:27.579714] INFO: do sleep 1ms ...
[07/21 17:02:27.581079] INFO: do sleep 1ms ...
[07/21 17:02:27.581663] INFO: do sleep 1ms ...
[07/21 17:02:27.582607] INFO: do sleep 1ms ...
[07/21 17:02:27.583555] INFO: do sleep 1ms ...
[07/21 17:02:27.584650] INFO: do sleep 1ms ...
[07/21 17:02:27.585559] INFO: do sleep 1ms ...
complete query with 3 threads and 30 sql 2 spend 0.016352s QPS: 1834.638 query delay avg: 0.000997s min: 0.000745s max: 0.001392s p90: 0.001370s p95: 0.001387s p99: 0.001392s SQL command: select count(*) from d0 
[07/21 17:02:27.586718] INFO: Spend 5.1750 second completed total queries: 60, the QPS of all threads:     11.594 ,error 0 (rate:0.000%)[07/21 17:02:27.586729] INFO: free resource and exit ...

結果解讀:

  • 數據查詢測試?:SELECT COUNT(*) FROM d0(??1,654.6 QPS??,平均延遲0.000948s )
  • 數據查詢測試: SELECT last_row(*) from METERS( ??5.415?? QPS), 查詢 METERS 表的??最新行數, METERS 表數據量很大(1 億行),TDengine 需要掃描索引找到最新數據,可能涉及磁盤 I/O,所以很慢。

四、基準測試結論

  • 寫入性能??:

    • 1億行數據寫入僅耗時25.49秒,吞吐量達 ??400萬行/秒?? 級別,遠超傳統時序數據庫(如InfluxDB的10萬~50萬行/秒)。
    • 子表創建速度極快(22,573表/秒),適合大規模設備接入場景。
  • 查詢性能??:

    • COUNT(*)查詢??:QPS極高(1,654.6),因僅需統計單表行數,適合高頻監控場景。
    • select last_row():查詢 meters 表的 ??最新行數據??(類似于 SELECT * FROM meters ORDER BY ts DESC LIMIT 1),如果 meters 表數據量極大(如 1 億行),last_row() 需要掃描所有子表或索引,導致延遲高。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/91406.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/91406.shtml
英文地址,請注明出處:http://en.pswp.cn/web/91406.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【IQA技術專題】DISTS代碼講解

本文是對DISTS圖像質量評價指標的代碼解讀&#xff0c;原文解讀請看DISTS文章講解。 本文的代碼來源于IQA-Pytorch工程。 1、原文概要 以前的一些IQA方法對于捕捉紋理上的感知一致性有所欠缺&#xff0c;魯棒性不足。基于此&#xff0c;作者開發了一個能夠在圖像結構和圖像紋…

2024年SEVC SCI2區,一致性虛擬領航者跟蹤群集算法GDRRT*-PSO+多無人機路徑規劃,深度解析+性能實測

目錄1.摘要2.算法背景3.GDRRT*-PSO與虛擬領航者跟蹤算法4.結果展示5.參考文獻6.算法輔導應用定制讀者交流1.摘要 隨著無人機技術的快速發展及其卓越的運動和機動性能&#xff0c;無人機在社會和軍事等諸多領域得到了廣泛應用。多無人機協同作業&#xff0c;能夠顯著提升任務執…

鏈特異性文庫是什么?為什么它在轉錄組測序中越來越重要?

鏈特異性文庫是什么&#xff1f;為什么它在轉錄組測序中越來越重要&#xff1f; 在現代分子生物學研究中&#xff0c;RNA測序&#xff08;RNA-seq&#xff09; 是一種廣泛應用的技術&#xff0c;用于分析基因在不同條件下的表達情況。而在RNA-seq的眾多技術細節中&#xff0c;有…

ClickHouse vs PostgreSQL:數據分析領域的王者之爭,誰更勝一籌?

文章概要 作為一名數據架構師&#xff0c;我經常被問到一個問題&#xff1a;在眾多數據庫選擇中&#xff0c;ClickHouse和PostgreSQL哪一個更適合我的項目&#xff1f;本文將深入探討這兩種數據庫系統的核心差異、性能對比、適用場景以及各自的優缺點&#xff0c;幫助您在技術選…

面向對象系統的單元測試層次

面向對象系統的單元測試層次面向對象&#xff08;Object-Oriented, OO&#xff09;編程范式引入了封裝、繼承和多態等核心概念&#xff0c;這使得傳統的、基于函數的單元測試方法不再充分。面向對象系統的單元測試必須適應其獨特的結構和行為特性&#xff0c;從單一方法擴展到類…

如何用USRP捕獲手機信號波形(上)系統及知識準備

目錄&#xff1a; 如何用USRP捕獲手機信號波形&#xff08;上&#xff09;系統及知識準備 如何用USRP捕獲手機信號波形&#xff08;中&#xff09;手機/基站通信 如何用USRP捕獲手機信號波形&#xff08;下&#xff09;協議分析 一、手機通信參數獲取 首先用Cellular-z網絡…

C語言-數組:數組(定義、初始化、元素的訪問、遍歷)內存和內存地址、數組的查找算法和排序算法;

本章概述思維導圖&#xff1a;C語言數組在C語言中&#xff0c;數組是一種固定大小的、相同類型元素的有序集合&#xff0c;通過索引&#xff08;下標&#xff09;訪問。數組數組&#xff1a;是一種容器&#xff0c;可以用來存儲同種數據類型的多個值&#xff1b;數組特點&#…

河南萌新聯賽2025第(二)場:河南農業大學(補題)

文章目錄前言A.約數個數和整除分塊(相當于約數求和)相關例題&#xff1a;取模B.異或期望的秘密二進制的規律相關例題累加器小藍的二進制詢問乘法逆元1. 概念2.基本定義3.費馬小定理1.定理內容2.重要推論D.開羅爾網絡的備用連接方案E.咕咕嘎嘎!!!(easy)I.猜數游戲(easy)K.打瓦M.…

常見中間件漏洞

一、TomcatTomcat put方法任意文件寫入漏洞環境搭建&#xff0c;啟動時端口被占用就改yml配置文件&#xff0c;改成8081端口。(我這里是8080)cd vulhub-master/tomcat/CVE-2017-12615 docker-compose up -d 去抓包&#xff0c;改成put提交。下面的內容是用哥斯拉生成的木馬文件…

27.(vue3.x+vite)以pinia為中心的開發模板(監聽watch)

效果截圖 代碼實現: HelloWorld.vue <template><div style="padding: 20px">介紹:<br />1:使用統一的 watch 來監聽store的值。<br

Jenkins 詳解

Jenkins 是一個開源的持續集成和持續交付(CI/CD)工具&#xff0c;用于自動化軟件開發過程中的構建、測試和部署階段。以下是關于 Jenkins 的詳細介紹&#xff1a; 1. Jenkins 核心概念 1.1 持續集成(CI) 開發人員頻繁地將代碼變更提交到共享倉庫每次提交都會觸發自動構建和測試…

動態配置實現過程

查看DCCValueBeanFactory類的完整實現&#xff0c;了解動態配置的實現過程 動態配置實現過程 1. 自定義注解 使用DCCValue注解標記需要動態配置的字段&#xff0c;格式為key:defaultValue&#xff1a; DCCValue("downgradeSwitch:0") private String downgradeSw…

【大模型理論篇】跨語言AdaCOT

參考&#xff1a;AdaCoT: Rethinking Cross-Lingual Factual Reasoning throughAdaptive Chain-of-ThoughtAdaCoT&#xff08;Adaptive Chain-of-Thought&#xff0c;自適應思維鏈&#xff09;是一項提升大型語言模型&#xff08;LLMs&#xff09;跨語言事實推理能力的新框架。…

vue3項目搭建

前一段時間招聘前端開發,發現好多開發連基本的創建項目都不會,這里總結一下 在Vue 3中,使用Webpack和Vite創建的項目文件結構及語言(JS/TS)的選擇有以下主要區別: 1. 創建方式與文件結構差異 方式一、Webpack(Vue CLI) 創建命令: vue create project-name 典型文件結構…

企業簽名的多種形式

企業簽名有多種形式&#xff0c;可分為企業簽名獨立版、企業簽名穩定版、企業簽名共享版等。每一種形式的企業簽名都有其獨特的特點&#xff0c;其中&#xff1a;  企業簽名獨立版&#xff1a;其特性主要為穩定性較高&#xff0c;使用者可以通過控制APP的下載量來保證APP的穩…

解構遠程智能系統的視頻能力鏈:從RTSP|RTMP協議接入到Unity3D頭顯呈現全流程指南

在人工智能奔騰的2025年&#xff0c;WAIC&#xff08;世界人工智能大會&#xff09;釋放出一個明確信號&#xff1a;視頻能力已經成為通往“遠程智能”的神經中樞。在無人機、四足機器人、遠程施工、巡檢等新興場景中&#xff0c;一套可靠、低延遲、可嵌入頭顯設備的視頻傳輸系…

Less Less基礎

1.lessless是一種動態樣式語言&#xff0c;屬于CSS預處理器的范疇&#xff0c;它擴展了CSS語言&#xff0c;增加了變量&#xff0c;Mixin&#xff0c;函數等特性&#xff0c;使CSS更易維護和擴展。Less既可以在客戶端上運行&#xff0c;也可以借助Node.js在服務端運行。2.Less中…

如何使用 Redis 實現 API 網關或單個服務的請求限流?

使用 Redis 高效實現 API 網關與服務的請求限流 在微服務架構中&#xff0c;對 API 網關或單個服務的請求進行速率限制至關重要&#xff0c;以防止惡意攻擊、資源濫用并確保系統的穩定性和可用性。 Redis 憑借其高性能、原子操作和豐富的數據結構&#xff0c;成為實現請求限流的…

圖片查重從設計到實現(7) :使用 Milvus 實現高效圖片查重功能

使用 Milvus 實現高效圖片查重功能本文將介紹如何利用 Milvus 向量數據庫構建一個高效的圖片查重系統&#xff0c;通過傳入圖片就能快速從已有數據中找出匹配度高的相似圖片。一.什么是圖片查重&#xff1f; 圖片查重指的是通過算法識別出內容相同或高度相似的圖片&#xff0c;…

誘導多能干細胞(iPSC)的自述

自十七年前誘導多能干細胞&#xff08;也稱iPS細胞或iPSC&#xff09;技術出現以來&#xff0c;干細胞生物學和再生醫學取得了巨大進展。人類iPSC已廣泛用于疾病建模、藥物發現和細胞療法開發。新的病理機制已被闡明&#xff0c;源自iPSC篩選的新藥正在研發中&#xff0c;并且首…