Monitoring Paging and Swapping


 
Thread Tools Search this Thread
Operating Systems Solaris Monitoring Paging and Swapping
# 15  
Old 12-13-2018
Quote:
Originally Posted by jlliagre
Both the linked thread and MOS Document are correct.

vmstat is reporting that there is unused RAM and it is true. There is no data stored on that RAM.

malloc fails because there is no more swap or RAM available. All of it is either used or unused but reserved.

Let me try a metaphor: if you enter a restaurant and see many empty tables, that doesn't mean you can sit on any of them. They might all be reserved by customers that aren't there yet (and maybe some will never show up).
Hi Jilliagre,

Thanks for your reply and appreciate the suiting metaphor used.

I think the point I am trying to confirm is

a) when doing memory reservation on virtual swap, the "physical space" that is reserved on the ram/swap device is not physically allocated right ? (still show as free in vmstat and swap -l)

b) can reserved but unused memory/swap (aka virtual swap) still be use for actual physical swapping ? (or it is reserved and no longer available for other usage)

c) if reserved swap isn't reflected as used space in swap -l, does this means i am really having actual swapping if i am seeing 2GB of physical swap space being used in swap -l ?
But again, I still has free memory - when doing echo ::memstat | mdb -k, will "reserved" but unused ram, shows up in "Free" ?


Regards,
Noob
# 16  
Old 12-13-2018
a) yes, reserved is only reserved. A reservation only has an impact on further reservations. The OS can overcommit reservations, i.e. allow more than it could ever use.
b) the actual usage of swap is not limited by reservations.
c) yes, if "swap -l" reports 2GB swap then 2GB of data was moved from RAM to disk. Using that again would require a copy to RAM first. The OS uses a LRU scheme i.e. picks the Least Recently Used RAM for "archiving" in swap (on disk).
This User Gave Thanks to MadeInGermany For This Post:
# 17  
Old 12-13-2018
Quote:
Originally Posted by javanoob
a) when doing memory reservation on virtual swap, the "physical space" that is reserved on the ram/swap device is not physically allocated right ? (still show as free in vmstat and swap -l)
Reservation is a "logical" operation, there is no such thing as a "physical allocation". The only physical operations with memory are read and write.

The physical space that is reserved (thus unused) on RAM or swap area shows as free RAM and free swap.

Quote:
b) can reserved but unused memory/swap (aka virtual swap) still be use for actual physical swapping ? (or it is reserved and no longer available for other usage)
Hmm, yes. Unused memory can be used (hopefully), but then, it is no more reported as reserved but as used. (That sounds logical, doesn't it?)

Quote:
c) if reserved swap isn't reflected as used space in swap -l, does this means i am really having actual swapping if i am seeing 2GB of physical swap space being used in swap -l ?
If you see 2GB used, that means there are 2GB of data stored there. There has been some swapping (actually pagination) for these 2G to be written.

Quote:
But again, I still has free memory - when doing echo ::memstat | mdb -k, will "reserved" but unused ram, shows up in "Free" ?
It might indeed. memstat is showing physical memory usage, it has no idea about logical, virtual one.

--- Post updated at 22:54 ---

Quote:
Originally Posted by MadeInGermany
The OS can overcommit reservations, i.e. allow more than it could ever use.
That's not the case with Solaris with which malloc (or similar) will fail if no swap or RAM is available to back it.
Unlike with Linux, memory overcommiting can only happen on Solaris when explicitely requested by the (rare) applications using MAP_NORESERVE mmap.
This User Gave Thanks to jlliagre For This Post:
# 18  
Old 12-14-2018
Hi Jlliagre , MadeInGermany,

Thank you both for your reply and insight.

Quote:
b) the actual usage of swap is not limited by reservations.
Hmm, yes. Unused memory can be used (hopefully), but then, it is no more reported as reserved but as used. (That sounds logical, doesn't it?)
q1) Do you mean if ProcessA has made reservation on the virtual swap (ram & disk), another Process B can actually use this reserved space for actual physical paging into RAM and out to swap/disk ?

