AB post test HTTP and WebService interface method and use case

Time:2020-7-4

AB (APACHE bench) is a hypertext transfer protocol (HTTP) performance testing tool that comes with Apache. Its design intention is to describe the execution performance of the currently installed Apache, mainly to show how many requests Apache can process per second.

useab -helpView help interface

  1. AB testing simple HTTP requests

    ab -n30000 -c1000 "http://10.1.1.21:8080/"
    
  2. AB test HTTP interface (post)

    ab -n400 -c20  -p "img.json" -T "application/x-www-form-urlencoded" "http://10.1.1.21:8080/test.do" 
    

    img.json Is a string that conforms to the interface format

    MIME types application / x-www-form-urlencoded and multipart / form data and text / plain references

    Similar to curl, curl specifies post, please @ specify file

    curl "http://10.1.1.21:8080/test.do" -d  @/root/img.json
    
  3. AB test WebService interface

    ab -k -T "Content-Type:text/xml;charset=UTF-8" -p data.xml -n 1000 -c 32 http://10.1.1.21:8080/services/routeService?wsdl 
    

    be careful: data.xml Must conform to the WSDL specification and can be generated using soapUI

    If an error is reported:no soapaction header

    ab -k -T "Content-Type:text/xml;charset=UTF-8;soapaction=''" -p data.xml -n 1000 -c 32 http://10.1.1.21:8080/services/routeService?wsdl
    

Other references: detailed explanation of pressure test with ab