exception_handler icon indicating copy to clipboard operation
exception_handler copied to clipboard

Excessive memory usage on Heroku

Open wemmick opened this issue 7 years ago • 7 comments

I got this working on Heroku (thanks for the great gem!) However, now that it's running, it tends to eat up a ton of memory. It seems like a gem that's doing something relatively straightforward like this shouldn't take up 100MB+ of memory on Heroku, so perhaps there's some issue with it.

I use Scout on Heroku to check memory usage, and this gem is using more memory than any other page in my app by far, so it'd be awesome if you could figure out what's going on. That said, the dump from Scout didn't help me much in figuring out what was up - here's what it tells me:

Router/Rails
1 call
100%
exception_handler/exceptions/show
1 call
0%
...
Middleware
1 call
0%
Controller
1 call
0%
RedirectRule#find
SQL
1 call
0%

As you can see, "Router/Rails" appears to be the culprit, but I'm not sure what to do about that. None of my other pages see this kind of memory increase in the Router. Any ideas? Let me know if you need more info.

wemmick avatar Jun 29 '18 06:06 wemmick

VERY interesting.

The gem itself just uses all rails' native functionality... so I don't see why it would cause 100mb of memory usage. Are there any deeper reports you have access to?

Thanks for the kind words!

On 29 June 2018 at 07:52 wemmick [email protected] wrote:

I got this working on Heroku (thanks for the great gem!) However, now that it's running, it tends to eat up a ton of memory. It seems like a gem that's doing something relatively straightforward like this shouldn't take up 100MB+ of memory on Heroku, so perhaps there's some issue with it.

I use Scout on Heroku to check memory usage, and this gem is using more memory than any other page in my app by far, so it'd be awesome if you could figure out what's going on. That said, the dump from Scout didn't help me much in figuring out what was up - here's what it tells me:

Router/Rails
1 call
100%
exception_handler/exceptions/show
1 call
0%
layouts/_header
1 call
0%
Rendering
1 call
0%
GradeLevel#find
SQL13 ROWS
2 calls
0%
layouts/_header_search
1 call
0%
layouts/_footer
1 call
0%
ResourceFormat#find
SQL16 ROWS
1 call
0%
layouts/_content_footer
1 call
0%
layouts/_shim
1 call
0%
Middleware
1 call
0%
Controller
1 call
0%
RedirectRule#find
SQL
1 call
0%

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub https://github.com/richpeck/exception_handler/issues/65 , or mute the thread https://github.com/notifications/unsubscribe-auth/ABDaL3680TmENCnUCX0LY2jkxqOu825Eks5uBc7DgaJpZM4U8hvT .

richpeck avatar Jun 29 '18 07:06 richpeck

This is the trace I get from Scout on Heroku - does it help? It looks like the bloat is all in the Router, but I'm not sure what can be done about that.

fireshot capture 18 - exceptionhandler__exceptionscontroller_ - https___apm scoutapp com_apps_6280

wemmick avatar Jul 03 '18 05:07 wemmick

Many thanks, will investigate this myself - not sure why it would be eating memory like that.

Does the app have any other memory leaks or is it just with ExceptionHandler?

richpeck avatar Jul 03 '18 06:07 richpeck

As far as I can tell, it's just ExceptionHandler. I haven't seen memory usage at that scale on any other pages, and I've never seen significant usage coming from the router. Any help would be much appreciated!

wemmick avatar Jul 07 '18 04:07 wemmick

Got the same results on Heroku for one of our apps - looking at the issue but still unsure as to what's causing it.

richpeck avatar Jul 07 '18 06:07 richpeck

Hi Rich, any insights on this?

wemmick avatar Jul 31 '18 01:07 wemmick

Still looking - sorry for the late response; for some reason, the email response didn't register as a comment!

richpeck avatar Aug 18 '18 07:08 richpeck