Bug 1488895

Summary: RFE: Provide memory statistics over domainListGetStats
Product: [Community] Virtualization Tools Reporter: Marko Myllynen <myllynen>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED NOTABUG QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: libvirt-maint, mprivozn, myllynen, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-08 14:14:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marko Myllynen 2017-09-06 12:26:37 UTC
Description of problem:
From https://www.redhat.com/archives/libvir-list/2017-September/msg00107.html:

Would it be possible to allow querying memory statistics over domainListGetStats as well in one operation? Currently <nr-of-domains> calls from Python are needed to fetch memory statistics for all guests which may be a bit costly in larger environments.

All other statistics are already available over domainListGetStats.

Comment 1 Michal Privoznik 2017-09-06 12:31:06 UTC
Since we need support for this in libvirt firstly I'm switching component. Libvirt-python will pick this up then too.

Comment 2 Michal Privoznik 2017-09-07 09:06:22 UTC
Marko, I've just noticed that we have balloon stats that cover the memory stats too:

virsh # domstats --balloon fedora
Domain: 'fedora'
  balloon.current=4194304
  balloon.maximum=4194304
  balloon.swap_in=0
  balloon.swap_out=0
  balloon.major_fault=245
  balloon.minor_fault=75455
  balloon.unused=3845540
  balloon.available=4018564
  balloon.usable=3759644
  balloon.last-update=1504774536
  balloon.rss=123164

Which produces the same result as dommemstat:

virsh # dommemstat fedora
actual 4194304
swap_in 0
swap_out 0
major_fault 245
minor_fault 75455
unused 3845540
available 4018564
usable 3759644
last_update 1504774536
rss 123164

Do you think that is enough for you? Sorry for not spotting this earlier.

Comment 3 Marko Myllynen 2017-09-07 11:19:44 UTC
(In reply to Michal Privoznik from comment #2)
> Marko, I've just noticed that we have balloon stats that cover the memory
> stats too:
> 
> virsh # domstats --balloon fedora
> Domain: 'fedora'
>   balloon.rss=123164
> 
> Which produces the same result as dommemstat:
> 
> virsh # dommemstat fedora
> rss 123164

Right, and this is also implemented in PCP already:

# pmrep -p -s 3 libvirt.domstats.mem.rss,memory libvirt.domstats.balloon.rss,balloon
          memory  balloon
          a6e32e  a6e32ea
           Kbyte    Kbyte
14:16:21  459840   459840
14:16:22  482276   482540
14:16:23  596060   596060

> Do you think that is enough for you? Sorry for not spotting this earlier.

For all practical purposes, probably yes. Is the plan to make everything available over balloon stats that will be available over memory stats?

The only case I can think of in favor of implementing this is that people e.g. with PCP merely request all "libvirt" metrics rather than spelling out subsections so then inadvertently hitting the slow code path. But that's probably more a documentation issue. IOW, ideally all stats would be available using the more efficient domainListGetStats but I won't protest if that is deemed unnecessary for these kind of duplicated stats and this RFE is closed.

Thanks.

Comment 4 Michal Privoznik 2017-09-08 14:14:02 UTC
(In reply to Marko Myllynen from comment #3)
> (In reply to Michal Privoznik from comment #2)
> > Marko, I've just noticed that we have balloon stats that cover the memory
> > stats too:
> > 
> > virsh # domstats --balloon fedora
> > Domain: 'fedora'
> >   balloon.rss=123164
> > 
> > Which produces the same result as dommemstat:
> > 
> > virsh # dommemstat fedora
> > rss 123164
> 
> Right, and this is also implemented in PCP already:
> 
> # pmrep -p -s 3 libvirt.domstats.mem.rss,memory
> libvirt.domstats.balloon.rss,balloon
>           memory  balloon
>           a6e32e  a6e32ea
>            Kbyte    Kbyte
> 14:16:21  459840   459840
> 14:16:22  482276   482540
> 14:16:23  596060   596060
> 
> > Do you think that is enough for you? Sorry for not spotting this earlier.
> 
> For all practical purposes, probably yes. Is the plan to make everything
> available over balloon stats that will be available over memory stats?
> 
> The only case I can think of in favor of implementing this is that people
> e.g. with PCP merely request all "libvirt" metrics rather than spelling out
> subsections so then inadvertently hitting the slow code path. But that's
> probably more a documentation issue. IOW, ideally all stats would be
> available using the more efficient domainListGetStats but I won't protest if
> that is deemed unnecessary for these kind of duplicated stats and this RFE
> is closed.

Yes, we realize the importance of the domainListGetStats API therefore all the stats should be available there. If not, we can certainly fix that. Thanks.