Deprecated: Function Yoast\WP\SEO\Conditionals\Schema_Blocks_Conditional::get_feature_flag is deprecated since version Yoast SEO 20.5 with no alternative available. in /home1/minerho3/public_html/wp-includes/functions.php on line 6078

Deprecated: Function Yoast\WP\SEO\Conditionals\Schema_Blocks_Conditional::get_feature_flag is deprecated since version Yoast SEO 20.5 with no alternative available. in /home1/minerho3/public_html/wp-includes/functions.php on line 6078

Deprecated: Function Yoast\WP\SEO\Conditionals\Schema_Blocks_Conditional::get_feature_flag is deprecated since version Yoast SEO 20.5 with no alternative available. in /home1/minerho3/public_html/wp-includes/functions.php on line 6078

Warning: Cannot modify header information - headers already sent by (output started at /home1/minerho3/public_html/wp-includes/functions.php:6078) in /home1/minerho3/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home1/minerho3/public_html/wp-includes/functions.php:6078) in /home1/minerho3/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home1/minerho3/public_html/wp-includes/functions.php:6078) in /home1/minerho3/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home1/minerho3/public_html/wp-includes/functions.php:6078) in /home1/minerho3/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home1/minerho3/public_html/wp-includes/functions.php:6078) in /home1/minerho3/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home1/minerho3/public_html/wp-includes/functions.php:6078) in /home1/minerho3/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home1/minerho3/public_html/wp-includes/functions.php:6078) in /home1/minerho3/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home1/minerho3/public_html/wp-includes/functions.php:6078) in /home1/minerho3/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":1205,"date":"2018-03-27T13:25:52","date_gmt":"2018-03-27T13:25:52","guid":{"rendered":"http:\/\/minervadb.com\/?p=1205"},"modified":"2018-03-28T17:34:48","modified_gmt":"2018-03-28T17:34:48","slug":"benchmarking-cpu-memory-file-i-o-and-mutex-performance-using-sysbench","status":"publish","type":"post","link":"http:\/\/minervadb.com\/index.php\/2018\/03\/27\/benchmarking-cpu-memory-file-i-o-and-mutex-performance-using-sysbench\/","title":{"rendered":"Benchmarking CPU, Memory, file I\/O and mutex performance using Sysbench"},"content":{"rendered":"

We already have written blog on Sysbench (https:\/\/minervadb.com\/index.php\/2018\/03\/13\/benchmarking-mysql-using-sysbench-1-1\/<\/a><\/span>) , so in this blog we are not covering basic details like installation and configuration of Sysbench. In this blog we are just specific on benchmarking CPU, Memory, file I\/O and mutex performance :<\/p>\n

Benchmarking CPU using Sysbench<\/strong><\/p>\n

This benchmark is configured with the number of simultaneous threads and the maximum number to verify if it is a prime.<\/p>\n

[root@localhost shiv]# sysbench --test=cpu --cpu-max-prime=2000000 --num-threads=120 run<\/pre>\n
Running the test with following options:\r\nNumber of threads: 120\r\nInitializing random number generator from current time\r\n\r\n\r\nPrime numbers limit: 2000000\r\n\r\nInitializing worker threads...\r\n\r\nThreads started!\r\n\r\nCPU speed:\r\n    events per second:     0.69\r\n\r\nThroughput:\r\n    events\/s (eps):                      0.6891\r\n    time elapsed:                        174.1418s\r\n    total number of events:              120\r\n\r\nLatency (ms):\r\n         min:                               169807.71\r\n         avg:                               172640.02\r\n         max:                               174120.65\r\n         95th percentile:                   100000.00\r\n         sum:                             20716802.25\r\n\r\nThreads fairness:\r\n    events (avg\/stddev):           1.0000\/0.00\r\n    execution time (avg\/stddev):   172.6400\/0.83\r\n<\/pre>\n
“time elapsed” is the variable we seriously look for to measure CPU performance, In this case it is 174.1418 seconds.<\/div>\n
<\/div>\n
Benchmarking threads performance using sysbench<\/strong><\/div>\n
When we increase the threads workload,\u00a0each worker thread will be allocated a mutex (a sort of lock) and will, for each execution, loop a number of times (documented as the number of yields) in which it takes the lock, yields (meaning it asks the scheduler to stop itself from running and put it back and the end of the runqueue) and then, when it is scheduled again for execution, unlock.<\/div>\n
\n
[root@localhost shiv]# sysbench --test=threads --thread-locks=10 --max-time=60 run\r\n\r\nsysbench 1.1.0-651e7fd (using bundled LuaJIT 2.1.0-beta3)\r\n\r\nRunning the test with following options:\r\nNumber of threads: 1\r\nInitializing random number generator from current time\r\n\r\n\r\nInitializing worker threads...\r\n\r\nThreads started!\r\n\r\n\r\nThroughput:\r\n    events\/s (eps):                      2366.0725\r\n    time elapsed:                        60.0003s\r\n    total number of events:              141965\r\n\r\nLatency (ms):\r\n         min:                                    0.38\r\n         avg:                                    0.42\r\n         max:                                    8.86\r\n         95th percentile:                        0.53\r\n         sum:                                59942.51\r\n\r\nThreads fairness:\r\n    events (avg\/stddev):           141965.0000\/0.00\r\n    execution time (avg\/stddev):   59.9425\/0.00\r\n<\/pre>\n

