Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a shell script which can spawn multiple concurrent processes which call a specified web service

Tags:

bash

shell

sh

I am trying to create a load testing shell script essentially what I am looking to do is have the script spawn some N number of concurrent processes and have each of those processes call a specified URL and perform a few basic actions. I am having a hard time figuring this out - any help would be awesome!!

like image 963
user1588220 Avatar asked Mar 24 '26 09:03

user1588220


2 Answers

If you really need to use shell, take a look at Bash: parallel processes. But there are load testing tools like ab (Apache HTTP server benchmarking) that can do the job for you.

You can use ab as simple as:

ab -n 10 -c 2 -A myuser:mypassword http://localhost:8080/

For more examples, look at Howto: Performance Benchmarks a Webserver.

like image 54
messivanio Avatar answered Mar 27 '26 04:03

messivanio


have a look at this article:

http://prll.sourceforge.net/shell_parallel.html

as described: "Parallel batch processing in the shell

How to process a large batch job using several concurrent processes in bash or zsh

This article describes three methods of parallel execution: the first is not very performant and the other two are not safe to use. A more complete solution is called prll and can be found here. This article is not meant to be good advice, but instead laments the state of scriptable job control in shells."

like image 25
marstone Avatar answered Mar 27 '26 02:03

marstone



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!