Posted by stoyan
On
bbox2 i installed
swiftiply gem . This changed the
mongrel_rails command to use evented mongrel – mongrel, patched to use
eventmachine tcp stack instead of the original pure ruby one.
In
/etc/init.d/mongrel_cluster i’m starting all mongrel instances with:
env EVENT=1 mongrel_cluster_ctl start ...
And because only testing is boring ;) I deployed
restolog also to
bbox2 . Now it’s available on both
bbox and
bbox2:
So now there is a “real world” application running on nginx+evented mongrel cluster. In fact the current post is done via bbox2 :)
The backend is the same database, so there will be no duplicated etc. posts.
I wanted to do the benchmarks again but ab seems buggy – it’s hang after sending 900 requests ( -c 100 -n 1000 ). Searching the internet gave me that: ab hang .
Hm, maybe will try httperf.
Posted by stoyan
A small fast HTTP server written in (mostly) Ruby that can be used to host web frameworks directly with HTTP rather than FastCGI or SCGI.
Examples already working with Camping .
See also: Mongrel RDoc pages
Posted by stoyan
After seen a small webservers in Perl and Ruby here is my try with using Mongrel :
Start an webserver on all interfaces (0.0.0.0), port 3002, serving static pages from ./html/ directory:
require 'mongrel'
config = Mongrel::Configurator.new :host => "0.0.0.0", :port => 3002 do
listener { uri "/", :handler => Mongrel::DirHandler.new("html/") }
trap("INT") { stop }
run
end
config.join
And with adding some statistics (on
http://.../status/ URL):
#!/usr/bin/env ruby
require 'rubygems'
require 'mongrel'
require 'yaml'
stats = Mongrel::StatisticsFilter.new(:sample_rate => 1)
config = Mongrel::Configurator.new :host => "0.0.0.0", :port => 3002 do
listener do
uri "/", :handler => Mongrel::DirHandler.new("html/")
uri "/", :handler => stats
uri "/status", :handler => Mongrel::StatusHandler.new(:stats_filter => stats)
end
trap("INT") { stop }
run
end
puts "Mongrel running on 0.0.0.0:3002 with docroot ./html/"
config.join
I’m using it for serving static pages, generated with Rote – pretty fast ;)
Posted by stoyan
mongrel_cluster makes it easy to manage multiple Mongrel processes behind a reverse-proxy server and load balancer such as Pound, Balance, Lighttpd, or Apache.
See also: