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/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 UrlEncode encryption, so really put in post.txt inside the content is data=%7b%22id%22%3a%221234%22%7d, also have to pay attention to, Instead of building a post.txt on Windows yourself, use such as 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 a simple way to count QPS is to count through logs:
Tail-f Jradx-go-dsp.info | grep Originaldeviceid | Cut-d '-f2 | Cut-d ': '-f3 |cut-d '. '-f1| Uniq-c
To view memory consumption:
Free-ml-s 1
To see the memory consumption of Go:
http://xiaorui.cc/2016/03/20/golang%E4%BD%BF%E7%94%A8pprof%E7%9B%91%E6%8E%A7%E6%80%A7%E8%83%BD%E5%8F%8Agc%E8% b0%83%e4%bc%98/
Crawl network packets on Linux:
Tcpdump tcp-i eth1-t-S 0-c and DST Port! and src net 192.168.1.0/24-w./target.cap
https://docs.mongodb.com/manual/reference/read-preference/http://blog.csdn.net/zqg5258423/article/details/53207471
Apache Bench (AB) stress test analog POST request