Re: [PECL-DEV] ssh2 / performance issue
[email protected] ("Christoph M. Becker") Fri, 4 Oct 2024 01:03:40 +0200
| Newsgroups | php.pecl.dev |
|---|---|
| Message-ID | <[email protected]> |
On 28.09.2024 at 16:30, [email protected] wrote: > After I got ssh2 running, I'm struggling with performance issues. > > Same file, same server system (Ubuntu), same client system (Ubunut), sam= e > 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 improvem= ent > was achived. > > > > $buffer_size =3D 64*1024; > > $j =3D 0; > > while ($data =3D 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