text stringlengths 0 1.8k |
|---|
**Frederic Branczyk:** One thing that I think is really important to mention - everything revolves around the pprof standard. This is kind of an industry standard format for profiling data. So everything produces or works with pprof format. So you could send any kind of profile, like memory profiles that have been capt... |
\[32:12\] The agent actually also produces pprof-compatible profiles, and maybe we can have a look at that later. The server ingests those, and then one additional really cool feature, I think, is any query that you do in the Parka frontend, you can download again in pprof format. And if you have any other sort of tool... |
**Gerhard Lazu:** Okay. We are on the server, looking at all the CPU profiles. This is the profile coming from container Parka. How do we read this? There's a CPU sample, we can see the root, that's the root's span... What about all the other spans? What are these? |
**Frederic Branczyk:** This is what's called a Flame Graph, and every span that we're seeing here represents how much this span, as well as all of its children make up in cumulative. That's actually what the frontend also says - the cumulative value. |
**Gerhard Lazu:** Right. |
**Frederic Branczyk:** And essentially, we're saying "Everything from this point onwards and further down, uses up --" In this case you're hovering over one that says 11%. So, for example, we can see here in the middle, runtime.greyObject, for example. If we were able to optimize that greyObject function, for example, ... |
In this case, you actually clicked a particularly interesting sample, because we can see in our metrics above that we have these spikes every now and then, and we can very clearly see what it is that is causing this spike in this profile; we can see that it's garbage collection. A very classic thing, that can use a lot... |
**Gerhard Lazu:** Right. So this is garbage collection that happens in |
**Frederic Branczyk:** Right. |
**Gerhard Lazu:** Okay. So why does this garbage collection happen? |
**Frederic Branczyk:** Because of how Go works, you allocate objects in memory, and when you don't use them anymore, eventually the runtime will come around and see that this piece of memory is not in use anymore, and kind of free that memory to the operating system, so that anybody on the machine can use it. |
And in this case, essentially, what we're seeing because we have such a huge spike, that's telling us Parka is doing a lot of allocations, it's allocating a lot of memory, that then consequently is kind of thrown away and can be garbage-collected. So it seems like there's probably some potential in optimizing allocatio... |
That said, having allocations is not a bad thing, because at the end of the day I can write a program that does absolutely nothing, and does no app allocations, but that's also not useful. Producing a side effect - it's one of those things that as software engineers we try to not produce a side effect; but as it turns ... |
**Gerhard Lazu:** That's when real work happens, right? These spikes are an artifact of real work happening. And if I had to guess, without knowing too much - I mean, what Parka does behind the scenes, but not knowing all the details... I think that this is related to all those profiles being maybe read, being symboliz... |
**Frederic Branczyk:** The two major things are definitely what you already mentioned. Symbolization, because this happens asynchronously, as you have uploaded your profiling data... And then it's actually ingesting and writing that profiling data to its storage. This is something that, because we're doing continuous p... |
\[36:11\] Now, there are a number of optimizations that can be done to reduce this, and you can reuse buffers, and stuff like that... And we'll get to all of that, but it's unlikely that we'll ever get to know. Zero. But there's definitely lots of optimization potential here. |
**Gerhard Lazu:** Okay. I do have to say, looking at this Flame Graph, it's really amazing. If you remember how difficult this used to be in the past, where you had generate a pprof, and then use that pprof, or something similar that can read that profile, to get at this Flame Graph, and then try and slice and dice... ... |
**Frederic Branczyk:** Right. |
**Gerhard Lazu:** So why do we see only these numbers? What are those numbers, first of all? |
**Frederic Branczyk:** Yeah, that's a really good question. So these are the raw memory addresses that we obtained from the agent. And the reason why we're only seeing memory addresses is because most of the time when you install a package from -- let's say a Debian package, or something like that... By default, these ... |
In the case of Debian, for example, if you still want those debug symbols, the convention is that you -- let's say "apt-get postgres", the convention then is the package name is -dbgsym (debug symbols), and that downloads the debug symbols as a separate package, which can then again be picked up by the Parka Agent as w... |
But in this case we didn't have any debug information available, and so - yeah, this particular Postgres binary is stripped, and so it does not have this debug information. That said, there is a really cool project called Debuginfod, where the distributions have come together and they're hosting these servers where usi... |
This is great news, because it means that you don't have to install these debug packages manually anymore. Parka can just go through this Debuginfod server and retrieve it itself. That's the good news. The bad news is Parka doesn't have support for this just yet. We already have support for this plan, I just haven't go... |
**Gerhard Lazu:** So there's a good news and a bad news, and that "yet" is the good news and the bad news. It's coming, but it's not there yet. |
**Frederic Branczyk:** Exactly. |
**Gerhard Lazu:** That's really cool. I didn't know this. I knew about strip boundaries 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 that server? That's really cool. |
Okay, so we've seen Postgres... What about Erlang VM? 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. So we see the same thing here... |
**Frederic Branczyk:** Yeah. So this is kind of another variation of this, but the first difference is this is not a binary that was compiled to machine-readable code, right? This is, in the broadest possible sense, interpreted code. The good news about Erlang is it actually has a just-in-time compiler. So what that me... |
\[40:17\] This is kind of good news again, because at least in theory, the same strategy can be applied. It just turns out that a lot of the strategies that these dynamic languages or virtual machines tend to very subtly differ, and so we do have to essentially implement small pieces of runtime-specific things. |
One thing that's actually really cool, that I think Erlang does implement, and the Node.js runtime implements as well, is something called perf.maps. 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 a... |
**Gerhard Lazu:** Okay. |
**Frederic Branczyk:** There seems to be something specific that the Erlang VM does, that we don't fully understand yet... But it's one of those things where language support is something that's always in progress, and hopefully will soon have full support for the Erlang VM as well. |
**Gerhard Lazu:** Nice. So we can't really see that. But there's another thing which we haven't shown - the compare one; the compare view. So we can compare two profiles side by side... So we take a low one - I think that's how you like to start. You take a low profile on the left, you take a high on the right, and it ... |
**Frederic Branczyk:** Yeah, so this is going to be hard when we just see memory addresses, but essentially, anything that is blue has stayed exactly the same. It used exactly the same amount of CPU in the one observation as it did in the compared one. Anything that's green, the CPU cycles got less. I can actually see ... |
**Gerhard Lazu:** That one. |
**Frederic Branczyk:** ...somewhere in there there's one that got very slightly better. 50%. It seems like it was two CPU samples before, and now it was only one. |
**Gerhard Lazu:** How do you know it was two CPU samples? |
**Frederic Branczyk:** So we see that the dif if -1, right? |
**Gerhard Lazu:** Right... |
**Frederic Branczyk:** And the current sample is 1. So there must have been two before. |
**Gerhard Lazu:** Okay. So that's CPU cycles. |
**Frederic Branczyk:** It's observations of stack traces. So we at most look at a process 100 times per second, and so that means -- 100 means one CPU core being used; in this case, this is 1%, like one millicore... |
**Gerhard Lazu:** Right, okay. |
**Frederic Branczyk:** ...that was being used within those ten seconds. |
**Gerhard Lazu:** Okay. So this one is slightly better... But this one, the beam.smp - and I wish we knew what this was... Or maybe this one, which is just a memory address... This is 350% worse. So I can see, or I can think -- I mean, even though this is very Christmasy, and I like it, like red and green, and it's ver... |
**Frederic Branczyk:** \[44:13\] Yeah. |
**Gerhard Lazu:** Okay. |
**Frederic Branczyk:** I'm writing this down. |
**Gerhard Lazu:** Cool. So this is great, to be able to see the difference... And I'm just wondering, if we were to take this memory address, and you were to look into that file, into that perf.map file, would we be able to figure out what this is? |
**Frederic Branczyk:** It's possible. The problem is, in this case -- so we can look at the process and we can kind of go through the steps of what the Parka Agent would do manually, and then we can try to see if we can figure out why this is not able to symbolize this. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.