Listing Memory Usage by Process

Solaris OS LogoA question asked to me often, “Which processes are using up too much memory?”  I generally use top to figure them out manually.  But there’s a better way to do it, using Solaris pmap command.  I can get a good estimate on the memory usage.  Brandon Hutchinson has a shell script that provides a nice output.  I modified it a little bit to include a column for process owner.

#!/bin/sh
/usr/bin/printf "%-6s %-9s %-13s %s\n" "PID" "Total" "User" "Command"
/usr/bin/printf "%-6s %-9s %-13s %s\n" "---" "-----" "----" "-------"
for PID in `/usr/bin/ps -ef  | /usr/bin/awk '$2 ~ /[0-9]+/ { print $2 }'`
do
   USER=`/usr/bin/ps -o user -p $PID | /usr/bin/tail -1`
   CMD=`/usr/bin/ps -o comm -p $PID | /usr/bin/tail -1`
   # Avoid "pmap: cannot examine 0: system process"-type errors
   # by redirecting STDERR to /dev/null
   TOTAL=`/usr/bin/pmap $PID 2>/dev/null | /usr/bin/tail -1 | \
   /usr/bin/awk '{ print $2 }'`
   [ -n "$TOTAL" ] && /usr/bin/printf "%-6s %-9s %-13s %s\n" "$PID" "$TOTAL" "$USER" "$CMD"
done | /usr/bin/sort -rn -k2

Note, this script needs to run as “root” for pmap to have permission to examine each process.

Output looks something like this:

PID    Total     User      Command
---    -----     ----      -------
694    25240K    root      /opt/RICHPse/bin/se.sparcv9.5.9
696    5208K     root      /usr/dt/bin/dtlogin
613    4992K     root      /opt/CA/BABcmagt/caagentd
326    4512K     smmsp      /usr/lib/sendmail
260    4440K     root      /usr/sbin/syslogd
269    2440K     root      /usr/sbin/cron
196    2360K     root      /usr/sbin/keyserv
193    2352K     root      /usr/sbin/rpcbind
103    2336K     root      /usr/lib/sysevent/syseventd
235    2224K     root      /usr/lib/nfs/lockd
206    2184K     root      /usr/lib/netsvc/yp/ypbind

What’s Next in IT Jobs?

The year is ending and it’s time to re-evaluate one’s career and direction in the next five years.  Doing the nuts and bolts of systems administration may not be as relevant anymore.  An article in Computer World UK noted:

So what should today’s IT employee do to protect his or her career? “Look for the skills the company is going to need five years from now, not now, and start building them,” advises Forrester’s Schadler. “These include vendor contract management, integration with the cloud, analytics, rich lightweight Internet workforce applications, mobile applications — these are all skills for the next decade,” he says.

IT executives are considering cloud computing. That’s where the game is at.  It’s going to be a slow shift, but it will surely happen.  Better be prepared than sorry.

Problem Solving And Deciding On A Solution

Working in a team can be quite challenging. Deciding what to agree on for an outcome or goal is important for the success of a project. Some key actions to evaluate solutions and gain consensus on the decision to be implemented are:

  1. Describe the decision and how it will be made.
  2. Jointly establish decision-making guidelines.
  3. Jointly evaluate options against the guidelines.
  4. Gain agreement on the best alternative.

Keep it cool, civilized, and concise. Keep discussions on topic and on time. Most of all, communicate well!