To conclude the interpretation of thread performance benchmarking, we annotate time elapsed (actual time for the completion of the activity), in this case it “60.0003” seconds.<\/p>\n<\/div>\n

Benchmarking mutex workload\u00a0<\/strong><\/div>\n
When benchmarking mutex workload, sysbench will run a single request per thread. This request generates load on the CPU (using a simple incremental loop, through the –mutex-loops<\/strong> parameter), after that it makes a random mutex, increments a global variable and release the lock again. This process is continued till the number of locks mentioned (–mutex-locks<\/strong>). The random mutex is generated by –mutex-num parameter.<\/div>\n

 <\/p>\n

[root@localhost shiv]# sysbench --test=mutex --num-threads=130 run\r\nWARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.\r\nWARNING: --num-threads is deprecated, use --threads instead\r\nsysbench 1.1.0-651e7fd (using bundled LuaJIT 2.1.0-beta3)\r\n\r\nRunning the test with following options:\r\nNumber of threads: 130\r\nInitializing random number generator from current time\r\n\r\n\r\nInitializing worker threads...\r\n\r\nThreads started!\r\n\r\n\r\nThroughput:\r\n    events\/s (eps):                      5.8047\r\n    time elapsed:                        22.3956s\r\n    total number of events:              130\r\n\r\nLatency (ms):\r\n         min:                                17566.82\r\n         avg:                                20789.93\r\n         max:                                22230.90\r\n         95th percentile:                    21641.55\r\n         sum:                              2702690.46\r\n\r\nThreads fairness:\r\n    events (avg\/stddev):           1.0000\/0.00\r\n    execution time (avg\/stddev):   20.7899\/0.82\r\n<\/pre>\n

The throughput and average latency are the two matrices we consider to interpret mutex workload performance :<\/p>\n

Throughput:\r\n    events\/s (eps):                      5.8047\r\n    time elapsed:                        22.3956s\r\n\r\nLatency (ms):\r\n         min:                                17566.82\r\n         avg:                                20789.93\r\n         max:                                22230.90\r\n         95th percentile:                    21641.55\r\n         sum:                              2702690.46\r\n<\/pre>\n

 <\/p>\n

Benchmarking the memory workload\u00a0<\/strong><\/p>\n

When we use sysbench to benchmark memory, sysbench allocate a memory buffer and then read or write from\/on it, each time for the size of a pointer (32 bit or 64 bit) and until the total buffer size has been read from or written to. \u00a0This activity will be continued till the provided volume (–memory-total-size) is reached. The load can be increased or reduced by providing multiple threads (–num-threads), size of buffer (–memory-block-size) and request type (read \/ write \/ sequential \/ random)<\/p>\n

[root@localhost shiv]# sysbench --test=memory --num-threads=140 --memory-total-size=10G run\r\n\r\nsysbench 1.1.0-651e7fd (using bundled LuaJIT 2.1.0-beta3)\r\n\r\nRunning the test with following options:\r\nNumber of threads: 140\r\nInitializing random number generator from current time\r\n\r\n\r\nRunning memory speed test with the following options:\r\n  block size: 1KiB\r\n  total size: 10240MiB\r\n  operation: write\r\n  scope: global\r\n\r\nInitializing worker threads...\r\n\r\nThreads started!\r\n\r\nTotal operations: 10485720 (3351958.44 per second)\r\n\r\n10239.96 MiB transferred (3273.40 MiB\/sec)\r\n\r\n\r\nThroughput:\r\n    events\/s (eps):                      3351958.4393\r\n    time elapsed:                        3.1282s\r\n    total number of events:              10485720\r\n\r\nLatency (ms):\r\n         min:                                    0.00\r\n         avg:                                    0.01\r\n         max:                                 2931.98\r\n         95th percentile:                        0.00\r\n         sum:                               123371.54\r\n\r\nThreads fairness:\r\n    events (avg\/stddev):           74898.0000\/0.00\r\n    execution time (avg\/stddev):   0.8812\/0.93\r\n<\/pre>\n

Throughput and operations per second are the important matrices to measure for memory workload benchmarking :<\/p>\n

Total operations: 10485720 (3351958.44 per second)\r\n\r\n10239.96 MiB transferred (3273.40 MiB\/sec)\r\n<\/pre>\n
\n

Benchmarking file system I\/O with Sysbench<\/h3>\n

You can use multiple scenarios for benchmarking file system I\/O but here we have used rndrw \u00a0(combined random read \/ write) for more complex I\/O and production similar I\/O operations, This happens in three steps explained below:<\/p>\n