Slow page rendering


Some of my repos very slow when browsing to any of their pages from the browser. The index pages, an empty issues page, any of them.

The new repos are very fast, e.g. Page: 12ms Template: 1ms.

While these other repos are slow, both the home page takes this long: Page: 4601ms Template: 2ms. The empty pull request section takes about the same. The repo these load times were from have these stats:

  • 1160 Commits
  • 45 Branches
  • 477 Releases

While the rendering was happening the CPU went from 10% to 100% utilization all for the gogs process. Watching mytop I did not notice any slow queries.

Using gogs, go 1.9.2, CentOS Linux release 7.2.1511 (Core), database 10.1.18-MariaDB.


Hi, in the case of your repository has many directories, Gogs happens to take some time to load because we don
t cache data right now.


I get it. Is it number of folders? I saw an open issue on commit counts but I don’t know this is related. I ran the commit count manually on disk and it was 5s the first time, then sub-second all subsequent times - which is not the observed behavior on my server.

Are there any options which can mitigate this issue?

Also is there an existing issue open on this? I don’t know if it’s more involved then I’d have time address, but I’d like to review it before I rule out doing a PR.


Currently, the load time couldn’t be faster without having cache, but cache system is not something that we accept PRs, I’ll do it myself.

More cores and powerful CPU might help, but not ideal.


I get it.

Can you point me at what is taking the most processing time?

I can dedicate a VM to this and I want to look at whatever optimizations are possible from an operations end of things.


Getting count of branches, count of releases, and list of file/dirs are all possible to slow down the process. Basically CPU and disk IO