I submitted my first Rails patch this weekend. We’ve been seeing occasional lock contention, timeout and deadlock in our mysql database but without SHOW INNODB STATUS at the time of the error, it’s difficult to track down the cause of the contention. So I added lock error logging to ActiveRecord’s MysqlAdapter class. It was also [...]
Entries Tagged as 'Rails'
MySQL lock debugging
May 28th, 2008 · No Comments
Tags: 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 of ActiveRecord [...]
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.
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 like. [...]
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
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 [...]
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 [...]
Tags: Rails
Creating a counter_cache column
December 17th, 2007 · 9 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 [...]
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 get fixtures [...]
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) – [...]
Tags: Rails