-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Proposal: Gitea git cat-file Subprocess Management Optimization #33952
Comments
If we do not like creating sub-processes, why not just use "gogit"? |
I think
I don't whether it's fast enough to just replace |
But I do not think you made it right: #33954 (comment) |
We only need the " cat-file / attr-check " (reading some entry information) in this case, other problems won't really happen. And maybe go-git v6 will have sha256 support. |
Yes. That's a better alternative than this one if the performance is enough and sha256 will be supported. |
I've looked briefly at gitlab's gitaly and it looks like they are just using git under the hood there (no idea if they have some patches on top of it) and that got me curious - what benefit does gogit bring over git binary, besides not having to carry the git binary with gitea? Is it that some operations are faster there? |
you still need local git installed even for gogit. |
Gitaly used to rely on libgit2 about two years ago but later switched to using native Git commands. It now utilizes git cat-file --batch and git cat-file --batch-command, which is similar to Gitea’s approach of spawning a new subprocess for each request. I think they have implemented a similiar subprocess cache https://gitlab.com/gitlab-org/gitaly/-/tree/master/internal/git/catfile?ref_type=heads @eeyrjmr Have you run any benchmark tests comparing the two Gitea binaries? Unlike native Git, go-git lacks features like git cat-file --batch, which makes it significantly slower when working with large repositories such as the Linux kernel. One potential solution is to implement a mechanism similar to git cat-file --batch based on go-git to improve performance. |
You're right, they have a cache layer for cat-file so it might be a good idea to look through it for reference. I think gitea will end up supporting gitaly for distributed scenarios so it's not a bad idea to mirror some solutions. |
Feature Description
Background
Currently, Gitea creates a new
git cat-file --batch
subprocess for each request when handling git operations. While this approach is straightforward, it leads to the following issues in high-concurrency scenarios:Proposal Overview
Design and implement a lightweight
git cat-file --batch
subprocess manager to improve performance and resource utilization through subprocess reuse. Key features include:Detailed Design
Subprocess Manager Structure
Core Functionality Implementation
Acquiring a Subprocess
Creating a New Subprocess
Releasing a Subprocess
Periodic Cleanup
start the manager
Implementation Considerations
Performance Expectations
Drawbacks
git cat-file --batch
run for a long time and repository updated, what will happen.TODO
The text was updated successfully, but these errors were encountered: