r/devops • u/AutoModerator • Sep 28 '26
Weekly Self Promotion Thread
Hey r/devops, welcome to our weekly self-promotion thread!
Feel free to use this thread to promote any projects, ideas, or any repos you're wanting to share. Please keep in mind that we ask you to stay friendly, civil, and adhere to the subreddit rules!
21
Upvotes
View all comments
1
u/DistinctHomework3618 Sep 29 '26
eBPF Python Profiler — finds the latency your APM can't see
Every APM (Datadog, New Relic, OpenTelemetry) shows you database time and HTTP call time. But there's always a gap. Your API takes 5 seconds, APM explains 3. Where did the other 2 go?
That unaccounted time is hiding in GIL contention, GC pauses, off-CPU waits, and request queue delays. Traditional APMs can't see it because they instrument at the application layer. The real answers are at the kernel level.
I built an eBPF tool that hooks into CPython internals and the Linux kernel to find exactly where those milliseconds go.
What it catches:
GIL contention. Shows both who is holding the GIL and who is waiting, with full Python stacks for both. Not sampling. Event-driven. Every GIL acquire captured with exact timestamps. We found URL resolution was the biggest GIL holder. Added URL caching and cut GIL wait by 80%.
GC pauses. Exact duration per generation. We found gen-2 was pausing 1.27 seconds walking 1.5M objects. Fixed with gc.freeze(), brought it down to 88ms.
Off-CPU analysis. Shows why your thread is sleeping with kernel + userspace + Python stacks combined in one event. Found a Kafka push blocking for 130ms that was invisible in OpenTelemetry.
Gunicorn handoff. How long requests sit in the queue before a worker picks them up.
Network. TCP handshake latency, retransmits, resets, host network health. Found a stale nginx upstream IP causing random 504s that no APM ever showed.
Uses eBPF uprobes on CPython's take_gil/drop_gil and gc_collect_main. Walks Python frame chains directly from kernel space. No code changes, no agents, no restarts.
Real production impact: GIL wait dropped 80%, GC pauses from 1.27s to 88ms.
CPython 3.11 only for now. Open source under Apache 2.0.
GitHub: https://github.com/deepanshu406/python-ebpf-profiling