You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Rod Morris <za...@gmail.com> on 2006/03/07 02:49:52 UTC

Concurrency with mod_perl 2.01 on Windows

Hi all,

I'm porting some old perl code to a new installation of Apache/2.0.54
(Win32) mod_perl/2.0.1 on Windows 2003 Server. In testing some file locking
code, I noticed that response seemed very slow when I dumped in multiple
jobs via multiple browsers to the server. I added a timer and saw the
scripts waiting for one to finish before the next started as if they were
queued waiting for the server.

I've got another server running freeBSD and it's set up to run mutilple
instance of Apache which seems to deal with this. But on Windows, I haven't
added anything for this and it comes up by default with 2 instances of
Apache.

It's my impression that threading should be used to deal with mutilple
requests for one script, but that's not what I'm seeing. I'm seeing one
script wait and then start when the last one finishes. MY script just gets
the time, sleeps and then gets the time again.

Am I missing a configuration option or do I need a different version of
perl? I installed for the standard combined Apache/mod_perl distribution.

Thanks,
Rod Morris

Re: Concurrency with mod_perl 2.01 on Windows

Posted by Perrin Harkins <pe...@elem.com>.
On Tue, 2006-03-07 at 04:43 -0800, Rod Morris wrote:
> Now, it appears that what I'm seeing is related to the browser. With
> IE, mutilple requests to one perl script are no issue. With Firefox,
> multiple requests are queued and served in order. Strange.
> 
> Any ideas?

Difference in keep-alive behavior maybe?

It could also be some kind of locking issue in your code.  Do you use a
session module that does exclusive locking?

- Perrin


Re: Concurrency with mod_perl 2.01 on Windows

Posted by Rod Morris <za...@gmail.com>.
Hi Bill,

I don't believe that these are the issues. Just for grins, I logged on to a
couple of servers and dumped the jobs in via a browser. As I suspected, it
was no problem and I saw them all running simultaneously. Next I opened a
copuple more IE windows and tried the same thing. No problem.

Now, it appears that what I'm seeing is related to the browser. With IE,
mutilple requests to one perl script are no issue. With Firefox, multiple
requests are queued and served in order. Strange.

Any ideas?

Rod

On 3/6/06, William A. Rowe, Jr. <wr...@rowe-clan.net> wrote:
>
> One thing that causes a significant performance degredation on Win32 is
> fixed, we are looking at the second issue.
>
> In APR, unbuffered writes were system-level flushing.  I believe this
> had to do with some early network testing and multiple-writer concurrency
> issues, but the end result is unacceptable, and you may be seeing this.
> 2.0.56 and 2.2.1 will likely incorporate this fix.
>
> The other is multi-process concurrency using file level locking from byte
> 0 to -1 (unlimited).  This too has proven very slow, although I'm not yet
> sure how much the previous issue impacted this apparent performance.
>
> Effectively, on Unix write() is atomic, and in append mode, safe across
> processes/threads.  On win32, we need to emulate this behavior.  That
> said,
> just be aware that we are researching this.
>
> The patch to the already committed quirk for 2.0 windows is here;
>
> http://svn.apache.org/viewcvs?rev=378055&view=rev
>
> Let us know if this alters your observed performance.
>
> Yours,
>
> Bill
>
>
> Rod Morris wrote:
> > Hi all,
> >
> > I'm porting some old perl code to a new installation of Apache/2.0.54
> > (Win32) mod_perl/2.0.1 on Windows 2003 Server. In testing some file
> > locking code, I noticed that response seemed very slow when I dumped in
> > multiple jobs via multiple browsers to the server. I added a timer and
> > saw the scripts waiting for one to finish before the next started as if
> > they were queued waiting for the server.
> >
> > I've got another server running freeBSD and it's set up to run mutilple
> > instance of Apache which seems to deal with this. But on Windows, I
> > haven't added anything for this and it comes up by default with 2
> > instances of Apache.
> >
> > It's my impression that threading should be used to deal with mutilple
> > requests for one script, but that's not what I'm seeing. I'm seeing one
> > script wait and then start when the last one finishes. MY script just
> > gets the time, sleeps and then gets the time again.
> >
> > Am I missing a configuration option or do I need a different version of
> > perl? I installed for the standard combined Apache/mod_perl
> distribution.
> >
> > Thanks,
> > Rod Morris
> >
> >
>
>

