Single Thread for KEX Handling Causes Increased SSH Latency with High Concurrent Connections
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 400
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 1
Description
### Version
2.12.1
### Bug description
The issue is related to [Apache MINA SSHD #458](https://github.com/apache/mina-sshd/issues/458).
In version 2.12.1, a singleton thread pool was introduced for the Key Exchange (KEX) message handler flushing. This change has led to a significant increase in the time taken to establish SSH connections when a single client frequently connects to multiple servers. With only one thread available for KEX, this architecture becomes a bottleneck.
Our application frequently SSHs to over 10,000 servers to periodically poll specific information. Due to the single-threaded KEX, all 10,000 SSH connections now rely on the same thread, causing the average time to SSH into a server to increase. This directly impacts the application's polling frequency, leading to performance degradation.
### Actual behavior
A single thread is used for KEX, leading to increased SSH time when the client handles several thousand SSH connections concurrently.
### Expected behavior
Provide a configurable option to set the number of threads for KEX.
### Relevant log output
_No response_
### Other information
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the KEX message-handler flushing change introduced in version 2.12.1 and the related Apache MINA SSHD issue #458. Trace how the shared KEX thread pool is created and configured, then identify concurrency or connection-establishment tests covering many simultaneous clients. Done means the KEX thread count can be configured and high-concurrency connection latency is no longer constrained to one thread.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100