Stress Testing a Web Service Method with Powershell

I want to emphasize the web service method test by calling it several thousand times in a row. The method has one string parameter, which will change with each call.

I am planning to write a Powershell script to loop and call this method multiple times.

Is there a better way to do this?

+1


source to share


5 answers


If you make a call after a call, it won't help you too much, as it won't show you how the service works under a heavy load of many concurrent connections.

Go with some multi-threaded solution (I don't know if powershell has this).



Some open source testing tools are listed here . Just set up the web service to accept GET requests, not just SOAP (the default), so you can generate URLs.

+3


source


In these situations, I would use JMeter . You need to play with it first, but it is very flexible, it will run queries on different threads, it will display the results graphically, and it will also allow you to script your jobs.



I would also recommend running it on a different machine than the server, and if possible run two or more instances on different machines to simulate the load.

+1


source


Personally, I would use something like openSTA .

This allows you to record a session from a website and then play it back using a relatively simple script language.

You can also easily test web services and write your own scripts.

It allows you to put scripts together in a test in any way you want and customize the number of iterations, the number of users in each iteration, the rise time to introduce each new user, and the delay between each iteration. Tests may also be scheduled in the future.

It's open source and free.

It generates several reports that can be saved in a spreadsheet. We then use a pivot table to easily analyze and display the results.

0


source


It really depends if there are other requirements. For example, a magazine, history, etc.

If you need it quick and dirty then you are good.

If you want something more robust, you can look at either assembling the test harness in your language of choice, or using things like Mercury, MS Team Tester, nUnit, etc.

0


source


For those who stumbled upon this and don't want to use the already mentioned third party options. As noted in the accepted answer, a multithreading solution is the best, this can be achieved in PowerShell:

ForEach -Parallel ($item in $collection) {  }

      

https://docs.microsoft.com/en-us/powershell/module/psworkflow/about/about_foreach-parallel

Although the number of threads can be limited to 5: does the parallelized PowerShell interface use no more than 5 threads?

0


source







All Articles