In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Xiaobian to share with you how to view memory from the outside of PostgreSQL, I believe most people do not know how, so share this article for everyone's reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!
PostgreSQL view memory using a lot of methods, most of them are into POSTGRESQL to view, today from PostgreSQL external to view the use of memory and methods.
The main command used this time is the ps command.
The ps command provides an overview of the threads currently running on the PG, and the ratio of CPU Memory used by each thread is also clearly displayed on the screen.
ps -u postgres o pid,rss:8,cmd | awk 'NR>1 {A+=$2} {print} END{print "Total RSS: " A}'
By combining PS and AWK, you can compare the current POSTGRESQL with the current amount of memory used by processes related to postgresql, as well as the total amount of memory used.
First we need to figure out what RSS is.
RSS is the total number of pages currently mapped to the process. It is divided into two parts, the first part is the shared part of RSS in Shared_Clean + Shared_Dirty, and Private_Clean + Private_Dirty is the exclusive part of RSS for this process.
In LINUX proc directory has information about all relevant processes, PSS is obtained by the following prediction, so RSS-PSS equals to process-specific memory
ps -u postgres o pid= | sed 's#.*#/ proc/&/smaps#'|sed s/[[:space:]]//g | xargs sudo grep ^Pss: | awk '{A+=$2} END{print A}'
In fact, knowing the process number, with a little modification of the above statement, you can get, you want to know how much PSS is used by the thread, through the comparison of the two values in the figure below, you can know how much memory 16848 - 10737 in the postgres main process is shared by this process and other processes.
Of course, there is no easier way to obtain this information. Currently, smem tools that can directly display RSS PSS USS information through commands can meet relevant requirements, and can also display which processes have started using SWAP.
So when someone asks how much memory POSTGRESQL uses, and after that, you can tell him how much shared memory is used, how much exclusive processes are used, which processes have started using SWAP, which is helpful to solve some problems about memory, especially for the analysis of memory usage by certain accessing processes.
VSS- Virtual Set Size Virtual memory consumption (including memory consumed by shared libraries)
RSS- Resident Set Size Actual use of physical memory (including memory occupied by shared libraries)
PSS- Proportional Set Size Physical memory actually used (memory occupied by shared libraries is allocated proportionally)
USS- Unique Set Size Physical memory occupied by the process alone (excluding memory occupied by shared libraries)
That's all for "How to view memory from outside PostgreSQL", thanks for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.