Install the Performance Test tool: Sysbench and using Apache AB

Source: Internet
Author: User
Tags server port

First, the use of software, it mainly includes the following methods of testing:
1. CPU Performance
2. Disk IO Performance
3. Scheduling Program Performance
4. Memory allocation and transmission speed
5. POSIX threading Performance
6. Database performance (OLTP benchmark)

Why can't this software find the official website? Giulib the above URL can only download the source code. But the use of the instructions, but no. Estimate is a personal software that has no subsequent updates.

The latest version is version 0.5. Originally is the basic function, does not need the consummation. So updates don't need to be very frequent. For example, memcache this kind of software also November. And even the 1.x version.

Second, inductive installation steps:

1. Decompression

2. Run the./autogen.sh script in the source directory. The goal is to automate the cleanup, resulting in a configure file in the source directory

3./configure--with-mysql-libs=/mysql installation directory/lib/--with-mysql-includes=/mysql installation directory/include/

4. Make && make install

5. Setting Environment variables

Export Ld_library_path=/usr/mysql/lib

Software that may be involved:

Libtool Tools

Third, the installation process encountered doubts and understanding

Run the command in the unpacked directory:./autogen.sh, clean up the environment (the operation is sysbench0.4.12 exclusive and may error if not done)

The Configure file will not appear until you run the above command.

./configure--with-mysql-includes=/usr/local/include/mysql--with-mysql-libs=/usr/local/lib/mysql

--with-mysql-includes is the directory that specifies MySQL, is the installation directory or what? There is an include directory under the MySQL installation directory,/usr/local/mysql/lib/include/

What directory does the--with-mysql-libs key specify for MySQL? There is a Lib directory under the MySQL installation directory/usr/local/mysql/lib/

Note: Online someone said, this is the case, MySQL must be compiled and installed, not the RPM way to install MySQL.

By running

./configure--with-mysql-includes=/usr/local/mysql/include/--with-mysql-libs=/usr/local/mysql/lib/

Make && make install

No error. Think the installation was successful?

So run: Sysbench--test=cpu--cpu-max-prime=5000 Run

Want to test the CPU

Error:


Sysbench:error while loading shared libraries:libmysqlclient.so.18:cannot open Shared object file:no such file or dire Ctory

This indicates that Sysbench cannot find the MySQL library file, which is most likely the environment variable Ld_library_path not set and can be resolved after setting.

Export Ld_library_path=/usr/mysql/lib

Some of the solutions on the Internet are:

# in-s/usr/local/mysql-5.5.8/lib/libmysqlclient.so.16/lib64/libmysqlclient.so.16

This solution is to consider that Sysbench will go to the/lib64/libmysqlclient.so.16 directory to look for mysqlclient, so set a soft link to the real mysqlclient directory to go.

Question: I didn't understand the idea. Many people are leaf out, without explaining why.

/usr/local/mysql/lib/libmysqlclient.so.18 What is this file for?

My is error libmysqlclient.so.18 this file, and online some is libmysqlclient.so.16 this file

I opened the virtual machine the next day and found that I would report such a mistake. I don't know what the reason is. Add the export Ld_library_path=/usr/mysql/lib to the/etc/rc.local file, set to boot on the running environment variables, even useless.

Ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib/libmysqlclient.so.18

If the operating system is 64-bit, then/usr/lib/libmysqlclient.so.18, in the Lib to change to lib64, such as:

Ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib64/libmysqlclient.so.18

Four, the installation is complete, carries on the test

How does the CPU test result read?

Sysbench--TEST=CPU--cpu-max-prime=5000 Run

Number of threads:1 indicates that a thread was used. A thread is used by default.

Primer numbers limit, which represents the maximum prime number limit, is the value specified by the parameter--cpu-max-prime

Total numbers OOF events, maximum number of requests, default = 10000, 0 for unrestricted

Respones time is the calculation of the response speed. Min is the minimum time spent in executing multiple requests, Avg time. Max spends the longest time executing multiple requests

Parameter question: What is the difference between the number of threads and the maximum number of requests?

Does it mean that a thread will make a request for total numbers of events? So the total number of requests accepted is "threads *total numbers of events"

The explanation in the Sysbench--help command is a summary

--num-threads=n number of threads to use [1] How many threads are used

--max-requests=n limit for total number of requests [10000] maximum requests

Presumably, I understand: how many threads can imagine how many clients (computers or many users) are simultaneously initiating requests for test targets, each of which sends--max-requests requests.

Note: Each computer can not only send a request, send a request to test nothing at all. Therefore, it is often repeated requests. So--max-requests means that each thread has to send so many requests to test.

So the final number of requests:--num-threads*--max-requests.

I doubt that the CPU performance is tested, using the maximum prime number test, what is the actual meaning? How to read the above data.

Why do you test CPU performance using the addition of prime numbers?

It's the primality test. This is what the official website says.

In this mode all request consists in calculation of prime numbers up
To a value specified by the--cpu-max-primes option. All calculations
is performed using 64-bit integers.

Primes English means "the first, the most basic, the first" meaning. Prime numbers refers to the meaning of prime numbers.

1, the principle of CPU testing: For prime numbers do addition operations

Primes are also called prime numbers. What is prime, a number is a, it can only be divided by two number: 1 and its own, but not divided by the other number. For example, 3 can be divided by 1,3 to divide by 3 (it itself). 3 divided by 2 is not divisible.

The number of prime numbers within 1000 is listed online:

within 10002 3 5 7 11 13 17 19 23 2931 37 41 43 47 53 59 61 67 7173 79 83 89 97 101 103 107 109 113127 131 137 139 149 151 157 163 16 7 173179 181 191 193 197 199 211 223 227 229233 239 241 251 257 263 269 271 277 281283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409419 421 431 433 439 443 449 457 461 463467 479 487 491 499 503 509 521 523 541547 5 57 563 569 571 577 587 593 599 601607 613 617 619 631 641 643 647 653 659661 673 677 683 691 701 709 719 727 733739 743 75 1 757 761 769 773 787 797 809811 821 823 827 829 839 853 857 859 863877 881 883 887 907 911 919 929 937 941947 953 967 971 977 983 991 997 1000 out of 168

2,3,5,7 are prime numbers. For example, 7 can be divided by 1 and divided by 7. But divided by 2,3,4,5,6 can not be apart (can not be larger than 7, large number to divide, the results are definitely decimal)

2, the test file read and write performance principle:

1. Create a file first

2. Then simulate how many concurrent threads are read and write for the file. Look at the response speed. This way, you can test the i/0 capability of the disk.

Summary: Sysbench are tested for local CPU, memory performance. Remote testing is not possible. Because none of the parameters of the URL are provided


Use reference materials:
http://blog.csdn.net/clh604/article/details/12108477
Http://www.cnblogs.com/ylqmf/archive/2012/09/29/2708562.html

http://www.cnblogs.com/dyllove98/archive/2013/07/28/3221603.html all parameters explained comprehensively

Attached: Test options description
--test=string Specifies the test project name. The value is one of the following values: FILEIO,CPU,MEMORY,THREADS,MUTEX,OLTP--debug=[on|off] Displays more debug information.  The default is off. --validate=[on|off] Perform validation checks where possible. The default is off.


Use of the help command:

List all commands

Sysbench--help

Lists the specified test item usage instructions

Sysbench--TEST=CPU Help


To view the parameters of a specific test item

Sysbench--test=threads Help

Name of parameter

Describe

--thread-yields=n

Memory block size, default is 1K

--thread-locks=n

The amount of data transferred, default is 100G

Sysbench--TEST=CPU Help



Apache's AB tool use

D:\soft\kaifa\ide\wamp\bin\apache\apache2.4.9\bin>ab.exe-n 50-c http://www.ab.com:1080/test_mc_pconnect.php

Where-n represents the number of requests, and-C represents the number of concurrent

50 requests, 40 concurrent. Concurrency is not understandable as 40 users, each user sends a (50/40) request.

Note: URLs can be quoted with quotation marks. can also not be cited.

How to read the statistical results here, how to get useful information?

Netizens have explained:

---------------------------------------

10 concurrent, is instantaneous 10 requests to the server up (simulates 10 concurrent requests), if the server processing fast, then continues , but uses the parameter to have the total number of requests ,

In fact, with each 10 concurrent way, you set the total number of requests to the server up, see how long the server can be processed, calculate the average response per second.

---------------------------------------

-N 600-c 500

It is understood that: Create 500 threads and request a specified URL at the same time. Each thread requests 600 times in a row (which is a batch request, we see the statistics indicating that 100 requests have been completed and 200 requests have been completed.) 300 requests have been completed. )

Correct: the understanding is wrong. n does not indicate that each thread requests so many times. Instead, it represents a C thread that requests so many times in total.

So each thread request is (N/C). In this case, at least one request is sent to each thread. So. The value of n must be >=c. Otherwise, it is not good to allocate each thread, at least one request per thread.

At the moment, it's very certain. C represents an instantaneous number of requests to the server (which we often say concurrency). The AB command has explained that this parameter is number of multiple requests to made at a time

Make a time is instantaneous.

Create so many concurrent requests to the server at the same time. If the server can still accept, then continue to initiate the request, how to initiate the law?

For example, the current setting n is 100 million. The concurrency number is set to 5,000 concurrency. Then the first time you start out of 5,000. The server is able to finish processing.

Well, continue to initiate concurrent requests. There are 10000-5000 of them at this time.

Finally understand the actual meaning of the n representation as described in English: number of requests to perform. Total number of requests. Is the result of multiple requests being accumulated.

Ab.exe-n 10000-c 5000

5,000 concurrent requests go to the server. If acceptable, continue to initiate the remaining (total-requested number of times), i.e. (10000-5000).

Why can't the number of requests be lower than the number of concurrent numbers? This parameter is well understood.

Reference: http://wenku.baidu.com/link?url=hzxyk5tfjietkywmaraif79flidcsw1mj9dqchyeadi84t37u1xxy__- Hist4r8rnjzpcxsmurykq61kkmk0_b-7osapcwze4fuchuqpk1q

AB principle: The AB command creates multiple concurrent access threads, simulating multiple visitors accessing a URL address at the same time. Its test target is URL-based, so it can be used to test the load pressure of Apache, as well as other Web servers such as Nginx, Lighthttp, Tomcat, and IIS.

The AB command is very low on the computer that emits the load, and it does not occupy a high CPU or consume a lot of memory. But it will cause a huge load on the target server, which works like a CC attack. You also need to be aware of your own testing, or too much load at a time. May cause the target server resources to run out, serious even causes the panic.

Server software:apache/2.0.54
//platform Apache version 2.0.54
Server hostname:127.0.0.1
//Server host name
Server port:80
//Server Port

Document Path:/index.html.zh-cn.gb2312
//test page document
Document length:1018 bytes
//Document size

Concurrency level:1000
Concurrency number
Time taken for tests:8.188731 seconds
Duration of the entire test
Complete requests:1000
Number of requests completed
Failed requests:0
Number of failed requests
Write errors:0

Total transferred:1361581 bytes
Network traffic in the entire scene
HTML transferred:1055666 bytes
The amount of HTML content transferred throughout the scene
Requests per second:122.12 [#/sec] (mean)
//One of the most concerned indicators is the equivalentLrIn the number of transactions per second mean time per request:       8188.731 [MS] (mean)
// LR Average transaction response time time per request:       8.189 [MS] (mean, Across all concurrent requests)
//average of actual elapsed time per request
Transfer rate:           162.30 [kbytes/sec] received
// Average network traffic per second can help eliminate the problem of extended response times due to excessive network traffic

Connection Times (MS)
Min MEAN[+/-SD] Median max
Connect:4 646 1078.7 89 3291
processing:165 992 493.1 938 4712
waiting:118 934 480.6 882 4554
total:813 1638 1338.9 1093 7785
//The decomposition of time consumed on the network, the specific algorithm of each data is not very clear

Percentage of the requests served within a certain time (MS)
50% 1093
66% 1247
75% 1373
80% 1493
90% 4061
95% 4398
98% 5608
99% 7368
100% 7785 (Longest request)


//response of all requests in the entire scene. Each request in the scene has a response time, where 50% of the user's response time is less than 1093 milliseconds, 60% of the user response time is less than 1247 milliseconds, and the maximum response time is less than 7785 milliseconds

Due to concurrent requests, the CPU is not actually processed at the same time, but instead is rotated on a per-request basis, so basically the first time of the request is approximately equal to the second time per request multiplied by the number of concurrent requests .

Install the Performance Test tool: Sysbench and using Apache AB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.