Re: Concurrency with mod_perl 2.01 on Windows

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
One thing that causes a significant performance degredation on Win32 is
fixed, we are looking at the second issue.

In APR, unbuffered writes were system-level flushing.  I believe this
had to do with some early network testing and multiple-writer concurrency
issues, but the end result is unacceptable, and you may be seeing this.
2.0.56 and 2.2.1 will likely incorporate this fix.

The other is multi-process concurrency using file level locking from byte
0 to -1 (unlimited).  This too has proven very slow, although I'm not yet
sure how much the previous issue impacted this apparent performance.

Effectively, on Unix write() is atomic, and in append mode, safe across
processes/threads.  On win32, we need to emulate this behavior.  That said,
just be aware that we are researching this.

The patch to the already committed quirk for 2.0 windows is here;

http://svn.apache.org/viewcvs?rev=378055&view=rev

Let us know if this alters your observed performance.

Yours,

Bill


Rod Morris wrote:
> Hi all,
> 
> I'm porting some old perl code to a new installation of Apache/2.0.54 
> (Win32) mod_perl/2.0.1 on Windows 2003 Server. In testing some file 
> locking code, I noticed that response seemed very slow when I dumped in 
> multiple jobs via multiple browsers to the server. I added a timer and 
> saw the scripts waiting for one to finish before the next started as if 
> they were queued waiting for the server.
> 
> I've got another server running freeBSD and it's set up to run mutilple 
> instance of Apache which seems to deal with this. But on Windows, I 
> haven't added anything for this and it comes up by default with 2 
> instances of Apache.
> 
> It's my impression that threading should be used to deal with mutilple 
> requests for one script, but that's not what I'm seeing. I'm seeing one 
> script wait and then start when the last one finishes. MY script just 
> gets the time, sleeps and then gets the time again.
> 
> Am I missing a configuration option or do I need a different version of 
> perl? I installed for the standard combined Apache/mod_perl distribution.
> 
> Thanks,
> Rod Morris
> 
> 


Re: Concurrency with mod_perl 2.01 on Windows

Posted by Issac Goldstand <ma...@beamartyr.net>.
Hey Rod,

You're only supposed to get 2 processes on win32.  The win32 mpm
supports only one master process and one child processes (which causes
all sorts of issues and delays when the child process segfaults :-( ).
The child process loads by default with 250 worker threads which are the
"instances" you seem to be referring to.  By default mod_perl loads 1
perl interpreter into the parent process and then clones it 3 times
(tunable - see
http://perl.apache.org/docs/2.0/user/config/config.html#Threads_Mode_Specific_Directives)
 into the child process.  The clones are then made available to the
worker threads as explained at
http://perl.apache.org/docs/2.0/user/intro/overview.html#Threads_Support
(someone please correct me if that's wrong - my mp internals knowledge
is still somewhat limited)

So you'll always see 2 processes on win32 in the task manager
processlist though you can also check the thread counts to see the
workers).  Hope that helps somewhat.

 Issac

Rod Morris wrote:
> Hi all,
> 
> I'm porting some old perl code to a new installation of Apache/2.0.54
> (Win32) mod_perl/2.0.1 on Windows 2003 Server. In testing some file
> locking code, I noticed that response seemed very slow when I dumped in
> multiple jobs via multiple browsers to the server. I added a timer and
> saw the scripts waiting for one to finish before the next started as if
> they were queued waiting for the server.
> 
> I've got another server running freeBSD and it's set up to run mutilple
> instance of Apache which seems to deal with this. But on Windows, I
> haven't added anything for this and it comes up by default with 2
> instances of Apache.
> 
> It's my impression that threading should be used to deal with mutilple
> requests for one script, but that's not what I'm seeing. I'm seeing one
> script wait and then start when the last one finishes. MY script just
> gets the time, sleeps and then gets the time again.
> 
> Am I missing a configuration option or do I need a different version of
> perl? I installed for the standard combined Apache/mod_perl distribution.
> 
> Thanks,
> Rod Morris
> 
>