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 number, default:-r|--rounds Test number, default: 10 times-s|-sleeptime interval time, default: 10 seconds-i|--min Minimum concurrent number, default: 0-x|--max Maximum concurrent number, default: 0-j|--step number of times increment concurrency-r|--runtime Overall run time, maximum number of requests when setting this item 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/xxab-n 1-c 1-p post.txt-t APPL Ication/octet-stream  HTTP://172.25.33.211:8088/DSP/RTB

  

In addition, the post data inside the post.txt should be put in your JSON data, such as

data={"id": "1234"}

but pay attention to the UrlEncode encryption, so the content that really put in post.txt inside 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 building a TXT will have a special character at the beginning of the file, so you can't parse it. 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

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.