Created
August 9, 2013 09:06
-
-
Save maxsz/cddf3f20456d2a053b70 to your computer and use it in GitHub Desktop.
Slow newrelic_rpm gem with rubinius and rails 4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% ruby --version | |
rubinius 2.0.0.n198 (1.9.3 417f847d 2013-07-17 JI) [x86_64-apple-darwin12.4.0] | |
% rails --version | |
Rails 4.0.0 | |
Create a new Rails app and switch to it's folder | |
% rails new TestApp | |
% cd TestApp | |
Install gems: | |
% bundle install | |
Create some controllers/models/views | |
% rails g scaffold test | |
$ rake db:migrate | |
Start the rails server: | |
% rails s | |
Open a webbrowser and go to http://localhost:3000/tests. Observe the rails log: | |
% Started GET "/tests" for 127.0.0.1 at 2013-08-09 11:00:47 +0200 | |
% Processing by TestsController#index as HTML | |
% Test Load (0.2ms) SELECT "tests".* FROM "tests" | |
% Rendered tests/index.html.erb within layouts/application (0.9ms) | |
% Completed 200 OK in 8ms (Views: 5.3ms | ActiveRecord: 0.2ms) | |
Particularly interesting is the response time of 8ms. | |
Next, add "gem 'newrelic_rpm'" to the Gemfile and run bundle install again. | |
Start the rails server and do the same http://localhost:3000/tests request. Now, | |
when observing the rails log you see something like this: | |
% Started GET "/tests" for 127.0.0.1 at 2013-08-09 11:01:37 +0200 | |
% Processing by TestsController#index as HTML | |
% Test Load (0.2ms) SELECT "tests".* FROM "tests" | |
% Rendered tests/index.html.erb within layouts/application (802.9ms) | |
% Completed 200 OK in 809ms (Views: 807.7ms | ActiveRecord: 0.2ms) | |
Note the response time has increased by a factor of 100! The CPU of the machine | |
went straight to 100%. This does not only happen on my Mac OS X 10.8 work | |
machine, but also when deploying to heroku. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment