Hi,

Yes, your suggestion also works, just as my hack did, by forcing the 
allocation of a pty.
Unfortunately, I am concerned of the performance and resource 
ramifications in my application, as there could be hundreds, or 
potentially thousands of these sessions.

Based on your suggestion, I added the following code:

  // HACK! This is to cause the SSHD not to buffer data for better 
performance
  com.jcraft.jsch.ChannelExec hackChannel = ( 
com.jcraft.jsch.ChannelExec ) dataSession.getSession(  ).openChannel( 
"exec" );
  hackChannel.setPty( true );    // Assign a Pseudo TTY to our Session 
to improve latency for small packets from SSHD
  hackChannel.connect(  );
  hackChannel.disconnect(  );

After this code executes, any reverse forwards over this Session are 
high performance (no latency).
I am also worried about a timing issue by disconnecting the ChannelExec 
immediately after connecting in a high-volume scenario.
What do you think?

Thanks,
  - Scott

On 5/19/2011 10:15 PM, Atsuhiko Yamanaka wrote:
> Hi,
>
> Thank you for your interesting feedback,
>
>     +-From: "B. Scott Smith"<sc...@smithdomain.com>  --
>     |_Date: Thu, 19 May 2011 12:12:18 -0500 ___________
>     |
>     |After investigating this issue, I discovered that the performance was
>     |good with the native SSH client because it was allocating  a pseudo
>     |terminal (pty) to display the remote command shell. When I instructed
>     |the SSH client NOT to allocate a pty (ssh -N -R5900:localhost:5900 ...),
>     |I was able to duplicate the same poor performance I saw with JSch.
>     |Apparently, if there is no pty assigned to the remote session, the SSH
>     |server will buffer and "chunk" the data over all reverse forwards on
>     |that session.
>
> Is it needed to keep running pty during remote port forwarding session or
> is it enough to establish and disconnect pty before requesting port 
> forwarding?
> If the later is enough, how about
>   ChannelExec#setPty(true)
> with simple remote command?
>
>
> Sincerely,
> --
> Atsuhiko Yamanaka
> JCraft,Inc.
> 1-14-20 HONCHO AOBA-KU,
> SENDAI, MIYAGI 980-0014 Japan.
> Tel +81-22-723-2150
>      +1-415-578-3454
> Skype callto://jcraft/
> Twitter: http://twitter.com/ymnk
> Facebook: http://facebook.com/aymnk

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to