{"id":17775,"date":"2025-03-23T10:50:59","date_gmt":"2025-03-23T02:50:59","guid":{"rendered":"https:\/\/www.orczhou.com\/?p=17775"},"modified":"2025-03-23T10:50:59","modified_gmt":"2025-03-23T02:50:59","slug":"about-mysql-benchmark-tool-sysbench","status":"publish","type":"post","link":"https:\/\/www.orczhou.com\/index.php\/2025\/03\/about-mysql-benchmark-tool-sysbench\/","title":{"rendered":"MySQL \u538b\u6d4b\u5de5\u5177 Sysbench \u751f\u4ea7\u6570\u636e\u5927\u5c0f\u9884\u4f30"},"content":{"rendered":"<div id=\"tocer-1\" class=\"tocer tocer-pos-flt-e\"><div class=\"tocer-toc\"><header class=\"tocer-header\"><h2 class=\"tocer-title\">\u76ee\u5f55<\/h2>\n<\/header>\n<ul class=\"tocer-list tocer-adv tocer-sp-os-bf tocer-st-ctrs-dec tocer-lvl1\"><li><div><a href=\"#tocer-heading-1\">\u7ed3\u8bba\u6982\u8ff0<\/a><\/div><\/li>\n<li><div><a href=\"#tocer-heading-2\">\u751f\u6210\u6570\u636e\u547d\u4ee4<\/a><\/div><\/li>\n<li><div><a href=\"#tocer-heading-3\">\u5360\u7528\u7a7a\u95f4\u5927\u5c0f<\/a><\/div><\/li>\n<li><div><a href=\"#tocer-heading-4\">\u6570\u636e\u751f\u6210\u65f6\u95f4\u7edf\u8ba1<\/a><\/div><\/li>\n<li><div><a href=\"#tocer-heading-5\">\u5173\u4e8e\u201c\u6807\u51c6\u6d4b\u8bd5\u201d<\/a><\/div><\/li>\n<li class=\"tocer-has-sub\"><div><a href=\"#tocer-heading-6\">\u66f4\u591a\u7edf\u8ba1<\/a><\/div>\n<ul class=\"tocer-sublist tocer-lvl2\"><li><div><a href=\"#tocer-heading-7\">Sysbench 500\u4e07\u6570\u636e\u5927\u5c0f<\/a><\/div><\/li>\n<li><div><a href=\"#tocer-heading-8\">Sysbench 1\u5343\u4e07\u6570\u636e\u5927\u5c0f<\/a><\/div><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<p>Sysbench \u662f MySQL \u793e\u4ea4\u5e38\u7528\u7684\u538b\u6d4b\u5de5\u5177\uff0c\u672c\u6587\u5bf9 Sysbench \u9ed8\u8ba4\u538b\u6d4b\u8868\u5927\u5c0f\u8fdb\u884c\u5206\u6790\uff0c\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u4e86\u89e3\u8be5\u6d4b\u8bd5\u8fd0\u884c\u65f6\u7684\u6570\u636e\u91cf\u5927\u5c0f\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u7ed3\u8bba\u6982\u8ff0<\/h4>\n\n\n\n<p>\u6d4b\u8bd5\u4e86 100\u4e07\u3001500\u4e07\u6570\u636e\uff0c\u5360\u7528\u7a7a\u95f4\u5927\u5c0f\u53ef\u4ee5\u53c2\u8003\u5982\u4e0b\u6570\u636e\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\">sysbench \u8868\u5927\u5c0f\u9884\u4f30<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u5355\u8868\u8bb0\u5f55<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u8868\u6570\u91cf<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u603b\u7a7a\u95f4\u9884\u4f30<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">\u573a\u666f 1<\/td><td class=\"has-text-align-center\" data-align=\"center\">1,000,000<\/td><td class=\"has-text-align-center\" data-align=\"center\">10<\/td><td class=\"has-text-align-center\" data-align=\"center\">2.3 GB<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">\u573a\u666f 2<\/td><td class=\"has-text-align-center\" data-align=\"center\">5,000,000<\/td><td class=\"has-text-align-center\" data-align=\"center\">16<\/td><td class=\"has-text-align-center\" data-align=\"center\">18.4 GB<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">\u573a\u666f 3<\/td><td class=\"has-text-align-center\" data-align=\"center\">10,000,000<\/td><td class=\"has-text-align-center\" data-align=\"center\">16<\/td><td class=\"has-text-align-center\" data-align=\"center\">36.32 GB<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">\u751f\u6210\u6570\u636e\u547d\u4ee4<\/h4>\n\n\n\n<p>\u8fd9\u91cc\u4f7f\u7528\u5982\u4e0b\u7684\u547d\u4ee4\u8fdb\u884c\u6570\u636e\u751f\u6210<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">sysbench --mysql-host=... --mysql-db=sysbenchdb --db-driver=mysql \\\n         --mysql-user=... --mysql-password=...   \\\n         --table_size=1000000 --tables=10 prepare<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u5360\u7528\u7a7a\u95f4\u5927\u5c0f<\/h4>\n\n\n\n<p>\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u89c2\u5bdf\u6570\u636e\u5e93\u4e2d\u7684\u8868\u5927\u5c0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">MySQL [sysbenchdb]&gt; show table status like '%sbtest1%'\\G\n*************************** 1. row ***************************\n           Name: sbtest1\n         Engine: InnoDB\n        Version: 10\n     Row_format: Dynamic\n           Rows: 986400\n Avg_row_length: 228\n    Data_length: 225132544\nMax_data_length: 0\n   Index_length: 16269312\n      Data_free: 4194304\n Auto_increment: 1000001\n    Create_time: 2025-03-01 05:57:45\n    Update_time: 2025-03-01 05:57:45\n     Check_time: NULL\n      Collation: utf8mb4_0900_ai_ci\n       Checksum: NULL\n Create_options:\n        Comment:<\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u5355\u8868\u7ea6\u4e3a <code>230 MB<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">(225132544+16269312)\/1024\/1024 ~ 230 <\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>\u518d\u901a\u8fc7\u6570\u636e\u5e93\u7684\u7269\u7406\u6587\u4ef6\u89c2\u5bdf\u5927\u5c0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\"># ls -lah\ntotal 2.4G\ndrwxr-x---  2 mysql mysql 4.0K Mar  1 14:04 .\ndrwxr-x--x 11 mysql mysql 4.0K Mar  1 14:02 ..\n-rw-r-----  1 mysql mysql 240M Mar  1 14:04 sbtest10.ibd\n-rw-r-----  1 mysql mysql 240M Mar  1 14:00 sbtest1.ibd\n-rw-r-----  1 mysql mysql 240M Mar  1 14:01 sbtest2.ibd\n-rw-r-----  1 mysql mysql 240M Mar  1 14:01 sbtest3.ibd\n-rw-r-----  1 mysql mysql 240M Mar  1 14:02 sbtest4.ibd\n-rw-r-----  1 mysql mysql 240M Mar  1 14:02 sbtest5.ibd\n-rw-r-----  1 mysql mysql 240M Mar  1 14:03 sbtest6.ibd\n-rw-r-----  1 mysql mysql 240M Mar  1 14:03 sbtest7.ibd\n-rw-r-----  1 mysql mysql 240M Mar  1 14:03 sbtest8.ibd\n-rw-r-----  1 mysql mysql 240M Mar  1 14:04 sbtest9.ibd<\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u5355\u8868\u5927\u5c0f\u7ea6\u4e3a 240 MB\uff0c\u4e0e\u4e0a\u8ff0\u8ba1\u7b97\u7684 230 MB \u5e76\u65e0\u592a\u5927\u5dee\u8ddd\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u6570\u636e\u751f\u6210\u65f6\u95f4\u7edf\u8ba1<\/h4>\n\n\n\n<p>\u8fd9\u91cc\u4f7f\u7528\u7684\u662f\u4e00\u53f0 Amazon RDS xlarge \u89c4\u683c\u7684\u5b9e\u4f8b\uff0c\u5b58\u50a8\u7c7b\u578b\u4e3a<code>io1<\/code>\uff0ciops\u89c4\u683c\u4e3a3000\uff0c\u5728\u8be5\u73af\u5883\u4e0b\uff0c\u5927\u7ea618\u79d2\u5b8c\u6210\u4e00\u4e2a\u8868\u7684\u521d\u59cb\u5316\uff0c\u7b97\u662f\u6bd4\u8f83\u5feb\u7684\u901f\u5ea6\uff0c\u5373\u6bcf\u79d2\u5199\u5165\u7ea6\u4e3a5.5\u4e07\u8bb0\u5f55\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u5173\u4e8e\u201c\u6807\u51c6\u6d4b\u8bd5\u201d<\/h4>\n\n\n\n<p>\u5728\u201c<a href=\"https:\/\/www.orczhou.com\/index.php\/cloud-database-performance-rds-mysql\/\">\u4e91\u6570\u636e\u5e93 MySQL \u7684\u5bf9\u6bd4\u6d4b\u8bd5<\/a>\u201d\u4e2d\uff0c\u9009\u62e9\u4e864c16g\u7684\u89c4\u683c\uff0c\u538b\u6d4b\u65f6\u4f7f\u7528\u4e8610\u4e2a\u8bb0\u5f55\u6570\u4e3a100\u4e07\u7684\u8868\uff0c\u5373\u6309\u4e0a\u8ff0\u8ba1\u7b97\uff0c\u6570\u636e\u91cf\u5927\u5c0f\u7ea6\u4e3a2.3GB\u3002\u5373\uff0c\u6240\u6709\u7684\u6570\u636e\u5747\u53ef\u4ee5\u7f13\u5b58\u518d\u5185\u5b58\u5f53\u4e2d\u3002\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u8be5\u6d4b\u8bd5\u662f\u4e00\u4e2a CPU \u5bc6\u96c6\u578b\u6d4b\u8bd5\u7684\u4e3b\u8981\u539f\u56e0\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u8003\u8651\u5c06\u6570\u636e\u91cf\u8c03\u6574\u4e3a 500\u4e07\uff0c\u5373\u5355\u8868\u7ea6\u4e3a1.15GB\uff0c\u603b\u96c616\u4e2a\u8868\uff0c\u90a3\u4e48\u6570\u636e\u91cf\u5c31\u53ef\u80fd\u8fbe\u5230 18.4 GB\uff0c\u90a3\u4e48\u8fd9\u4e2a\u6d4b\u8bd5\u5c31\u53ef\u80fd\u6210\u4e3a\u4e00\u4e2aIO\u5bc6\u96c6\u578b\u7684\u6d4b\u8bd5\uff0c\u51c6\u786e\u7684\u8bf4\uff0c\u53ef\u80fd\u662f\u4e00\u4e2a\u8bfbIO\u5bc6\u96c6\u578b\u7684\u6d4b\u8bd5\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\">sysbench \u8868\u5927\u5c0f\u9884\u4f30<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u5355\u8868\u8bb0\u5f55<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u8868\u6570\u91cf<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u603b\u7a7a\u95f4\u9884\u4f30<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">\u573a\u666f 1<\/td><td class=\"has-text-align-center\" data-align=\"center\">1,000,000<\/td><td class=\"has-text-align-center\" data-align=\"center\">10<\/td><td class=\"has-text-align-center\" data-align=\"center\">2.3 GB<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">\u573a\u666f 2<\/td><td class=\"has-text-align-center\" data-align=\"center\">5,000,000<\/td><td class=\"has-text-align-center\" data-align=\"center\">16<\/td><td class=\"has-text-align-center\" data-align=\"center\">18.4 GB<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">\u66f4\u591a\u7edf\u8ba1<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">Sysbench 500\u4e07\u6570\u636e\u5927\u5c0f<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">bash-5.1# ls -l\n-rw-r----- 1 mysql mysql 1220542464 Mar 23 02:18 sbtest1.ibd<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">mysql> show table status\\G\n*************************** 1. row ***************************\n           Name: sbtest1\n         Engine: InnoDB\n        Version: 10\n     Row_format: Dynamic\n           Rows: 4938540\n Avg_row_length: 205\n    Data_length: 1017118720\nMax_data_length: 0\n   Index_length: 0\n      Data_free: 3145728\n Auto_increment: 5000001\n    Create_time: 2025-03-23 02:17:49\n    Update_time: 2025-03-23 02:17:49\n     Check_time: NULL\n      Collation: utf8mb4_0900_ai_ci\n       Checksum: NULL\n Create_options:\n        Comment:\n1 row in set (0.01 sec)<\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u5b9e\u9645\u5360\u7528\u7a7a\u95f4\uff1a<code>1.137GB ~ 1220542464\/1024\/1024<\/code>\u3002\u90a3\u4e48\uff0c\u4f9d\u6b21\u6570\u636e\uff0c16\u4e2a\u5927\u5c0f\u7ea6\u4e3a <code>18.19<\/code> GB\u3002\u4e0e\u4e0a\u8ff0\u6570\u636e\u5e76\u65e0\u592a\u5927\u5dee\u8ddd\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Sysbench 1\u5343\u4e07\u6570\u636e\u5927\u5c0f<\/h5>\n\n\n\n<p>\u5982\u4e0b\u6570\u636e\u7edf\u8ba1\u4e86\uff0c1000\u4e07\u6570\u636e\u5927\u5c0f\u3002\u53ef\u4ee5\u770b\u5230\uff0c\u603b\u5360\u7528\u78c1\u76d8\u7a7a\u95f4\uff1a<code>2.27GB = 2436890624\/1024\/1024\/1024<\/code>\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">bash-5.1# ls -l\n-rw-r----- 1 mysql mysql 2436890624 Mar 23 02:42 sbtest1.ibd<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">mysql> show table status\\G\n*************************** 1. row ***************************\n           Name: sbtest1\n         Engine: InnoDB\n        Version: 10\n     Row_format: Dynamic\n           Rows: 9868349\n Avg_row_length: 220\n    Data_length: 2179989504\nMax_data_length: 0\n   Index_length: 0\n      Data_free: 5242880\n Auto_increment: 10000001\n    Create_time: 2025-03-23 02:41:25\n    Update_time: 2025-03-23 02:41:25\n     Check_time: NULL\n      Collation: utf8mb4_0900_ai_ci\n       Checksum: NULL\n Create_options:\n        Comment:\n1 row in set (0.01 sec)\n\nmysql> select count(1) from sbtest1;\n+----------+\n| count(1) |\n+----------+\n| 10000000 |\n+----------+\n1 row in set (2.74 sec)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sysbench \u662f MySQL \u793e\u4ea4\u5e38\u7528\u7684\u538b\u6d4b\u5de5\u5177\uff0c\u672c\u6587\u5bf9 Sysbench \u9ed8\u8ba4\u538b\u6d4b\u8868\u5927\u5c0f\u8fdb\u884c\u5206\u6790\uff0c\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u4e86\u89e3\u8be5\u6d4b\u8bd5\u8fd0\u884c\u65f6\u7684\u6570\u636e\u91cf\u5927\u5c0f\u3002 \u7ed3\u8bba\u6982\u8ff0 \u6d4b\u8bd5\u4e86 100\u4e07\u3001500\u4e07\u6570\u636e\uff0c\u5360\u7528\u7a7a\u95f4\u5927\u5c0f\u53ef\u4ee5\u53c2\u8003\u5982\u4e0b\u6570\u636e\uff1a sysbench \u8868\u5927\u5c0f\u9884\u4f30 \u5355\u8868\u8bb0\u5f55 \u8868\u6570\u91cf \u603b\u7a7a\u95f4\u9884\u4f30 \u573a\u666f 1 1,000,000 10 2.3 GB \u573a\u666f 2 5,000,000 16 18.4 GB \u573a\u666f 3 10,000,000 16 36.32 GB \u751f\u6210\u6570\u636e\u547d\u4ee4 \u8fd9\u91cc\u4f7f\u7528\u5982\u4e0b\u7684\u547d\u4ee4\u8fdb\u884c\u6570\u636e\u751f\u6210 \u5360\u7528\u7a7a\u95f4\u5927\u5c0f \u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u89c2\u5bdf\u6570\u636e\u5e93\u4e2d\u7684\u8868\u5927\u5c0f\uff1a \u53ef\u4ee5\u770b\u5230\uff0c\u5355\u8868\u7ea6\u4e3a 230 MB\uff1a (225132544+16269312)\/1024\/1024 ~ 230 \u518d\u901a\u8fc7\u6570\u636e\u5e93\u7684\u7269\u7406\u6587\u4ef6\u89c2\u5bdf\u5927\u5c0f\uff1a \u53ef\u4ee5\u770b\u5230\uff0c\u5355\u8868\u5927\u5c0f\u7ea6\u4e3a 240 MB\uff0c\u4e0e\u4e0a\u8ff0\u8ba1\u7b97\u7684 230 MB \u5e76\u65e0\u592a\u5927\u5dee\u8ddd\u3002 \u6570\u636e\u751f\u6210\u65f6\u95f4\u7edf\u8ba1 \u8fd9\u91cc\u4f7f\u7528\u7684\u662f\u4e00\u53f0 Amazon RDS xlarge \u89c4\u683c\u7684\u5b9e\u4f8b\uff0c\u5b58\u50a8\u7c7b\u578b\u4e3aio1\uff0ciops\u89c4\u683c\u4e3a3000\uff0c\u5728\u8be5\u73af\u5883\u4e0b\uff0c\u5927\u7ea618\u79d2\u5b8c\u6210\u4e00\u4e2a\u8868\u7684\u521d\u59cb\u5316\uff0c\u7b97\u662f\u6bd4\u8f83\u5feb\u7684\u901f\u5ea6\uff0c\u5373\u6bcf\u79d2\u5199\u5165\u7ea6\u4e3a5.5\u4e07\u8bb0\u5f55\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"wp-custom-template-a-1440-px-width-template","format":"standard","meta":{"_eb_attr":"","inline_featured_image":false,"_tocer_settings":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-17775","post","type-post","status-publish","format-standard","hentry","category-simplelife"],"_links":{"self":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/17775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/comments?post=17775"}],"version-history":[{"count":13,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/17775\/revisions"}],"predecessor-version":[{"id":17788,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/17775\/revisions\/17788"}],"wp:attachment":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/media?parent=17775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/categories?post=17775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/tags?post=17775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}