Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails with 500 error for unknown reason #69

Closed
andrewhavens opened this issue Jan 29, 2016 · 3 comments
Closed

Fails with 500 error for unknown reason #69

andrewhavens opened this issue Jan 29, 2016 · 3 comments

Comments

@andrewhavens
Copy link

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...
@schneems
Copy link
Member

Are you able to do all of the debugging steps in https://github.com/schneems/derailed_benchmarks#running-in-production-locally ? What's in your log/production.log ?

@andrewhavens
Copy link
Author

@schneems I skipped to running in development rather than trying to run in production mode because I knew I was going to have to make changes to get my app to run in production mode locally. Maybe I missed something...is it required to run in production mode, or just preferred? I'm not concerned with a super accurate benchmark, just some rough numbers to help identify pain points.

@schneems
Copy link
Member

Your app behaves totally differently in development mode, it reloads all files on every request...it's not even close to being indicative of the performance you would see on a real production server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants