~~META: date created = 2010-04-21 10:17~~ ====== 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 [[http://docs.oracle.com/cd/E19082-01/819-2240/prstat-1m/index.html|prstat(1M)]] man page: * ''-Z'' Report information about processes and zones. In this mode, ''prstat'' displays 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 [[http://docs.oracle.com/cd/E19082-01/819-2240/prstat-1m/index.html|prstat(1M)]] man page: * ''-z zoneidlist'' Report 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 [[http://docs.oracle.com/cd/E19253-01/816-5175/zones-5/index.html|zones(5)]]. * ''-s key'' Sort output lines (that is, processes, lwps, or users) by key in descending order. Only one key can be used as an argument. * ''rss'' Sort by resident set size. * ''size'' Sort 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 [[http://docs.oracle.com/cd/E19082-01/819-2240/prstat-1m/index.html|prstat(1M)]]. {{tag>opensolaris solaris solaris_container sysadmin zone}}