Mike Perham

On Ruby, software and the Internet

Entries Tagged as 'Rails'

ActiveRecord 2.1 Performance (Part 1)

May 3rd, 2008 · No Comments

I’ve been playing with the upcoming ActiveRecord 2.1 release in order to gauge any performance concerns.  First let me explain the scenario being tested here: we load a lot of data into a database (both inserts and updates) so my testing mostly concerns optimizing bulk loading. This is definitely not the common case [...]

[Read more →]

Tags: Rails

Java Developers moving to Ruby and Rails

February 15th, 2008 · No Comments

I’ve mentioned here in the past that I’m one example of the flow of career software developers from Java and .Net to Ruby.  What I didn’t know is that DHH himself quoted my blog as a perfect example of this in his State of Rails 2005 presentation!
Wow, Check out slide 3.

[Read more →]

Tags: Rails · Ruby

Tuning ActiveRecord

February 6th, 2008 · 3 Comments

We’re in the process of building a very database-heavy system to store lots of metric data for our FiveRuns RM-Manage product. We looked at using tools like RRDTool and Berkeley DB but eventually came to the conclusion that a well-tuned mysql instance will work better for the flexibility and ease of maintenance we would [...]

[Read more →]

Tags: Rails

Austin jumping on Rails

January 28th, 2008 · No Comments

Great article with an overview of Rails and how it is slowly changing software development. Obviously I’m one example of the “attracting developers to the latest, greatest framework” point they make in the article.
Austin jumping on Rails

[Read more →]

Tags: Rails · Ruby

ActiveSupport Dependency arcanery

January 16th, 2008 · No Comments

I was getting the following error when running some Ruby code and a Google search  did not clarify what the problem was.  ‘to_constant_name’: Anonymous modules have no name to be referenced by (ArgumentError)
Essentially the problem was dependency load order.  The error was due to this line:
      ActiveRecord::Base.send(:include, AttributeMapper)
The problem was that I had not required [...]

[Read more →]

Tags: Rails

Performance and ActiveRecord::Base.establish_connection

January 7th, 2008 · No Comments

I’ve got a library which requires its own database so I’m using a shared superclass for my models which uses establish_connection to point to a different database than the default one used by ActiveRecord::Base.connection.  The problem is performance.  I’m inserting and updating a large amount of data in a single unit test method and finding [...]

[Read more →]

Tags: Rails

Creating a counter_cache column

December 17th, 2007 · 6 Comments

A counter_cache provides a reasonable way to speed up code which faults in a collection just to get the size.  In my experience, the most painful part is initializing the column with the first value.  Traditionally the Rails blogs use Ruby code to iterate through every instance, calculating the value by performing an individual query [...]

[Read more →]

Tags: Rails

Using Fixtures without Rails

October 30th, 2007 · No Comments

We’ve got several applications internal to FiveRuns which are Ruby but not Rails. They use ActiveRecord for database access but not the rest of the Rails stack. We still wanted to use fixtures to provide a foundation of data for our testing though so I spent a few hours figuring out how to [...]

[Read more →]

Tags: Rails · Ruby

Glassfish versus Mongrel

October 15th, 2007 · No Comments

I’ve been working on my upcoming AOR Glassfish talk. Here’s some interesting numbers. (Unfortunately WordPress is pretty bad at offering good HTML formatting tools so you’ll have to put up with some sad formatting.)
Memory Usage

Glassfish - 230MB resident, 840MB virtual
Mongrel Cluster (2 nodes) - 46MB resident, 104MB virtual
Nginx (2 workers) - [...]

[Read more →]

Tags: Rails

File Uploads in Merb versus Rails

October 2nd, 2007 · 3 Comments

At FiveRuns, we have a set of installed clients which upload data to our service periodically. Because of the way it is implemented, Rails is quite slow in handling file uploads. Merb is an alternative, albeit much simpler, stack to Rails which handles file uploads in a much saner manner. The performance [...]

[Read more →]

Tags: Rails