SDB provides high-accuracy stack profiling for Ruby applications. It can profile Ruby at microsecond (0.000001 second) intervals and offers event tagging for requests.
- Minimal Impact: SDB does not affect the target application's performance.
- Event Tagging: SDB supports event tagging, making it easier to trace and identify slow functions.
- High Accuracy: SDB offers precision down to microseconds.
Instrumentation libraries like opentelemetry-ruby
generate data during application runtime, and some stack profilers block application threads. These approaches can introduce delays in your application.
SDB, inspired by LDB, operates by pulling stack traces on a separate thread, which minimizes the impact on our application.
Event tagging, such as adding trace_id for Puma requests, makes it easier to identify slow functions.
Moreover, SDB can precisely identify delays, down to a single microsecond.

The stack scanner scans the Ruby stacks without the GVL as reading an Iseq address is atomic. The symbolizer translates Iseq into function name and path and it "caches" the translation result for avoiding repeat work to achieve better performance. As it "caches" the translation result, it marks the Iseq address at each beginning of GC for avoiding incorrect results -- an Iseq has been reclaimed and the address is used by a new Iseq.
The image above is generated by sdb-analyzer. It represents a simple Ruby API application rendering an empty body.
The image clearly shows which methods are used and their latency, helping us understand the application's behavior and identify potential latency issues, even without prior background knowledge.
SDB is still in the experimental stage. Rather than focusing on ease of use and stability, I am exploring additional use cases, such as detecting concurrency issues or delays caused by GVL.