Solved

Performance issue

Posted on 2013-05-27
9
323 Views
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?
0
Comment
Question by:ittechlab
  • 4
  • 4
9 Comments
 
LVL 34

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.
0
 

Author Comment

by:ittechlab
ID: 39199148
what is VIRT? can i sort VIRT and how?
0
 
LVL 34

Accepted Solution

by:
Duncan Roe earned 500 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            
More

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).
0
 
LVL 7

Expert Comment

by:expert1010
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.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

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

PR  NI  VIRT  RES  SHR S
0
 
LVL 34

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.
0
 

Author Comment

by:ittechlab
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.
0
 
LVL 34

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).
0
 

Author Closing Comment

by:ittechlab
ID: 39443468
better solution
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now