Sample the engine's memory where the engine is - #120
Merged
Merged
Conversation
A served engine reported its driver's memory and called that the engine. getrusage has no field for a server this process never forked, so the resource table's memory rows described the Bolt driver for neo4j and memgraph, which is the one part of that run nobody wants sized. Memory is now read once a second where the engine actually is: out of the container's own cgroup for a served engine, off the process tree for an embedded or subprocess one. The sampler keeps the largest reading and the last, because an engine that reaches a gigabyte to answer one query and an engine that holds a gigabyte all day are a different problem with the same peak. Off Linux the local probe answers -1 rather than forking ps once a second: every fork lands in RUSAGE_CHILDREN, which is where a subprocess engine's own cost is read from, so a sampler built that way would pay for itself out of the figures it sits beside. The peak rss rows still answer there.
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #56, the memory half of the resource measurement section.
A served engine reported its driver's memory and called that the engine. getrusage has no field for a server this process never forked, so the memory rows of the resource table described the Bolt driver for neo4j and memgraph, which is the one part of that run nobody wants sized. That is what the issue means by RUSAGE_SELF reading about zero for bolt engines.
Memory is now read once a second where the engine actually is:
The sampler keeps the largest reading and the last one. An engine that reaches a gigabyte to answer one query and an engine that holds a gigabyte all day are a different problem with the same peak, and a table that carries only one of the two numbers cannot tell them apart. Two rows are added, memory peak (sampled) and memory steady (sampled), and a row that is unknown everywhere is dropped as before.
Sampling starts before the engine is up, so the peak covers the load as well as the measured run. The load is often where an engine reaches highest.
Off Linux the local probe answers -1 rather than forking ps once a second. Every fork lands in RUSAGE_CHILDREN, which is the accounting a subprocess engine's own cost is read out of, so a sampler built that way would pay for itself out of the figures it sits beside. There is a clean reading on darwin through proc_pidinfo, but only by linking libproc through cgo, and the default build here is cgo-free. The peak rss rows still answer there, from getrusage; what is missing off Linux is the steady state, which no rusage field holds.
A document written before this carries no sampled fields, and a missing number decodes as zero, which in this table would read as an engine that used no memory. Read normalizes those to unknown, told apart by the sample count.
Verified: the sampler and the /proc probe pass in a Linux container (the measure tests cross compiled and run under alpine), and cgroup memory.current answers through docker exec on this box. go test ./... green on darwin, GOOS=linux go build green.