From: Aaron Lauterer <a.lauterer@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Stefan Hanreich <s.hanreich@proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-manager] api: ceph: improve reporting of ceph OSD memory usage
Date: Wed, 16 Aug 2023 16:59:04 +0200 [thread overview]
Message-ID: <ad3d7a02-c012-4394-84f4-33c28e008eeb@proxmox.com> (raw)
In-Reply-To: <20230816143454.2225673-1-s.hanreich@proxmox.com>
one small nitL: if the OSD is powered off, we now send null for the meminfo.
Maybe set it explicitly to 0 to not change the behavior?
but overall:
Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>
On 8/16/23 16:34, Stefan Hanreich wrote:
> Currently we are using the MemoryCurrent property of the OSD service
> to determine the used memory of a Ceph OSD. This includes, among other
> things, the memory used by buffers [1]. Since BlueFS uses buffered
> I/O, this can lead to extremely high values shown in the UI.
>
> Instead we are now reading the PSS value from the proc filesystem,
> which should more accurately reflect the amount of memory currently
> used by the Ceph OSD.
>
> We decided on PSS over RSS, since this should give a better idea of
> used memory - particularly when using a large amount of OSDs on one
> host, since the OSDs share some of the pages.
>
> [1] https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt
>
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
> PVE/API2/Ceph/OSD.pm | 19 ++++++++++++++-----
> 1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
> index ded359904..5f7718b0a 100644
> --- a/PVE/API2/Ceph/OSD.pm
> +++ b/PVE/API2/Ceph/OSD.pm
> @@ -687,13 +687,10 @@ __PACKAGE__->register_method ({
>
> my $raw = '';
> my $pid;
> - my $memory;
> my $parser = sub {
> my $line = shift;
> if ($line =~ m/^MainPID=([0-9]*)$/) {
> $pid = $1;
> - } elsif ($line =~ m/^MemoryCurrent=([0-9]*|\[not set\])$/) {
> - $memory = $1 eq "[not set]" ? 0 : $1;
here we lose setting the value explicitly to 0 if not available
> }
> };
>
> @@ -702,12 +699,24 @@ __PACKAGE__->register_method ({
> 'show',
> "ceph-osd\@${osdid}.service",
> '--property',
> - 'MainPID,MemoryCurrent',
> + 'MainPID',
> ];
> run_command($cmd, errmsg => 'fetching OSD PID and memory usage failed', outfunc => $parser);
>
> $pid = defined($pid) ? int($pid) : undef;
> - $memory = defined($memory) ? int($memory) : undef;
> +
> + my $memory;
> + if ($pid && $pid > 0) {
> + open (my $SMAPS, '<', "/proc/$pid/smaps_rollup")
> + or die 'Could not open smaps_rollup for Ceph OSD';
> +
> + while (my $line = <$SMAPS>) {
> + if ($line =~ m/^Pss:\s+([0-9]+) kB$/) {
> + $memory = $1 * 1024;
> + last;
> + }
> + }
> + }
>
> my $data = {
> osd => {
next prev parent reply other threads:[~2023-08-16 14:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-16 14:34 Stefan Hanreich
2023-08-16 14:59 ` Aaron Lauterer [this message]
2023-08-16 15:11 ` Stefan Hanreich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ad3d7a02-c012-4394-84f4-33c28e008eeb@proxmox.com \
--to=a.lauterer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=s.hanreich@proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox