scragg0x / realms-wiki

Git based wiki inspired by Gollum
http://realms.io
GNU General Public License v2.0
833 stars 91 forks source link

Slow Performance CPU Spikes? #145

Closed stevezau closed 7 years ago

stevezau commented 8 years ago

Hi,

I am in the process of converting to Realms Wiki. We have built a script to convert from trac wiki to Realms.

For some reason realms takes a while to render some pages (5-10seconds). I've noticed gunicorn goes to 100% cpu usage during this time. Even after subsequent loads..

I'm using Realms via docker, on latest version.

Any ideas where i can start to troubleshoot?

gazpachoking commented 8 years ago

It appears this is somehow related to the state of the git repo. We are serving this repo https://github.com/Flexget/wiki. Depending on the commit that is currently checked out, the performance changes drastically. On the markdown3 branch (currently at 88ee8b7) realms is very snappy at serving the pages, but on markdown4 (bbb3ebc) it takes 5-10 seconds to serve a page before it's been cached. The working tree is verrry similar between those 2 branches, so it doesn't seem it's anything to do with the number of files, or contents of those files, but something more internal to git.

gazpachoking commented 8 years ago

There is more info in #147, but the main issue is that to get the history for a given file, you have to step through every commit starting from HEAD, checking to see if the given file was modified in each one. For repos with a lot of commits, this could get very slow. Compounding the problem was that the first item of history was getting looked up needlessly for every (non-cached) page view, making regular browsing painful. Partially solved with #147, and more discussion for improvements in #149

@scragg0x I think we can close this issue and follow up in the others.