0

I would like to stress test a website using wget commands. How to concurrently run 40 wget commands in Microsoft Windows environment?

I have tried writing command script but the wget command will be triggered one by one.

Imran Ali Khan
  • 8,469
  • 16
  • 52
  • 77
hosir
  • 477
  • 1
  • 9
  • 33
  • question should be redirected to: http://stackoverflow.com/questions/3430810/wget-download-with-multiple-simultaneous-connections Also, are you sure running 40 wget commands is the best way to stress test a website? – Bassem Jun 04 '15 at 02:13
  • If you're establishing more than 20 concurrent connections you need to disable rate limiting. See https://social.technet.microsoft.com/Forums/windows/en-US/18667011-c034-43bc-ab2e-0e87bf811e5e/windows-7-increase-the-limit-of-concurrent-tcp-connections-not-related-to-eula-file-sharing?forum=w7itpronetworking – rojo Jun 04 '15 at 03:19

2 Answers2

2

You can use for /L to run a loop 40 times, and start to launch the program without waiting. From the command line:

for /L %a in (1 1 40) do start wget the_url

From a batch file, you would use the same command, except use %%a instead of %a

Because wget is a command-line program, you will see 40 new console windows open up, which should close automatically as the wget commands finish. You can avoid this by using start /b to run the commands all in the same console. In this case, I would also pipe the output of each command to NUL, to avoid having forty instances writing to the same console.

for /L %a in (1 1 40) do start /b wget the_url >nul
Ryan Bemrose
  • 9,018
  • 1
  • 41
  • 54
0

Use the & operator along with the start command:

C:\> start wget URL1 & start wget URL2 & start wget URL3.....
abelenky
  • 63,815
  • 23
  • 109
  • 159
  • `&` doesn't make them all launch at the same time. Each instance will only start once the one before has exited. – rojo Jun 04 '15 at 03:22
  • 1
    @rojo - that would only be true if the /WAIT option were used. This solution should work, but it would be simpler to put each START WGET on a new line and ditch the `&`. – dbenham Jun 04 '15 at 20:22
  • I'm pretty sure `start` was not a [part of this answer](http://stackoverflow.com/revisions/30633841/1) when I left that comment. Tricky. `-_-` – rojo Jun 05 '15 at 03:46