q2) If i still have free memory (ard 10G reported in memstat's free) but have physical swap being used (ard 3G in swap -l), what does this means then ?
Since reserved but free memory can be use by all, why is physical swap still being use ?

Doing vmstat for 30 minutes, did not see any counters jump for si/so, pi/po, and SR (all 0s) ?
Could i have some kind of spike @ certain timing (using up all the free ram), and cause the physical swap to be use ? < could this be 1 possiblity ?

Regards,
Noob

Last edited by javanoob; 12-14-2018 at 01:38 PM..
# 19  
Old 12-14-2018
Quote:
Originally Posted by javanoob
Hi Jilliagre
There's an extra "i", my pseudo is jlliagre, not jilliagre...
Quote:
q1) Do you mean if ProcessA has made reservation on the virtual swap (ram & disk), another Process B can actually use this reserved space for actual physical paging into RAM and out to swap/disk ?
Unless shared memory enter in the game, no it can't.
Virtual space allocated by a process is for its exclusive use. Note again that virtual memory is not the same as physical memory. No particular space is reserved, that's just an amount of space. The OS is free to map this virtual space to whatever physical backend it likes.
Quote:
q2) If i still have free memory (ard 10G reported in memstat's free) but have physical swap being used (ard 3G in swap -l), what does this means then ?
That means the OS stored 3G of seldom used virtual memory to disk, improving overall performance.
Quote:
Doing vmstat for 30 minutes, did not see any counters jump for si/so, pi/po, and SR (all 0s) ?
Could i have some kind of spike @ certain timing (using up all the free ram), and cause the physical swap to be use ? < could this be 1 possiblity ?
The si/so counters are unlikely to move under normal circumstances but only during severe RAM shortage.
The pi/po counters move when there pagination occur. Most of that pagination might be unrelated to VM shortage, that might simply be a file being read by some process.
Th sr only move if there is RAM shortage.

A static 3G doesn't cause any activity by itself.

The most important counter to monitor is "sr". As long as it stays equal to 0, there is no RAM shortage.
You might have VM shortage though, and the vmstat column to monitor is then "swap" (available swap space).

Note also that your system might use zones configured with virtual memory capping. In such case you might have swap usage without (global) vm shortage.
This User Gave Thanks to jlliagre For This Post:
# 20  
Old 12-14-2018
Hi Jlliagre,

I am so sorry for that extra "i". Eyes playing tricks on me..and thank you for your reply.

Quote:
Originally Posted by jlliagre
Unless shared memory enter in the game, no it can't.

Virtual space allocated by a process is for its exclusive use. Note again that virtual memory is not the same as physical memory. No particular space is reserved, that's just an amount of space. The OS is free to map this virtual space to whatever physical backend it likes.
Sorry if i am getting confused again..

Virtual swap = ram + disk. (shown in swap -s)
- I understand that memory reservation on virtual swap does not actually consume physical space
- From the previous thread, i understood that reserved virtual swap can be use for actual swapping/paging

But you mentioned that virtual space allocated by a process is for its exclusive use.. --> is reserved = allocated ?
I am actually referring to if virtual swap being reserved by a processA can still has the underlying unused physical ram/disk swap used by another ProcessB right ?

E.g.

T1) Process A reserved 5G of virtual swap using malloc ( (i) 3G from swap disk and (ii) 2G from ram ) -> again at this point, nothing is being physically allocated or used (ram and swap still shown as free in vmstat and swap -l)
T2) Existing Process B needs to read data into the physical RAM (page fault) -> it is actually able to put this piece of data into the (ii) 2G physical ram reserved by Process A - since the reservation is just done virtual swap
T3) OS also see the needs to page some data out of the physical ram -> it is also able to page out this data in ram out onto the (i)3G disk swapright ?
However, if a physical ram is already used/allocated to processA, no other process can use it.

Is my understanding correct ?

