Yes, it seems so. Looking briefly at the code it seems that the
'stream' mode that is used when uncompressed is selected on clone can
only be used when no heads have been specified. Do you think that it
could be possible to use this mode on pull or push (at least when
pulling all changes?).
Still, I am surprised that the web server itself seems to bet "stuck"
and not serve any pages while a big pull operation is being performed.
Is that normal?
Could it be because python only uses one of the server
processors?
Also I suspect that this probably also explains why sometimes pulls
seem to take even longer than usual. It probably happens when a user
starts a pull while another user is already performing pull, push or
clone operation. Does that make sense?
On Jul 6, 2012 8:29 PM, "Bryan O'Sullivan" <b...@serpentine.com> wrote:
>
> On Fri, Jul 6, 2012 at 7:57 AM, Angel Ezquerra <angel.e...@gmail.com> wrote:
>>
>>
>> Yes, it seems so. Looking briefly at the code it seems that the
>> 'stream' mode that is used when uncompressed is selected on clone can
>> only be used when no heads have been specified. Do you think that it
>> could be possible to use this mode on pull or push (at least when
>> pulling all changes?).
>
> No, since the protocol is completely different.
I was afraid that would be the case. What a potty, since the performance difference is huge!
>> Still, I am surprised that the web server itself seems to bet "stuck"
>> and not serve any pages while a big pull operation is being performed.
>> Is that normal?
>
>
> I don't think so. Is your server running via Apache, or as a standalone "hg serve"?
>
>>
>> Could it be because python only uses one of the server
>> processors?
>
>
> We'd need more details of your server setup before speculating, really.
I put some info on my first email. Since I'm on my phone i hope you don't mind if I just paste what i wrote, add some additional details and if you need something else just let me know:
The sever is an apache+wsgi based mercurial hgweb server. I believe the Apache version is 2.2 32 bit. The mercurial version is 1.9 and the python version is 2.6.5, 32-bit. The server is running on Windows Server 2003 Standard x64 edition. The machine running the web server is quite powerful, if slightly old, with a 2.33 GHz E5410 Xeon CPU coupled with 16 GB of RAM. The windows task manager shows that the server has plenty of free memory left (3.9 GB are used) and the CPU's are idle most of the time, with occasional peaks up to 50%. We are serving in the order of 500 repositories, including subrepos. There probably less than 50 potential users of this server.
>> Also I suspect that this probably also explains why sometimes pulls
>> seem to take even longer than usual. It probably happens when a user
>> starts a pull while another user is already performing pull, push or
>> clone operation. Does that make sense?
>
>
> It does suggest that there's some bottleneck on the server side.
Makes sense although I don't know what it could be. The task manager does not give any indication either since memory seems fine and CPU usage is high but does not seem to reach 100% on none of the processors.
Thanks for looking onto this!
Angel
The sever is an apache+wsgi based mercurial hgweb server.
So mod_wsgi.so was compiled for python 2.6.2. but we are using 2.6.5.
Other than that I don't see anything weird. However I am no expert on
any of this so I could be missing something trivial of course.
As a test, could you try running plain "hg serve" to see if that has the same problems? And also try running multiple instances of "hg serve" on different ports? (This will at least confirm whether or not the problem is threading-related)
I can't remember if "hg serve" can serve multiple repositories. I seem to remember TortoiseHG allowing it, but I'm not certain.
Simon
On Tue, Jul 10, 2012 at 3:00 PM, Martin Geisler <m...@aragost.com> wrote:No, Mercurial is a single-writer multiple-reader system. So you onlyneed a lock for write operations and there can be any number ofconcurrent readers at the same time.http://mercurial.selenic.com/wiki/LockingDesign--Martin Geisler
Martin,
but it is single-writer _per repo_ right? That is, it is not expected
that the wsgi process should block writing or even reading from a repo
when someone is writing (or even reading from) another repo, right?
> On Tue, Jul 10, 2012 at 3:00 PM, Martin Geisler <m...@aragost.com> wrote:
>> Benoît Allard <ben...@aeteurope.nl> writes:
>>
>>> Mercurial in itself has a few locks to prevent among others multiple
>>> write operation at the same time. Last time I looked at it, there was
>>> two kinds of locks: read locks (can have multiple of them, but not
>>> compatible with write lock), and write locks (only one allowed, not
>>> compatible with read locks.)
>>>
>>> If a user of yours is performing a huge push, I would expect the write
>>> lock to come in place, preventing anyone to read that repository until
>>> the push is done.
>>
>> No, Mercurial is a single-writer multiple-reader system. So you only
>> need a lock for write operations and there can be any number of
>> concurrent readers at the same time.
>>
>> http://mercurial.selenic.com/wiki/LockingDesign
>>
>> --
>> Martin Geisler
>
> Martin,
>
> but it is single-writer _per repo_ right? That is, it is not expected
> that the wsgi process should block writing or even reading from a repo
> when someone is writing (or even reading from) another repo, right?
Remember that python's threading behaviour is limited by the Global Interpreter Lock - only a single thread can be running python code at any time. I don't know exactly how this works with mod_wsgi (perhaps there are multiple interpreters?), but I could easily imagine a big push on one repository slowing down access to another, inside the same process.
I've also found that mercurial is generally slower on windows due to things like virus checkers, indexing services etc.
Simon
I think that if it turns out that this limited performance is to be
expected on windows when using apache this should probably be said
loud and clear on the wiki, perhaps on the PublishingRepositories
page.
On Tue, Jul 10, 2012 at 7:41 AM, Angel Ezquerra <angel.e...@gmail.com> wrote:I think that if it turns out that this limited performance is to be
expected on windows when using apache this should probably be said
loud and clear on the wiki, perhaps on the PublishingRepositories
page.It should be clear from the thread so far that you're the only person we know of who has shown up and talked about trying this, so until you can along we have had no reason to have any expectations of any kind (or to ever even think about the issue).(Not only that, but the people who have been offering you advice (myself included!) are clearly shooting in the dark, and at least some of what's being said (e.g. about the GIL) is somewhere between irrelevant and wrong.)
On Jul 12, 2012 4:09 AM, "Bryan O'Sullivan" <b...@serpentine.com> wrote:
>
> On Tue, Jul 10, 2012 at 7:41 AM, Angel Ezquerra <angel.e...@gmail.com> wrote:
>>
>> I think that if it turns out that this limited performance is to be
>> expected on windows when using apache this should probably be said
>> loud and clear on the wiki, perhaps on the PublishingRepositories
>> page.
>
>
> It should be clear from the thread so far that you're the only person we know of who has shown up and talked about trying this, so until you can along we have had no reason to have any expectations of any kind (or to ever even think about the issue).
I'm a bit surprised that I'm the first one with this problem. Either it is specific to my setup or nobody serves hg repos through Apache + wsgi on windows...
> (Not only that, but the people who have been offering you advice (myself included!) are clearly shooting in the dark, and at least some of what's being said (e.g. about the GIL) is somewhere between irrelevant and wrong.)
>
> The most we've established so far is that it seems fairly clear that you have a concurrent access problem with the combination of Apache and mod_wsgi; I have no way of knowing if this is generic to Windows or specific to your local configuration. To figure that out, it seems worth trying CGI, as Adrian suggested.
I think you are right. Changing from wsgi to CGI is the next thing I'll try next week when I'll be back from a short vacation :-)
I'll let you guys know the results of my tests a soon as I've done them.
Thanks a lot to all of you for your help an suggestions. I'll be back with more info next week.
Cheers,
Angel
Would you mind elaborating on why the GIL is definitely not the issue here?