1000 distinct SSH command execution using JASSH SSH API executed in less than 35 seconds, the executed remote shell code is "sleep 1 ; echo 'Hello from hostid'", so at least one second is spent on each host.

Of course, I'm using the same localhost destination host for this small SSH/JASSH performance test. So it may require some ssh daemon tuning, check /etc/ssh/sshd_config file, parameters MaxSessions and MaxStartups ; those parameters values must be set to a value superior to the chosen parallelism level.

JASSH is JSCH based, this library is doing classic blocking IO, so there are as many threads as we have simultaneous SSH connections established ; as many threads as the chosen parallelism level. High parallelism value may be counterproductive, I will need a NIO SSH implementation for better performances.

On my 6 core host, I got the following results with various parallelism level :
Parallelismduration Best theorical duration
1 1020s 1000s
10 116s 100s
25 48s 40s
50 35s 20s
75 37s 13s
100 41s 10s

So best value for my server is around 50 for this kind of processing.

The scala script requires you to use java 7 or better (ForkJoinPool is used). The concurrency model used is based on futures, check SIP-14 - Futures and Promises for more information.