How to Pressure Test Login Interface in Batch

  devops

Order

Recently, you always receive feedback that the interface is slow, so it is necessary for you to prove yourself at this time. How to test a pair of URLs in batches and then check the overall situation of the interface? There are two requirements:

  • Can batch pressure test txt interface

  • Can carry header or cookie

Apache bench scheme

Ab does not have direct support, but there is an extended plug-inapachebench-for-multi-url, the specific use is as follows:

  • Batch pressure measurement

ab -c 100 -n 2000 -L urls.txt > results.txt
  • Carrying login status

ab -c 100 -n 2000 -C "token=xxxxx" -L urls.txt > results.txt

Siege scheme

Siege’s direct support is relatively convenient.

brew install siege
  • Batch pressure measurement

siege -c 200 -r 3 -f bench-url.txt
  • Carrying login status

siege -c 200 -r 3 --header "Cookie: your-cookie-name=your-cookie-value" -f bench-url.txt

doc


For the latest content, please pay attention to WeChat public number

图片描述