LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 10-24-2008, 03:07 PM   #1
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
vmstat and sar -r free memory discrepancy


Code:
alucard@v1:~$ vmstat -S 1
 kthr      memory            page            disk          faults      cpu
 r b w   swap  free  si  so pi po fr de sr m0 m1 m2 s0   in   sy   cs us sy id
 0 0 0 19678728 4057304 0 0 770 14 13 0  0 208 127 120 2 921 9433 1623 2  3 95
 0 0 0 17986376 2263368 0 0 333 8  8  0  0 30 17 16  0  666 5464  483  0  1 99

alucard@v1:~$ sar -r 
00:00:00 freemem freeswap
[...]
16:00:00   71281  8993164

Average    75745  8996994
alucard@v1:~$ pagesize
8192
alucard@v1:~$ uname -a
SunOS v1 5.10 Generic_127127-11 sun4u sparc SUNW,Sun-Fire-V445
top reports:
Code:
Memory: 8192M phys mem, 2243M free mem, 16G swap, 16G free swap
vmstat reports in KB, and as you can see 2263368KB agrees with top's 2243MB.

sar -r reports in pages. Ok, 71281 * 8 = 570248 KB?? vmstat's report is nearly 4 times as much.

What piece am I missing, why do these not agree?

Last edited by AlucardZero; 10-24-2008 at 03:20 PM.
 
Old 10-25-2008, 07:33 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint, Tribblix
Posts: 9,746

Rep: Reputation: 456Reputation: 456Reputation: 456Reputation: 456Reputation: 456
I don't know why you observe this discrepancy on your system as both commands pick their source data from the same kernel statistics. Just make sure all relevant patches are applied.

Run sar in real time too:
Code:
sar -r 2 4
In any case, I would trust vmstat output.

Last edited by jlliagre; 10-25-2008 at 07:35 AM.
 
Old 10-27-2008, 10:31 AM   #3
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Original Poster
Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
Another question, is Solaris 10 like Linux in that I should only worry about memory usage if I am actively swapping to disk? Does it use all available memory for buffers and cache like Linux?
 
Old 10-27-2008, 01:12 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint, Tribblix
Posts: 9,746

Rep: Reputation: 456Reputation: 456Reputation: 456Reputation: 456Reputation: 456
Solaris uses available memory before starting to paginate. Linux, as a Unix like OS, implemented the same optimization.

One difference is Solaris doesn't allows over-commiting memory while Linux does.
 
Old 10-28-2008, 08:55 AM   #5
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Original Poster
Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
Thanks, and one more thing. Is there a port of the Linux tool "free" to Solaris? Searching Google for it obviously sucks.
 
Old 10-28-2008, 05:41 PM   #6
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint, Tribblix
Posts: 9,746

Rep: Reputation: 456Reputation: 456Reputation: 456Reputation: 456Reputation: 456
I have no Linux machine available at the moment. What is "free" output you would like under Solaris ?
 
Old 10-28-2008, 05:54 PM   #7
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Original Poster
Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
Code:
alucard@karrde:~$ free
             total       used       free     shared    buffers     cached
Mem:        553164     539300      13864          0      14740     111656
-/+ buffers/cache:     412904     140260
Swap:       131064      23576     107488
Showing 413MB for program RAM usage and the rest for buffers, cache, and actually free.

I don't have my Solaris machines on me, but I did find something named (iirc) mdb and ::memstat. Is that the closest I'll get? It's pretty slow.
 
Old 10-29-2008, 02:39 AM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint, Tribblix
Posts: 9,746

Rep: Reputation: 456Reputation: 456Reputation: 456Reputation: 456Reputation: 456
Filesystem cache memory is reported as free under Solaris when UFS is used, but as kernel used memory for ZFS cache. If you only use ZFS, you don't need mdb/memstat to get the cache size.
 
Old 01-06-2009, 10:52 AM   #9
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Original Poster
Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
So it was suggested that sar -r reports in 512-blocks instead of 1024. But even that would make sar's result half of vmstat's instead of a quarter. Any other ideas?
 
Old 01-06-2009, 08:51 PM   #10
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Hey There,

Actually, there's a good bit of difference between the two commands and how they display the information - generally, once you've gone through all the steps, you'll find that they equal.

Check out this link. I wrote it, but I didn't want to copy and paste the whole thing in here. It will walk you through getting a true comparison of the values:

http://linuxshellaccount.blogspot.co...d-swap-on.html

Hope that helps you out

Best wishes,

Mike
 
Old 01-07-2009, 06:07 PM   #11
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Original Poster
Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
I have already multiplied by the page size. The numbers do not match.
 
Old 01-07-2009, 06:27 PM   #12
crisostomo_enrico
Member
 
Registered: Dec 2005
Location: Madrid
Distribution: Solaris 10, Solaris Express Community Edition
Posts: 547

Rep: Reputation: 36
As jlliagre said: it's strange they don't match and run sar in real time.

Your sar output is:
Quote:
16:00:00 71281 8993164
I don't know at what time you ran vmstat but I bet it was not 16:00:00... As you'll have noticed, sar data collection by default is scheduled on sys' crontab:
Code:
$ crontab -l sys
0 * * * 0-6 /usr/lib/sa/sa1
20,40 8-17 * * 1-5 /usr/lib/sa/sa1
5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
Why do you expect the output being the same in the case the two commands' output refer to two distinct points in time?

Last edited by crisostomo_enrico; 01-07-2009 at 06:30 PM.
 
Old 01-07-2009, 07:24 PM   #13
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Hey there,

If they are, indeed, not matching and you have any and all patches applied, can you post some dated information?


Quote:
date
vmstat 1 5
date
/usr/lib/sa/sa1
sar -r
date
So that we can reference anything. I missed the part at the top where you already multiplied by pagesize (apologies), but as crisostomo and jlliagre both noted, are we entirely sure that both metrics were collected at the exact same time?


One thing I would also suggest is that you either run top during your entire run of information gathering, or don't run it at all. Generally, when you run top, it will show as one of the most consumptive processes running. Best not to run it at all when comparing sar and vmstat output, as it could cause a spike that would offset meaningful results.

Best wishes,

Mike

Last edited by eggixyz; 01-07-2009 at 07:26 PM.
 
Old 01-07-2009, 07:41 PM   #14
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Forget this post - I can't delete it, but the information I requested has already been provided. The post preceding is still valid

Thanks,

Mike

Last edited by eggixyz; 01-07-2009 at 07:43 PM. Reason: duplicate information
 
Old 01-07-2009, 07:42 PM   #15
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Original Poster
Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
Quote:
Originally Posted by eggixyz View Post
Also, this thought just crossed my mind, so we can be absolutely sure,

Have you checked the output of the command "pagesize"

8096 is the norm, but it's possible that it's set differently.

Just trying to consider all possible reasons for your system's discrepancy in reporting.

Thanks,

Mike
Yes, 8196.

I will get dated stats tomorrow.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sar iostat sadf mpstat ? vmstat ? for Cent OS 4.2 rafiqul Linux - Newbie 6 07-16-2013 02:29 PM
difference between sar and vmstat brettcarr Linux - General 0 11-30-2007 05:41 AM
vmstat vs. sar danieldinu Solaris / OpenSolaris 10 10-27-2006 04:07 PM
Free Memory according to vmstat Camino Linux - Newbie 3 02-27-2006 09:27 AM
Difference between Sar and Vmstat blurblur Linux - Newbie 3 05-03-2005 09:14 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 04:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration