Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Effective concurrent SshClient connections bumps into a limit #409

Copy link
Copy link
@cankut

Description

@cankut
Issue body actions

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.