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

Wiki overview of pages is loading slowly #20156

Closed
luwol03 opened this issue Jun 27, 2022 · 1 comment · Fixed by #32732
Closed

Wiki overview of pages is loading slowly #20156

luwol03 opened this issue Jun 27, 2022 · 1 comment · Fixed by #32732
Labels
performance/speed performance issues with slow downs topic/wiki
Milestone

Comments

@luwol03
Copy link

luwol03 commented Jun 27, 2022

Description

Yesterday I searched for a example _Sidebar.md for the wiki pages, especially how to link to other pages. While doing so I thought Gitea.com may has some wikis with a sidebar and I discovered the following repo: https://gitea.com/henri/wiki/wiki/?action=_pages , but this page is loading very slowly, page: ~11s, template: ~5ms.

Gitea Version

1.18.0+dev-14-g1e2c2edab

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

image

Git Version

No response

Operating System

No response

How are you running Gitea?

I discovered the bug on https://gitea.com. I guess it's using MySQL as discussed on discord.

Database

MySQL

@lunny lunny added performance/speed performance issues with slow downs topic/wiki and removed type/bug labels Jun 28, 2022
@lunny
Copy link
Member

lunny commented Jun 28, 2022

Obviously for every page in the list, it will invoke a git command below. There are over 100 pages in this list. That's why it's slow.

wiki-perf.wiki.git: /usr/local/bin/git -c protocol.version=2 -c uploadpack.allowfilter=true -c uploadpack.allowAnySHA1InWant=true -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= log -1 --pretty=format:%H -- Antisemitismus.md

Take a look at the code, it just wants to get the updated time of the file from git log.

	entries, err := commit.ListEntries()
	if err != nil {
		ctx.ServerError("ListEntries", err)
		return
	}
	pages := make([]PageMeta, 0, len(entries))
	for _, entry := range entries {
		if !entry.IsRegular() {
			continue
		}
		c, err := wikiRepo.GetCommitByPath(entry.Name())
		if err != nil {
			ctx.ServerError("GetCommit", err)
			return
		}
		wikiName, err := wiki_service.FilenameToName(entry.Name())
		if err != nil {
			if models.IsErrWikiInvalidFileName(err) {
				continue
			}
			ctx.ServerError("WikiFilenameToName", err)
			return
		}
		pages = append(pages, PageMeta{
			Name:        wikiName,
			SubURL:      wiki_service.NameToSubURL(wikiName),
			UpdatedUnix: timeutil.TimeStamp(c.Author.When.Unix()),
		})
	}

@lunny lunny added this to the 1.23.0 milestone Dec 5, 2024
lunny added a commit that referenced this issue Dec 6, 2024
Backport #32732 by @lunny

Fix #20156

We reuse the code from the repository code view instead of the current
code.
Previously it took `5653ms` for
https://gitea.com/henri/wiki/wiki/?action=_pages in my local machine,
now it's about `300ms` .

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance/speed performance issues with slow downs topic/wiki
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants