-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Extremely slow post-receive hook of Gitea - in Docker on a Synology server #13706
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
Comments
There has been a lot of work on speed, and other performance increases. Please update to at least the latest version. |
Hi @techknowlogick , I have installed version 1.12.6 but actually if you look at the logs below there is no change. Any ideas?
|
OK so the post-receive endpoint here is doing: Lines 373 to 529 in b7ad2d4
This essentially iterates through the stdin of post-receive checking and updating the refs that the push has updated collates them and then: Line 425 in b7ad2d4
gitea/modules/repofiles/update.go Lines 639 to 700 in b7ad2d4
L642 is unlikely to be slow here. However L652 could be the problem: gitea/modules/repofiles/update.go Line 652 in b7ad2d4
How big is your repository? |
Hi @zeripath , my repository is I think very small about 2MB. But I am using SQlite. My doubt was the performance of the database but I do not know if this could be related? |
Only 2Mb? There's something very wrong going on here. |
Is there any way I can help debugging? |
We need more logs. Read: https://docs.gitea.io/en-us/logging-configuration/#debugging-problems In addition, consider setting: [server]
ENABLE_PPROF = true The way you use pprof is on the server do: go tool pprof http://localhost:6060/debug/pprof/profile?seconds=60
should give you the longest running functions. SQL logs could be obtained using: [database]
LOG_SQL=true
... Additional git logs using: RUN_MODE = dev However the pprof option and the additional logs from following the debugging information above should help. |
I'm using the latest version and sometimes it takes several seconds to push files to a repository, all of these files range from 1 KB to 800 KB. I'm using the API from the automatically generated client library from https://github.com/belidzs/Gitea and automating a process of uploading thousands of small files to thousands of repositories belonging to thousands of users.
|
what do you mean by |
Yes, 1.13.1. |
Ok could you read #13706 (comment) so that we actually have some information to go about debugging this |
I have attached the trace log file here:
|
@atillabyte thank you. Looks like most of the time is spent on argon2. Please follow #13718 for more details. |
I modified it to use PBKDF2 with 1 iteration so basically instant user creation, now it is this:
|
Web or SVG or one of the other visual tools would be helpful because too doesn't tell us what is calling those functions. A lot of the git calls will end up having to be done though so there might not be further improvement. At the end of the day reducing from 13s to 910ms should represent a huge improvement though. |
I have no idea how to do that. I've never used Go prior to this week. Is there a chance there could be benchmarks made? The improvement doesn't have anything to do with uploading a file into a repository, it's just eliminating the time it takes to compute a hash for a new users password. The upload process for a file that is less than a megabyte in size should take only a few milliseconds, especially when it is being run on localhost. I'm trying to figure out where that time is being spent, but I'm at a dead end now. To compute the hash for the file in Git shouldn't take very long since it uses SHA-1... any ideas? |
They're just commands on the pprof prompt |
SVG is in here:
|
Ok. Well that's not completely helpful because it's telling me about multiple different http requests. All of these requests appear a little slow to me but none of them match with a slow post-receive which is what this issue was about. There's a 1.64s call to repo.CreateFile in there which could match with your description of uploading a file - but that is not what this issue is about and if that's where your problem is then you're on the wrong issue. Now... That doesn't mean to say that we can't help further but please could you be a lot clearer in future. Ok assuming you actually do want to complain about uploading a file over the API. We need to focus in on that request to figure out where that 1.64s is being spent. In pprof:
Should then give us an annotated source code which would allow us to dig in further. Now I expect that would not be too helpful so we'd need to look at:
And
Following the code down the slowest things to find what really is the slow cause. The runtime.cgocall things you are seeing in the |
Oh. I was under the impression that the two were related. I will create a new issue then. #14668 |
I just got my GitEA synology docker installed and have a trivial repo: nothing in it, except the branch where i deleted README.md. It is soo slow. I was sold on the claims that this was lightweight and not turgid and slow. Anyway, I have beefy NAS with a 10G connexion to my client and nothing else running in Docker except an unused BitWarden. I added the nas-git as a remote to my keybase-git based repo. Keybase has to go out to the keybase servers plus locally perform various crypto ops, and I am familiar with how slow it is: not really. The nas-git takes noticeably longer to do nothing.
Almost 10x slower. That is impressive! |
I haven't read through the entire history of this issue yet, but it seemed relevant to what I'm seeing on my instance. I'm on 1.14.x and I'm seeing what looks like Google Bot crawling my instance with logs like:
This is triggering high latency alarms for me that I trigger on >300ms threshold. |
In terms of performance - whilst I appreciate lots of users can't run main - 1.14 is over 400 commits behind 1.15 and there are many many improvements in 1.15. Try the building from If problems persist there - then report back but moaning about 1.14 performance is deeply unhelpful. |
I'd love to use a later version if only you guys would push up a newer set of Docker images :) Can we do that? If not, I'll build it myself :D |
Also as much as I believ eyou, check the logs again and the IP address. Do a |
I pushed 1.15.0-RC2 yesterday and it's up on docker hub... But I suspect you're not using the gitea/gitea build? What build are you using? |
Let me check and get back to you! Thanks! 🙇♂️ |
I stand corrected: https://webmasters.stackexchange.com/questions/123987/googlebot-doing-post-requests Googlebot will now do POSTs when it believes that it is safe to do so I suspect putting your website in your recent issue means that your site is being crawled by the GoogleBot. I recommend that you create a robots.txt as per https://docs.gitea.io/en-us/search-engines-indexation/ |
I don't mind my instance being crawled as long as there isn't any form of abuse going on :D |
But I'll read those docs anyway just in case I want to change things... 👌 |
[x]
):Description
Hello,
if I push to my repository it takes up to 30-40 seconds. Looking at the logs I see one line that has raised my attention:
[Macaron] 2020-11-26 17:55:24: Completed POST /api/internal/hook/post-receive/StormTest/newFramework3 200 OK in 19.555562956s
Why does the post-receive hook take 20 seconds to complete for a repository with a size of only about 2MB?
I have not setup any post-receive hook. What is going wrong?
Any ideas? Help appreciated.
Kind regards,
Markus
Logs
The text was updated successfully, but these errors were encountered: