These are chat archives for ManageIQ/manageiq/performance

3rd
Jun 2016
Keenan Brock
@kbrock
Jun 03 2016 14:34
@jrafanie @Fryguy I'm measuring metrics and noticed that ObjectSpace.memsize_of_all is slow (39ms) and creates a bunch of objects. Calling GC.stat is much quicker (0ms) and creates far fewer objects.
The numbers are high enough to add too much noise to my capturing
@Fryguy is "memory used up by this process" that important? can #objects via GC.stat suffice?
Joe Rafaniello
@jrafanie
Jun 03 2016 14:42
@kbrock you can do dirty things like shell out to top to get memory usage
or use MiqProcess or SysProctable
Jason Frey
@Fryguy
Jun 03 2016 14:44
is "memory used up by this process" that important? can #objects via GC.stat suffice?
They are slightly different, so it's nice to have both when measuring
I frequently use MiqProcess.processInfo, which doesn't seem to incur much penalty
Joe Rafaniello
@jrafanie
Jun 03 2016 14:51
@kbrock on linux Sys::ProcTable.ps(pid).smaps.pss might be less, haven't measured
Jason Frey
@Fryguy
Jun 03 2016 14:51
@jrafanie Do we have pss in processInfo? Maybe we should add it
Joe Rafaniello
@jrafanie
Jun 03 2016 14:54
no, I was hoping to remove processInfo stuff and replace with SysProctable at some point
Keenan Brock
@kbrock
Jun 03 2016 14:54
um, shelling out to parse a text file
yea
I'd prefer ObjectSpace
will just remember that the results are skewed by 40ms - just when it is measured hierarchically and in a loop ... throws the numbers off
in one place it was introducing ~200ms
Joe Rafaniello
@jrafanie
Jun 03 2016 14:55
yeah, this silly thing works for quick and dirty stuff (from the lazy load catalogs)
RAILS_ENV=production bin/rails r 'top = `/usr/bin/top -l 1 -pid #{Process.pid} | grep -E "ruby.+M"`; memory = top.split[7].to_i; puts memory'
but mac specific since top's switches are different on linux
Jason Frey
@Fryguy
Jun 03 2016 14:57
[2] pry(main)> Benchmark.realtime {MiqProcess.processInfo}
=> 0.006809740996686742
¯\_(ツ)_/¯
Keenan Brock
@kbrock
Jun 03 2016 14:57
@jrafanie yea, that takes 289ms and 184 objects
@Fryguy wow, processInfo only takes 12ms and 168 objects
Jason Frey
@Fryguy
Jun 03 2016 14:59
yeah
@jrafanie How do I run the sys proctable thing? I can't get it to work
Joe Rafaniello
@jrafanie
Jun 03 2016 14:59
yeah, i don't use it on mac
Jason Frey
@Fryguy
Jun 03 2016 14:59
[7] pry(main)> Sys::ProcTable.ps($$).smaps.pss
NoMethodError: undefined method `smaps' for #<Struct::ProcTableStruct:0x007fdb1e504208>
from (pry):7:in `<main>'
Joe Rafaniello
@jrafanie
Jun 03 2016 14:59
:cry:
smaps is linux only
Jason Frey
@Fryguy
Jun 03 2016 14:59
ohhhh ok
Joe Rafaniello
@jrafanie
Jun 03 2016 14:59
I have no idea where to get that information on mac
Jason Frey
@Fryguy
Jun 03 2016 14:59
how do you get PSS on mac?
:(
Alex Krzos
@akrzos
Jun 03 2016 15:39
@Fryguy Is that db:migrate bug a blocker?
I can try and get that test running today if the patch is easy to apply
Jason Frey
@Fryguy
Jun 03 2016 15:41
It got switched to not be a blocker
Alex Krzos
@akrzos
Jun 03 2016 15:41
rgr that
Jason Frey
@Fryguy
Jun 03 2016 15:45
@jrafanie Here's for you leg :meat_on_bone: http://osxbook.com/book/bonus/ancient/procfs/