Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Zeno Davatz
Dear Ben

On Fri, Feb 11, 2011 at 2:34 PM, Ben Noordhuis  wrote:
> On Fri, Feb 11, 2011 at 14:11, Zeno Davatz  wrote:
>>> Apache on Windows serves all requests from a single process.
>>
>> Apache on Linux does not do that?
>
> Nope. The worker and event MPMs are hybrids: serving requests from
> many processes, where each process has many threads. And if all
> processes are busy, Apache will simply spin up more.

Ok, thank you for this hint! I am reading this now:
http://httpd.apache.org/docs/2.2/en/mpm.html

>>> The Ruby interpreter is not thread-safe so mod_ruby creates a Big Mutex
>>> whenever it needs to run. Thus on Windows, with its single-process
>>> model, mod_ruby can only serve one request at a time.
>>
>> So you say, that mod_ruby on Windows can _not_ leverage its power
>> because Apache on Windows is a single thread process?
>
> Effectively single-threaded when mod_ruby is serving a request, yes.

So in other words, what I am trying to achieve - trying to have a big
load of Traffic on Apache for Windows with mod_ruby - does not work
the same way as it does for Linux because of Apache for Windows
running in a single process with many threads.

So it is back to the books then.

Thank you for your help, Ben and Eric.

Best
Zeno


Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Ben Noordhuis
On Fri, Feb 11, 2011 at 14:11, Zeno Davatz  wrote:
>> Apache on Windows serves all requests from a single process.
>
> Apache on Linux does not do that?

Nope. The worker and event MPMs are hybrids: serving requests from
many processes, where each process has many threads. And if all
processes are busy, Apache will simply spin up more.

>> The Ruby interpreter is not thread-safe so mod_ruby creates a Big Mutex
>> whenever it needs to run. Thus on Windows, with its single-process
>> model, mod_ruby can only serve one request at a time.
>
> So you say, that mod_ruby on Windows can _not_ leverage its power
> because Apache on Windows is a single thread process?

Effectively single-threaded when mod_ruby is serving a request, yes.


Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Zeno Davatz
Dear Eric

On Fri, Feb 11, 2011 at 2:25 PM, Eric Covener  wrote:
>> Apache on Linux does not do that? Our Apache on Linux with mod_ruby
>> sometimes has over 1'000 sessions and about 30-50 threads open. Memory
>> can go up to 10 GB.
>
> Normally Apache on unix uses multiple child processes. See your MPM
> and MPM configuration for details.

Yes, thank you. I am just reading this:

http://httpd.apache.org/docs/2.2/platform/windows.html

Quote: Because Apache for Windows is multithreaded, it does not use a
separate process for each request, as Apache can on Unix. Instead
there are usually only two Apache processes running: a parent process,
and a child which handles the requests. Within the child process each
request is handled by a separate thread.

Fundamental stuff I did not know this explicitly.

Best
Zeno


Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Zeno Davatz
Dear Eric

On Fri, Feb 11, 2011 at 2:23 PM, Eric Covener  wrote:
>> I can execute Ruby as a CGI-script without a problem with these simple
>> VirtualHost settings (I tested it with test.rbx)
>
> What does that have to do with debugging mod_ruby?

It shows that Ruby can be executed as a CGI-Script on Apache without
mod_ruby. I think that is helpful to know.

Best
Zeno


Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Eric Covener
> Apache on Linux does not do that? Our Apache on Linux with mod_ruby
> sometimes has over 1'000 sessions and about 30-50 threads open. Memory
> can go up to 10 GB.

Normally Apache on unix uses multiple child processes. See your MPM
and MPM configuration for details.


Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Eric Covener
> I can execute Ruby as a CGI-script without a problem with these simple
> VirtualHost settings (I tested it with test.rbx)

What does that have to do with debugging mod_ruby?


Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Zeno Davatz
Dear Ben

Thank you for your valuable input!

On Fri, Feb 11, 2011 at 1:55 PM, Ben Noordhuis  wrote:
> On Fri, Feb 11, 2011 at 08:25, Zeno Davatz  wrote:
>> I am trying to debug mod_ruby to load in Apache for Windows. So far
>> Apache for Windows does start with mod_ruby.so but it seems that httpd
>> does not start correctly with mod_ruby enabled in Apache for Windows.
>
> I don't have a solution for you but I would suggest to not do this
> (run mod_ruby on Windows, that is).

Ok, I take notice of this.

> Apache on Windows serves all requests from a single process.

Apache on Linux does not do that? Our Apache on Linux with mod_ruby
sometimes has over 1'000 sessions and about 30-50 threads open. Memory
can go up to 10 GB.

> The Ruby interpreter is not thread-safe so mod_ruby creates a Big Mutex
> whenever it needs to run. Thus on Windows, with its single-process
> model, mod_ruby can only serve one request at a time.

So you say, that mod_ruby on Windows can _not_ leverage its power
because Apache on Windows is a single thread process?

This is very interesting.

Best
Zeno


Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Ben Noordhuis
On Fri, Feb 11, 2011 at 08:25, Zeno Davatz  wrote:
> I am trying to debug mod_ruby to load in Apache for Windows. So far
> Apache for Windows does start with mod_ruby.so but it seems that httpd
> does not start correctly with mod_ruby enabled in Apache for Windows.

I don't have a solution for you but I would suggest to not do this
(run mod_ruby on Windows, that is).

