本文共 9503 字,大约阅读时间需要 31 分钟。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | [root@Betty ~] # cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz stepping : 7 cpu MHz : 1600.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc arat pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm bogomips : 6585.40 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: [8] processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz stepping : 7 cpu MHz : 1600.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 1 cpu cores : 2 apicid : 2 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc arat pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm bogomips : 6585.00 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: [8] processor : 2 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz stepping : 7 cpu MHz : 1600.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 1 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc arat pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm bogomips : 6584.95 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: [8] processor : 3 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz stepping : 7 cpu MHz : 1600.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 1 cpu cores : 2 apicid : 3 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc arat pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm bogomips : 6585.00 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: [8] [root@Betty ~] # |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | [root@Betty ~] # sysbench --test=cpu --cpu-max-prime=20000 run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Doing CPU performance benchmark Threads started! Done. Maximum prime number checked in CPU test : 20000 Test execution summary: total time : 25.6727s total number of events: 10000 total time taken by event execution: 25.6696 per-request statistics: min: 2.56ms avg: 2.57ms max: 5.36ms approx. 95 percentile: 2.57ms Threads fairness: events (avg /stddev ): 10000.0000 /0 .00 execution time (avg /stddev ): 25.6696 /0 .00 [root@Betty ~] # |
1 2 3 4 5 6 | [root@Betty ~] # sysbench --test=fileio --file-total-size=10G prepare sysbench 0.4.12: multi-threaded system evaluation benchmark 128 files, 81920Kb each, 10240Mb total Creating files for the test ... [root@Betty ~] # |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | [root@Betty ~] # ll total 10498016 -rw------- 1 root root 83886080 Aug 14 10:53 test_file.0 -rw------- 1 root root 83886080 Aug 14 10:53 test_file.1 -rw------- 1 root root 83886080 Aug 14 10:53 test_file.10 -rw------- 1 root root 83886080 Aug 14 10:55 test_file.100 ... -rw------- 1 root root 83886080 Aug 14 10:56 test_file.109 -rw------- 1 root root 83886080 Aug 14 10:53 test_file.11 -rw------- 1 root root 83886080 Aug 14 10:56 test_file.110 ... -rw------- 1 root root 83886080 Aug 14 10:56 test_file.119 -rw------- 1 root root 83886080 Aug 14 10:53 test_file.12 -rw------- 1 root root 83886080 Aug 14 10:56 test_file.120 ... -rw------- 1 root root 83886080 Aug 14 10:56 test_file.127 -rw------- 1 root root 83886080 Aug 14 10:53 test_file.13 ... -rw------- 1 root root 83886080 Aug 14 10:53 test_file.19 -rw------- 1 root root 83886080 Aug 14 10:53 test_file.2 -rw------- 1 root root 83886080 Aug 14 10:53 test_file.20 ... -rw------- 1 root root 83886080 Aug 14 10:55 test_file.98 -rw------- 1 root root 83886080 Aug 14 10:55 test_file.99 [root@Betty ~] # |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | [root@Betty ~] # sysbench --test=fileio --file-total-size=10G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Initializing random number generator from timer. Extra file open flags: 0 128 files, 80Mb each 10Gb total file size Block size 16Kb Number of random requests for random IO: 0 Read /Write ratio for combined random IO test : 1.50 Periodic FSYNC enabled, calling fsync() each 100 requests. Calling fsync() at the end of test , Enabled. Using synchronous I /O mode Doing random r /w test Threads started! Time limit exceeded, exiting... Done. Operations performed: 25981 Read, 17320 Write, 55424 Other = 98725 Total Read 405.95Mb Written 270.62Mb Total transferred 676.58Mb (2.255Mb /sec ) 144.32 Requests /sec executed Test execution summary: total time : 300.0315s total number of events: 43301 total time taken by event execution: 176.0072 per-request statistics: min: 0.01ms avg: 4.06ms max: 76.53ms approx. 95 percentile: 13.04ms Threads fairness: events (avg /stddev ): 43301.0000 /0 .00 execution time (avg /stddev ): 176.0072 /0 .00 [root@Betty ~] # |
1 2 3 4 5 | [root@Betty ~] # sysbench --test=fileio --file-total-size=10G cleanup sysbench 0.4.12: multi-threaded system evaluation benchmark Removing test files... [root@Betty ~] # |
测试内容:模拟事务处理系统的工作负载。使用一张超过百万行记录的表。a. 生成表
1 2 3 4 5 6 | [root@Betty ~] # sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --db-driver=mysql --mysql-socket=/tmp/mysql.sock --mysql-user=root prepare sysbench 0.4.12: multi-threaded system evaluation benchmark Creating table 'sbtest' ... Creating 1000000 records in table 'sbtest' ... [root@Betty ~] # |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | mysql> show tables; + ----------------+ | Tables_in_test | + ----------------+ | sbtest | + ----------------+ 1 row in set (0.00 sec) mysql> mysql> mysql> select count (*) from sbtest; + ----------+ | count (*) | + ----------+ | 1000000 | + ----------+ 1 row in set (0.19 sec) mysql> |
b. 运行测试
8 线程并发、只读模式、测试时长为 60s 。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | [root@Betty ~] # sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 --db-driver=mysql --mysql-socket=/tmp/mysql.sock run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 8 Doing OLTP test . Running mixed OLTP test Doing read -only test Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases) Using "BEGIN" for starting transactions Using auto_inc on the id column Threads started! Time limit exceeded, exiting... (last message repeated 7 times ) Done. OLTP test statistics: queries performed: read : 1442434 write: 0 other: 206062 total: 1648496 transactions: 103031 (1717.12 per sec.) deadlocks: 0 (0.00 per sec.) read /write requests: 1442434 (24039.63 per sec.) other operations: 206062 (3434.23 per sec.) Test execution summary: total time : 60.0023s total number of events: 103031 total time taken by event execution: 479.5035 per-request statistics: min: 1.49ms avg: 4.65ms max: 3493.99ms approx. 95 percentile: 2.41ms Threads fairness: events (avg /stddev ): 12878.8750 /1194 .34 execution time (avg /stddev ): 59.9379 /0 .01 [root@Betty ~] # |
1 2 3 4 5 6 | [root@Betty ~] # sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --db-driver=mysql --mysql-socket=/tmp/mysql.sock cleanup sysbench 0.4.12: multi-threaded system evaluation benchmark Dropping table 'sbtest' ... Done. [root@Betty ~] # |
转载地址:http://lgeno.baihongyu.com/