Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Performance issue

Posted on 2013-05-27
Medium Priority
Last Modified: 2013-08-27
top - 09:12:44 up 388 days, 17:09,  1 user,  load average: 1.47, 0.85, 0.40
Tasks: 163 total,   2 running, 161 sleeping,   0 stopped,   0 zombie
Cpu(s): 16.0%us,  6.3%sy,  0.0%ni, 56.7%id, 15.8%wa,  0.4%hi,  4.8%si,  0.0%st
Mem:   8043428k total,  7930920k used,   112508k free,     1136k buffers
Swap:  4194296k total,  3804432k used,   389864k free,   740040k cached

can some advise how to troubleshoot this swap issue?
Question by:ittechlab
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
LVL 35

Expert Comment

by:Duncan Roe
ID: 39199132
I suspect some program is leaking memory. To find it, run top -b -n 1 | less and look down the VIRT column for a whopper. That will be the culprit.

Author Comment

ID: 39199148
what is VIRT? can i sort VIRT and how?
LVL 35

Accepted Solution

Duncan Roe earned 1500 total points
ID: 39199847
VIRT is a heading in the output from top, right after the headings as you posted. You should have seen it when you tried the command I posted. Like this
07:18:26$ top -b -n 1 | less
top - 07:37:59 up 22 min, 12 users,  load average: 0.00, 0.05, 0.20
Tasks: 174 total,   1 running, 173 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.7%us,  0.7%sy,  0.0%ni, 95.2%id,  2.3%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   8302872k total,   539704k used,  7763168k free,    42336k buffers
Swap:        0k total,        0k used,        0k free,   250412k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
    1 root      20   0  2008  556  488 S    0  0.0   0:00.85 init               
    2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd           
    3 root      20   0     0    0    0 S    0  0.0   0:00.01 ksoftirqd/0        
    5 root       0 -20     0    0    0 S    0  0.0   0:00.00 kworker/0:0H       
    7 root       0 -20     0    0    0 S    0  0.0   0:00.00 kworker/u:0H       
    8 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/0        
    9 root      20   0     0    0    0 S    0  0.0   0:00.00 rcu_bh             
   10 root      20   0     0    0    0 S    0  0.0   0:00.08 rcu_sched          
   11 root      20   0     0    0    0 S    0  0.0   0:00.02 ksoftirqd/1        
   12 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/1        
   14 root       0 -20     0    0    0 S    0  0.0   0:00.00 kworker/1:0H       
   15 root       0 -20     0    0    0 S    0  0.0   0:00.00 cpuset             
   16 root       0 -20     0    0    0 S    0  0.0   0:00.00 khelper            
   17 root      20   0     0    0    0 S    0  0.0   0:00.00 kdevtmpfs          
   18 root       0 -20     0    0    0 S    0  0.0   0:00.00 netns              
  468 root      20   0     0    0    0 S    0  0.0   0:00.00 bdi-default        
  470 root       0 -20     0    0    0 S    0  0.0   0:00.00 kblockd            

Open in new window

VIRT is the 5th column. It describes the virtual size of the process, i.e. not just what's in memory but also what's paged out (to "Swap" - a very old name for the paging disk which dates back to when processes had to be swapped in and out of memory in their entirety - but I digress).
The output above shows that the init process has a virtual size of 2008 KB. If I had paged through further I would have seen other non-zero values. The default unit is kilobytes (K) - big enough processes are shown in megabytes with an M.
Just look and see what you can see. You could post the output if you prefer: top -b -n 1 >top.txt and post top.txt as a file attachment (Use Attach File link below text entry area).
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.


Expert Comment

ID: 39200510
If you just want to run top sorted interactively (no batch mode with -b -n1) by VIRT you sould hit "F" and then "o" and return. You could also use "<" och ">" to move sorting around in the columns.

Author Comment

ID: 39241011
I am  trying to understand what is these field represent and how its help to make decision when doing performance tuning.

LVL 35

Expert Comment

by:Duncan Roe
ID: 39242829
For a description of these fields, type man top. If or when you have done that, post any more specific questions you may have. You need a basic understanding of virtual memory and demand-paged architecture to make sense of some of them. I'll take a shot at explaining that a bit more if you like.
Your problem, however, still looks to me like a rogue application leaking (i.e. continually acquiring more) memory.
"performance tuning" is not going to help you one bit - in fact it very rarely helps anyone. What does help is identifying problem processes and doing something about them.

Author Comment

ID: 39366973
can you please let me know how do i get top 10 process which taking swap space by using command line instead of using top then shift O, i need to run a command line to list the first 10 process . This is for my script purpose.
LVL 35

Expert Comment

by:Duncan Roe
ID: 39373074
Good, you have found shift-o already. When you have got the order as you want using shift-o, write a .toprc file in your home directory by going back to running top then press shift-w.
After that, whenever you run top it will sort by swap file size. To get a static display of the top 10, run top for one sample in batch mode and crop the output by top -b -n 1|head -17|tail +8 (you may need to experiment with the numbers - they worked for me).

Author Closing Comment

ID: 39443468
better solution

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question