Apache Bench (AB) stress test analog POST request

Source: Internet
Author: User
Tags urlencode

AB command format:-n|--count Total number of requests, default: 5w-c|--clients concurrency, default: 100-r|--rounds test times, Default: 10-s|-sleeptime interval, default: 10 seconds-i|--min most Small concurrency, default: 0-x|--max max concurrency, default: 0-j|--step increment concurrency number-r|--runtime Overall run time, set this item the maximum number of requests is 5w-p|--postfile post data file path-u|--url test address

To use AB for post data testing. From help you can see that we need to define two of content
One is the-p parameter. Specify data that needs to be post
There is also a-t parameter that specifies the Content-type used

Eg:ab-n 3-c 3-p post.txt-t application/x-www-form-urlencoded http://192.168.1.176:8080/xx.do

In addition, post.txt inside the post data to put your JSON data, such as data={"id": "1234"} but pay attention to UrlEncode encryption, so the real content in the Post.txt is Data=%7b%22id%22%3a%221234%22%7d, and notice that you don't have to build a post.txt on Windows yourself, but instead use eclipse or notepad++ , because you build a TXT will have a special character at the beginning of the file, so that cannot parse. I was using the IntelliJ idea to develop a TXT file built with it. After doing well, you can definitely be under ab ....

the-P option specifies the location of the post file, and the-t option specifies how the post file is encoded, by default, clear text, or if - t ' application/x-www-form-urlencoded ' is specified Post file using urlencode

Note: Content-type must be set to become application/x-www-form-urlencoded



Apache Bench (AB) stress test analog POST request

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.