Phat is my new Rails 2.3.5 application which runs 100% asynchronous, supporting many concurrent requests in a single Ruby process. This is a new breed of Rails application which uses a new mode of execution available in Ruby 1.9: single Thread, multiple Fiber. Existing modes of execution suck: Single thread harkens back to the days [...]
Entries Tagged as 'Rails'
Introducing Phat, an Asynchronous Rails app
April 3rd, 2010 · 21 Comments
Tags: Rails
Using ActiveRecord with EventMachine
March 30th, 2010 · 3 Comments
Given all my work with Fibers and EventMachine over the last three months, it should come as no surprise that I’ve been working on infrastructure based on Fibers and EventMachine to get maximum scalability without the callback style of code which I dislike for many reasons. Watch my talk on scaling with EventMachine if you [...]
DataFabric – database sharding for Rails
October 5th, 2009 · 1 Comment
With the closing of FiveRuns, the blog post that was the main page for DataFabric has disappeared. I’m creating this blog post as a replacement. DataFabric is a Rails plugin/gem that adds sharding support to ActiveRecord. It supports Rails 2.x and is theoretically database independent, although I haven’t tested it personally with anything but MySQL [...]
Tags: Rails
Rails Engines at LSRC
August 28th, 2009 · 1 Comment
Here’s my slides for LSRC covering the new Engines feature in Rails 2.3. Basically I cover Rails’ history from monolithic application to supporting code reuse via plugins to supporting MVC reuse via engines. Rails Engines (PPT, 2.9MB) Rails Engines (Keynote, 1.8MB)
Tags: Rails
Old versus New
July 29th, 2009 · No Comments
We had some performance issues recently and discovered we were using memcache-client 1.5.0. Our daemon was blocked by memcached socket operations hanging forever, which caused monit to kill and restart the daemon after 5 minutes. I performed the brain surgery to use 1.7.4 (since we are using Rails 2.1) and deployed. See if you can [...]
Adding multi-get support to Rails
June 13th, 2009 · No Comments
Memcache-client has the ability to fetch multiple keys in one request but Rails does not expose this functionality. It’s really easy to add it yourself though: config/initializers/rails_patches.rb Rails.cache.instance_eval <<-EOM def read_multi(*keys) @data.get_multi(*keys) end EOM Rails uses read/write for its API naming so we name the method read_multi rather than get_multi. Here’s a sample usage in [...]
Tags: Rails
Engines in Rails 2.3
April 18th, 2009 · 1 Comment
Engines have been around Rails for years but it wasn’t until the recent 2.3 release that Rails officially supported Engines. So what is an Engine? An Engine is a Rails plugin with full MVC capabilities. In essence, that means your Engine has an app directory with helpers, controllers, models and views just like a standard [...]
Tags: Rails
Caching and Rails
March 25th, 2009 · 3 Comments
Here’s the slides from my AOR talk last night: Caching, Memcached and Rails (600KB). Caching, Memcached And Rails I was a little unhappy with my wrapup – the one thing I wanted to teach people was when to use each different caching mechanism provided by Rails and I didn’t really revisit and summarize that content. [...]
Using memcache-client 1.6.x in Rails < 2.3
March 3rd, 2009 · 13 Comments
Jemery Kemper recently upgraded Rails 2.3′s vendored copy of memcache-client to the 1.6.4 release. But what do you do if you are running Rails 2.1/2.2 and want to take advantage of the massive speedup in 1.6.x? You write some really ugly code that performs brain surgery on the Ruby environment to override ActiveSupport. Create config/initializers/memcache-client-upgrade.rb [...]
Tags: Rails
FiveRuns Dash, now with 100% more rimshot!
February 24th, 2009 · No Comments
I’m giving away a free copy of my iPhone app, Zinger, to every person who gets their app running with our new metrics service, Dash. Just email me. Steps (documented in more depth here): 1) Request an invite by signing up at https://dash.fiveruns.com 2) Log into Dash, create a new Rails application and note your [...]