You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airavata.apache.org by DImuthu Upeksha <di...@gmail.com> on 2021/01/06 20:03:17 UTC

Reconsidering SSH client library

Hi Folks,

We have been using JCraft for a long time until when we move to SSHJ [3]
recently as the standard ssh client library of Airavata job manager. Main
reasons for that migration are the lack of error handlers and
implementation complexity of JCraft whereas SSHJ, provided cleanly defined
APIs to perform ssh command invocations and SFTP operations. The downside
of SSHJ is, it is mainly driven by one developer even though there are PRs
coming from other users. However, SSHJ is actively being developed (last
release Aug 2020 [4]) compared to JCraft (last release Nov 2018 [2])

Comparing both libraries, we had to manually implement connection pooling
support externally as both were designed for one-time invocation. We had to
manipulate the sessions and connections from outside to make sure that all
are utilized optimally without crashing the connections. However, from time
to time we are still seeing issues in this implementation as it is not the
natural way to go with either of these libraries.

While googling, I found Apache Mina SSHD [5]  is getting more development
attention these days [6]. Their documentation is also pretty good compared
to other libraries and as it is based on Apache Mina asynchronous IO, I
think that the performance also should be good. From the feature-wise,
session keepalive function [8] might open new ways to reuse a connection
without external pools and the remote-to-remote transfer [9] function will
release the trouble of handling input and output streams manually.

I'm going to give it a try in the next week as time permits but if any of
you have some experience working on mina-sshd library, please let me know.

[1] http://www.jcraft.com/jsch/
[2] https://mvnrepository.com/artifact/com.jcraft/jsch
[3] https://github.com/hierynomus/sshj
[4] https://mvnrepository.com/artifact/com.hierynomus/sshj/0.30.0
[5] https://github.com/apache/mina-sshd
[6] https://mvnrepository.com/artifact/org.apache.sshd/sshd-core
[7] https://github.com/apache/mina-sshd/blob/master/docs/client-setup.md
[8]
https://github.com/apache/mina-sshd/blob/master/docs/client-setup.md#keeping-the-session-alive-while-no-traffic
[9]
https://github.com/apache/mina-sshd/blob/master/docs/scp.md#remote-to-remote-transfer

Thanks
Dimuthu