<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pivotal Labs &#187; Adam Berlin</title>
	<atom:link href="http://pivotallabs.com/author/aberlin/feed/" rel="self" type="application/rss+xml" />
	<link>http://pivotallabs.com</link>
	<description>Agility Developed</description>
	<lastBuildDate>Tue, 21 May 2013 05:27:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>NYC Standup &#8211; February 27th, 2012</title>
		<link>http://pivotallabs.com/nyc-standup-february-27th-2012/</link>
		<comments>http://pivotallabs.com/nyc-standup-february-27th-2012/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 15:15:00 +0000</pubDate>
		<dc:creator>Adam Berlin</dc:creator>
				<category><![CDATA[Labs]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/nyc-standup-february-27th-2012/</guid>
		<description><![CDATA[<p><h1>Interesting</h1>

<h4>Monit + 'check program' + Zombies</h4>

<p><em>from Dave Goddard</em></p>

<p>Monit recently introduced a new type of service to check ; "check program" which will run a script each cycle &#40;or specified number&#41; 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 &#40;real soon now&#41;</p>

<h4>Polymorphic Associations and Active Record Subclasses</h4>

<p><em>from Adam Milligan</em></p>

<p>If you have a polymorphic association, Rails will use the base class of the parent of the association &#40;as defined by ActiveRecord&#41; as the class name of the associated parent.</p>

<p>For instance:</p>

<pre><code>class Foo &#60; AR::Base
  belongs_to :wibble, polymorphic: true
end

class Bar &#60; AR::Base
  has_many :foo, as: :wibble
end

class Baz &#60; SomeSubclassOfActiveRecordBase
  has_many :foo, as: :wibble
end
</code></pre>

<p>The class of the wibble association when instantiated for Bar will be Bar.</p>

<p>The class of the wibble association when instantiated for Baz will be SomeSubclassOfActiveRecordBase, not Baz, unless SSOARB.abstract_class returns true.</p> <a href="http://pivotallabs.com/nyc-standup-february-27th-2012/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/nyc-standup-february-27th-2012/">NYC Standup &#8211; February 27th, 2012</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<h1>Interesting</h1>
<h4>Monit + &#8216;check program&#8217; + Zombies</h4>
<p><em>from Dave Goddard</em></p>
<p>Monit recently introduced a new type of service to check ; &#8220;check program&#8221; which will run a script each cycle &#40;or specified number&#41; 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 &#40;real soon now&#41;</p>
<h4>Polymorphic Associations and Active Record Subclasses</h4>
<p><em>from Adam Milligan</em></p>
<p>If you have a polymorphic association, Rails will use the base class of the parent of the association &#40;as defined by ActiveRecord&#41; as the class name of the associated parent.</p>
<p>For instance:</p>
<pre><code>class Foo &lt; AR::Base
  belongs_to :wibble, polymorphic: true
end

class Bar &lt; AR::Base
  has_many :foo, as: :wibble
end

class Baz &lt; SomeSubclassOfActiveRecordBase
  has_many :foo, as: :wibble
end
</code></pre>
<p>The class of the wibble association when instantiated for Bar will be Bar.</p>
<p>The class of the wibble association when instantiated for Baz will be SomeSubclassOfActiveRecordBase, not Baz, unless SSOARB.abstract_class returns true.</p>
<p>The post <a href="http://pivotallabs.com/nyc-standup-february-27th-2012/">NYC Standup &#8211; February 27th, 2012</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/nyc-standup-february-27th-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Ruby 1.9.3 w/ RVM on Mac OSX Lion</title>
		<link>http://pivotallabs.com/installing-ruby-1-9-3-w-rvm-on-mac-osx-lion/</link>
		<comments>http://pivotallabs.com/installing-ruby-1-9-3-w-rvm-on-mac-osx-lion/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 15:56:00 +0000</pubDate>
		<dc:creator>Adam Berlin</dc:creator>
				<category><![CDATA[Labs]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/installing-ruby-1-9-3-w-rvm-on-mac-osx-lion/</guid>
		<description><![CDATA[<p><ul>
<li>Ruby 1.9.3</li>
<li>RVM 1.10.0</li>
<li>Mac OSX 10.7.2</li>
<li>XCode 4.2</li>
</ul>

<p>Our team ran into an issue installing Ruby 1.9.3 on Lion today.  When running...</p>

<pre><code>$ rvm install ruby-1.9.3
</code></pre>

<p>... the installer fails with an error message including "checking whether the C compiler works... no" even though we had XCode and gcc installed.</p>

<p>After some reading on StackOverflow and Github I found this solution [1]...</p>

<pre><code>$ rvm install 1.9.3-p0 --with-gcc=clang
</code></pre>

<p>... which points an explanation on RVM's issue tracker [2].</p>

<ol>
<li>http://stackoverflow.com/questions/8675194/error-installing-1-9-3-with-rvm-on-lion</li>
<li>https://github.com/wayneeseguin/rvm/issues/534</li>
</ol> <a href="http://pivotallabs.com/installing-ruby-1-9-3-w-rvm-on-mac-osx-lion/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/installing-ruby-1-9-3-w-rvm-on-mac-osx-lion/">Installing Ruby 1.9.3 w/ RVM on Mac OSX Lion</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<ul>
<li>Ruby 1.9.3</li>
<li>RVM 1.10.0</li>
<li>Mac OSX 10.7.2</li>
<li>XCode 4.2</li>
</ul>
<p>Our team ran into an issue installing Ruby 1.9.3 on Lion today.  When running&#8230;</p>
<pre><code>$ rvm install ruby-1.9.3
</code></pre>
<p>&#8230; the installer fails with an error message including &#8220;checking whether the C compiler works&#8230; no&#8221; even though we had XCode and gcc installed.</p>
<p>After some reading on StackOverflow and Github I found this solution [1]&#8230;</p>
<pre><code>$ rvm install 1.9.3-p0 --with-gcc=clang
</code></pre>
<p>&#8230; which points an explanation on RVM&#8217;s issue tracker [2].</p>
<ol>
<li>http://stackoverflow.com/questions/8675194/error-installing-1-9-3-with-rvm-on-lion</li>
<li>https://github.com/wayneeseguin/rvm/issues/534</li>
</ol>
<p>See our full command line history and error messages below:</p>
<pre><code>$ rvm install ruby-1.9.3-p0
Installing Ruby from source to:     /Users/foobar/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu&#40;s&#41;...

ruby-1.9.3-p0 - #fetching
ruby-1.9.3-p0 - #extracted to /Users/foobar/.rvm/src/ruby-1.9.3-p0 &#40;already extracted&#41;
Fetching yaml-0.1.4.tar.gz to /Users/foobar/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/foobar/.rvm/src
Configuring yaml in /Users/foobar/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/foobar/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/foobar/.rvm/usr
ruby-1.9.3-p0 - #configuring
ERROR: Error running ' ./configure -- prefix=/Users/foobar/.rvm/rubies/ruby-1.9.3-p0 --enable- shared --disable-install-doc --with-libyaml- dir=/Users/foobar/.rvm/usr ', please read  /Users/foobar/.rvm/log/ruby-1.9.3-p0/configure.log
ERROR: There has been an error while running configure.  Halting the installation.

$ cat /Users/foobar/.rvm/log/ruby-1.9.3-p0/configure.log
[2012-01-13 10:31:49]  ./configure -- prefix=/Users/foobar/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml- dir=/Users/foobar/.rvm/usr
configure: WARNING: unrecognized options: --with-libyaml-dir
checking build system type... x86_64-apple-darwin11.2.0
checking host system type... x86_64-apple-darwin11.2.0
checking target system type... x86_64-apple-darwin11.2.0
checking whether the C compiler works... no
configure: error: in `/Users/foobar/.rvm/src/ruby-1.9.3-p0':
configure: error: C compiler cannot create executables
See `config.log' for more details
</code></pre>
<p>The post <a href="http://pivotallabs.com/installing-ruby-1-9-3-w-rvm-on-mac-osx-lion/">Installing Ruby 1.9.3 w/ RVM on Mac OSX Lion</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/installing-ruby-1-9-3-w-rvm-on-mac-osx-lion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Don&#039;t Sweep It Under the Rug</title>
		<link>http://pivotallabs.com/don-t-sweep-it-under-the-rug/</link>
		<comments>http://pivotallabs.com/don-t-sweep-it-under-the-rug/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 02:33:00 +0000</pubDate>
		<dc:creator>Adam Berlin</dc:creator>
				<category><![CDATA[Labs]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/don-t-sweep-it-under-the-rug/</guid>
		<description><![CDATA[<p><h1>Advice for Rails Performance Optimization</h1>

<h2>Upcoming Launch</h2>

<p>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.</p>

<p>We started with a few goals in mind. We wanted:</p>

<ul>
<li>data-driven improvements</li>
<li>to prefer simple performant code to complex caching strategies</li>
<li>to use available tools to provide visualization for badly performing requests</li>
</ul> <a href="http://pivotallabs.com/don-t-sweep-it-under-the-rug/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/don-t-sweep-it-under-the-rug/">Don&#039;t Sweep It Under the Rug</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<h1>Advice for Rails Performance Optimization</h1>
<h2>Upcoming Launch</h2>
<p>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.</p>
<p>We started with a few goals in mind. We wanted:</p>
<ul>
<li>data-driven improvements</li>
<li>to prefer simple performant code to complex caching strategies</li>
<li>to use available tools to provide visualization for badly performing requests</li>
</ul>
<h2>Plan a Solution</h2>
<p>We brainstormed for ideas on what would reliably lead us in the right direction.  Requests per second &#40;and seconds per request&#41; were useful data points that we were able to get from Apache Benchmark &#40;ab&#41;.  Using AB we could make a change, run the benchmark, and be sure that the change made a positive performance impact.  One obvious way to get requests per second to increase is to use caching.  Our team was hesitant to use caching for several reasons:</p>
<ul>
<li>there are many user-specific features</li>
<li>caching increases the complexity of your codebase when dealing with cache population and invalidation strategies</li>
<li>we felt that we could meet our performance needs without caching by employing a few other tools</li>
</ul>
<p>To track down specific bottlenecks we used Ruby Benchmark.  We could perform an Outside-in performance analysis of specific actions, benchmarking deeper and deeper, until specific methods or database calls stood out as obvious problems.</p>
<h2>The Big Wins</h2>
<p>A few things stood out as <em>Big Wins</em> for us:</p>
<ul>
<li>Missing database indexes often came up as a cause for slowness.  Often there were non-foreign key columns that had not been indexed but were being used in a WHERE or a JOIN.  The MySQL slow query log led us to several major culprits.  </li>
<li>We could see from our New Relic graphs that while iterating and rendering the same exact view with a different user, we would see a large spike of time spent rendering.  This smelled to us of garbage collection.  We turned on Rack::Bug and quickly noticed that we were performing 6 garbage collections during one request.  We had read a blog article from Sam Coward about using Ruby Enterprise Edition Garbage Collection statistics gathering to track down object allocation and garbage collection problems. &#40;http://pivotallabs.com/users/scoward/blog/articles/1411-identify-memory-abusing-partials-with-gc-stats&#41;  We installed his patch to Rack::Bug which displays memory usage information for each ActionView template that is rendered.  From there we were able to use our outside-in benchmarking to find our offensive memory hogs and make them more friendly.  We found out later that New Relic has released an RPM that also graphs time spent in garbage collection. </li>
<li>This led us to our final optimization.  We had removed most of our GC time, but still had not taken advantage of the Ruby Enterprise GC variables.  Our servers are hosted with Blue Box Group &#40;http://www.blueboxgrp.com/&#41; and their service staff helped us eek out the last bit of memory performance.  They worked with us to tweak our Ruby Enterprise Edition garbage collection variables to the most optimum settings.</li>
</ul>
<h2>What We Learned</h2>
<p>In the end, we learned a few things about optimization.</p>
<ul>
<li>There are many things you can do easily to improve performance without resorting to complex solutions.  </li>
<li>A data driven approach can lead you quickly to a good solution.</li>
<li>Use tools that can give you visibility into your performance bottlenecks.</li>
<li>Set a realistic performance goal to meet.  Your site can always perform better.  The real question is, how much performance do you need?</li>
</ul>
<p>These are the obvious, well-covered topics of performance enhancement.  There&#8217;s a reason.  They can take your application a long way.</p>
<p>&#8211;<br />
Thanks to <a href="http://pivotallabs.com/users/evan/blog">Evan Farrar</a> for much of the wisdom that went into our performance optimization thought process.</p>
<p>The post <a href="http://pivotallabs.com/don-t-sweep-it-under-the-rug/">Don&#039;t Sweep It Under the Rug</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/don-t-sweep-it-under-the-rug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using apc
Database Caching using apc
Object Caching 548/582 objects using apc

 Served from: pivotallabs.com @ 2013-05-21 08:08:02 by W3 Total Cache -->