How to do Load test against web service - Using java bench

write web service  and upload it to some web server

Then generate wsdl by type address as follows
http://appserver.cloud-test.wso2.com:9766/services/t/yyy.yyy/testB?wsdl

use soapui to generate soap message
Create new project and give wsdl to it





Then
get the request text
Copy it into request.xml file located inside the folder jababench folder

Then use the following command in command line to execute

java -jar benchmark.jar -p request.xml -n 100 -c 10 -k -H "SOAPAction: readResource" -T "text/xml; charset=UTF-8" http://appserver.cloud-test.wso2.com:9766/services/t/yyy.yyy/testB

usage: HttpBenchmark [options] [http://]hostname[:port]/path
-v Set verbosity level - 4 and above prints response
content, 3 and above prints information on headers, 2 and above prints
response codes (404, 200, etc.), 1 and above prints warnings and info.
-H
Add arbitrary header line, eg. 'Accept-Encoding:
gzip' inserted after all normal header lines. (repeatable)
-n Number of requests to perform for the benchmarking
session. The default is to just perform a single request which usually
leads to non-representative benchmarking results.
-T Content-type header to use for POST data.
-c Concurrency while performing the benchmarking
session. The default is to just use a single thread/client.
-h Display usage information.
-i Do HEAD requests instead of GET.
-k Enable the HTTP KeepAlive feature, i.e., perform
multiple requests within one HTTP session. Default is no KeepAlive
-p File containing data to POST.

here
http://appserver.cloud-test.wso2.com:9766/services/t/yyy.yyy/testB is my service endpoint
SOAPAction: readResource is my operation name
inside wsdl you will find operation name=readResource
here we used soap 1.1 wsdl then we must use -T "text/xml

then run your test
you will see following output









No comments:

Post a Comment

Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release

  Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...