Memory Usage of a Solaris Container (Zone)
Last week one of my servers ran out of RAM and Swap. Shame on me for not monitoring that, but it's now.
As the server is running several zones, my first question was: Which zone is eating up my RAM? So, here are the commands I used.
Part 1: Find the Zone
To see the memory usage of the running zones:
prstat -Z
From the prstat(1M) man page:
-ZReport information about processes and zones. In this mode,prstatdisplays separate reports about processes and zones at the same time.
Part 2: Find the Process(es) in the Zone
To see which processes use the most RAM in the zone, use one of these commands:
prstat -z zone -s rss prstat -z zone -s size
From the prstat(1M) man page:
-z zoneidlistReport only processes or LWPs whose zone ID is in the given list. Each zone ID can be specified as either a zone name or a numerical zone ID. See zones(5).-s keySort output lines (that is, processes, lwps, or users) by key in descending order. Only one key can be used as an argument.rssSort by resident set size.sizeSort by size of process image.
Note the upper case -Z in the first an the lower case -z in the second command.
For more information about prstat, see the manual prstat(1M).
