Slow hgweb.cgi
Dominik Psenner
dpsenner at gmail.com
Thu Apr 14 02:13:01 CDT 2011
I managed the profiling it by myself and thus I love to share the outcome
with you.
Here's the output of the profiler:
1022/395 0.012 0.000 0.576 0.001 templater.py:200(_flatten)
9/7 0.004 0.000 0.580 0.083 util.py:233(increasingchunks)
130305 0.620 0.000 0.620 0.000 posixpath.py:170(samestat)
1 0.000 0.000 0.660 0.660 wsgicgi.py:14(launch)
511 0.564 0.001 1.188 0.002
util.py:1275(_add_dir_if_not_there)
9228 2.092 0.000 2.092 0.000 :0(stat)
8670 0.024 0.000 2.120 0.000 genericpath.py:38(isdir)
4683/512 0.036 0.000 2.776 0.005 os.py:209(walk)
34 0.000 0.000 4.044 0.119 :0(extend)
10 0.000 0.000 4.044 0.404 hgwebdir_mod.py:40(urlrepos)
10 0.012 0.001 4.044 0.404 util.py:1269(walkrepos)
1 0.000 0.000 4.044 4.044 hgwebdir_mod.py:22(findrepos)
4 0.000 0.000 4.128 1.032 hgwebdir_mod.py:63(refresh)
1 0.000 0.000 4.128 4.128 hgwebdir_mod.py:56(__init__)
1 0.000 0.000 4.132 4.132 __init__.py:12(hgweb)
1 0.000 0.000 4.796 4.796 profile:0(main())
3/1 0.000 0.000 4.796 4.796 <string>:1(<module>)
1 0.000 0.000 4.796 4.796 test.sh:2(main)
ncalls tottime percall cumtime percall filename:lineno(function)
This explains why hg serve works well. It's within the hgwebdir_mod and thus
this code is executed only by the cgi script.
Then let's start with figuring out what's going wrong there. This is the
paths syntax I use in the config file:
[paths]
/ = repos/*
And there are 10 repositories inside. That certainly should not be a number
that would cause problems. But one can observe that he went abnormally often
through here:
4683/512 0.036 0.000 2.776 0.005 os.py:209(walk)
Could it be that the walker is recursing into .hg directories and searching
there for repositories?
More information about the Mercurial-devel
mailing list