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 buffer size for create_regular_tmpfile_linkable_with_content #2831

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

nanonyme
Copy link
Contributor

The small buffer size results in really bad performance under any FUSE-based filesystems with round-trips.

@openshift-ci
Copy link

openshift-ci bot commented Mar 14, 2023

Hi @nanonyme. Thanks for your PR.

I'm waiting for a ostreedev member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@cgwalters
Copy link
Member

/ok-to-test

@cgwalters
Copy link
Member

Hmm...I wonder if higher level code should instead be creating a https://developer-old.gnome.org/gio/stable/GBufferedInputStream.html ?

What code paths were you seeing for this? What is the FUSE filesystem involved here?

@nanonyme
Copy link
Contributor Author

We're using buildbox-fuse as part of our build stack and running ostree inside it. We noticed the small reads and writes and polls result in very high overhead. It seems this is negligible with regular filesystems. Using larger buffer works consistently on both. This resulted in ballpark doubling filesystem performance.

The small buffer size results in really bad performance under any
FUSE-based filesystems with round-trips.
@nanonyme
Copy link
Contributor Author

Hmm...I wonder if higher level code should instead be creating a https://developer-old.gnome.org/gio/stable/GBufferedInputStream.html ?

It's possible this could also use higher-level primitive. I was just trying to avoid larger code changes. The conversion to g_malloc was largely to avoid allocating larger amounts of memory from stack when increasing buffer size.

@nanonyme
Copy link
Contributor Author

Ah yes, so the codepath was what flatpak build-export calls on ostree. I can't recall specific call anymore but we traced the hot path to this code segment a couple of months back.

@dbnicholson
Copy link
Member

FWIW, I recall reading a comment from a kernel developer a few years ago that using a classic kB sized buffer is a mistake. He suggested a much bigger buffer like 10 or even 50 MB would have much better performance with no downside.

@nanonyme
Copy link
Contributor Author

I have no problem increasing it further. The bump to 1MB is tested to improve performance and I would like a bump to at least this. It's quite trivial to change the number after switching to g_malloc, it's quite literally just a number.

@dbnicholson
Copy link
Member

I think 1MB is fine. I was just acking the idea that generally we should use a bigger buffer for these read loops.

@cgwalters
Copy link
Member

/override continuous-integration/jenkins/pr-merge

@cgwalters cgwalters merged commit 42aad34 into ostreedev:main Mar 15, 2023
@openshift-ci
Copy link

openshift-ci bot commented Mar 15, 2023

@cgwalters: Overrode contexts on behalf of cgwalters: continuous-integration/jenkins/pr-merge

In response to this:

/override continuous-integration/jenkins/pr-merge

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@nanonyme nanonyme deleted the larger-buffer branch March 15, 2023 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants