go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.02k stars 5.49k forks source link

Slow response on repo/search #30661

Open richardbeumer opened 6 months ago

richardbeumer commented 6 months ago

Description

After updating Gitea from version 1.21.5 to 1.21.10 performance of repository search is much slower as before. Repo search was near instant and now taking up around 8 seconds.

We are using Elastic as repo indexer.

Logs show:

2024/04/23 12:40:42 ...eb/routing/logger.go:68:func1() [W] router: slow      GET /repo/search?sort=updated&order=desc&uid=11&team_id=undefined&q=bgt&page=1&limit=15&mode=&archived=false for 10.244.2.12:44360, elapsed 3301.6ms @ repo/repo.go:507(repo.SearchRepo)
2024/04/23 12:40:42 ...eb/routing/logger.go:102:func1() [I] router: completed GET /metrics for 10.244.4.12:50702, 200 OK in 220.7ms @ web/metrics.go:16(web.Metrics)

Screenshots

image

Gitea Version

1.21.10

Can you reproduce the bug on the Gitea demo site?

No

Operating System

kubernetes/container image

Browser Version

Chrome 124 / Firefox 125

lunny commented 6 months ago

The repository name search on dashboard just a database like operation. It's weird.

richardbeumer commented 6 months ago

I will have a look at our database then. Strange thing is that most search queries give a good response where other queries are slow.

lunny commented 6 months ago

What type database are you using with Gitea?

richardbeumer commented 6 months ago

We are running on Postgres.

alvonwong commented 5 months ago

I have the same problem . 1.21.5 works fine on FreeBSD14.1release/amd64/postgresql15,but 1.21.6 shows slow router and can't edit with sqlite or postgresql . FYI, v1.21.11 and v1.22.0 work fine on FreeBSD14.1release/amd64/postgresql15 .

somera commented 3 months ago

I run Gitea 1.22.1 with PostgreSQL 16 on NUC with 4 Cores and Ubuntu 22.04.x server. And I have ~22000 projects and the search ist fast. The question is how is your database configured. How much memory, work_mem, ... All this has an impact on the speed. And when you see the wuery in postgresql.log or gitea.log, than just try explain analyse sql in an db client to see what happens.