How to increase the performance of libssh2 NMSSH Framework ios

I am using NMSSH Framework version 2.2.0 to download files from server. I found that the file chunk size is fixed to 2000 bytes libssh2_sftp_read () , this method returns a fixed size. I tried increasing the buffer size, but it won't increase the chunk read size. I want to increase the performance of the structure by increasing the Chunk size.

+3


source to share


2 answers


I found a way to increase the chunk size. The snippet size is hardcoded in the libssh2 library, you need to download the source code from the libssh2 site and then edit the constant given in the sftp.h file i.e. #SFTP_READ_SIZE 8000 or whatever size you want, but make sure it doesn't have to be larger than your buffer size.



Then rebuild the library.

+2


source


Even though the body of the question asks about resizing the libssh2 block, the title of the question is still the top result on Google when looking for NMSSH performance.

So, to answer the title of the question:

Instead of rebuilding libssh2, I found the following simple steps to improve NMSSH performance. Enable compression:

   libssh2_session_flag(sshSession.session, LIBSSH2_FLAG_COMPRESS, 1)

      



where sshSession is an instance of NMSSHSession (in Objective-C the getter is rawSession).

And besides, for NMSFTP, increase the default buffer size from 16k to 128k:

    sftpSession.bufferSize = 128 * 1024

      

where sftpSession is an NMSFTP instance

0


source







All Articles