Forum: Ruby on Rails [ANN] Mongrel Web Server 0.3.12 -- Pre-Release

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Zed S. (Guest)
on 2006-03-27 12:05
(Received via mailing list)
Hello Everyone,

Mongrel is due for a 0.3.12 release which will feature some pretty
insane
goodies for everyone.  There's talk of IOWA support, lots of speed
improvements (including sendfile support), a great Configurator which
makes
configuring Mongrel a snap (especially for framework implementers), and
a
ton of debugging stuff.

WARNING

This is a pre-release announcement for the Mongrel Web Server 0.3.12.
That's ****PRE-release*** not release, not gold, not stable, not
will-keep-your-children-alive-in-a-snow-storm release.  PRE.  PRE means
it
will not work for you.  PRE means you will test and tell me what's wrong
because you like me and Mongrel.  PRE means you will not run this
release on
your MoneyMakerWeb2OhMatic 6000 web site and then complain to me that
you
have lost billions in the baby trafficking market.


DON'T CRY

Now that everyone is sufficiently scared, the list of what's changed is
given at:

    http://mongrel.rubyforge.org/news.html

Go ahead and do this to try out the 0.3.12 release for me (pretty
please):

  $ gem uninstall mongrel
  $ gem uninstall gem_plugin
  $ gem install mongrel --source=http://mongrel.rubyforge.org/releases/

And if you want to play with the deadly edge you can also do:

  $ gem install sendfile

This will give you a sendfile send for all of your static files.  Even
though everyone was raving about sendfile speed being like setting a cat
on
fire, it's actually only about 20% faster.  Let me know what you find
(and
if it works).

CHANGES

* A more complete Configurator and RailsConfigurator.  These make
setting up
Rails super easy but is mostly for framework implementers to use.
Still,
it's wicked neat API.
* The mongrel_rails script is implemented using the new Configurator
scheme
and works much better.
* You can pass a config file to mongrel_rails start and it will load
that
(command line options override) using the -C option.
* Graceful restart works more reliably (not in Win32 since it uses
services).
* Reload works better and doesn't break the restart.
* More logging of the start-up process.
* There is a wicked nice debugging framework that logs object counts,
open
files, and request params between each request.  Try mongrel_rails start
-B
and look in log/mongrel_debug.
* The Rails specific components are now in Mongrel::Rails modules.
* More examples using the Mongrel::Configurator.
* Dramatic speed improvements on FreeBSD, especially if you install the
ruby18-nopthreads version.
* Slight speed improvements on Mac OSX.  OSX is like shoving a slug
through
a cheese grater.  What's wrong with Apple?
* Platforms that can install ruby-sendfile will get an estimated 20%
speed
boost in static file serving.  This is currently FreeBSD, Linux, and
Solaris.
* Lots of little bug fixes and minor speed tweaks.

Try out the release and let me know if I missed anything.  It should
work
with Rails 1.1RC1 but I haven't tested extensively.


SPONSORSHIP

Mongrel now has sponsorship from Eastmedia (http://www.eastmedia.com) in
partnership with Verisign (http://www.verisign.com/) to make Mongrel
fast
and stable enough for enterprise class loads (meaning "gigantic", not
"Java
style").  Their sponsorship has made it possible to get large pools of
test
servers, payment to work on Mongrel, and a real application to use
Mongrel
on.  Everyone should toss out a thanks to them since this may mean I'll
get
to work on Mongrel full time in the near future and it will raise the
quality of Ruby application hosting in general.  Not to mention the fact
that they are letting all of my Mongrel work stay LGPL licensed and open
source.

Other companies benefiting from Ruby should take this as an example.  I
can
think of quite a few things (Ruby 1.9 and a real virtual machine are
just
two) that need some serious commercial cash to get them in gear.  If
you're
making money off Ruby consider hiring a developer part-time, full-time,
or
posting a bounty for something you and the community needs.  There's no
better time for enlightened self-interest than now.


Zed A. Shaw
http://www.zedshaw.com/
frazer horn (Guest)
on 2006-03-27 20:10
(Received via mailing list)
Zed

Congratulations on the sponsorship - fully deserved!!  I'm sure many,
many
people will benefit from this.

A quick note - you previously mentioned attempting to compile ruby on
windows nopthreads to see if it had similar inprovements as per BSD.  Is
this still in the pipeline

cheers

Fraz
A. S. Bradbury (Guest)
on 2006-03-27 22:50
(Received via mailing list)
On Monday 27 March 2006 09:04, Zed S. wrote:
> Mongrel is due for a 0.3.12 release which will feature some pretty insane
> goodies for everyone.  There's talk of IOWA support, lots of speed
> improvements (including sendfile support), a great Configurator which makes
> configuring Mongrel a snap (especially for framework implementers), and a
> ton of debugging stuff.

Mongrel has looked very interesting to me for a while. How does the
memory
usage of Mongrel compare to the equivalent fastcgi based solution? Also,
does
anyone have any real-world performance figures for Mongrel? Is FastCGI
faster? I'm really pleased to here about your sponsorship, and like you
I
also hope that companies will take a look at sponsoring other aspects of
Ruby.

Alex
Steve R. (Guest)
on 2006-03-28 01:32
(Received via mailing list)
I installed, per instructions, and even included the sendfile gem. Now,
pages
are served up fine, but any reference to things that ought to be under
the
public directory (images, stylesheets, javascripts) seem not to be
served.
This worked in the previous version of mongrel.

Uninstalling sendfile didn't fix the problem.

BTW: The mongrel console complains about the configurator in this
version.
--
View this message in context:
http://www.nabble.com/-ANN-Mongrel-Web-Server-0.3....
Sent from the RubyOnRails Users forum at Nabble.com.
Steve R. (Guest)
on 2006-03-28 01:57
(Received via mailing list)
Further notes:

OS/X Tiger
Ruby 1.8.4

Same effect with edge or 1.0 Rails
--
View this message in context:
http://www.nabble.com/-ANN-Mongrel-Web-Server-0.3....
Sent from the RubyOnRails Users forum at Nabble.com.
unknown (Guest)
on 2006-03-28 02:13
(Received via mailing list)
Steve,

Yep, total horrible bug in the fresh DirHandler code.  It's actually
sending two Content-Length headers on accident.  First one is 0 second
one
is the right length.

I've got a fix for this which I'll drop tonight as well as a tweak so
that
DirHandler only answers HEAD and GET requests and does the HEADs
correctly.  This seems to make IE snappier in the process.

Zed
Joe (Guest)
on 2006-03-28 02:21
Heh, there should be a Zed S. school of techical documentation. Where
can I get a MoneyMakerWeb2OhMatic 6000 web site? ;P

One serious question - what's "IOWA support"? I assume it's not some
sort of i18n/l12n support for some dialect in Iowa, US?

I want Mongrel to rock, but am gun-shy since my previous "15 minutes
then it becomes unresponsive experience." Any luck on figuring out what
may be/have been responsible?

Joe
Jonathan W. (Guest)
on 2006-03-28 02:25
(Received via mailing list)
Hi Zed,

>
> Try out the release and let me know if I missed anything.  It should work
> with Rails 1.1RC1 but I haven't tested extensively.

At least with 0.3.11 there seems to be no support for mime-types. The
server does not set default mime-types for docs, pdfs & co if I download
a file directly from the filesystem.

IMHO this is needed if you want to use Mongrel as an easy to setup
Windows deployment.

Greets,
Jonathan
Ben M. (Guest)
on 2006-03-28 07:07
(Received via mailing list)
Joe wrote:
> One serious question - what's "IOWA support"? I assume it's not some
> sort of i18n/l12n support for some dialect in Iowa, US?

http://enigo.com/projects/iowa/index.html

b
Zed S. (Guest)
on 2006-03-28 07:29
(Received via mailing list)
Hey Joe,

Yeah, I actually have goodies just for you.  I just updated the 0.3.12
release so go grab it:

  $ gem install --source=http://mongrel.rubyforge.org/releases/

Once it's installed, go to your app directory and try out:

  $ mongrel_rails start -B

Ok, hit your app a few 1000 times and then exit the app.  Go check out
the
log/mongrel_debug directory and look at all the files there.  It will
list
all open files between requests, the request parameters, objects that
were
live between requests, and then a final dump of all the objects that got
created during the app.

You should be looking for anything that's jamming up your threads like
files
not being closed etc.

Also check the mongrel log about the server being overloaded.

Let me know how it works.


Zed A. Shaw
http://www.zedshaw.com/
http://mongrel.rubyforge.org/
Zed S. (Guest)
on 2006-03-28 07:31
(Received via mailing list)
On 3/27/06 11:10 AM, "frazer horn" <removed_email_address@domain.invalid> wrote:

> Zed
>
> Congratulations on the sponsorship - fully deserved!!  I'm sure many, many
> people will benefit from this.
>
Thanks.  It's already helped out a lot just in motivation for me to
work.

> A quick note - you previously mentioned attempting to compile ruby on windows
> nopthreads to see if it had similar inprovements as per BSD.  Is this still in
> the pipeline
>
No luck.  I was trying to get ruby to build under MinGW to see if that
had
any difference first, but can't even get that build to install in the
right
directory.  I'll take a look at the one-click installer setups sometime
this
week too.
Zed S. (Guest)
on 2006-03-28 07:35
(Received via mailing list)
Jonathan,

It does have support for extending mime types. Take a look at the -h for
start:

Usage: mongrel_rails [options]
    -e, --environment ENV            Rails environment to run as
    -d, --daemonize                  Whether to run in the background or
not
    -p, --port PORT                  Which port to bind to
    -a, --address ADDR               Address to bind to
    -l, --log FILE                   Where to write log messages
    -P, --pid FILE                   Where to write the PID
    -n, --num-procs INT              Number of processor threads to use
    -t, --timeout SECONDS            Timeout all requests after SECONDS
time
    -m, --mime PATH                  A YAML file that lists additional
MIME
types
    -c, --chdir PATH                 Change to dir before starting (will
be
expanded)
    -r, --root PATH                  Set the document root (default
'public')
    -B, --debug                      Enable debugging mode
    -C, --config PATH                Use a config file
    -h, --help                       Show this message
        --version                    Show version

You pass it -m and a YAML file with the mapping of any mime types you
want.
Mongrel has a very small default set since there actually isn't much of
a
"standard" on the types and postfix mapping doesn't help much for things
like Rails.

Here's an example mime file:

---
.jpeg: image/jpeg
.png: image/test

The --- is important.

Zed A. Shaw
http://www.zedshaw.com/
http://mongrel.rubyforge.org/
Joe (Guest)
on 2006-03-28 14:41
Hey Zed,

I installed the latest Mongrel, but can't get my Rails app to load at
all now :(. This is the error I'm getting:

NoMethodError (private method `sub' called for nil:NilClass):
    /app/controllers/application.rb:18:in `set_site'

And line 18 is:

    server_name = request.env["SERVER_NAME"].sub(/:[0-9]+/, '')

So it looks like the request method/variable isn't getting set for some
reason (perhaps Mongrel isn't forwarding the request vars onto Rails, or
however it works - but it seems Rails' request method should still be
available).

Using:
  FC4
  Lighty with "fair" proxying to five mongrels (-d -n 5)
  Rails 1.0

Joe
Joe (Guest)
on 2006-03-28 14:46
I another app I have that just uses a straight proxy to a single Mongrel
process and that works. But it looks like :0 is getting appended as the
port for my link_to URLs, but only when named routes are used. For
example:

link_to 'abc', foo_url(:id=>123) # http://xyz.com:0/foo/123
link_to 'def', {:controller=>'bar', :id=>456) # http://xyz.com/bar/456

Joe
Joe (Guest)
on 2006-03-28 14:53
One more note - I rolled back to Mongrel 0.3.11 and both apps I
mentioned in my last two posts now work fine. Hopefully this all is
helpful info Zed :).

Joe
Zed S. (Guest)
on 2006-03-28 18:33
(Received via mailing list)
All fixed up Joe.  Go ahead and grab the 0.3.12 pre-release again (gem
install mongrel --source=http://mongrel.rubyforge.org/releases/) and
shoot
me any more bugs you run into.


Zed A. Shaw
http://www.zedshaw.com/
http://mongrel.rubyforge.org/
Zed S. (Guest)
on 2006-03-28 20:01
(Received via mailing list)
One more thing Joe, this code seems to be wrong. The SERVER_NAME is just
the
DNS name of the server and the SERVER_PORT has the port.  If you're
doing
what you have below then you're not getting the port at all since
Mongrel
already strips it.

I think what you want for this is the HTTP_HOST parameter, which is the
raw
param that comes from the browser for what host it is talking to.

Zed A. Shaw
http://www.zedshaw.com/
http://mongrel.rubyforge.org/
Joe (Guest)
on 2006-03-28 23:34
Right on Zed. I tried again, then ran ab:

$ ab -n 1000 -c 25 xyz.com/categories/index

Server Software:        Mongrel
Server Hostname:        www.xyz.com
Server Port:            80

Document Path:          /categories/index
Document Length:        9945 bytes

Concurrency Level:      25
Time taken for tests:   21.707388 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      10198000 bytes
HTML transferred:       9945000 bytes
Requests per second:    46.07 [#/sec] (mean)
Time per request:       542.685 [ms] (mean)
Time per request:       21.707 [ms] (mean, across all concurrent
requests)
Transfer rate:          458.74 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       1
Processing:    94  531 697.5    439    7133
Waiting:       94  531 697.4    439    7132
Total:         95  531 697.5    439    7133

Percentage of the requests served within a certain time (ms)
  50%    439
  66%    486
  75%    520
  80%    553
  90%    663
  95%   1006
  98%   2036
  99%   6583
 100%   7133 (longest request)

#######################################

And a database query heavy page:

$ ab -n 1000 -c 25 xyz.com/items/list

Server Software:        Mongrel
Server Hostname:        www.xyz.com
Server Port:            80

Document Path:          /items/list
Document Length:        27719 bytes

Concurrency Level:      1
Time taken for tests:   237.114409 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      27973000 bytes
HTML transferred:       27719000 bytes
Requests per second:    4.22 [#/sec] (mean)
Time per request:       237.114 [ms] (mean)
Time per request:       237.114 [ms] (mean, across all concurrent
requests)
Transfer rate:          115.21 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:   173  236  76.0    234    1386
Waiting:      172  236  76.0    234    1386
Total:        173  236  76.0    234    1386

Percentage of the requests served within a certain time (ms)
  50%    234
  66%    235
  75%    236
  80%    237
  90%    254
  95%    359
  98%    507
  99%    526
 100%   1386 (longest request)

#######################################

After multiple tests, Mongrel still seems as fast as when first started
(unlike before), and I haven't experienced any unresponsive pages. I'll
try Mongrel on my heavier traffic site again and see how it holds up.

Thanks!

Joe

PS - Yeah, HTTP_HOST is probably the better var to use ;).
Joe (Guest)
on 2006-03-29 01:36
More good news :). I switched my heavier traffic server to Mongrel
shortly after my previous post. It uses Lighty proxy load balancing and
multiple Mongrels. So far, the site is continuing to operate fine.

Also, Mongrel seems to be managing the Postgresql connections much
better - instead of 20 open connections per site, I'm seeing 1-4 per
site.

Joe
Jonathan W. (Guest)
on 2006-03-29 16:55
(Received via mailing list)
Hi Zed,

Zed S. wrote:
 > Jonathan,
 >
 > It does have support for extending mime types. Take a look at the -h
for
 > start:

Ahh, I must have overlooked it.

This works with 0.3.11 but not with the 0.3.12 pre-release (at least on
windows) if I start Mongrel from the command line. On 0.3.12 the `loaded
MIME` messages shows up two times and the mime-settings seem to have no
effect.

Also if I try to install a Windows Service with this option, I get the
following error (both 0.3.11 and 0.3.12):

C:\code\InstantRails-1.0\rails_apps\minea>mongrel_rails_service install
  -r C:\code\InstantRails-1.0\rails_apps\minea -p 80 -e production -m C:
tantRails-1.0\rails_apps\minea\config\mime.yaml
C:/code/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.12-msw
mongrel_rails_service:83:in `validate': undefined method `Expand_path'
Class (NoMethodError)

Regards,
Jonathan
Gyoung-Yoon N. (Guest)
on 2006-03-29 18:11
(Received via mailing list)
Hi,

I've made rake tasks(start/stop/restart) for my application.

<snip>
namespace "mongrel" do
  desc "Start mongrel server..."
  task :start => :environment do
    baseport = 8000
    1.upto(5) do |i|
      sh "mongrel_rails start -p #{baseport+i} -P log/mongrel-#{i}.pid
-e #{RAILS_ENV} -d"
    end
  end

  desc "Stop mongrel server..."
  task :stop => :environment do
    Dir.glob('log/mongrel-*.pid').each do |pid|
      sh "mongrel_rails stop -P #{pid} --force"
    end
  end

  desc "Restart mongrel server..."
  task :restart => [:environment] do
    Dir.glob('log/mongrel-*.pid').each do |pid|
      sh "mongrel_rails restart -P #{pid}"
    end
  end
end
</snip>
Zed S. (Guest)
on 2006-03-29 19:28
(Received via mailing list)
Thanks Jonathan, I'll fix that up tonight and ship out a new snapshot.
I
actually want to unify the two platforms into one script to avoid these
disconnects.

Zed
Zed S. (Guest)
on 2006-03-29 19:34
(Received via mailing list)
Cool Joe.  One thing with Mongrel, it used to run with a fixed set of
worker
threads which was why you got the 20 connections.  Now it fires one
thread
per request, which is why you're getting only 1-4.  There's a problem
that
if your Mongrel servers get slammed then these will jack up.  You're
best
off setting ActiveRecord to *not* be threaded (whatever that setting
name is
these days).

Rather than have Mongrel decide what is best, I left it to people
running
rails.  If you just change it in your environment.rb you'll be set.

Zed
Joe (Guest)
on 2006-03-30 00:25
Must be this setting:

    # Determines whether or not to use a connection for each thread, or
a single shared connection for all threads.
    # Defaults to true; Railties' WEBrick server sets this to false.
    cattr_accessor :allow_concurrency
    @@allow_concurrency = true

I'm not exactly sure to what true or false corresponds. I guess
concurrent = one connection/thread, since I'm seeing more than one
connection per app (and I haven't changed this setting).

Joe
David S. (Guest)
on 2006-04-07 03:40
Joe wrote:
> Must be this setting:
>
>     # Determines whether or not to use a connection for each thread, or
> a single shared connection for all threads.
>     # Defaults to true; Railties' WEBrick server sets this to false.
>     cattr_accessor :allow_concurrency
>     @@allow_concurrency = true
>
> I'm not exactly sure to what true or false corresponds. I guess
> concurrent = one connection/thread, since I'm seeing more than one
> connection per app (and I haven't changed this setting).
>
> Joe

I tried that setting in my envonment.rb file and got an error starting
mongrel-0.3.12.3-mswin32 like:

mongrel_rails start -n 4 -B

undefined method 'cattr_accessor' in environment.rb.

We are using Mongrel/Rails to run a web service that does a screen
scrape of another site (using Watir).  Each request can take up to a
minute or more to complete so we will need to to be running more than
one scrape simultaneously.  Is there a way for Mongrel to be working on
more than one rails request at a given time other than by spawning off
multiple Mongrel processes and using an Apache or Lighttpd proxy?

David
This topic is locked and can not be replied to.