[erlang-questions] ssh client

Daniel Goertzen daniel.goertzen@REDACTED
Tue Sep 7 21:17:04 CEST 2010


Thanks Kenji. I did come across that and it was helpful.  In the end,
ssh_sftp and ssh_sftpd were the readily available examples I was looking
for.


This might be of interest to the list, so I'll share it...

I stress tested Erlang and SSH by establishing 1000 concurrent SSH client
sessions.  Each server sent back an 8 byte message every 250ms.  On my
Windows Core2Duo 3GHz, system load was ~25%.

To compare, I also wrote the client in Python using Paramiko for SSH (1 OS
thread per connection).  CPU load and memory usage was consistent with the
Erlang solution, but it died at 400 connections due to address space
exhaustion (thread stacks were too big...probably fixable, but I didn't try
too hard)

Also, I wrote a Python client that used plink.exe for SSH. (1 OS process per
connection).  CPU load was consistent with the Erlang solution, but memory
use was insane. It died at ~500 connections due to lack of file descriptors
(also probably fixable, but I didn't try).

In all cases, the server was a single linux machine running Erlang/SSH.  The
actual use case for all this is to talk SSH to 1000 individual embedded
systems on a large LAN.  I am pleased with the way Erlang has behaved.

Dan.

On Mon, Sep 6, 2010 at 11:57 PM, Kenji Rikitake <kenji.rikitake@REDACTED>wrote:

> http://github.com/jj1bdx/sshrpc/
>
> Far from a complete one - but might be useful.
> Kenji Rikitake
>
> In the message <AANLkTi=xDOQ7P8nfCW-=P+98daXyKW=
> RJhO4NVkvUYsd@REDACTED>
> dated Wed, Sep 01, 2010 at 11:17:21AM -0500,
> Daniel Goertzen <daniel.goertzen@REDACTED> writes:
> > I want to write a program that will chat with another remote program via
> > SSH.  Erlang SSH is a bit complex, and I was unable to find an example of
> > what I wanted, so I thought I would confirm my approach here before
> barking
> > up the wrong tree.  Here is what I was going to do:
> >
> >
> > 1. Open a connection with ssh:connect()
> > 2. Open a channel with ssh_connection:session_channel()
> > 3. Call ssh_channel:start_link() to create my handler process.
> > 4. In my callback module, init() will call ssh_connection:exec() to
> invoke
> > the remote program.
> > 5. Incoming data gets sent to my handle_ssh_message() callback.  I send
> data
> > with ssh_connection:send()
> >
> > Do I have it right?
> >
> > It would be nice if there was a "port" abstraction for an ssh channel, so
> I
> > could treat locally and remotely invoked programs identically...  I guess
> it
> > wouldn't be hard to write my own wrapper for that.
> >
> > Thanks,
> > Dan.
>



-- 
Daniel Goertzen
-----------------
dang@REDACTED (work)
daniel.goertzen@REDACTED (home)
-----------------
1 204 272 6149 (home/office)
1 204 470 8360 (mobile)
-----------------


More information about the erlang-questions mailing list