Regards,
Noob
# 21  
Old 12-14-2018
Quote:
Virtual swap = ram + disk. (shown in swap -s)
- I understand that memory reservation on virtual swap does not actually consume physical space
- From the previous thread, i understood that reserved virtual swap can be use for actual swapping/paging
The reservation is just an amount of virtual memory. Not located in a certain area (unless there would be a flag "contiguous" memory, don't know if Solaris has this).
If there is no overcommit (Solaris) then this reservation is never sacrificed by another process.

Last edited by MadeInGermany; 12-14-2018 at 04:34 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Swapping lines

Hi there, I have a text that I'm trying to format into something more readable. However, I'm stuck in the last step. I've searched and tried things over the internet with no avail. OS: Mac After parsing the original text that I won't put here, I managed to get something like this, but this... (8 Replies)
Discussion started by: Kibou
8 Replies

2. Solaris

Swapping

Hi Guys I am using SPARC-T4 (chipid 0, clock 2998 MHz), SunOS 5.10 Generic_150400-38 sun4v. How do I see if the server was doing some swapping like yesterday? I had a java application error with java.lang.OutOfMemoryError, now I want to check if the server was not doing some swapping at... (4 Replies)
Discussion started by: Phuti
4 Replies

3. Shell Programming and Scripting

Swapping fields

Hallo Team, This is the command that i am running : grep ",Call Forward Not Reachable" *2013* this is the output that i am getting (i did a head -10 but the files can be more than 1000) ... (8 Replies)
Discussion started by: kekanap
8 Replies

4. Shell Programming and Scripting

Swapping three lines

I have some text: <date>some_date</date> <text>some_text</text> <name>some_name<name> and I want to transform it to smthng like that: some_name on some_date: some_text I've tried sed: sed 's/<text>\(.*\)<\/text> <name>\(.*\)<\/name>/\2 - \1/' but it says unterminated... (13 Replies)
Discussion started by: dsjkvf
13 Replies

5. UNIX for Dummies Questions & Answers

Swapping in VI editor

Hi, I am attempting to replace several similar words with another word in vi. Here is what I have written for the script: 3dTcat -prefix SuperBrik_4WAY_HRF ../JULY10_2007A/results2TENT/stats.JULY10_2007A+tlrc ../JULY10_2007G/results2TENT/stats.JULY10_2007G+tlrc... (1 Reply)
Discussion started by: Jahn
1 Replies

6. UNIX for Advanced & Expert Users

virtual memory management, swapping paging

can anybody explain me the concepts virtual memory mangement, swapping and paging? although i roughly know what they are , i need more solid distinction between them, and also i want to figure out the relations between them? do you have any well-defined definitons for this concepts? (2 Replies)
Discussion started by: gfhgfnhhn
2 Replies

7. SuSE

Swapping

Hello! Why does my SuSE GNU/Linux machine swap? I have a Gig of ram, currently 14MBs of free RAM, 724MB - buffers and caches... That is 685MB of cached RAM, then kernel really should'nt have to swap, It should release cached memory in my thinkin... It has only swaped 3MB's but still,... (3 Replies)
Discussion started by: Esaia
3 Replies

8. UNIX for Dummies Questions & Answers

how to get swapping info

Hi How can I determine if swapping is occuring on a server. Thanks, Leo (2 Replies)
Discussion started by: leo
2 Replies

9. Filesystems, Disks and Memory

Paging and Swapping

Hi Guys: Would like to know how to check system swapping and paging and some theory on how they function. I am an oracle dba and my environment is 8171 on AIX 433. We have a 1GB of RAM on the box and I am educating myself to see how much more SGA can be accommodated on the box and what are the... (2 Replies)
Discussion started by: ST2000
2 Replies

10. UNIX for Advanced & Expert Users

Excessive Paging&Swapping!

Hi all! Working on Oracle v8i/9i on Unix Sun Solaris v8.0. I am experiencing excessive paging & Swapping.Would like to know the cause. I guess:could be due to inappropriate setting of Unix Kernel Parameters... Please correct me if I am wrong! Thanks&Regards, Amit. (5 Replies)
Discussion started by: Amitstora
5 Replies
Login or Register to Ask a Question