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:

  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"?

  • 1
    What version of Solaris? The ::memstat operation requires a large number of TLB shootdowns that require full inter-CPU synchronization. (See here for an explanation of why and what you can do about it.) Apr 26, 2012 at 13:26
  • Both run SunOS 5.10 (I updated the question with uname details)
    – exhuma
    Apr 26, 2012 at 13:29
  • ... and thanks for the article... (reading it right now)...
    – exhuma
    Apr 26, 2012 at 13:30
  • 1
    "[These optimizations] will also be in Solaris 10 Update 8, which is patch 141444-08 for SPARC and 141445-08 for x86." (It has since released.) Apr 26, 2012 at 13:31
  • 1
    Hmmm... cat /etc/release gives me Solaris 10 8/07 on the slow machines, and Oracle Solaris 10 8/11 on the faster machines. So it seems that this is the problem. Could you post an answer with something like "older versions of mdb is inherently slow for ::memstat! Upgrade!" so I can accept your answer? Credit where credit is due ;)
    – exhuma
    Apr 26, 2012 at 13:53

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .