Deploying Rails Applications is Released as a Beta!

Posted by ezmobius Thu, 16 Aug 2007 16:13:00 GMT

Just a quick note to say that after 22 months and many many rewrites my Book “Deploying Rails Applications” Has gone Beta! This is a super early beta and we will be shooting to add a chapter every 3 weeks until the print book is done.

I have to give a huge thanks my coauthors Bruce Tate, Geoffrey Grosenbach and Brian Hogan. Thanks for making it happen guys!

Now this is an early beta so expect rough edges and markup. But we wanted to get this out there before deployments changes again and caused another rewrite ;)

Deploying Rails Applications( A step by step guide)

Tags , , ,  | 7 comments

Event Driven Mongrel and Swiftiply Proxy

Posted by ezmobius Sat, 12 May 2007 08:49:00 GMT

Kirk Haines of the IOWA project has finally released his swiftiply package. I’m really excited about this project. The project has a few parts. There is a monkey patch to Mongrel that rips out ruby’s threading and Socket classes and replaces them with an eventmachine event loop. I have been testing this evented mongrel extensively for the past few weeks and it is notably faster and higher throughput then normal multi threaded mongrel.

It’s a drop in compatible with rails and merb and should work with any custom mongrel handlers you have. Once you install the swiftiply package you can start mongrel_rails with the new evented mongrel like this:

$ EVENT=1 mongrel_rails start

I am getting a huge speedup in merb from evented mongrel. And rails apps run very stable and do not start to slow down and bloat under high concurrent load like threaded mongrel does.

This is big news people. This thing makes shit faster and more stable under load

Now that it the easy way to get started with evented mongrel and buy yourself some performance. But the swiftiply proxy is also very very cool.

Swiftiply works differently from a traditional proxy. In Swiftiply, the backend processes are clients of the Swiftiply server—they make persistent socket connections to Swiftiply. One of the major advantages to this architecture is that it allows one to start or stop backend processes at will, with no configuration of the proxy. The obvious disadvantage is that this is not behavior that backends typically expect.

Luckily there is a swiftiplied version of mongrel in this package as well. I’ll make another post about how to use swiftiply later.

A week or so ago I was able to speed merb up from 299req/sec fro hello world to 620req/sec. Well dropping in evented mongrel gets merb’s hello world to a blazing 987req/sec!! no bull, see this pastie:

So go grab swiftiply and play around a bit. I am using this in production for more then a week now with no adverse affects and the app that runs it has much better response times and memory usage then it did before.

Tags , ,  | 31 comments

Merb 0.3 released as gem

Posted by ezmobius Sun, 29 Apr 2007 04:03:00 GMT

Merb 0.3 is out in gem form peoples. I stayed up late last night hacking on merb trying to find a really annoying memory leak. In the process I refactored the class loading to be a noop in produciton mode and made frozen constants for most string’s merb uses over and over internally.

Before I was able to find the mem leak I had improved the performance of a merb hello world app from 298req/sec on my maccbook to a whopping 688req/sec on one process. Peep the numbers

Finished 15000 requests
Server Software:                                                           
Server Hostname:        localhost
Server Port:            4000

Document Path:          /hello
Document Length:        11 bytes

Concurrency Level:      1
Time taken for tests:   21.784 seconds
Complete requests:      15000
Failed requests:        0
Broken pipe errors:     0
Total transferred:      1965000 bytes
HTML transferred:       165000 bytes
Requests per second:    688.58 [#/sec] (mean)
Time per request:       1.45 [ms] (mean)
Time per request:       1.45 [ms] (mean, across all concurrent requests)
Transfer rate:          90.20 [Kbytes/sec] received

Yup that’s 1.4ms average response time for a simple action that returns a “hello world!” string.. Of course full actions with templates and such are not as fast as this but this is the theoretical fastest request merb can serve that goes thru the full routing and dispatcher. This gives you a lot more headroom for your application code then rails does.

Anyway I finally tracked down the memory leak to an implementation of traits that I added recently. This bascially had the effect of retaining a reference to every controller ever instantiated. Ouch! I refactored away from traits and back to class_inheritable_attributes and killed the mem leaks so merb used a flatline 21Mb of ram even after 50k requests in a row.

Mrblog is being worked on again and I hope to have merb’s own site launched in time for railsconf.

Tags , ,  | 6 comments

Slides from my Mongrel/Merb talk

Posted by ezmobius Mon, 23 Apr 2007 15:35:00 GMT

Here are the slides form my talk on Custom Mongrel Hanlders and Merb at the SDForum Rubyconf this past weekend. There was video shot that I hope will be posted soon. The slides don’t show the entire story as I did a bunch of live benchmarks and some hacking and code exploring, but you can get the idea.

Mongrel: Learning how to walk the dog

Tags , , ,  | 5 comments

Building Custom Mongrel Handlers for Speed and Concurrency

Posted by ezmobius Thu, 05 Apr 2007 18:59:00 GMT

I will be giving a talk at the SDForum Ruby Conference April 21&22. I speak sometime on Sunday. Here is my talk’s abstract. I will post slides and hopefully audio after my talk.

All the cool kids are using Mongrel to run their Rails applications these days. And sometimes Mongrel itself gets so tightly coupled with Rails in peoples thoughts that they don’t realize that Mongrel is something they can use outside of Rails to build their own fast, custom HTTP servlets.

Zed Shaw has built an awesome HTTP server library that is easily extensible and very high performance. In this talk we will explore how to make your own hybrid Application Server with a custom Mongrel handler and some Ruby code.

The web is moving towards a world of resources and services. Rails is the tool of choice for building these web2.0 applications. But sometimes you have a critical section of your application that Rails is just too slow at serving, or you need to be able to support many concurrent users in portions of your site. Learning how to build custom Mongrel handlers will help you scale these performance critical areas of your application.

We will build a simple dynamic javascript server from scratch. This type of app can be used for web stat tracking or javascript widget serving. We will end with some benchmarks showing off how fast a Ruby web service can be when you get closer to the metal.

Tags ,  | 3 comments

Merb 0.1.0

Posted by ezmobius Fri, 19 Jan 2007 05:02:00 GMT

This is mainly a big fix release. The 0.9.0 release had a bad app skeleton. I have fixed this problem.

I also added support for freezing the merb framework into your app for portability. Just deploy the entire app and no need to install the merb gem on your server.

A few refactors and updates go in as well. Gem install merb in a few hours when the gem propogates.

Tags , , ,  | 4 comments

Merb 0.0.9 released

Posted by ezmobius Mon, 15 Jan 2007 01:54:00 GMT

I have just released version 0.0..9 of Merb to rubyforge. Within a few hours you should be able to gem install merb and get the new version.

There have been a ton of updates since the last release. It’s now easier to get started with merb. There is an app generator as well as mrblog, a lightweight blogging engine build on merb(not finished but good for examples)

Merb is running in production on more then 12 apps that I know of. Some of these apps are handling insane amounts of file uploads every day. And a few javascript tracker style apps are running on merb now for speed.

Here is an excerpt from the changelog. I know I missed a ton of stuff because merb has grown twice as much code since the last release and is working sweet now.

* Added merb app generator  $ merb -g appname
* added super snazzy error pages and stack trace. install the coderay gem to get syntax highlighting of error code pages.
* many fixes for efficeincy of overall framework. 
* extensiuve refactoring since last version
* form helpers
* template caching
* production test and development environments.
* upload progress built in now. no need for mup gem.
* added helper system.
* Updated merb rails session parasite mode.
* vendored Paginator gem
* added memory sessions
* added transactional yaml store.
* before and after filters, with very powerfult filter chain halting and redirection
* refactor merb_server to be in the framework and not in bin/
* catch_content and throw_content
* updated routing tobe more precise
* added status codes module
* added Request object
* added Merb::Mailer frameowkr
* fixed up exception handling 
* added basic auth mixin
* added drb service provider
* refactored merb halnder for speed
* added Enumerable#injecting
* too many more tweaks to list

You can get your own merb app started in a few steps with the new app generator:

$ sudo gem install merb
$ merb -g myapp

And you can look at mrblog to see a merb app with a decent amount of functionality to see how merb works a little bit easier then the old sample app:

mrblog svn

And the rdoc has been updated quite a bit as well:

Merb Rdoc

Stay tuned for some detailed tutorials on making a secure file upload/download server with merb and integrating it with your rails app.

Tags , , ,  | 5 comments

Merb 0.0.8 released

Posted by ezmobius Sat, 16 Dec 2006 18:49:00 GMT

I am happy to announce the release of Merb 0.0.8. This release is a huge improvement over the last release. There are too many changes to list. So here are some highlights:

* Performance optimization of mime parsing.
* Refactoring of entire codebase. 
* reorganize layout of source files.
* Added GlobaleHelper that all view can use. 
* Helpers named after the current controller will be available in the view as well as global helper.
* Added support for returning an IO stream from your controller.
* Merb::SimpleModel is a transactional yaml storage for smaller projects.
* Cleaned up the app_skeleton, it is now up to date.
* Added Merb::Const module to incapsulate constants
* Added HTTP status codes module
* Optimized and improved the ViewContext object
* Added rails session parasite mode
* Added new improved ActivceRecord session store. much faster
* Added Request object to encapsulate all helpers that use the headers to grab info
* Added merb_upload_hanlder for upload progress.
* Added merb_upload_progress class. if only one merb is being run then it will just load the upload prgress class in memory. When more then one merb is run, merb has a drb server that gets started and holds the state for the upload progress meter.
* Added merb_exceptions for custom, exceptions
* Added Kernel#aquire, like require on steroids with glob
* Huge improvements in the before/after filter code
* Added after filter capability to Merb::Controller.

I am working on a tutorial that I will post this weekend as a quick primer to getting started with Merb. The rdoc is improved though now and has some good information. The new implementation of befopre and after filters is really sweet too.

sudo gem install merb


Tags , , ,  | no comments

Merb Mailing List

Posted by ezmobius Thu, 30 Nov 2006 19:58:00 GMT

I have finally got a mailing list on rubyforge for discussion of all things Merb. Please join if you are workign on merb apps or want to help with the framework or have any other questions.

Join the Merb Mailing List

Tags , , ,  | no comments

Merb 0.0.7 Released

Posted by ezmobius Thu, 30 Nov 2006 03:44:00 GMT

I have just released Merb 0.0.7 as a gem. The docs are updated at:

Here is the changelog:

* added respond_to 
* added json POST body to be parsed into params 
* added configurable log level 
* added before filters. :symbols or Proc's 
* added :include and :exclude hashes to before filters. 
* merb cluster works better. pid files work with monit 
* added merb_drb_server 
* added drb session container 
* added support for mongrel_upload_progress 
* added nginx_send_file and send_file methods 
* improved dispatching speed. 
* keep mime parsing and route recorgnition out of mutex 
* only mutex around places that can call ActiveRecxord objects. 
* Improved memory profile with fastthread 
* uses fson if installed falls back to json 
* added basic auth module and filters. 
* changed default template extensions to .herb .jerb and .xerb for html, js and xml 
* added many helpers 
* add start of framework specs built with rspec

I hope to have some real tutorials RealSoon Now™. Enjoy!

Rdocs and README Merb Trac and tickets. Merb svn repo

Tags , , ,  | 5 comments

Older posts: 1 2