On 28.09.2024 at 16:30, hostmas...@audiogen.ch wrote: > After I got ssh2 running, I'm struggling with performance issues. > > Same file, same server system (Ubuntu), same client system (Ubunut), same > network connection, only difference is the transfer protocol - sftp vs. > https. > > > > File to download: > > Size: 33.6 MB > > Type: Zip file > > > > Download time > > with ssh2/sftp: 45 sec > > with wget/https: 1.6 sec > > with openssh-client/sftp: 6 sec > > > > That's quite a huge difference! > > I played around with the buffer_size of the input stream but no improvement > was achived. > > > > $buffer_size = 64*1024; > > $j = 0; > > while ($data = fread($remote_stream, $buffer_size)) { > > ++$j; > > fwrite($local_stream, $data); > > } > > echo $j; > > > > The data is received in 4314 buffers, which indicates the chunk size the > server is using to transfer data is 8k (33.6 * 1024 * 1024 / 4314). So > setting buffersize on the client side or in ssh2 seems to have no effect. > > > > The results make me conclude the problem can't be sftp as such nor the > server. So it's probably me :-) Is there anything performance-wise I'm > missing? Something in need to tweak in the PHP configuration? .. ?
I suggest you open a ticket at <https://github.com/php/pecl-networking-ssh2/issues>. Or maybe ask on <https://stackoverflow.com/>. Christoph