1

I'm testing my webserver and sending API Thousand of request to optimize my program with high traffic. Indeed I write two bash-shells but they not fast as I want any one can help me on this and let me know how to modify them to execute fast as much as possible?

$ mycurl() { contents=$(< data.txt); eval "words=( $contents )"; arguments=(); for i in {1..1000}; 
do arguments+=( "${words[@]}" ); done; curl "${arguments[@]}"; }; 
$ export -f mycurl; 
$ seq 100 | parallel -j0 mycurl

and the second one is

$ for i in $(seq 100000); do cat data.txt; done | curl -K -

One way that I can run on my computer is the following but I am not sure it is the best way.

 mycurl() { parallel -j0 bash :::: <(ls job{1..2}.sh) };
 export -f mycurl;
 seq 10 | parallel -j0 mycurl;
New contributor
user401012 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Is your client maxing out its CPU power? If not, then increase seq 10 until it is maxed out. If GNU Parallel starts warning about limitations, lift those limits. – Ole Tange Mar 26 at 8:09
  • @OleTange Dear Ole many thanks for the comment. Indeed the client I am working on has 20 GB of memory and 10 CPUs. I was wondering how can run my two shell script parallel and then again call then in another parallel command. – user401012 Mar 26 at 8:19
  • Is your client maxing out its CPU power? If not, then increase seq 10 until it is maxed out. If GNU Parallel starts warning about limitations, lift those limits. – Ole Tange Mar 26 at 11:14

Your Answer

user401012 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.