性能测试 ============================= .. code-block:: bash sudo apt update && sudo apt install -y sysbench # Ubuntu # 准备测试数据: 使用 MySQL 数据库初始化测试数据表。 sysbench oltp_read_write --mysql-host=192.168.88.250 --mysql-port=3307 --mysql-user=root \ --mysql-password=your_password --mysql-db=test --tables=10 \ --table-size=100000 prepare # 执行读写测试: sysbench oltp_read_write --mysql-host=192.168.88.250 --mysql-user=root \ --mysql-password=your_password --mysql-db=test --mysql-port=3307 --tables=10 \ --table-size=100000 --threads=16 --time=60 run # ----------------------------------------------------- # 下面是运行的日志,这里只跑了1各表。 sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2) Running the test with following options: Number of threads: 16 Initializing random number generator from current time Initializing worker threads... Threads started! SQL statistics: queries performed: read: 10094 write: 2884 other: 1442 total: 14420 transactions: 721 (11.68 per sec.) # TPS queries: 14420 (233.57 per sec.) # 查询性能 ignored errors: 0 (0.00 per sec.) # 错误 reconnects: 0 (0.00 per sec.) # 重连 General statistics: total time: 61.7359s # 耗时 total number of events: 721 Latency (ms): min: 484.58 avg: 1355.66 max: 3497.64 95th percentile: 2238.47 sum: 977431.05 Threads fairness: events (avg/stddev): 45.0625/0.90 execution time (avg/stddev): 61.0894/0.21 # ----------------------------------------------------- # 清理测试数据: sysbench oltp_read_write --mysql-host=127.0.0.1 --mysql-user=root \ --mysql-password=your_password --mysql-db=test cleanup