Does it make sense to use VSZ from the ps command to monitor memory of processes on a Redhat server?

Tony Stark asked:

I found many articles on the web about RSS and VSZ and what the difference between both is and all I really understood is that it’s very hard to determine the actual used memory of a process on Linux. This is very unsatisfying.

Now an admin who takes care our application does not want us to go into production because in his eyes our application uses too much memory. He states that VSZ for the application is about 10GB. The RSS however is about 4GB.

Does it make sense to use VSZ from the ps command to monitor and alert memory of processes on a Redhat server? Would it be better to take another value for such monitoring?

I believe that adding all VSZ sizes of all applications does not equal 100% of all memory of the server. Why would it make sense to monitor it for one process then?

Does it even make sense to monitor processes on a server and wouldn’t it be much better to just monitor the memory usage of the whole server and react when it reaches about 90% of all the memory?

My answer:

It doesn’t make any sense to use VSZ for much of anything at all.

This number is the entire amount of virtual memory allocated by the application. This includes memory requested but not actually in use by the application, memory swapped out to disk,┬ápages of the application text itself which haven’t even been loaded from disk yet and might never be, and probably a few other things I’m forgetting. Most of this doesn’t actually use RAM in the sense you’re concerned with.

RSS is actually what you need to be concerned about; that is exactly how much RAM the process is using at any given time.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.