yfractal
sdb
Rust

A Ruby stack profiler without GVL.

Last updated Feb 28, 2026
80
Stars
0
Forks
0
Issues
0
Stars/day
Attention Score
8
Language breakdown
Rust 69.2%
Ruby 18.8%
Python 9.5%
Shell 1.5%
JavaScript 0.6%
Dockerfile 0.4%
โ–ธ Files click to expand
README

SDB: High-accuracy stack profiler for Ruby

Introduction

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.

Why Do We Need Another Stack Profiler?

  • 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.

How it Works

Image

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.

Usage Example

roda

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.

NOTICE

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.
๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท yfractal/sdb ยท Updated daily from GitHub