3
$\begingroup$

Late edit: currently working through the FlameGraphs bibliography here. It looks like what I'm doing is similar to an icicle chart, but with passage of time on the x-axis. The author mentions inspirations for this FlameGraph that have this specific trait (time on x-axis), but I'll need to follow through to see if anyone implemented exactly the same thing.

I'm looking to visualize the flow of nested sub-tasks in my web service. The resulting visualization is probably going to look like a hybrid of a treemap, a dendrogram and a Gantt chart, and I've a feeling that there is a standard chart for it that I'm struggling to find.

Data

Each time a request is served, I log an object that contains a multi-level N-tree of everything the service did to serve the request, and how long it took.

For example, I log a start and end (relative to the request timeline) of the database call, as well as how long it took to connect, execute a query, and process the result into a model. The latter three operations are treated as sub-tasks for the database call.

This is what a simplified execution log would look like the listing below. Note that I have hundreds of operations, and some of them are 5-10 levels deep.

{
    "name": "total", // scope name
    "s": 100,        // start
    "e": 700,        // end
    "c": [           // scopes nested under this one
        {
            "name": "database",
            "s": 200,
            "e": 500,
            "c": [
                {
                    "name": "connect",
                    "s": 200,
                    "e": 300
                },
                {
                    "name": "query",
                    "s": 300,
                    "e": 500,
                    "c":[
                    {
                        "name": "subquery",
                        "s": 400,
                        "e": 470,
                    }]
                }]
                }
            ]
        },
        {
            "name": "ui",
            "s": 510,
            "e": 700,
            "c":[{
                "name": "render",
                "s": 520,
                "e": 690
            }]
        }
    ]
}

Current approach

I've written a small Haskell program to parse the tree and output the following chart onto an HTML Canvas: current visualization

At the moment, I can nicely represent the nested nature of the sub-tasks, and see where the tasks are relative to each other on the timeline.

I don't really want to build a chart renderer from scratch though.

Difference from chart types I've considered

Nested bar chart: bar charts usually have the bars starting at the 0, and all stacking usually happens based on bar size. I need more of a timeline view.

Gantt chart: very similar idea-wise, but usually tracks 'jobs' or 'projects' as rows, and normally doesn't deal with nested jobs.

Treemap: in treemap, all values get assigned the area based on their scalar value. Here, my area is made up of rows (number of sub-tasks) and width (task duration in milliseconds)

Dendrogram: close in terms of data structure, but I can't think of a way to render it in a way that helps to show the start/end/duration of nested tasks well.

Flame Chart/Flame Graph (late addition, see edit at the top): at last I've found someone with similar ideas! Looks like people working with performance profiler software have been working to visualize nested call stacks - in a very similar fashion, but sizing things by call count vs. duration.

The question

Am I reinventing the wheel?

I feel that there should exist a standard visualization type (probably well supported by common tools as well) that can render the chart above just as well.

$\endgroup$

1 Answer 1

1
$\begingroup$

One option would be a flamegraph with time on the x-axis and nested hierarchy of functions on the y-axis. The width of each box on the graph represents the amount of time that function took to execute as a percentage of the total time of its parent function.

Something like this: enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.