jsch


how to increase the jsch buffer size?


I am using jsch for sftp file transfer. When I send file using sftp command by setting the buffer size 512 (-B option ) sftp B 512 [sftp server name] and invoking put command, I can transfer files in 8.0MBPS. (The regular speed is 3.0MBPS).
When I do the same file transfer using jsch api in java, I get only 2.6MBPS. Is there any option to increase the buffer size in jsch or improve the speed of jsch?
Here is my code...
Channel channel = null;
ChannelSftp channelSftp = null;
log("preparing the host information for sftp.");
try {
JSch jsch = new JSch();
session = jsch.getSession(username, hostname, port);
session.setPassword(password);
java.util.Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.connect();
System.out.println("Host connected.");
channel = session.openChannel("sftp");
channel.connect();
log("sftp channel opened and connected.");
channelSftp = (ChannelSftp) channel;
channelSftp.cd(SFTPWORKINGDIR);
File f = new File(fileName);
channelSftp.put(new FileInputStream(f), f.getName());
log("File transferred successfully to host.");
} catch (Exception ex) {
System.out.println("Exception found while transfer the response.");
ex.printStackTrace();
} finally{
channelSftp.exit();
log("sftp Channel exited.");
channel.disconnect();
log("Channel disconnected.");
session.disconnect();
log("Host Session disconnected.");
}
Check out the newer version of Jsch (1.50), it became faster downloading.
It may work but I am not sure. I saw it somewhere in jsch code base.
You can try it out:
getSession().setConfig("max_input_buffer_size", "increased_size");

Related Links

java jsch -executing multiple unix commands
How to get one stream from error stream and input stream when calling a script using JSCH
SFTP using jschexception verify false sometimes fails
how to increase the jsch buffer size?
The cipher 'aes256-cbc' is required, but it is not available
How to pause/resume procedure while/after upload file by ChannelSftp
jsch + running multiple command in shell after SU and then close channal
NGit/Nsch Generating SSH Keypair (c# Jgit)
Extract userInfo from JSCH stream
Running a Shell Script using java ( process Builder ) with a specific unix user
Java jsch and resuming file upload after interruption?
How to pass a variable through channel in Jsch?
How to handle passwords prompts in expectj
Retaining the last modified date while using ChannelSftp for file transfer
Is there a limit to how many channels can be open per session in JSch?
How to read JSch command output?

Categories

HOME
maven
image
kde
smarty
alpha
directx
autotools
volttron
google-cloud-spanner
jplayer
flask-wtforms
graphlab
highlight.js
propel
database-replication
text-rendering
oxyplot
conemu
scriptcs
errorlevel
sylius
tapestry
core-text
bootstrap-tour
shopware
intel-pin
pingfederate
webkitspeechrecognition
skia
directx-10
vsts-build-task
android-nestedscrollview
nssegmentedcontrol
overriding
service-discovery
webix-treetable
angularjs-factory
eclipse-scout
grid.mvc
no-www
btrace
apache-fop
dotnetzip
crypt
nsarray
python-cryptography
arrow-keys
or-tools
google-cdn
infix-notation
dstu2-fhir
etsy
fputcsv
actionbardrawertoggle
whois
rvest
bluemix-app-scan
netmq
jms2
lib.web.mvc
eclipse-clp
cannon.js
feedback
spidermonkey
rgeo
twirl
apache-commons-fileupload
sonarqube5.1.2
device-orientation
npapi
tld
contenttype
fluentautomation
dealloc
floating-point-precision
bulkloader
qt-faststart
orchardcms-1.7
ocunit
factory-method
path-separator
datawindow
automount
viewswitcher
data-loss
subgurim-maps
joyent
horizontal-accordion
rfc1123
yslow
asp.net-profiles
meego
exchange-server-2003
putchar

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App