Asynchronous Stack Trace Correlation for Time-Based Sampling
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In asynchronous execution environments like Node.js, time-based sampling (TBS) struggles to accurately identify performance bottlenecks due to the inability to link asynchronous work requests with their corresponding callback functions, leading to incomplete stack traces that miss the root cause of latency issues.
Innovation Solution
The method involves determining if time-based sampling is activated, loading and saving callback stack traces, and correlating them with current stack traces to capture the entire execution flow, enabling attribution of performance issues to specific functions.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If time-based sampling is used in asynchronous execution environments, then computational efficiency is improved, but measurement precision of performance bottlenecks deteriorates due to incomplete stack traces
Solution Approach 1:
The patent stores the callback stack trace when the asynchronous function is initially called, before the actual execution occurs. This preliminary capture of the stack trace ensures that when time-based sampling later identifies a performance bottleneck in the callback function, the original calling context is already recorded and can be retrieved to provide complete stack trace information for accurate bottleneck identification.
2Measurement precision
If callback stack trace is always captured and stored, then measurement precision of performance bottlenecks is improved, but use of energy and computational overhead increases
Solution Approach 1:
The patent applies different sampling strategies to different parts of the execution flow. Callback stack traces are captured with high precision (every call) only when needed for asynchronous functions, while other execution paths use standard time-based sampling. This localized application of detailed tracking minimizes overall computational overhead while ensuring accurate bottleneck identification for asynchronous operations.
Data Source
AI summary
The present disclosure describes methods, systems, and computer program products for providing additional stack trace information for time-based sampling (TBS) in asynchronous execution environments. One computer-implemented method includes determining whether time-based sampling is activated to capture a time-based sampling data during execution of a JavaScript function; in response to determining that the time-based sampling is activated to capture the time-based sampling data, determining whether a callback stack trace is active; in response to determining that the callback stack trace is active, loading the callback stack trace; retrieving a current stack trace of the JavaScript function; and saving the loaded callback stack trace and the current stack trace of the JavaScript function as the time-based sampling data.


