[ANN] Mongrel Web Server 0.3.12 -- Pre-Release

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

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

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

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.12----Pre-Release-t1347847.html#a3618545
Sent from the RubyOnRails Users forum at Nabble.com.

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

Heh, there should be a Zed S. school of techical documentation. Where
can I get a MoneyMakerWeb2OhMatic 6000 web site? :stuck_out_tongue_winking_eye:

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

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

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

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.12----Pre-Release-t1347847.html#a3619029
Sent from the RubyOnRails Users forum at Nabble.com.

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://mongrel.rubyforge.org/

On 3/27/06 11:10 AM, “frazer horn” [email protected] 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.

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:inset_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

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://mongrel.rubyforge.org/

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

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) # .xyz Domain Names | Join Generation XYZ

Joe

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://mongrel.rubyforge.org/

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://mongrel.rubyforge.org/

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

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 methodExpand_path’
Class (NoMethodError)

Regards,
Jonathan

Hi,

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

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