Adam Berlin's blog
Interesting
Monit + 'check program' + Zombies
from Dave Goddard
Monit recently introduced a new type of service to check ; "check program" which will run a script each cycle (or specified number) and will end up being good or bad depending on the exit code. After we started using this, we noticed that the script was often marked as a zombie on the machine ; at first we blamed the script, but eventually discovered that this is expected behaviour by monit, and that monit is planning to fix it RSN (real soon now)
Polymorphic Associations and Active Record Subclasses
from Adam Milligan
If you have a polymorphic association, Rails will use the base class of the parent of the association (as defined by ActiveRecord) as the class name of the associated parent.
For instance:
class Foo < AR::Base
belongs_to :wibble, polymorphic: true
end
class Bar < AR::Base
has_many :foo, as: :wibble
end
class Baz < SomeSubclassOfActiveRecordBase
has_many :foo, as: :wibble
end
The class of the wibble association when instantiated for Bar will be Bar.
The class of the wibble association when instantiated for Baz will be SomeSubclassOfActiveRecordBase, not Baz, unless SSOARB.abstract_class returns true.
- Ruby 1.9.3
- RVM 1.10.0
- Mac OSX 10.7.2
- XCode 4.2
Our team ran into an issue installing Ruby 1.9.3 on Lion today. When running...
$ rvm install ruby-1.9.3
... the installer fails with an error message including "checking whether the C compiler works... no" even though we had XCode and gcc installed.
After some reading on StackOverflow and Github I found this solution [1]...
$ rvm install 1.9.3-p0 --with-gcc=clang
... which points an explanation on RVM's issue tracker [2].
- http://stackoverflow.com/questions/8675194/error-installing-1-9-3-with-rvm-on-lion
- https://github.com/wayneeseguin/rvm/issues/534
Advice for Rails Performance Optimization
Upcoming Launch
Recently, our team releasing to a large set of users and needed to ensure that our application could meet the performance needs of the new users. Launch day was a month away. Months of steady Agile feature development needed to meet a healthy amount performance engineering.
We started with a few goals in mind. We wanted:
- data-driven improvements
- to prefer simple performant code to complex caching strategies
- to use available tools to provide visualization for badly performing requests
