Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
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.) –  David Schwartz Apr 26 '12 at 13:26
    
Both run SunOS 5.10 (I updated the question with uname details) –  exhuma Apr 26 '12 at 13:29
    
... and thanks for the article... (reading it right now)... –  exhuma Apr 26 '12 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.) –  David Schwartz Apr 26 '12 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 '12 at 13:53

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.