0

I'm using the Percona Query Playback tool and I want to run multiple clients at once

This is the sample command

/usr/local/bin/percona-playback --queue-depth 99999 --mysql-max-retries 0 --mysql-host somehost.xxx.com --mysql-username xxx --mysql-password xxxx --mysql-schema xxx --query-log-file some_slow_log.log

I want to be able to run that 30x concurrently. What tool/framework/library should I look at?

edmamerto
  • 7,605
  • 11
  • 42
  • 66
  • 1
    Does this answer your question? [How do you run multiple programs in parallel from a bash script?](https://stackoverflow.com/questions/3004811/how-do-you-run-multiple-programs-in-parallel-from-a-bash-script) – Peter Cordes May 27 '20 at 23:28
  • Actually [How can I execute parallel "for" loops in Bash?](https://stackoverflow.com/q/47786684) is a more specific duplicate. – Peter Cordes May 27 '20 at 23:33

1 Answers1

1

If you are running on the terminal. Run the for loop.

for run in {1..30}
do
  command &
done

& to run the process in the background, so you can continue to use the shell and do not have to wait until the script is finished

for run in {1..30}
do
/usr/local/bin/percona-playback --queue-depth 99999 --mysql-max-retries 0 --mysql-host somehost.xxx.com --mysql-username xxx --mysql-password xxxx --mysql-schema xxx --query-log-file some_slow_log.log &
done
nischay goyal
  • 3,206
  • 12
  • 23
  • That runs them sequentially, not concurrently. Perhaps you meant `command &` instead of `;`. – Peter Cordes May 27 '20 at 23:26
  • Your first and last code blocks are still sequential, not using `&` – Peter Cordes May 27 '20 at 23:32
  • 1
    Your answer doesn't say that, and the question's "sample command" doesn't use `&`. It's also not how bash's grammar works: `&` or `;` are separate from the command itself. `for i in {1..30}; do true & done` is valid, `& ;` would also work but be redundant. The key part of your answer is one character buried at the far right of the middle code block that would be very easy for most readers to miss. But anyway, this question is a duplicate of [How can I execute parallel "for" loops in Bash?](https://stackoverflow.com/q/47786684) so we can just close it instead of fixing your answer. – Peter Cordes May 27 '20 at 23:35
  • 1
    Anyhow, thanks for the recommendations. I fixed it. – nischay goyal May 27 '20 at 23:38
  • Be aware that the bash overhead of launching another background thread is non-trivial. If your query list is long enough, you can amortize the overhead enough to ignore it. – Rick James May 28 '20 at 21:39