Shell scripting, yeah…?

After a nice session of #dungeonsanddragons I thought I take another nightly hour to work a bit more on my side project. Because I did some initial performance tests with promising results, I wanted to create some more elaborate but still simple test suite for exactly this.

The idea: Write a script that runs a couple of curl commands in parallel to do kind of a load test. It’s not very scientific but it would give a good overview of the API performance.

Unfortunately I had to realize that running commands in parallel and in a loop is not as simple. There is GNU Parallel for exactly that but it’s really not as straightforward as I wish it to be.

And did you know that xargs can run parallel processes as well?! Just give it a -P 4 to run 4 processes. How cool is that? But it was just not working the way I wanted it to work so I gave up for today.

Do you speak Bash (or ZSH or whatever)? Tell me in the comments. In any language.


Adding comments is only possible via Instagram directly, sorry. If you're okay with visiting Instagram, you can use the link to my post .

  1. #worldcode #workenvironment #mindsetmatters #webdeveloper #developerjobs #htmlcode #seniordeveloper #peoplewithlaptops #workhardanywhere #peoplewhocode #thedevlife #appdeveloper #buildtheweb #codergallery #weprogrammers #developerdiaries #developerlifestyle #setupgoals #myworkspace #designyourworkspace #minimalbeast #hustle #techsetup #deskgoals #informationtechnology #dellxps #linux @codeclique @comment_sense @lovecoders @coding @worldcode @coderlifes @programmerrepublic @thedevlife @peoplewhocode @developerstuff

    1. Golang might be a great option for that as well

      1. There are lots of tools for api performance testing. Wrk and wrk2 are both really good and have lua scripting support. Also hload, ab and jmeter are excellent also. I’ve written some specific benchmarking clients to handle certain socket nuances like keep alive and eof signaling. But curl in a loop will never give your a good benchmark, youre always going to have the added latency of loading and unloading my the binary onto memory, file system reads for config files etc... there’s a lot happening just to load and unload the program.

        1. @dnsbrian very true. I'm well aware that this way I will not get any accurate benchmark. It was more meant as general load testing and the server logs would show me nicely if more load is affecting the processing times.