-2

I want to run my client program 25,000 times. I need to create a batch file for this purpose. I just want to test my server how many connections it will accept without any delays. I am using java. nio. Can anybody help me?

  1. I need to know how to create batch file for running a program.

  2. How to call Batch file using java program.

  3. How to create a batch file which run a java program 25,000 times.

Thanks in advance.

UmNyobe
  • 21,924
  • 8
  • 55
  • 89
Amith
  • 1,827
  • 5
  • 29
  • 47

2 Answers2

2

Run 25k times in sequence:

for /l %%x in (1,1,25000) do (java -cp ... MyClass)

Run 25000 times in parallel:

for /l %%x in (1,1,25000) do (start "" java -cp ... MyClass)

If you want to limit the parallelism (which you should for such high numbers) then you need a bit more logic. One example is given in this answer.

Community
  • 1
  • 1
Joey
  • 330,812
  • 81
  • 665
  • 668
1

Why not just put the loop inside your client program? or write another class that calls it 25,000 times? But:

I just want to test my server how many connections it will accept without any delays

This test won't test that, as all the connections are sequential: each previous connection is closed by the program exiting before the next one starts. If your server doesn't pass that test there is something very seriously wrong with it. A more interesting test would be how many concurrent connections it can handle.

user207421
  • 298,294
  • 41
  • 291
  • 462