As stated in the title, when I run echo ::memstat | mdb -k
on certain machines, it is very slow. My munin graphs show a vastly increased CPU load when I run this regularly. I intend to use ::memstat
as input for munin graphs, so it needs to be run frequently.
While the process is running, I see this in the prstat
output:
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
6865 root 14M 12M cpu2 0 0 0:00:26 23% mdb/1
6868 root 14M 12M cpu1 0 0 0:00:26 23% mdb/1
As you can see, it has already been running for 26 seconds. Monitoring prstat
shows an ever increasing CPU usage during the processes run-time. It needs around 30 seconds to finish.
On another machine (granted, in terms of hardware it's beefier), it runs much faster. The point is, that it runs much faster as I would expect from comparing the hardware specs (8GB vs 12GB memory, 8 Cores vs 4 Cores, SunOS 5.10 Generic_147441-01 i86pc i386 i86pc
vs SunOS 5.10 Generic_127128-11 i86pc i386 i86pc
). But that's not the real point. My primary problem is that echo ::memstat | mdb -k
takes 30 seconds to complete.
Can somebody please explain what's going on here? What could explain the "slowness"?
Older versions of Solaris have a much slower
::memstat
operation, due mostly to a large number of TLB shootdowns required. (And the fact that nobody had yet bothered to profile and optimize it.) Newer versions (Solaris 10 Update 8) have an optimized version. See the comments.