-
-
Notifications
You must be signed in to change notification settings - Fork 962
Closed
Milestone
Description
I am trying to make SSH connections to multiple clients concurrently to check their availability.
I noticed that, after a specific limit, increasing thread count doesn't have an effect on total process time.
For testing purposes,
I choose a fake IP address that connection will never happen and set the connection timeout to 5 seconds.
private static void MakeConnection()
{
using (var client = new SshClient("1.2.3.4", 22, "test", "test"))
{
client.ConnectionInfo.Timeout = TimeSpan.FromSeconds(5);
try
{
client.Connect();
}
catch { }
}
}
Executed test runs for different thread & connection counts.
Here are the results:
Thread Count | Connection Count | Total Process Time |
---|---|---|
1 | 1 | 5 sec |
2 | 2 | 5 sec |
3 | 3 | 5 sec |
4 | 4 | 10 sec |
5 | 5 | 10 sec |
6 | 6 | 10 sec |
7 | 7 | 15 sec |
8 | 8 | 15 sec |
I expect to see 5 sec for each row but somehow effective active thread counts seems like 3. Even though I spawn 8 threads, it has been processed as 3+3+2.
What might be causing this behaviour?
Simple console application to reproduce the issue:
https://gist.github.com/cankut/4efb95d2da8fdf63fb14cf762b1f953d
patgauvingeek and vovanluan
Metadata
Metadata
Assignees
Labels
No labels