<> Memory state detection tool smem command
(1)smem Is a command line memory usage reporting tool , He can provide Linux Multiple reports of memory usage under the system ,seme Unlike existing tools , Can report PSS
situation ( Physical memory used (PSS), This measures the amount of memory used by virtual memory system libraries and Applications .
(2) Most of the physical memory is usually shared between multiple applications ,
* linux The system has been used for a long time virtual memory( virtual memory )
, If you want to accurately calculate the physical memory used by a process, it is not so easy to do . Just knowing the virtual memory size of a process is not very useful , Because there is no way to get the actual allocated physical memory size .
* RSS-(resident set size): Physical memory occupied by process
RSS Is the resident collection size , That is, the physical memory of the non swap area used by the process .
(1)top Commands can also be found , Most commonly used memory metrics
(2) In each process RSS After adding values , Generally, it will exceed the memory consumption of the whole system , that is because RSS Contains shared memory between processes
* PSS-(proportion set size)
Scale set size
When all programs using a shared library share the memory occupied by the shared library , Obviously all the processes PSS The sum is the amount of memory used by the system , It will be more accurate , He averaged the size of shared memory , In the process of allocation .
* USS-(unique set size): Process occupies memory alone
Only calculate the memory size occupied by the process alone , Does not contain any shared parts
* install smem tool yum install epel-release yum install smem python-matplotlib
* Display the memory usage status of each process in the system
* smem -k
Display units on output , Convenient to view market memory usage smem -K # Parameter description -K # Display memory units -s # Sort
* smem -s pss/uss/rss
Specify content to sort smem -s pss
* smem -p
Report memory usage as a percentage , We can clearly observe the proportion of each process to Xiyong , smem -p
* smem -u
Display the size of memory occupied by system users smem -u -k
* Specifies the size of memory used by viewing user processes smem -P mysql #( Capitalized P) smem -k -P mysql