Skip to content

2 memory leak from db duration#6

Open
buermann wants to merge 8 commits intotchak:masterfrom
buermann:2-memory-leak-from-db-duration
Open

2 memory leak from db duration#6
buermann wants to merge 8 commits intotchak:masterfrom
buermann:2-memory-leak-from-db-duration

Conversation

@buermann
Copy link

@buermann buermann commented Apr 27, 2018

The ActiveSupport::Notifications::Event object will blow up sometimes when the start time passed from ActiveSupport::Notifications.subscribe('sql.active_record') is nil. Fixing that problem gave rise to something like a memory leak as the Event objects proliferate with every request, while doing very little. We could simply make the calculation it performs ourselves and greatly improve performance.

Before this change in my app under load the performance severely degraded very quickly (the load average on the box rose to over 20). The spikes on the right here are when the box was under load, flattening out when I hit the emergency breaks on our load tests:

screen shot 2018-04-27 at 12 59 19 pm

screen shot 2018-04-27 at 1 04 39 pm

After the change under the same load it faired much much better (the spikes the left are the deployment):

screen shot 2018-04-27 at 1 42 45 pm

screen shot 2018-04-27 at 1 43 00 pm

…vent objects generated in the before hook of Grape::Middleware::Lograge pushes my garbage collection and object allocations through the roof, severly degenerating application performance, and doesn't seem to actually be necessary.
cycle also creates a huge memory leak that is never collected, running a
system out of free memory and crashing on disk swaps.
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

Successfully merging this pull request may close these issues.

1 participant