Upgrading to Rails 4.2.0.beta2 ( aka upgrading to rspec-rails 3.1.x )

October 21, 2014


Here is the process we went through to get our tests passing after upgrading our Rails app from Rails 4.1 to Rails 4.2.0.beta2. We updated the rails gem version and ran bundle update, and found these gems needed to be upgraded to resolve dependencies: gem 'rspec-rails', '~> 2.14.1' upgraded to '~> 3.1.0' gem 'rspec', '~> 2.14.1' upgraded to '~> 3.1.0' gem 'sass-rails', '>= 3.2' upgraded to '>= 5.0.0.beta1' gem 'bootstrap-sass', '~> 3. ... Read more

Deploying versions with zero downtime ( 2 months later )

October 7, 2014


Again, two months, almost to the day since we last hit problems with deployment, we are here again. Up till the day before, deployments worked fine if a little slow, but now they fail with a timeout. The site is running okay but remains at that version: “Update environment operation is complete, but with command timeouts. Try increasing the timeout period. For more information, see troubleshooting documentation.” It is not possible to retrieve the logs - also due to an execution timeout. ... Read more

Speeding up Ruby on Rails

August 19, 2014


…with less sql queries A Rails application will make a large number of sql queries per page unless steps are taken to mitigate this. This is bad because it degrades the performance of your app, affects your ability to scale, and will cost you money. Install the New Relic gem to see the sql queries made when loading a page in your app. Here is what we changed to reduce the number of sql queries per page: For lists: fix the n+1 problem with eager loading Avoid unnecessary count queries resulting from ”. ... Read more

Eager loading and pg_search: good bye to polymorphic association.

August 11, 2014


When we first designed the database schema for our Rails project, we employed the ‘Single Table Inheritance’ and ‘Polymorphic Associations’ strategies to two different and deserving cases. For the latter case, we needed to model different types of a class having common properties as well as unique. So for this, Polymorphic Association was chosen over Single Table Inheritance to achieve a cleaner data structure ( with less holes ). Since then, the project has evolved and undergone several performance enhancement iterations, and today we decided it was time to lose the polymorphic association at the center of an n + 1 performance problem. ... Read more

Deploying versions with zero downtime

July 24, 2014


Two months, almost to the day since we last hit problems with deployment, it looks like we are here again. Up till the day before, deployments worked fine if a little slow, but now they fail with a timeout. The site is running okay but remains at that version: “Update environment operation is complete, but with command timeouts. Try increasing the timeout period. For more information, see troubleshooting documentation.” It is not possible to retrieve the logs - also due to an execution timeout. ... Read more

© 2018 Keith P | Follow on Twitter | Git