This is a Rails application that plugs into Rails instrumentation to trace object allocation during the lifecycle of a request. The trace data will be streamed to your browser and graphed real time in D3. Keep in mind this is a proof of concept!
This is just a simple rails application right now, but the goal is to make it a mountable rails engine. Doing so will enable real time allocation profiling of YOUR rails application.
- Ruby 2.1
- Lots of RAM
bundle install
rails s
- Load
http://localhost:3000
- Click 'Start instrumentation'
- Review graph; nodes represent objects, edges represent references. The thicker the edge, the more references between objects.
- Click 'Test'
- Notice how the graph aggregates data over many requests...lines get thicker.
Be careful not to broaden the scope or depth of recursion too much. Currently, it is easy to overload your browser with events.
ApplicationController#test
is the code executed when clicking 'Test'.ApplicationController#object_space_scope
will scope the graph to only the descendants of the class provided.ApplicationController#max_object_space_depth
determines how many levels of recursion to profile fromobject_space_scope
.
- Buffer streamed events to reduce websocket overload.