Skip to content

[feat][Ruby][meta] - Overall Ruby interpreter improvements #941

@dalehamel

Description

@dalehamel

I have submitted a number of issues and PRs related to improving Ruby profiling, and have additional ones queued up.

I thought it would be helpful to create this meta issue to describe the deficiencies that I'm addressing, and paint a more complete picture of the desired end state.

Demonstration branch

At Shopify we've been using a branch composed of a bunch of these fixes and a few other tweaks, it is available at Shopify#8 and should be more or less suitable for production use (assuming production is x86_64, and ruby is compiled with --enable-shared for now). We're using it internally, and probably have one of the largest and most demanding ruby stacks in the world, so I'd expect if it works for us it is sufficient for others.

Here is an example of it working with JIT, detecting GC, and appropriately charging the leaf frames to the appropriate native functions, while also providing frame labels that match what is seen in stackprof or other ruby profilers:

End to end Ruby to native to kernel:

Image

Thanks to #907 we can see the cfunc call that initiated the native calls and it makes sense (here is the native code servicing request to look up memory usage, which is ultimately served by the kernel doing smaps_rollup)

Here is the overall ruby process with native profiling unwinding:

Image

It looks identical to the stackprof request profiles for the same thing, albeit with more detail about the native calls:

Image

Zooming in on GC, we can see exactly what is happening during the marking and sweeping stages:

Image

And zooming in on the leaf nodes, we can see where time is being spent in native functions to service cfunc calls:

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions