what is Inactive(file) and Active(file) in /proc/meminfo?
Active — The total amount of buffer or page cache memory, in kilobytes, that is in active use. This is memory that has been recently used and is usually not reclaimed for other purposes.
Inactive — The total amount of buffer or page cache memory, in kilobytes, that are free and and available. This is memory that has not been recently used and can be reclaimed for other purposes.
Ref : https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s2-proc-meminfo
Ubuntu doesn't use inactive memory and does swapping. Why?
What's wrong with a little swapout? If the kernel can find really cold pages, why would you want them wasting memory?
There seems to be a lot of superstition about swap - people who religiously believe systems are better without it, etc. The fact is that swap is just optimization of your memory use. Swapout is good for a system, since it makes physical memory available for more important uses. OTOH, if you see nontrivial swapIN, then you might have a problem (but that's not inherent to having swap or in experiencing modest swapout.)
What is the relationship between three metrics of RDS: Free Memory,Active Memory and Freeable Memory?
Let me answer your question in two parts.
- What is difference between Enhanced monitoring and Cloudwatch monitoring?
As per official guide
Amazon RDS Enhanced Monitoring — Look at metrics in real time for the
operating system.Amazon CloudWatch Metrics – Amazon RDS automatically sends metrics to
CloudWatch every minute for each active database. You are not charged
additionally for Amazon RDS metrics in CloudWatch.
Meaning, enhanced monitoring allows your to monitor operating system counters while cloudwatch monitoring enables your to monitor performance counters per database instance.
- What does Free/Active/Freeable memory represents?
Enhanced monitoring info source
Free Memory
The amount of unassigned memory, in kilobytes.
Active Memory
The amount of assigned memory, in kilobytes.
Freeable Memory
Official Source
The amount of available random access memory.
Units: Bytes
Freeable memory is not a indication of the actual free memory
available. It is the memory that is currently in use that can be freed
and used for other uses; it's is a combination of buffers and cache in
use on the database instance.
Trouble Understanding Inactive Memory in MacOSX
Well, apparently the required workaround is to use the purge
command on MacOSX. This will clear the caches marking most of the inactive memory as free. It seems that the OS keeps as much inactive memory as possible in order to improve the responsiveness of the GUI, which unfortunately impacts the performance of some memory-intensive tools.
There is a thread with some extra information on a sister site.
I wonder whether MacOSX Server might be tuned to release more of the inactive memory for non-GUI processes…
Using inactive memory to my advantage. What is this code storing in RAM or inactive memory?
How could the OS possibly make a memcpy
on an mmap
'd file work if the file's pages weren't resident in memory? The OS takes your hint that you don't want the data cached, but if still will if it has no choice or it has nothing better to do with the memory.
Your pages have the lowest priority, because the OS believes you that you won't access them again. But they had to be resident for the memcpy
to work, and the OS won't throw them away just to have free memory (which is 100% useless). Inactive memory is better than free memory because there's at least some chance it might save I/O operations.
Questions about Linux Memory Types
I try to answer your questions:
(1)Basically speaking, your thoughts are correct. But the page cache implementation is complicated in Linux Kernel. The Linux Kernel uses LRU(Least Recently Used) algorithm to manage the page cache lists. There may be different memory zones in one Linux system, each zone maintains several LRU list, such as LRU_INACTIVE_ANON, LRU_ACTIVE_ANON(these two lists are for anonymous page caches), LRU_INACTIVE_FILE , LRU_ACTIVE_FILE(these two lists are for file page caches), LRU_UNEVICTABLE. These lists are maintained using LRU algorithm(added to the tail, remove from the head). And pages are transited between active list and inactive list according to the access frequency. Pages are added to the active list tail only when the page is accessed and it is residing in the inactive list. And if the active list becomes too larger, the pages which at the head of the active list will be moved to the inactive list tail. The page reclaiming happen on the inactive list, start from the head of the inactive list.
(2) Regular files read/write, block deivce files access, and memory-mapped files can all trigger Linux Kernel to generate the page caches, active or inactive. Also the malloc used in user-space process and user-space stack can trigger Linux Kernel to generate the page caches.
(3) Maybe I misunderstand your question, I guess you mean difference between buffer cache and page cache: Older version kernel use both buffer cache and page cache. Page cache are for file accesses(such as regular file accesses, memory-map file, block device file accesses), and buffer cache are for physical disk blocks accesses(normally the size of the physical disk block is less than one page, so several physical disk blocks can fill into one page). Although new version kernel is still using the buffer cache concept, new kernel implements the buffer cache based on page cache.
Or you mean difference between memory buffer and cpu cache, if so, the memory buffer is to speed up the disk/peripheral accesses, and the cpu cache is to speed up the memory accesses.
Related Topics
How to Convert an Ssl Certificate in Linux
In Linux Determine If a .A Library/Archive 32-Bit or 64-Bit
Append Line to /Etc/Hosts File with Shell Script
Preserving File Permissions for Samba Shares When File Is Edited
What Exactly Is Sudo Bang Bang
How to Change File Permissions in Ubuntu
I Get "Dquote>" as a Result of Executing a Program in Linux Shell
How to Create a Script to Save and Restore Permissions
Sed Insert Line with Spaces to a Specific Line
How to Print Only the Hex Values from Hexdump Without the Line Numbers or the Ascii Table
Colored Shell Script Output Library
Calculate Size of Files in Shell
How to Install Cargo on a Rhel Linux Server