Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase SFTP chunk size to increase the SFTP throughput in both directions #664

Open
wants to merge 11 commits into
base: devel
Choose a base branch
from

Conversation

Jakuje
Copy link
Contributor

@Jakuje Jakuje commented Nov 19, 2024

SUMMARY

This is built on top of #638 so it depends on that change

Previously, the 1024b chunk was used, which resulted in large traffic overhead as each of the chunk needs to be wrapped in SFTP packet, as well as large overhead on high-latency links as the SFTP is now synchronous, waiting for every packet confirmation.

The libssh documentation recommends to use 16kB chunks, but using 32kB chunks should be safe as it still fits to the recommended limits in the SFTP specification. Using large reads could cause issues such as curl/curl#11804

ISSUE TYPE
  • Bugfix Pull Request

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Nov 19, 2024
@Jakuje Jakuje mentioned this pull request Nov 19, 2024
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/ansible-pylibssh-664
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

src/pylibsshext/sftp.pyx Outdated Show resolved Hide resolved
@Jakuje
Copy link
Contributor Author

Jakuje commented Dec 22, 2024

The 🐍 3.9@macos-13 job is weird. It fails the first time (with some internal error -- not sure if we can do anything about that), but works on maximum verbosity ...

Copy link

@NilashishC
Copy link
Contributor

@Jakuje When trying to build a wheel/sdist with the combined changes in PR #638 and this one, I get the following error:

Error compiling Cython file:
------------------------------------------------------------
...
#
from posix.types cimport mode_t

from libc cimport stdint

from pylibsshext.includes.libssh cimport ssh_channel, ssh_session, ssh_string
^
------------------------------------------------------------

src/pylibsshext/includes/sftp.pxd:22:0: 'pylibsshext/includes/libssh/ssh_string.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
        stdint.uint64_t createtime
        stdint.uint32_t createtime_nseconds
        stdint.uint64_t mtime64
        stdint.uint32_t mtime
        stdint.uint32_t mtime_nseconds
        ssh_string acl
        ^
------------------------------------------------------------

src/pylibsshext/includes/sftp.pxd:53:8: 'ssh_string' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        stdint.uint64_t mtime64
        stdint.uint32_t mtime
        stdint.uint32_t mtime_nseconds
        ssh_string acl
        stdint.uint32_t extended_count
        ssh_string extended_type
        ^
------------------------------------------------------------

src/pylibsshext/includes/sftp.pxd:55:8: 'ssh_string' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        stdint.uint32_t mtime
        stdint.uint32_t mtime_nseconds
        ssh_string acl
        stdint.uint32_t extended_count
        ssh_string extended_type
        ssh_string extended_data
        ^
------------------------------------------------------------

src/pylibsshext/includes/sftp.pxd:56:8: 'ssh_string' is not a type identifier
[fedora@libssh-fedora-41 pylibssh]$ rpm -qa | grep libssh
libssh-config-0.10.6-8.fc41.noarch
libssh-0.10.6-8.fc41.x86_64
libssh-devel-0.10.6-8.fc41.x86_64

Any ideas?

@Jakuje
Copy link
Contributor Author

Jakuje commented Jan 22, 2025

@Jakuje When trying to build a wheel/sdist with the combined changes in PR #638 and this one, I get the following error:

How did you combine these? This PR has all the commits from the #638.

This sounds like somehow the change to src/pylibsshext/includes/libssh.pxd did not land in your code:

https://github.com/ansible/pylibssh/pull/664/files#diff-fcc18a6d0552824c2398f687496ca9bc8db6eadb690f6093826daf73fdc83230

@NilashishC
Copy link
Contributor

@Jakuje You're right. I might have missed something while applying the patches. The PR works out great. I've verified it to significantly improve SFTP performance compared to the existing one.

@webknjaz
Copy link
Member

The 🐍 3.9@macos-13 job is weird. It fails the first time (with some internal error -- not sure if we can do anything about that), but works on maximum verbosity ...

@Jakuje py3.10 too. One of the differences is that the rerun disables the coverage plugin. And the first run seems to be crashing in one of the pytest-cov's teardown hook.

I've restarted the CI to see if that happens again. But will probably have to look into what deps need to be pinned or upgraded.

@webknjaz
Copy link
Member

Error: This request has been automatically failed because it uses a deprecated version of actions/download-artifact: v3. Learn more: https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/

Urgh.. Need to upgrade that too.

@webknjaz
Copy link
Member

@NilashishC adding merge commits to topic branches causes foxtrot merges and inconveniences for contributors, it's best to select the rebase mode or let the contributor handle such updates unless they stated that it's okay to mess with their branch. Let's not be careless like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants