Ticket #7975 (new defect)
Viewing changesets is very slow
| Reported by: | it@… | Owned by: | cboos |
|---|---|---|---|
| Priority: | normal | Milestone: | next-minor-0.12.x |
| Component: | version control/changeset view | Version: | 0.11.2.1 |
| Severity: | major | Keywords: | |
| Cc: |
Description
Running trac 0.11.2.1 with Postgres 8.1.11 backend. We have approximatley 20k changesets. It takes several minutes to render a changeset. The systems appears to be doing heavy I/O against the database during the rendering. Have tried adjusting max_diff_bytes and max_diff_files to various settings with no effect.
Attachments
Change History
comment:1 Changed 14 months ago by cboos
- Component changed from general to version control/changeset view
- Milestone set to 0.13
comment:2 Changed 13 months ago by cboos
- Milestone changed from 0.13 to 0.12
Also eventually in connection with #515.
comment:3 Changed 7 months ago by cboos
- Owner set to cboos
- Severity changed from normal to major
An alternative idea to try out is to by pass the Genshi match filters by pre-rendering the diff sections.
comment:4 Changed 7 months ago by cboos
#8530 closed as duplicate - doing some rendering optimizations will also hopefully reduce overall memory consumption.
comment:5 Changed 5 months ago by rblank
- Milestone changed from 0.12 to next-minor-0.12.x
Moving alongside #515.
comment:6 follow-up: ↓ 7 Changed 3 months ago by Sascha Kratky <kratky@…>
The problem seems to be related to the number of changesets. We have a Trac environment with around 15K changesets and viewing a changeset that contains just one changed file has become unbearably slow. Another Trac environment with around 2K changesets does not have the problem.
We are using the following configuration:
- Mac OS X 10.5.9
- Trac 0.11.6
- Python 2.5.1
- SQLite 3.4.0
- pysqlite 2.3.2
- Pygments 1.1.1
- Subversion 1.6.6
- Genshi 0.5.1
comment:7 in reply to: ↑ 6 ; follow-up: ↓ 8 Changed 3 months ago by Sascha Kratky <kratky@…>
Replying to Sascha Kratky <kratky@…>:
The problem seems to be related to the number of changesets. We have a Trac environment with around 15K changesets and viewing a changeset that contains just one changed file has become unbearably slow. Another Trac environment with around 2K changesets does not have the problem.
We are using the following configuration:
- Mac OS X 10.5.9
- Trac 0.11.6
- Python 2.5.1
- SQLite 3.4.0
- pysqlite 2.3.2
- Pygments 1.1.1
- Subversion 1.6.6
- Genshi 0.5.1
I have run some tests on the Trac environment and found out that Trac's CachedRepository? is very inefficient in combination with SQLite. Upon viewing a changeset the CachedRepository? method previous_rev is called. The method runs the following query to determine the predecessor revision number:
2009-12-13 16:12:33,686 Trac[cache] INFO: SELECT rev FROM node_change WHERE CAST(rev AS int) < %s ORDER BY CAST(rev AS int) DESC LIMIT 1 2009-12-13 16:13:00,294 Trac[cache] INFO: 14636 : 14635
This query takes almost half a minute on our repository with 15K changesets. Actually upon further inspection it turned out that CachedRepository? contains a lot of queries which become very slow once the Subversion repository has more than a couple of thousand changesets.
To work around the problem I disabled caching for the Subversion repository by changing the repository type in the environment's trac.ini file from svn to direct-svnfs. This bypasses the generation of a CachedRepository? and directly uses SubversionRepository instead.
repository_type = direct-svnfs
comment:8 in reply to: ↑ 7 Changed 2 weeks ago by cboos
Replying to Sascha Kratky <kratky@…>:
...
Upon viewing a changeset the CachedRepository? method previous_rev is called. The method runs the following query to determine the predecessor revision number:
2009-12-13 16:12:33,686 Trac[cache] INFO: SELECT rev FROM node_change WHERE CAST(rev AS int) < %s ORDER BY CAST(rev AS int) DESC LIMIT 1 2009-12-13 16:13:00,294 Trac[cache] INFO: 14636 : 14635
This query takes almost half a minute on our repository with 15K changesets. Actually upon further inspection it turned out that CachedRepository? contains a lot of queries which become very slow once the Subversion repository has more than a couple of thousand changesets.
This has been fixed in r9224.
To work around the problem I disabled caching for the Subversion repository by changing the repository type in the environment's trac.ini file from svn to direct-svnfs. This bypasses the generation of a CachedRepository? and directly uses SubversionRepository instead.
repository_type = direct-svnfs
Don't, for determining the predecessor revision number, it's even (orders of magnitude) slower, for now (see ticket:8813#comment:1).



Good, we were just discussing on Trac-dev what we could do besides max_diff_bytes and max_diff_files to guarantee a faster response time, see googlegroups:trac-dev:26e351fbb8941f69.