Hacker News new | ask | show | jobs
by petethepig 1953 days ago
Hi Maciej,

vmprof is cool! For Python we currently use py-spy. The way it works is it reads certain areas of process's memory to figure out what the current stack is. It's a clever approach that I like because that means you can attach to any process very quickly without installing any additional packages or anything like that. The downside is that from the OS perspective reading another process's memory is often seen as a threat — so on macOS you have to use sudo, and on Linux sometimes you have to take extra steps to allow this kind of cooperation between processes — we already saw people with custom kernels having issues with it.

Going forward we'll definitely experiment with more profilers and over time add support for other ones as well.

I saw you joined our Slack, we'll be happy to chat about profilers at some point :)

1 comments

Note that py-spy seems problematic in containers—it requires ptrace, which means you need a special capability, and that's a security risk so many environments won't even give people the option to enable it.

In addition to vmprof, pyinstrument is another alternative.