Apache on Windows serves all requests from a single process. The Ruby
interpreter is not thread-safe so mod_ruby creates a Big Mutex
whenever it needs to run. Thus on Windows, with its single-process
model, mod_ruby can only serve one request at a time.


Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Zeno Davatz
Dear Eric

Thank you for your reply.

On Fri, Feb 11, 2011 at 1:37 PM, Eric Covener  wrote:
>> I really think it is the Content Handlers that do not work. So there
>> must be something different there in Apache for Windows compared to
>> Apache for Linux.
>
> Not in every other module that implements a handler, or even the one
> you care about when compiled with VS -- seems like some kind of ABI or
> tools problem not a problem with the module's src code.

Say that again please. So where should I start looking for next? How
do you recommend I should go about to debug this problem from the ABI
point of view. Which tools do you mean?

BTW:

I can execute Ruby as a CGI-script without a problem with these simple
VirtualHost settings (I tested it with test.rbx)

NameVirtualHost *:80


ServerName de.oddb.win
DocumentRoot
C:\Ruby-1.8.6-oniguruma\lib\ruby\gems\1.8\gems\de.oddb-2.0.0\doc
DirectoryIndex index.rbx
#RubyAddPath
'C:/Ruby-1.8.6-oniguruma/lib/ruby/gems/1.8/gems/de.oddb-2.0.0/lib'
#RubyRequire 'sbsm/trans_handler'
#RubyTransHandler SBSM::ZoneTransHandler.instance


Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all

#RubyHandler Apache::RubyRun.instance
#SetHandler ruby-object



I put test.rbx into the above doc folder and it works fine. My
index.rbx will not be executed because I need the SBSM Handler
(internal tool). Also mod_ruby can handle a lot more RPS and is just
much faster. So that is why I need mod_ruby.

Best
Zeno


Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Eric Covener
> I really think it is the Content Handlers that do not work. So there
> must be something different there in Apache for Windows compared to
> Apache for Linux.

Not in every other module that implements a handler, or even the one
you care about when compiled with VS -- seems like some kind of ABI or
tools problem not a problem with the module's src code.

-- 
Eric Covener
cove...@gmail.com


Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Zeno Davatz
Dear Eric

Thank you for your reply.

On Fri, Feb 11, 2011 at 12:51 PM, Eric Covener  wrote:
> On Fri, Feb 11, 2011 at 2:25 AM, Zeno Davatz  wrote:

>> I am trying to debug mod_ruby to load in Apache for Windows. So far
>> Apache for Windows does start with mod_ruby.so but it seems that httpd
>> does not start correctly with mod_ruby enabled in Apache for Windows.
>>
>> The steps I took to compile mod_ruby for Apache for Windows 2.2.17
>> with MinGW are here:
>
> you should eliminate mingw from the equation if you're mostly
> interested in the ruby side.

The reason why I need MinGW is because Ruby was compiled with MinGW. I
did compile mod_ruby with nmake on Windows. Works fine and Apache
starts as well if I install Ruby via nmake as well. Not a problem.

But I am dependent on the Oniguruma-patch and that patch can only be
applied with MinGW at the moment. Also Ruby compiled with MinGW is
faster then when compiled with nmake.

Are you a Windows or a Linux User? I am asking because I think I am
not that far away. I just need to understand the workings for Apache
in Windows a bit better - as mod_ruby does compile with MinGW with the
changes I pointed out.

So if you can point me towards somewhere to debug mod_ruby for Apache
on Windows so that I get my normal Server-Info as on Linux for:
Request Phase Participation.

I really think it is the Content Handlers that do not work. So there
must be something different there in Apache for Windows compared to
Apache for Linux.

Best
Zeno

PS: The Ruby-Windows Installer is compiled with MinGW. And that is a
great installer.


Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Eric Covener
On Fri, Feb 11, 2011 at 2:25 AM, Zeno Davatz  wrote:
> Hi
>
> I am trying to debug mod_ruby to load in Apache for Windows. So far
> Apache for Windows does start with mod_ruby.so but it seems that httpd
> does not start correctly with mod_ruby enabled in Apache for Windows.
>
> The steps I took to compile mod_ruby for Apache for Windows 2.2.17
> with MinGW are here:

you should eliminate mingw from the equation if you're mostly
interested in the ruby side.


mod_ruby on Apache for Windows 2.2.17

2011-02-10 Thread Zeno Davatz
Hi

I am trying to debug mod_ruby to load in Apache for Windows. So far
Apache for Windows does start with mod_ruby.so but it seems that httpd
does not start correctly with mod_ruby enabled in Apache for Windows.

The steps I took to compile mod_ruby for Apache for Windows 2.2.17
with MinGW are here:

http://dev.ywesee.com/wiki.php/Apache/Libapr-1

The Apache Server-Info of my Windows Box is:

Module Name: mod_ruby.c
Content handlers: none
Configuration Phase Participation: Create Directory Config, Merge
Directory Configs, Create Server Config, Merge Server Configs
Request Phase Participation: none

The Apache-Server Info of my Linux-Box is:

Module Name: mod_ruby.c
Content handlers: yes
Configuration Phase Participation: Create Directory Config, Merge
Directory Configs, Create Server Config, Merge Server Configs
Request Phase Participation: Post-Read Request, Translate Name, Check
Access, Verify User ID, Verify User Access, Check Type, Fixups,
Content Handlers, Logging

So something clearly seems to be different between Windows and Linux.

I am willing to pay to get this fixed.

Best
Zeno