On Sun, Oct 06, 2002 at 12:37:53PM -0700, Sean Chittenden wrote:
> [moving to modruby / modruby.net]
> 
> > > see mod_ruby Documents
> > >  http://www.modruby.net/doc/index.en.html
> > > and
> > >  apache/ruby-run.rb , apache/eruby-run.rb
> > > 
> > > > Where is 'Apache::MyAppRun.instance' defined?
> > > > The only thing I see defined is 'MyApp#handler'.
> > > 
> > > I'm sorry, it is my mistake.
> > > 
> > > -    RubyHandler Apache::MyAppRun.instance
> > > +    RubyHandler Apache::MyApp.instance
> > > 
> > > # My English is weak. I do not want to use English not much.
> > > # I am good at Japanese.
> > > 
> > 
> > Ok, first things first. I have created the following tree
> > from my website:
> > 
> >   main_site
> >      + htdocs
> >          timetest.rhtml
> >      + ruby
> >          rubyapp.rb
> 
> Move this into your site_ruby path, not into the document root.
 
Ok, I'll move it to site_ruby/apache/preload_timetest.rb.

> > I have the following in my http.conf file:
> > 
> >   <IfModule mod_ruby.c>
> >   RubyRequire apache/ruby-run
> >   RubyRequire apache/eruby-run
> >   RubyRequire apache/preload_timetest.rb
> > # this does   ^^^^^^^^^^^^^^^^^^^^^^^^^^
> > # not look right
> 
> I wouldn't worry about this.
> 
> >   <Location /ruby>
> >     SetHandler ruby-object
> >     RubyHandler Apache::RubyRun.instance
> >     RubyHandler Apache::MyApp.instance
> >   </Location>
> 
> Change the above to (I think you can trim it down to the following if
> you write the module correctly):
> 
>   <Location /myapp>
>     RubyHandler Apache::MyApp
>   </Location>
 
This still makes no sense to me. I have the following after
making the changes from above:

  mywebsite
   +-htdocs
   |  *.rhtml - these get executed fine
   +-ruby  
     no ruby files here yet. Don't see a need for them

  siteruby/apache
   +-preload_timetest.rb - Has the 'class MyApp' inside.

Now, I have two questions. It looks like I need
a .rthml or a .rbx file that loads MyApp from preload_timetest.rb.
I'm not sure how that code should look.

Second, what is <Location /myapp> doing?
Is myapp the name of the class or the name of the file?
Is this a directory off of site_ruby?

> > From a web browser the following works:
> > 
> >   mysite/timtest.rhtml
> > 
> > The following does NOT work:
> > 
> >   mysite/preload_timetest.rb
> 
> .rb files aren't associated with mod_ruby.  Try changing it to a .rbx
> file and I think you'll see some better results.
> 
> > Am I right to think that a preloaded ruby script needs to be in the
> > RUBYLIB/apache path and not in the mysite/ruby directory?
> 
> Yes.
> 
> > If so, then what does the location directive above have to do with
> > setting up a preloaded ruby script?
> 
> Do you really need to preload your script?  I'd recommend running the
> benchmark a total of 4 times.
> 
> 1st time:   run the benchmark, then throw away the data
> 2-4th time: run the benchmark, avg the times.
 
If you look at the min and max times of the scripts, there
is very little spread. Definitly less than the 50ms difference
that I was seeing. Also, the more I think about it, the more
I think the 50ms difference is additional startup delay that
mod_ruby has over php and not performance.

> -sc
> 
> -- 
> Sean Chittenden
> 

-- 
Jim Freeze
----------
Programming Ruby 
 def initialize; fun; end
A language with class