text
stringlengths
0
1.8k
[2212.94 --> 2213.82] Database, Postgres.
[2213.96 --> 2215.98] Let's see, what do we get from Postgres?
[2216.38 --> 2216.62] Okay.
[2217.40 --> 2219.38] So this is slightly a different view.
[2219.68 --> 2223.40] This is a machine compiled binary, right?
[2223.70 --> 2223.92] Right.
[2223.92 --> 2226.70] So why do we see only these numbers?
[2226.84 --> 2228.28] What are those numbers, first of all?
[2228.82 --> 2229.92] Yeah, that's a really good question.
[2230.12 --> 2235.56] So these are the raw memory addresses that we obtained from the agent.
[2236.22 --> 2248.36] And the reason why we're only seeing memory addresses is because most of the time when you, you know, install a package from, let's say, a Debian package or something like that.
[2248.36 --> 2253.56] By default, these packages are distributed without debug information.
[2254.50 --> 2260.48] And so they were intentionally removed from those binaries to reduce the size of the binary.
[2261.74 --> 2267.90] And sometimes it can also have a performance impact, but usually it's just for size optimization.
[2267.90 --> 2279.04] And in the case of Debian, for example, if you still want those debug symbols, the convention is that you, you know, let's say app get Postgres, right?
[2279.10 --> 2286.38] The convention then is the package name is dash dbgsym, debug symbols.
[2287.18 --> 2296.16] And that downloads the debug symbols as a separate package, which can then again be picked up by the Parker agent as well.
[2296.16 --> 2300.94] But in this case, we didn't have any debug information available.
[2301.52 --> 2304.92] And so, yeah, this particular Postgres binary is stripped.
[2305.38 --> 2307.54] And so it does not have this debug information.
[2307.80 --> 2317.44] That said, there is a really cool project called Debug Info D, where the kind of distributions have come together and they're hosting these servers.
[2317.60 --> 2319.26] We're using this build ID.
[2319.94 --> 2323.24] You can request the debug symbols on demand.
[2324.04 --> 2326.14] So this is great news, right?
[2326.16 --> 2331.72] Because it means that you don't have to install these debug packages manually anymore.
[2331.98 --> 2336.52] Parker can just go to this debug Info D server and retrieve it itself.
[2336.88 --> 2337.72] That's the good news.
[2337.92 --> 2341.02] The bad news is Parker doesn't have support for this just yet.
[2341.22 --> 2343.72] We already have support for this plan.
[2343.86 --> 2345.22] It's just haven't gotten to it yet.
[2345.22 --> 2350.48] So there's a good news and that bad news and that yet is the good news and that bad news.
[2350.56 --> 2352.52] It's coming, but it's not there yet.
[2353.00 --> 2354.26] So that's really cool.
[2354.78 --> 2355.70] Yeah, I didn't know this.
[2355.78 --> 2364.32] I knew about stripped binaries, but I didn't know about those build IDs and being able to use those build IDs to get the debug symbol for this particular binary from the server.
[2364.32 --> 2365.06] That's really cool.
[2365.66 --> 2367.02] Okay, so we've seen Postgres.
[2367.42 --> 2368.98] What about Erlang VM?
[2369.24 --> 2377.48] So this is our app and we can see that we have Beam SMP all over the place, which is the name of the binary for the Beam Erlang VM.
[2377.48 --> 2379.20] So we see the same thing here.
[2379.86 --> 2394.38] Yeah, so this is kind of another variation of this, but the first kind of difference is this is not a binary that was compiled to machine readable code, right?
[2394.78 --> 2398.58] This is in the broadest possible sense interpreted code.
[2398.96 --> 2405.12] The good news about Erlang is it actually has a just-in-time compiler.
[2405.12 --> 2417.50] So what that means is even though it is technically an interpreted or a virtual machine, on the fly compiles parts of your code to actually machine executable code.
[2417.84 --> 2423.18] So this is kind of good news again, because at least in theory, the same strategy can be applied.
[2423.48 --> 2431.82] It just turns out that a lot of the strategies that these like dynamic languages or virtual machines tend to very subtly differ.
[2431.82 --> 2439.72] And so we do have to essentially implement, you know, small pieces of runtime specific things.
[2439.90 --> 2451.22] One thing that's actually really cool that I think Erlang does implement and, you know, like the Node.js runtime implements as well is something called perf maps.
[2451.22 --> 2472.98] And this is something that many just-in-time compilers implement, where essentially the just-in-time compiler, because it generates or compiles this code on the fly, it can also write out this mapping from the memory address to the human readable symbol.
[2473.64 --> 2478.12] And that Parker agent can again pick up and symbolize on the fly.
[2478.12 --> 2481.72] Okay. Now, I have tried this with Node.js.
[2482.04 --> 2484.96] Unfortunately, we haven't gotten it to work with Erlang just yet.
[2486.64 --> 2494.44] So there seems to be something specific that the Erlang VM does that we don't fully understand yet.
[2495.14 --> 2502.24] But, you know, it's one of those things where language support is something that's always in progress.
[2502.24 --> 2506.42] And hopefully we'll soon have like full support for the Erlang VM as well.
[2506.42 --> 2509.52] Nice. So we can't really see that.
[2509.58 --> 2512.70] But there's another thing which I haven't shown, the compare one, the compare view.
[2513.42 --> 2515.48] So we can compare two profiles side by side.
[2515.66 --> 2517.98] So we take a low one. I think that's how you like to start.
[2518.10 --> 2523.44] You take a low profile on the left and you take a high on the right and it will compare them side by side.
[2524.14 --> 2526.72] So how do we interpret when this loads?
[2526.78 --> 2528.02] How do we interpret this result?
[2528.02 --> 2531.64] Yeah. So this is going to be hard when we just see memory addresses.
[2532.40 --> 2538.96] But essentially, anything that is blue has stayed exactly the same.
[2539.08 --> 2545.04] It used exactly the same amount of CPU in the one observation as it did in the compared one.
[2545.74 --> 2550.06] Anything that's green, the CPU cycles got less.
[2550.06 --> 2555.16] I can actually see one very tiny one on the left somewhere in there.
[2555.38 --> 2559.82] There's one that got very slightly better, 50%.
[2559.82 --> 2565.90] It seems like it was two CPU samples before and now it was only one.
[2566.64 --> 2568.62] How do you know it was two CPU samples?
[2568.62 --> 2574.76] So we see that the diff is minus one.
[2574.94 --> 2575.32] Right.
[2575.92 --> 2579.52] And the current sample is one.
[2579.92 --> 2581.40] So that must have been two before.
[2581.62 --> 2583.04] So that's CPU cycles.
[2583.62 --> 2586.72] It's observations of stack traces.
[2586.96 --> 2590.64] So we at most look at the process 100 times per second.
[2590.64 --> 2598.12] And so that means 100 means one CPU core being used.
[2598.32 --> 2602.44] So in this case, this is like 1%, like one millicore.
[2602.60 --> 2603.24] Right. Okay.
[2603.66 --> 2606.56] That was being used within those 10 seconds.
[2606.72 --> 2606.96] Okay.
[2607.50 --> 2610.48] So this one is slightly better.
[2611.08 --> 2615.14] But this one, the Beam SMP, and I wish we knew what this was,
[2615.64 --> 2618.68] or maybe this one, which is like just a memory address.
[2618.68 --> 2622.90] This is 350% worse.
[2623.64 --> 2626.74] So I can see, or I can think, I mean, even though this is very Christmassy
[2626.74 --> 2629.80] and I like it, like red and green and, you know, it's very nice.
[2630.18 --> 2633.36] It would be easier, like if we had used a different color
[2633.36 --> 2635.38] for the ones which have an infinity,
[2635.66 --> 2637.40] I know maybe black or something like that,
[2637.46 --> 2638.84] which they're like completely new.
[2638.92 --> 2642.86] I like the diff idea, but a different number,
[2643.26 --> 2645.16] sorry, different color from the ones that are like,
[2645.20 --> 2646.60] for example, this one plus 700.
[2646.60 --> 2650.62] So this is just worse, but this is like brand new.
[2650.74 --> 2653.74] This wasn't even like, didn't even happen in the previous sample.
[2653.88 --> 2653.98] Yeah.
[2654.94 --> 2655.26] Okay.
[2656.70 --> 2658.44] I'm writing this down.