zombocom / derailed_benchmarks Goto Github PK
View Code? Open in Web Editor NEWGo faster, off the Rails - Benchmarks for your whole Rails app
Go faster, off the Rails - Benchmarks for your whole Rails app
I'm running the following command:
TEST_COUNT=50_000 derailed exec perf:ram_over_time
The name of my rails app is "job_board"
Which results in the following errors:
booting: production
Digest::Digest is deprecated; use Digest
job_board already exists
Endpoint: "/"
{my-local-path}/derailed_benchmarks/tasks.rb:72: warning: already initialized constant DERAILED_APP
{my-local-path}/derailed_benchmarks-1.0.1/lib/derailed_benchmarks/tasks.rb:23: warning: previous definition of DERAILED_APP was here
PID: 11839
152.453125
{my-local-path}/derailed_benchmarks-1.0.1/lib/derailed_benchmarks/tasks.rb:92:in `call_app': Bad request: (RuntimeError)
Any thoughts as to what is happening here?
Awesome project!
I'm trying to hunt down memory leaks, and I had trouble starting perf:mem_over_time
until I added various Airbrake keys, but then I'm still getting an error (testing our Rails app)
→ AIRBRAKE_PROJECT_ID=6 AIRBRAKE_API_KEY=XXXX bundle exec derailed exec perf:mem_over_time
Booting: production
Endpoint: "/"
/Users/tansaku/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:72: warning: already initialized constant DERAILED_APP
/Users/tansaku/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:23: warning: previous definition of DERAILED_APP was here
PID: 79590
211.39453125
/Users/tansaku/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:92:in `call_app': Bad request: (RuntimeError)
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:174:in `block (3 levels) in <top (required)>'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:173:in `times'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:173:in `block (2 levels) in <top (required)>'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/rake-12.1.0/lib/rake/task.rb:251:in `block in execute'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/rake-12.1.0/lib/rake/task.rb:251:in `each'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/rake-12.1.0/lib/rake/task.rb:251:in `execute'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/airbrake-6.0.0/lib/airbrake/rake/task_ext.rb:19:in `execute'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/rake-12.1.0/lib/rake/task.rb:195:in `block in invoke_with_call_chain'
from /Users/tansaku/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/rake-12.1.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/rake-12.1.0/lib/rake/task.rb:181:in `invoke'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/bin/derailed:41:in `exec'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/bin/derailed:92:in `<top (required)>'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/bin/derailed:23:in `load'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/bin/derailed:23:in `<main>'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
from /Users/tansaku/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
The full project is https://github.com/AgileVentures/WebsiteOne/ - maybe I just turn off Airbrake - or might it be something else ...?
I just created a new rails 4.2.6 project. After doing setup, I added:
group :development do
gem 'stackprof'
gem 'derailed'
end
And I tried to run it, but it fails:
/Users/MYUSER/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/rubygems_integration.rb:355:in `block in replace_bin_path': can't find executable derailed (Gem::Exception)
from /Users/MYUSER/.rbenv/versions/2.2.3/bin/derailed:23:in `<main>'
I noticed that in my Gemfile.lock says that derailed_benchmarks v0.0.0
is installed. I think that 0.0.0
is not a valid version for this gem.
To solve this, I downgraded to rake 10.5.0, and it seems to work.
I think there's some kind of issue with rake 11+
(in fact I noticed that in your gemspec
the definition is: gem.add_dependency "rake", "~> 10"
)
I did the setup however when I run:
$ rake -f perf.rake perf:require_bench
rake aborted!
Don't know how to build task 'perf:require_bench'
/Users/luiszacheu/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/task_manager.rb:62:in []' /Users/luiszacheu/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:149:in
invoke_task'
/Users/luiszacheu/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:106:in block (2 levels) in top_level' /Users/luiszacheu/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:106:in
each'
/Users/luiszacheu/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:106:in block in top_level' /Users/luiszacheu/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:115:in
run_with_threads'
/Users/luiszacheu/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:100:in top_level' /Users/luiszacheu/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:78:in
block in run'
/Users/luiszacheu/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:176:in standard_exception_handling' /Users/luiszacheu/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:75:in
run'
/Users/luiszacheu/.rvm/rubies/ruby-2.2.4/bin/rake:33:in `
Returns this trace, do not understand what is happening can help me?
I'm using rails with activeadmin
thank you!
I dont understand:
I can start my app in production via
locally without any problems.
But when I try derailed:
I get this error and I dont know how to solve it
git:(master) ✗ RAILS_ENV=production bundle exec derailed exec perf:allocated_objects
Booting: production
[tunemygc] not enabled
bundler: failed to load command: derailed (/Users/jan/.rbenv/versions/2.4.1/bin/derailed)
LoadError: Could not load 'active_record/connection_adapters/mongodb_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `block in require'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/connection_specification.rb:174:in `spec'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.2/lib/active_record/connection_handling.rb:53:in `establish_connection'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.2/lib/active_record/railtie.rb:125:in `block (2 levels) in <class:Railtie>'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:43:in `instance_eval'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:43:in `execute_hook'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:33:in `block in on_load'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:32:in `each'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:32:in `on_load'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.2/lib/active_record/railtie.rb:121:in `block in <class:Railtie>'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `instance_exec'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `run'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:347:in `each'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:347:in `call'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:54:in `run_initializers'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/application.rb:352:in `initialize!'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:26:in `block (2 levels) in <top (required)>'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:60:in `block (2 levels) in <top (required)>'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:216:in `block in invoke_prerequisites'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `each'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `invoke_prerequisites'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:193:in `block in invoke_with_call_chain'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/derailed_benchmarks-1.3.2/bin/derailed:41:in `exec'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
/Users/jan/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/derailed_benchmarks-1.3.2/bin/derailed:92:in `<top (required)>'
/Users/jan/.rbenv/versions/2.4.1/bin/derailed:22:in `load'
/Users/jan/.rbenv/versions/2.4.1/bin/derailed:22:in `<top (required)>'
I just read your great post on http://www.schneems.com/2014/11/07/i-ram-what-i-ram.html , and had to do two tweaks to get bundle exec rake -f perf.rake perf:require_bench
to work as expected (using derailed_benchmarks
master):
perf:require_bench
loads derailed_benchmarks/core_ext/kernel_require.rb
after the setup task is executed. This way I don't get measures for the requires that are called during bootup. My solution: Require this file in perf.rake
.CUT_OFF != 0
, I never got any output since the TOP_REQUIRE
node always has a zero cost. My workaround is to check for name != "TOP"
in https://github.com/schneems/derailed_benchmarks/blob/master/lib/derailed_benchmarks/require_tree.rb#L37I am not absolutely sure how to fix those two issues, but I at least wanted to report them as others might stumple upon similar things.
Thank you for your great work!
I've noticed that this line seems to ignore a 302 response - is this the desired behaviour? This happens, for example, when authentication fails with a controller redirect (am learning this the hard way trying to write custom AuthHelper for my Rack app). In this case I'm assuming the generated output is from the redirect path & not the intended PATH_TO_HIT. If so this seems misleading.
Suggestion:
Curl can return response codes, so could this be used to check for a 200 response - i.e. same logic as when USE_SERVER is not set?
Thanks for this awesome gem! I used it to track down a gem that consumed a lot of memory, and submitted a pull request that eliminated the problem.
In a separate app that doesn't use a database, I just tried running derailed exec perf:mem
, and it complained that it could not load database configuration. No such file - ["config/database.yml"]
. Maybe I missed it, but I couldn't find a way to specify that my app doesn't use a database.
I could create a pull request to get this working in 1.9.3 with Rails 3.2, but in the meantime, could you provide the versions that are known to work with this gem? I really look forward to using this if I can get it running in our environment. Thanks for the work so far.
When running derailed exec perf:mem_over_time
I got the following err
PID: 7485
I, [2017-05-22T16:09:00.005495 #7485] INFO -- : Started GET "/" for at 2017-05-22 16:09:00 +0545
164.84375
I, [2017-05-22T16:09:00.039285 #7485] INFO -- : Processing by ProjectsController#index as HTML
I, [2017-05-22T16:09:00.042417 #7485] INFO -- : Redirected to http://www.example.org/
I, [2017-05-22T16:09:00.042492 #7485] INFO -- : Filter chain halted as :force_www rendered or redirected
I, [2017-05-22T16:09:00.042615 #7485] INFO -- : Completed 302 Found in 3ms (ActiveRecord: 0.0ms)
/home/sushant/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:92:in `call_app': Bad request: <html><body>You are being <a href="http://www.example.org/">redirected</a>.</body></html> (RuntimeError)
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:174:in `block (3 levels) in <top (required)>'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:173:in `times'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:173:in `block (2 levels) in <top (required)>'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
from /home/sushant/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/bin/derailed:41:in `exec'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
from /home/sushant/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.2/bin/derailed:92:in `<top (required)>'
from /home/sushant/.rvm/gems/ruby-2.3.1/bin/derailed:22:in `load'
from /home/sushant/.rvm/gems/ruby-2.3.1/bin/derailed:22:in `<main>'
from /home/sushant/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
from /home/sushant/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
I'm getting started using this gem with my Rails app. I'm trying to profile the memory usage of specific endpoints. Using the default configuration (in development
mode), I get an error:
$ RAILS_ENV=development rake -f perf.rake perf:mem
W, [2016-01-29T13:19:28.775029 #59970] WARN -- : [SKYLIGHT] [0.10.0] Running Skylight in development mode. No data will be reported until you deploy your app.
(To disable this message for all local apps, run `skylight disable_dev_warning`.)
Endpoint: "/"
/Users/andrew/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/derailed_benchmarks-1.3.0/lib/derailed_benchmarks/tasks.rb:72: warning: already initialized constant DERAILED_APP
/Users/andrew/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/derailed_benchmarks-1.3.0/lib/derailed_benchmarks/tasks.rb:23: warning: previous definition of DERAILED_APP was here
## Impact of `require <file>` on RAM
Showing all `require <file>` calls that consume 0.3 MiB or more of RSS
Configure with `CUT_OFF=0` for all entries or `CUT_OFF=5` for few entries
Note: Files only count against RAM on their first load.
If multiple libraries require the same file, then
the 'cost' only shows up under the first library
rake aborted!
Bad request: <!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<div>
<h1>We're sorry, but something went wrong.</h1>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>
Tasks: TOP => perf:mem
(See full trace by running task with --trace)
The output in my development.log
only shows the initial request:
Started GET "/" for at 2016-01-29 13:20:49 -0800
However, I see that it works if I specify to use puma
as the server:
$ RAILS_ENV=development USE_SERVER=puma rake -f perf.rake perf:mem
Booting: development
W, [2016-01-29T13:24:01.680161 #68693] WARN -- : [SKYLIGHT] [0.10.0] Running Skylight in development mode. No data will be reported until you deploy your app.
(To disable this message for all local apps, run `skylight disable_dev_warning`.)
Endpoint: "/"
/Users/andrew/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/derailed_benchmarks-1.3.0/lib/derailed_benchmarks/tasks.rb:72: warning: already initialized constant DERAILED_APP
/Users/andrew/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/derailed_benchmarks-1.3.0/lib/derailed_benchmarks/tasks.rb:23: warning: previous definition of DERAILED_APP was here
Port: 3312
Server: "puma"
Puma 2.14.0 starting...
* Min threads: 0, max threads: 16
* Environment: none
* Listening on tcp://0.0.0.0:3312
## Impact of `require <file>` on RAM
Showing all `require <file>` calls that consume 0.3 MiB or more of RSS
Configure with `CUT_OFF=0` for all entries or `CUT_OFF=5` for few entries
Note: Files only count against RAM on their first load.
If multiple libraries require the same file, then
the 'cost' only shows up under the first library
TOP: 274.875 MiB
application: 83.9492 MiB
refile/rails: 18.0625 MiB
...etc...
I've got a production rails app which has been having issues as far as the server running out of memory consistently over time. I came across your gem and thought I'd try it out, and sure enough just hitting an endpoint, I consistently saw the memory output in the file being written to tmp going up and up...
However, I wanted to prove that this was in fact demonstrating the problem, so I created a new rails app (4.1.4) with ruby 2.2.5, made a single controller with an action that does:
def index
head 200
end
When I tried hitting that endpoint with bundle exec derailed exec perf:mem_over_time
, the results I get are:
https://gist.github.com/patrick99e99/1fcb853bbc3fdc939053a6818462f78b
which does basically the same thing.. the number goes up and up and up.................. So......... I am a little confused? Does a brand new rails app that does nothing have a memory leak? Or am I misreading these numbers and this i actually not a problem?
Feature request
task/perf.rake
is filled with:
namespace :perf do
task :rack_load do
MyTask.new.run
end
end
~/P/o/scheduler ❯❯❯ derailed exec perf:objects ⏎master ✭ ✱ ◼
You're not using Rails
You need to tell derailed how to boot your app
In your perf.rake add:
namespace :perf do
task :rack_load do
# DERAILED_APP = your code here
end
end
Endpoint: "/"
/home/braulio/.rvm/gems/ruby-2.4.2/gems/derailed_benchmarks-1.3.4/lib/derailed_benchmarks/tasks.rb:71:in `block (3 levels) in <top (required)>': undefined method `starts_with?' for "ANT_HOME":String (NoMethodError)
Did you mean? start_with?
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/derailed_benchmarks-1.3.4/lib/derailed_benchmarks/tasks.rb:71:in `select'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/derailed_benchmarks-1.3.4/lib/derailed_benchmarks/tasks.rb:71:in `block (2 levels) in <top (required)>'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rake-12.3.0/lib/rake/task.rb:251:in `block in execute'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rake-12.3.0/lib/rake/task.rb:251:in `each'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rake-12.3.0/lib/rake/task.rb:251:in `execute'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rake-12.3.0/lib/rake/task.rb:195:in `block in invoke_with_call_chain'
from /home/braulio/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rake-12.3.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rake-12.3.0/lib/rake/task.rb:217:in `block in invoke_prerequisites'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rake-12.3.0/lib/rake/task.rb:215:in `each'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rake-12.3.0/lib/rake/task.rb:215:in `invoke_prerequisites'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rake-12.3.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
from /home/braulio/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rake-12.3.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rake-12.3.0/lib/rake/task.rb:181:in `invoke'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/derailed_benchmarks-1.3.4/bin/derailed:41:in `exec'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
from /home/braulio/.rvm/gems/ruby-2.4.2/gems/derailed_benchmarks-1.3.4/bin/derailed:92:in `<top (required)>'
from /home/braulio/.rvm/gems/ruby-2.4.2/bin/derailed:23:in `load'
from /home/braulio/.rvm/gems/ruby-2.4.2/bin/derailed:23:in `<main>'
from /home/braulio/.rvm/gems/ruby-2.4.2/bin/ruby_executable_hooks:15:in `eval'
from /home/braulio/.rvm/gems/ruby-2.4.2/bin/ruby_executable_hooks:15:in `<main>'
I asked this question on stackoverflow and have not received an answer, so I am raising as an issue here.
I am trying to use [derailed_benchmark to track down a memory leak in a rails app.
When I run the test
USE_SERVER=puma bundle exec derailed exec perf:mem_over_time
the test runs until the memory usage starts to level off, then then the test throws an error:
RuntimeError: Bad request to "curl 'http://localhost:3000/' -s --fail 2>&1" Response:
How do I fix this?
The output is as follows:
perf:mem_over_time
Booting: production
Endpoint: "/"
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:72: warning: already initialized constant DERAILED_APP
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:23: warning: previous definition of DERAILED_APP was here
Port: 3000
Server: "puma"
Puma 2.16.0 starting...
* Min threads: 0, max threads: 16
* Environment: none
* Listening on tcp://0.0.0.0:3000
PID: 17093
125.01171875
128.15234375
132.0546875
133.5078125
133.68359375
133.8828125
bundler: failed to load command: derailed (/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/bin/derailed)
RuntimeError: Bad request to "curl 'http://localhost:3000/' -s --fail 2>&1" Response:
""
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:85:in `call_app'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:174:in `block (3 levels) in <top (required)>'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:173:in `times'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:173:in `block (2 levels) in <top (required)>'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/Chris/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/derailed_benchmarks-1.3.1/bin/derailed:41:in `exec'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/gems/derailed_benchmarks-1.3.1/bin/derailed:92:in `<top (required)>'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/bin/derailed:23:in `load'
/Users/Chris/.rvm/gems/ruby-2.2.1@golf_mentor221/bin/derailed:23:in `<top (required)>'
I am trying to fix some memory leaks in my app, but when i do a derailed exec perf:mem_over_time
it returns ActiveRecord::NoDatabaseError (FATAL: database "myapp_production" does not exist
.
What can i do to fix it?
After reading the source code, I don't think that's it's possible to do a call with anything else than GET
.
This feature could be a good idea.
What do you thing?
Hi, when I run derailed exec perf:mem
I get the following error, what can I do?
Booting: production [9603/28895]
Traceback (most recent call last):
9638: from /home/user/.rvm/gems/ruby-2.6.3@project/bin/ruby_executable_hooks:24:in `<main>'
9637: from /home/user/.rvm/gems/ruby-2.6.3@project/bin/ruby_executable_hooks:24:in `eval'
9636: from /home/user/.rvm/gems/ruby-2.6.3@project/bin/derailed:23:in `<main>'
9635: from /home/user/.rvm/gems/ruby-2.6.3@project/bin/derailed:23:in `load'
9634: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/bin/derailed:92:in `<top (required)>'
9633: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
9632: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
9631: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
9630: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
9629: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/bin/derailed:41:in `exec'
9628: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
9627: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
9626: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
9625: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
9624: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `invoke_prerequisites'
9623: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `each'
9622: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:238:in `block in invoke_prerequisites'
9621: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
9620: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
9619: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
9618: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
9617: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
9616: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
9615: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/tasks.rb:60:in `block (2 levels) in <top (required)>'
9614: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
9613: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
9612: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
9611: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
9610: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
9609: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
9608: from /home/user/.rvm/rubies/ruby-2.6.3/lib64/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
9607: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/tasks.rb:19:in `block (2 levels) in <top (required)>'
9606: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:16:in `require'
9605: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `block in <top (required)>'
9604: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:49:in `measure_memory_impact'
9603: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `block (2 levels) in <top (required)>'
9602: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `require'
9601: from /home/user/src/govsciences/project/config/application.rb:3:in `<top (required)>'
9600: from /home/user/src/govsciences/project/config/application.rb:3:in `require_relative'
9599: from /home/user/src/govsciences/project/config/boot.rb:6:in `<top (required)>'
9598: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:16:in `require'
9597: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `block in <top (required)>'
9596: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:49:in `measure_memory_impact'
9595: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `block (2 levels) in <top (required)>'
9594: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `require'
9593: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/setup.rb:27:in `<top (required)>'
9592: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap.rb:24:in `setup'
9591: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache.rb:47:in `setup'
9590: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative'
9589: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
9588: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
9587: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
9586: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
9585: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:16:in `require'
9584: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
9583: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
9582: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
================== [omitted 1000s of repeated lines] ======================================
11: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
10: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:16:in `require'
9: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
8: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
7: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
6: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
5: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:16:in `require'
4: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
3: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
2: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
1: from /home/user/.rvm/gems/ruby-2.6.3@project/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/home/user/.rvm/gems/ruby-2.6.3@project/gems/derailed_benchmarks-1.3.5/lib/derailed_benchmarks/core_ext/kernel_require.rb:16:in `require': stack level too deep (SystemStackError)
$ rake -f perf.rake perf:require_bench
rake aborted!
NoMethodError: undefined method `locked_gems' for Bundler:Module
/Users/Ackerman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/derailed_benchmarks-36fd32239808/lib/derailed_benchmarks.rb:10:in `gem_is_bundled?'
/Users/Ackerman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/derailed_benchmarks-36fd32239808/lib/derailed_benchmarks/tasks.rb:53:in `block (2 levels) in <top (required)>'
/Users/Ackerman/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
/Users/Ackerman/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => perf:require_bench => perf:setup
(See full trace by running task with --trace)
Any idea?
There seems to be some weirdness going on if the app responds with a non-200 status.
response.body
output doesn't seem to be correct.After running bundle exec derailed exec perf:ips
Warming up --------------------------------------
ips
bundler: failed to load command: derailed (/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/bin/derailed)
RuntimeError: Bad request:
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/bundler/gems/derailed_benchmarks-dcccae665e75/lib/derailed_benchmarks/tasks.rb:106:in `call_app'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/bundler/gems/derailed_benchmarks-dcccae665e75/lib/derailed_benchmarks/tasks.rb:207:in `block (4 levels) in <top (required)>'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/benchmark-ips-2.7.2/lib/benchmark/ips/job/entry.rb:53:in `call_times'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/benchmark-ips-2.7.2/lib/benchmark/ips/job.rb:220:in `block in run_warmup'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/benchmark-ips-2.7.2/lib/benchmark/ips/job.rb:206:in `each'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/benchmark-ips-2.7.2/lib/benchmark/ips/job.rb:206:in `run_warmup'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/benchmark-ips-2.7.2/lib/benchmark/ips/job.rb:185:in `block in run'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/benchmark-ips-2.7.2/lib/benchmark/ips/job.rb:184:in `times'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/benchmark-ips-2.7.2/lib/benchmark/ips/job.rb:184:in `run'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/benchmark-ips-2.7.2/lib/benchmark/ips.rb:59:in `ips'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/bundler/gems/derailed_benchmarks-dcccae665e75/lib/derailed_benchmarks/tasks.rb:206:in `block (2 levels) in <top (required)>'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rake-12.3.0/lib/rake/task.rb:251:in `block in execute'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rake-12.3.0/lib/rake/task.rb:251:in `each'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rake-12.3.0/lib/rake/task.rb:251:in `execute'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rake-12.3.0/lib/rake/task.rb:195:in `block in invoke_with_call_chain'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rake-12.3.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rake-12.3.0/lib/rake/task.rb:181:in `invoke'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/bundler/gems/derailed_benchmarks-dcccae665e75/bin/derailed:41:in `exec'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/bundler/gems/derailed_benchmarks-dcccae665e75/bin/derailed:92:in `<top (required)>'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/bin/derailed:23:in `load'
/Users/user/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/bin/derailed:23:in `<top (required)>'
When following the instructions in the readme to supply a Devise user to authenticate I get an uninitialized constant error since the model is not loaded yet.
# broken perf.rake
require 'bundler'
Bundler.setup
require 'derailed_benchmarks'
require 'derailed_benchmarks/tasks'
DerailedBenchmarks.auth.user = User.find_by_email!("[email protected]")
Monkey-patching DerailedBenchmarks::AuthHelpers::Devise
using this syntax works since it defers the constant check until the app is loaded.
# working perf.rake
require 'bundler'
Bundler.setup
require 'derailed_benchmarks'
require 'derailed_benchmarks/tasks'
module DerailedBenchmarks
def auth.user
@user ||= User.find_by_email!("[email protected]")
end
end
Am I missing something with the documented syntax?
If not, I can make a PR that accepts a callable for DerailedBenchmarks.auth.user
.
DerailedBenchmarks.auth.user = -> { User.find_by_email!("[email protected]") }
This is not an issue, one clarification I have been using this derailed gem to identify the memory issues and when i try this mem. Ruby 2.2.2, Rails 3.2.22
bundle exec derailed bundle:mem
TOP: 55.3398 MiB
delayed_job_active_record: 15.8789 MiB
delayed_job: 14.5352 MiB (Also required by: delayed/railtie)
delayed/yaml_ext: 10.4688 MiB
but when i try that objects
allocated memory by gem
35887974 activesupport-3.2.22
7594834 mime-types-1.25.1
7076454 newrelic_rpm-3.9.8.273
6541589 mail-2.5.4
I think there is more memory taking for this mime-types and newrelic, right? and if should i update the gem mail? i am following this link https://blog.codeship.com/debugging-a-memory-leak-on-heroku/
Thanks for the library - I think this is the best out there for diagnosing memory issues...
Question: running against a real webserver, it looks like adding support for subdomains is possible - as we're just sub-shelling out to curl. But what about Rack::Mock? Is it possible to use subdomains in the endpoint in this case?
Thanks again!
I have an application where the root path is a page with omniauth-crowd authentication. Because of this, call_app fails with
Bad request: <html><body>You are being <a href="http://example.org/auth/crowd/">redirected</a>.</body></html>
Should it really consider a redirect a failure?
I'm trying to use this gem with puma (3.8.1) web server , but anytime I run one of the tasks, the web server dies on me with this message. I don't know what might be happening. Has anyone seen this type of error before?
I'm using Ruby 2.1.5+Rails 4.2.0 and derailed_benchmarks 1.0.0.
I wanted to do some tests in a Rails app that uses Devise for authenticated the User class.
I tried creating a perf.rake such as the one bellow, with and without the namespace block but I always get the error bellow. It seems that rails is not being load. Guess that I'm missing something simple..?!
Any clue?
require 'bundler'
Bundler.setup
require 'derailed_benchmarks'
require 'derailed_benchmarks/tasks'
namespace :perf do
task :rack_load do
DERAILED_APP = Rails.application # your code here
end
end
DerailedBenchmarks.auth.user = User.find_or_create!(email: "[email protected]")
$ bundle exec rake -f perf.rake perf:ram_over_time --trace
rake aborted!
NameError: uninitialized constant User
/Users/sergio/work/capthost/perf.rake:13:in `<top (required)>'
/Users/sergio/work/capthost/vendor/ruby/2.1.0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load'
/Users/sergio/work/capthost/vendor/ruby/2.1.0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/Users/sergio/work/capthost/vendor/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile'
/Users/sergio/work/capthost/vendor/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:94:in `block in load_rakefile'
/Users/sergio/work/capthost/vendor/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/sergio/work/capthost/vendor/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:93:in `load_rakefile'
/Users/sergio/work/capthost/vendor/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:77:in `block in run'
/Users/sergio/work/capthost/vendor/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/sergio/work/capthost/vendor/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/Users/sergio/work/capthost/vendor/ruby/2.1.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/Users/sergio/work/capthost/vendor/ruby/2.1.0/bin/rake:23:in `load'
/Users/sergio/work/capthost/vendor/ruby/2.1.0/bin/rake:23:in `<main>'
hi,
running derailed in "local" production (RAILS_ENV=production bundle exec derailed exec perf:mem
) gives me this :
TOP: 173.7539 MiB
application: 26.3008 MiB
while in dev I have (bundle exec derailed bundle:mem development
) :
TOP: 48.4063 MiB
rails/all: 18.8047 MiB
My app do take about 180 mib on heroku. I am desperately trying to low this value. Any clue about where to look ? what does TOP mean ?
Thk U !!
I have Windows 7 64bits.
When I run: "bundle exec derailed bundle:mem"
or "bundle exec derailed bundle:mem development"
I the following printed over and over again (I suspect once per gem loaded?) and that's it. This seems to indicate that ps command requested is not supported on Windows? A message in the readme would be nice if this is the case.
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
PS: gem 'stackprof' doesn't even compile on Windows.
bundler: failed to load command: derailed (/usr/local/opt/rbenv/versions/2.3.3/bin/derailed)
RuntimeError: Bad request:
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:92:in call_app' /usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:252:in
block (2 levels) in <top (required)>'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in block in execute' /usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in
each'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in execute' /usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:194:in
block in invoke_with_call_chain'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/2.3.0/monitor.rb:214:in mon_synchronize' /usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:187:in
invoke_with_call_chain'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:180:in invoke' /usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.2/bin/derailed:41:in
exec'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in run' /usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in
invoke_command'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in dispatch' /usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in
start'
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.2/bin/derailed:92:in <top (required)>' /usr/local/opt/rbenv/versions/2.3.3/bin/derailed:23:in
load'
/usr/local/opt/rbenv/versions/2.3.3/bin/derailed:23:in `<top (required)>'
Hi, I have an app which was 3 authenticable Models
User
, Agency
, AdminUser
I'm failing to perform the benchmarks.
when calling RAILS_ENV=development USE_AUTH=true bundle exec derailed exec perf:mem_over_time
Booting: development
Endpoint: "/"
Auth: true
/Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:72: warning: already initialized constant DERAILED_APP
/Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:23: warning: previous definition of DERAILED_APP was here
PID: 17858
160.21875
/Users/benja/dev/ibilbidea/perf.rake:15:in `call': undefined local variable or method `current_user' for #<MyCustomAuth:0x007fc159f4c028> (NameError)
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/rack-2.0.1/lib/rack/mock.rb:74:in `request'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/rack-2.0.1/lib/rack/mock.rb:56:in `get'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:91:in `call_app'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:174:in `block (3 levels) in <top (required)>'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:173:in `times'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:173:in `block (2 levels) in <top (required)>'
from /Users/benja/.rvm/gems/ruby-2.4.0@global/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
from /Users/benja/.rvm/gems/ruby-2.4.0@global/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
from /Users/benja/.rvm/gems/ruby-2.4.0@global/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/airbrake-6.0.0/lib/airbrake/rake/task_ext.rb:19:in `execute'
from /Users/benja/.rvm/gems/ruby-2.4.0@global/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
from /Users/benja/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
from /Users/benja/.rvm/gems/ruby-2.4.0@global/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
from /Users/benja/.rvm/gems/ruby-2.4.0@global/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/derailed_benchmarks-1.3.2/bin/derailed:41:in `exec'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/gems/derailed_benchmarks-1.3.2/bin/derailed:92:in `<top (required)>'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/bin/derailed:22:in `load'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/bin/derailed:22:in `<main>'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/bin/ruby_executable_hooks:15:in `eval'
from /Users/benja/.rvm/gems/ruby-2.4.0@rails_5/bin/ruby_executable_hooks:15:in `<main>'
I tried this following perf.rake
class MyCustomAuth < DerailedBenchmarks::AuthHelper
def setup
# initialize code here
require 'devise'
require 'warden'
extend ::Warden::Test::Helpers
extend ::Devise::TestHelpers
Warden.test_mode!
end
def call(env)
# log something in on each request
login_as(User.last, scope: :user)
login_as(Agency.last, scope: :agency)
login_as(AdminUser.last, scope: :admin_user)
app.call(env)
end
end
DerailedBenchmarks.auth = MyCustomAuth.new
what I'm missing?
best regards
Hiya. I'm really stumbling through this trying to get anything derailed does to work. I'm trying to debug a Sinatra application, and aside from not getting DERAILED_APP to work at all, I can't even get bundle exec derailed bundle:mem
to work to benchmark gems. I have derailed in my Gemfile, and I've run bundle install
but it dies immediately trying to load warden.
bundle exec derailed bundle:mem
bundler: failed to load command: derailed (/Users/shank/.rbenv/versions/2.3.3/bin/derailed)
LoadError: cannot load such file -- warden
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `require'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `block (2 levels) in <top (required)>'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:49:in `measure_memory_impact'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `block in <top (required)>'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:16:in `require'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sinatra_more-0.3.43/lib/sinatra_more/warden_plugin.rb:2:in `<top (required)>'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `require'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `block (2 levels) in <top (required)>'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:49:in `measure_memory_impact'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `block in <top (required)>'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:16:in `require'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sinatra_more-0.3.43/lib/sinatra_more.rb:5:in `<top (required)>'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `require'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `block (2 levels) in <top (required)>'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:49:in `measure_memory_impact'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/core_ext/kernel_require.rb:63:in `block in <top (required)>'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/bin/derailed:67:in `block in <class:DerailedBenchmarkCLI>'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/bin/derailed:92:in `<top (required)>'
/Users/shank/.rbenv/versions/2.3.3/bin/derailed:22:in `load'
/Users/shank/.rbenv/versions/2.3.3/bin/derailed:22:in `<top (required)>'
What am I doing wrong?
I'm trying to test cpu/memory/gc/etc consumption in some workers that I usually run in a rake task. I created a stress test with the code to test but I would like to use derailed_benchmark to get more info.
Is there anyway to do it?
I'm trying to benchmark some pages that needs the current user to be already logged in. How would I go about this with derailed_benchmarks ?
Thanks
Following the direction in the README, I installed the gem and ran "bundle exec derailed bundle:mem". I immediately get the following error:
NoMethodError: private method `warn' called for nil:NilClass
It originates on line 210 in lib/derailed_benchmarks/tasks.rb
task :ram_over_time do
Kernel.warn("The ram_over_time task is deprecated. Use mem_over_time")
Rake::Task["perf:ram_over_time"].invoke
end
Hey everyone, I tried to get this to run, specifically I tried to use the bundle exec rake -f perf.rake perf:require_bench
command but when doing so I get the following:
rake aborted!
NameError: uninitialized constant ActiveRecord
Tasks: TOP => perf:require_bench => perf:setup
(See full trace by running task with --trace)
When ran with the trace I get:
bundle exec rake -f perf.rake perf:require_bench --trace
** Invoke perf:require_bench (first_time)
** Invoke perf:kernel_require_patch (first_time)
** Execute perf:kernel_require_patch
** Invoke perf:setup (first_time)
** Execute perf:setup
rake aborted!
NameError: uninitialized constant ActiveRecord
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/derailed_benchmarks-0.0.0/lib/derailed_benchmarks/tasks.rb:30:in `block (2 levels) in <top (required)>'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:240:in `call'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:240:in `block in execute'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:235:in `each'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:235:in `execute'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:201:in `block in invoke_prerequisites'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:199:in `each'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:199:in `invoke_prerequisites'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:178:in `block in invoke_with_call_chain'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:165:in `invoke'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:150:in `invoke_task'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `each'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/Users/KevinKirsch/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/Users/KevinKirsch/.rvm/gems/ruby-2.1.2/bin/rake:23:in `load'
/Users/KevinKirsch/.rvm/gems/ruby-2.1.2/bin/rake:23:in `<main>'
Tasks: TOP => perf:require_bench => perf:setup
Any suggestions on what I can do to get this to work or to disable it attempting to benchmark ActiveRecord which isn't in use in our application. Thank you for your time, I appreciate your patience.
Hey @schneems thanks for your work on this gem!
Would you accept a PR for being able to specify the Benchmark.ips
:config
and :time
options? As of now the perf:ips
task is not useful if the endpoint you are hitting is very slow (over ~1 second) since the default :time
of 5 seconds is not enough to eliminate noise. The proposed API would be
IPS_WARMUP=5 IPS_TIME=30 derailed exec perf:ips
This isn't a problem. Whenever I run the command derailed bundle:mem
, for example, a warning is displayed:
WARN: Unresolved specs during Gem::Specification.reset:
rack (~> 1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
However, running the same command with bundle exec
, this warning is no longer displayed. I understand what it is. If you think this relevant, we can adjust it.
Thanks, Richard.
Best!
RAILS_ENV=production SKIP_FILE_WRITE=true rake -f perf.rake perf:ram_over_time TEST_COUNT=20
Doesn't matter what settings i changing it is silently stops.
Okay, so I read #84 and the readme about how to load an arbitrary Rack app. However, I don't know much about Rack + Sinatra modular apps, or at least, enough on how to load them in derailed.
I'm trying to run bundle exec derailed exec perf:mem_over_time
with the following perf.rake
:
require 'derailed_benchmarks'
require 'derailed_benchmarks/tasks'
namespace :perf do
task :rack_load do
require_relative './Jump'
DERAILED_APP = Jump.run!
end
end
where Jump
is a modular Sinatra, app, e.g.,
require 'sinatra'
require 'newrelic_rpm'
require 'sinatra/partial'
require 'sinatra_more/markup_plugin'
require 'mongoid'
require 'bcrypt'
require 'raven'
require 'skylight/sinatra'
require 'redis'
require 'sidekiq'
class Jump < Sinatra::Base
# snip
end
and where the config.ru
is
require './Jump'
run Jump
If I start it, this happens:
$ bundle exec derailed exec perf:mem_over_time
You're not using Rails
You need to tell derailed how to boot your app
In your perf.rake add:
namespace :perf do
task :rack_load do
# DERAILED_APP = your code here
end
end
Jump development server is online.
== Sinatra (v1.4.7) has taken the stage on 4567 for development with backup from Puma
Puma starting in single mode...
* Version 3.6.2 (ruby 2.3.3-p222), codename: Sleepy Sunday Serenity
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://localhost:4567
and nothing else unless I hit CTRL + C, at which point it shuts down and I end up with
== Sinatra has ended his set (crowd applauds)
- Gracefully stopping, waiting for requests to finish
=== puma shutdown: 2017-01-09 20:21:17 -0700 ===
- Goodbye!
Endpoint: "/"
bundler: failed to load command: derailed (/Users/shank/.rbenv/versions/2.3.3/bin/derailed)
LoadError: cannot load such file -- rack/test
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/skylight-1.0.1/lib/skylight/probes.rb:81:in `require'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/skylight-1.0.1/lib/skylight/probes.rb:81:in `require'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:69:in `block (2 levels) in <top (required)>'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-11.3.0/lib/rake/task.rb:248:in `block in execute'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-11.3.0/lib/rake/task.rb:243:in `each'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-11.3.0/lib/rake/task.rb:243:in `execute'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-11.3.0/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-11.3.0/lib/rake/task.rb:180:in `invoke_with_call_chain'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-11.3.0/lib/rake/task.rb:209:in `block in invoke_prerequisites'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-11.3.0/lib/rake/task.rb:207:in `each'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-11.3.0/lib/rake/task.rb:207:in `invoke_prerequisites'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-11.3.0/lib/rake/task.rb:186:in `block in invoke_with_call_chain'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-11.3.0/lib/rake/task.rb:180:in `invoke_with_call_chain'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-11.3.0/lib/rake/task.rb:173:in `invoke'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/bin/derailed:41:in `exec'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
/Users/shank/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/derailed_benchmarks-1.3.1/bin/derailed:92:in `<top (required)>'
/Users/shank/.rbenv/versions/2.3.3/bin/derailed:22:in `load'
/Users/shank/.rbenv/versions/2.3.3/bin/derailed:22:in `<top (required)>'
How exactly do I properly mount a modular Sinatra app using derailed?
Hi,
The require_bench rake task fails with a bad request error. What can I do to troubleshoot this ?
bundle exec rake -f perf.rake perf:require_bench --trace
** Invoke perf:require_bench (first_time)
** Invoke perf:kernel_require_patch (first_time)
** Execute perf:kernel_require_patch
** Invoke perf:setup (first_time)
** Execute perf:setup
Booting: production
** Execute perf:require_bench
## Impact of `require <file>` on RAM
Showing all `require <file>` calls that consume 0.3 mb or more of RSS
Configure with `CUT_OFF=0` for all entries or `CUT_OFF=5` for few entries
Note: Files only count against RAM on their first load.
If multiple libraries require the same file, then
the 'cost' only shows up under the first library
rake aborted!
Bad request:
/Users/ivan/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/derailed_benchmarks-0.0.0/lib/derailed_benchmarks/tasks.rb:56:in `call_app'
/Users/ivan/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/derailed_benchmarks-0.0.0/lib/derailed_benchmarks/tasks.rb:177:in `block (2 levels) in <top (required)>'
/Users/ivan/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.rb:240:in `call'
The Gemfile:
https://gist.github.com/chrisccerami/dd5233cfccd67a2a4505
Bundle list:
Gems included by the bundle:
It appears as though derailed_benchmarks (0.0.0) is being installed rather than derailed_benchmarks (1.0.0) like in other apps. When setting derailed_benchmarks explicitly to 1.0.0 in my Gemfile, I received the following:
Bundler could not find compatible versions for gem "rake":
In Gemfile:
derailed_benchmarks (~> 1.0.0) ruby depends on
rake (~> 10.4) ruby
sass-rails (~> 4.0.0) ruby depends on
railties (< 5.0, >= 4.0.0.beta) ruby depends on
rake (10.1.0)
I am working on diagnosing a memory leak in an app that uses a subdomain architecture. In order to use derailed's mem_over_time task, I needed to manually edit one of the files in the gem that contains a hardcoded reference to http://localhost
. It would be nice if there were a SUBDOMAIN
option, similar to the PATH_TO_HIT
option, that allowed users to optionally supply a subdomain to hit.
i'm trying to use TEST_COUNT
param and it seems to be ending way earlier than 100 or even 1000 tries
TEST_COUNT=1000 USE_SERVER=puma USE_AUTH=true PATH_TO_HIT=/api/v1/notifications.json RAILS_ENV=staging derailed exec perf:mem_over_time
Booting: staging
db_development already exists
Endpoint: "/api/v1/notifications.json"
Auth: true
Port: 3419
Server: "puma"
Puma 2.15.3 starting...
* Min threads: 0, max threads: 16
* Environment: none
* Listening on tcp://0.0.0.0:3419
PID: 52447
196.63671875
203.9296875
204.78515625
205.76953125
206.046875
206.07421875
206.2109375
206.29296875
206.41796875
206.51171875
206.6328125
206.64453125
#kicked out to shell here
there were no errors in my log, just regular hits to the server ( i set log level to debug as well ). are there any other debug flags I could set to try to figre out why its stopping early?
Ruby 2.2.2 and Rails 3.2.22
I am following this link https://github.com/schneems/derailed_benchmarks, and running this server in production mode, when i was running this
PATH_TO_HIT=/setup_others/new_reason bundle exec derailed exec perf:mem
Got this error
Booting: production
Endpoint: "/setup_others/new_reason"
/Users/test/.rvm/gems/ruby-2.2.2/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:72: warning: already initialized constant DERAILED_APP
/Users/test/.rvm/gems/ruby-2.2.2/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:23: warning: previous definition of DERAILED_APP was here Impact of require <file>
on RAM
Showing all require <file>
calls that consume 0.3 MiB or more of RSS
Configure with CUT_OFF=0
for all entries or CUT_OFF=5
for few entries
Note: Files only count against RAM on their first load.
If multiple libraries require the same file, then
the 'cost' only shows up under the first library
/Users/test/.rvm/gems/ruby-2.2.2/gems/derailed_benchmarks-1.3.2/lib/derailed_benchmarks/tasks.rb:92:in `call_app': Bad request: You are being redirected. (RuntimeError)
Hello,
This code is working perfectly with our application but we are seeing some seemingly alarming results that I wanted to inquire about.
When I run:
bundle exec derailed exec perf:objects
as well as:
TEST_COUNT=10 bundle exec derailed exec perf:objects
I see our allocated memory increase by a multiple of 10. Is this normal behavior?
Here is a sample of the output I see for TEST_COUNT=1:
3604658 haml-4.0.5
1921843 activerecord-4.1.6
1879824 parslet-1.6.0
1749971 activesupport-4.1.6
737334 activejunky2/app
448577 rack-1.5.5
392121 other
196629 arel-5.0.1.20140414130214
169070 newrelic_rpm-3.12.1.298
131902 actionpack-4.1.6
120986 actionview-4.1.6
118832 thread_safe-0.3.5
108375 dalli-2.7.2
96825 pg-0.17.1
49667 2.2.1/lib
17208 warden-1.2.3
15536 activejunky2/lib
13600 active_hash-1.4.0
12976 activemodel-4.1.6
7258 devise-3.4.0
3225 shortcode-1.0.0
2241 railties-4.1.6
2059 omniauth-1.2.2
1993 json-1.8.3
1920 hashie-3.4.3
1688 css_splitter-0.4.1
1040 sprockets-rails-2.3.3
368 tzinfo-1.2.2
288 sentry-raven-0.13.3
240 sunspot_rails-2.1.1
200 sprockets-2.11.0
167 sunspot-2.1.1
and here is for TEST_COUNT=10:
36009140 haml-4.0.5
19218430 activerecord-4.1.6
18794640 parslet-1.6.0
17497676 activesupport-4.1.6
7373340 activejunky2/app
4485770 rack-1.5.5
3921210 other
1966290 arel-5.0.1.20140414130214
1691701 newrelic_rpm-3.12.1.298
1318660 actionpack-4.1.6
1200761 actionview-4.1.6
1188320 thread_safe-0.3.5
1075010 dalli-2.7.2
968250 pg-0.17.1
496670 2.2.1/lib
172080 warden-1.2.3
155360 activejunky2/lib
136000 active_hash-1.4.0
129760 activemodel-4.1.6
72580 devise-3.4.0
32250 shortcode-1.0.0
22410 railties-4.1.6
20590 omniauth-1.2.2
19930 json-1.8.3
19200 hashie-3.4.3
16880 css_splitter-0.4.1
10400 sprockets-rails-2.3.3
3680 tzinfo-1.2.2
2880 sentry-raven-0.13.3
2400 sunspot_rails-2.1.1
2000 sprockets-2.11.0
1670 sunspot-2.1.1
Any feedback you are able to provide would be GREATLY appreciated.
Many thanks,
Ellie
I am trying to use derailed_benchmarks to dynamically benchmark my Padrino app. Following the docs I have created an appropriate perf:rack_load Rake task (code below).
However, when running bundle exec derailed exec perf:mem
I get the following error:
/Users/me/.rvm/gems/ruby-2.3.1/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:72:in block (2 levels) in <top (required)>': uninitialized constant DERAILED_APP (NameError)
It appears that when this task is invoked it simply runs the code from line 46 - and not my task.
Question: Is non-Rails/Rack actually supported right now - or now do I need to fork & overwrite the rack_load task at line 46? I see using config.ru
was discussed in #1 - do you need a PR to make this so?
config.ru
#!/usr/bin/env rackup
# encoding: utf-8
require File.expand_path('../config/boot.rb', __FILE__)
use Rack::Deflater
run Padrino.application
perf.rake
require 'bundler'
Bundler.setup
require 'derailed_benchmarks'
require 'derailed_benchmarks/tasks'
namespace :perf do
desc 'loads the app for derailed_benchmarks'
task :rack_load do
require_relative '../config/boot'
DERAILED_APP = Padfoot::App
end
end
I'm running a Rails 3.2.19 app and when I run the perf:require_benchmarks I get the following. It works fine on a Rails 4 app though:
neel@Neels-MacBook-Pro:/railsapps/imua$ bundle exec rake -f perf.rake perf:require_bench --trace> 3.0.0) more than once.
Your Gemfile lists the gem rspec-rails (
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem factory_girl_rails (~> 4.0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem jasmine (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
** Invoke perf:require_bench (first_time)
** Invoke perf:kernel_require_patch (first_time)
** Execute perf:kernel_require_patch
** Invoke perf:setup (first_time)
** Execute perf:setup
rake aborted!
NoMethodError: undefined method initialized?' for #Imua::Application:0x007fe5a2bf4e30
/Users/neel/.rvm/gems/ruby-2.1.2/gems/derailed_benchmarks-0.0.0/lib/derailed_benchmarks/tasks.rb:29:inblock (2 levels) in '
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:240:in call'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:240:inblock in execute'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:235:in each'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:235:inexecute'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:179:in block in invoke_with_call_chain'
/Users/neel/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:inmon_synchronize'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:172:in invoke_with_call_chain'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:201:inblock in invoke_prerequisites'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:199:in each'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:199:ininvoke_prerequisites'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:178:in block in invoke_with_call_chain'
/Users/neel/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:inmon_synchronize'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:172:in invoke_with_call_chain'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:165:ininvoke'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:150:in invoke_task'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:inblock (2 levels) in top_level'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:in each'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:inblock in top_level'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:115:in run_with_threads'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:100:intop_level'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:78:in block in run'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:176:instandard_exception_handling'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:75:in run'
/Users/neel/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/bin/rake:33:in'
/Users/neel/.rvm/gems/ruby-2.1.2/bin/rake:23:in load'
/Users/neel/.rvm/gems/ruby-2.1.2/bin/rake:23:in'
Tasks: TOP => perf:require_bench => perf:setup
I'm really excited to use this library but hopefully it's compatible with Rails 3.2.19..
Since I am able to move forward by using the USE_SERVER=puma
option, I am trying to benchmark an endpoint that requires authentication. This is an API that uses both Devise and token based authentication. So the requests to the API typically specify an authentication token.
I tried configuring perf.rake
as described in the README:
require 'bundler'
Bundler.setup
require 'derailed_benchmarks'
require 'derailed_benchmarks/tasks'
DerailedBenchmarks.auth.user = -> { User.find_by(email: "[email protected]") }
But my request:
SE_AUTH=true PATH_TO_HIT=/api/v1/myendpoint RAILS_ENV=development USE_SERVER=puma rake -f perf.rake perf:mem
...fails with the following backtrace:
Started GET "/api/v1/myendpoint" for 127.0.0.1 at 2016-01-29 13:40:19 -0800
NoMethodError (undefined method `serialize_into_session' for #<Class:0x007fb21c1094f8>):
devise (3.5.2) lib/devise.rb:448:in `block (2 levels) in configure_warden!'
warden (1.2.3) lib/warden/session_serializer.rb:26:in `store'
warden (1.2.3) lib/warden/proxy.rb:175:in `set_user'
warden (1.2.3) lib/warden/test/helpers.rb:20:in `block in login_as'
warden (1.2.3) lib/warden.rb:38:in `call'
warden (1.2.3) lib/warden.rb:38:in `block in test_mode!'
warden (1.2.3) lib/warden/hooks.rb:14:in `call'
warden (1.2.3) lib/warden/hooks.rb:14:in `block in _run_callbacks'
warden (1.2.3) lib/warden/hooks.rb:9:in `each'
warden (1.2.3) lib/warden/hooks.rb:9:in `_run_callbacks'
warden (1.2.3) lib/warden/manager.rb:53:in `_run_callbacks'
warden (1.2.3) lib/warden/proxy.rb:31:in `initialize'
warden (1.2.3) lib/warden/manager.rb:33:in `new'
warden (1.2.3) lib/warden/manager.rb:33:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:25:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/flash.rb:260:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/cookies.rb:560:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.4) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.4) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/reloader.rb:73:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
web-console (2.2.1) lib/web_console/middleware.rb:39:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
railties (4.2.4) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.4) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.4) lib/rails/rack/logger.rb:20:in `call'
quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
activesupport (4.2.4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/static.rb:116:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
newrelic_rpm (3.13.2.302) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
railties (4.2.4) lib/rails/engine.rb:518:in `call'
railties (4.2.4) lib/rails/application.rb:165:in `call'
derailed_benchmarks (1.3.0) lib/derailed_benchmarks/auth_helpers/devise.rb:34:in `call'
puma (2.14.0) lib/puma/server.rb:541:in `handle_request'
puma (2.14.0) lib/puma/server.rb:388:in `process_client'
puma (2.14.0) lib/puma/server.rb:270:in `block in run'
puma (2.14.0) lib/puma/thread_pool.rb:106:in `call'
puma (2.14.0) lib/puma/thread_pool.rb:106:in `block in spawn_thread'
So that got me wondering...does the USE_AUTH
option work with USE_SERVER
option?
Hello,
When I run the command bundle exec derailed exec perf:heap
with USE_SERVER=puma
and here is the errors.
Booting: production
/Users/home/Documents/Projects/pistachio/app/models/finance/transactions/name_to_group.rb:4: warning: duplicated key at line 13 ignored: :service_fee
Endpoint: "/"
/Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:72: warning: already initialized constant DERAILED_APP
/Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:23: warning: previous definition of DERAILED_APP was here
Running 1000 times
/Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:92:in `call_app': Bad request: (RuntimeError)
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:275:in `block (3 levels) in <top (required)>'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:274:in `times'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/derailed_benchmarks-1.3.1/lib/derailed_benchmarks/tasks.rb:274:in `block (2 levels) in <top (required)>'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/derailed_benchmarks-1.3.1/bin/derailed:41:in `exec'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/derailed_benchmarks-1.3.1/bin/derailed:92:in `<top (required)>'
from /Users/home/.rbenv/versions/2.2.3/bin/derailed:23:in `load'
from /Users/home/.rbenv/versions/2.2.3/bin/derailed:23:in `<main>'
Noticed this task while digging through the project (really cool stuff by the way!):
Seems like it was added in your second commit, modified to remove some noise in the commit after, but then really hasn't been touched since. Also seems like it doesn't have any tests/documentation around it, and also isn't a terribly descriptive task name. 😉
Just came across it while reading through the code base and was curious if it got left in by mistake. Should be a simple exercise to remove it if that is the case, just didn't want to do it myself incase I was wrong about it's value (which happens... a lot).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.