common: MemoryModel: performance improvements and API changes#58115
common: MemoryModel: performance improvements and API changes#58115
Conversation
Signed-off-by: Samuel Just <sjust@redhat.com> (cherry picked from commit 720ce78)
as 'snap' as a struct name does not follow the naming convention, and 'snap' is way overloaded in the codebase. Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
Allowing clients to hold on to the MemoryModel object for multiple "snapshots", saving (per measurements) ~40% of the sampling run time. Also: separating the parsing of /proc/maps (which consumes most of the remaining execution time) into a separate function. This will allow us to create a "no need for precise heap" fast mode (in a future commit). Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
We're going to add this functionality to other components, simplify this one first to match. Signed-off-by: Samuel Just <sjust@redhat.com> Signed-off-by: Shreekara <sshreeka@redhat.com> (cherry picked from commit f337bda)
Also - stopping the parsing of /proc/status once all the needed fields have been found, The resulting code is measurably faster than the previous version. Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
leave error reporting to the caller. This change achieves two targets: - no need for a context when creating the MemoryModel object; and - (more importantly) the error messages are now reported in the context of the caller, and can be made to appear only once in the logs. The existing client of the MemoryModel is modified to reflect the changes to its API. Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
Main points: - using charconv as a faster alternative to strtoll functions; - only parsing the addresses for relevant lines; - lines ending with '[heap]' are OK Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
in the object itself Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
922c353 to
d699e23
Compare
|
jenkins test make check |
|
@vshankar - can you review? thanks |
Ofcourse 👍 (I will plan to have a look in the next few days) |
mchangir
left a comment
There was a problem hiding this comment.
just a small query towards improving performance
| if (cmp_against(ln, "VmSize:", s.size) || | ||
| cmp_against(ln, "VmRSS:", s.rss) || cmp_against(ln, "VmHWM:", s.hwm) || | ||
| cmp_against(ln, "VmLib:", s.lib) || | ||
| cmp_against(ln, "VmPeak:", s.peak) || | ||
| cmp_against(ln, "VmData:", s.data)) { |
There was a problem hiding this comment.
Would it be too much to push all required items in a hash table and test for the presence of the prefix of the current line in the hash table instead ?
There was a problem hiding this comment.
Would it be too much to push all required items in a hash table and test for the presence of the prefix of the current line in the hash table instead ?
I do not see a way to do have better performance this way (I had originally measured multiple ideas I could think of). For example - note that we have sub-strings of at least two lengths here.
vshankar
left a comment
There was a problem hiding this comment.
MDCache change look fine.
|
This PR is under test in https://tracker.ceph.com/issues/67020. |
Performance: per my off-line (code snippets) benchmarks
(see benchtest):
The API changes:
The PR includes work by @athanatos & @shreekarSS,
picked from #54698