LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Linux server slow (https://www.linuxquestions.org/questions/linux-server-73/linux-server-slow-775516/)

Uday123 12-14-2009 04:43 AM

Linux server slow
 
I have been getting requests from application teams that the server is running slow. I have checked the memory utilization, processes running and cpu utilization. Please find below:

#free -m
total used free shared buffers cached
Mem: 3006 2994 11 0 6 171
-/+ buffers/cache: 2817 189
Swap: 12291 1123 11168
#

Processes running and cpu utilization are OK.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda5 9.7G 2.6G 6.7G 28% /
/dev/hda6 3.0G 69M 2.7G 3% /tmp
/dev/hda2 68G 34G 31G 53% /u01
/dev/hda1 99M 12M 83M 13% /boot
tmpfs 1.5G 0 1.5G 0% /dev/shm
#

Though most of the memory (RAM) utilized and just 11MB left for free, there is still HUGE swap space available. Will that not help with respect to memory? Why is the server running slow?

Please let me know what are the other parameters to check and judge the server slowness.

How to make it fast and comfortable server?

centosboy 12-14-2009 04:54 AM

Quote:

Originally Posted by Uday123 (Post 3790710)
I have been getting requests from application teams that the server is running slow. I have checked the memory utilization, processes running and cpu utilization. Please find below:

#free -m
total used free shared buffers cached
Mem: 3006 2994 11 0 6 171
-/+ buffers/cache: 2817 189
Swap: 12291 1123 11168
#

Processes running and cpu utilization are OK.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda5 9.7G 2.6G 6.7G 28% /
/dev/hda6 3.0G 69M 2.7G 3% /tmp
/dev/hda2 68G 34G 31G 53% /u01
/dev/hda1 99M 12M 83M 13% /boot
tmpfs 1.5G 0 1.5G 0% /dev/shm
#

Though most of the memory (RAM) utilized and just 11MB left for free, there is still HUGE swap space available. Will that not help with respect to memory? Why is the server running slow?

Please let me know what are the other parameters to check and judge the server slowness.

How to make it fast and comfortable server?



what about the output from top???


top -c

then shift + m will list in order or memory usage.

i dont think the ram being used is the problem as most of it is being used as cache for faster application access...

volga629 12-14-2009 05:23 AM

or maybe just 'yum install htop' and see what is hang . and start type 'htop'.

ilikejam 12-14-2009 07:13 AM

I think you've run out of RAM. You're showing 189 MB free, but you've eaten over a GB of swap.

Run 'vmstat 2 20' and check the 'si' and 'so' values. If these are showing a lot of actvity, you're swapping.

Dave

centosboy 12-14-2009 09:10 AM

Quote:

Originally Posted by ilikejam (Post 3790863)
I think you've run out of RAM. You're showing 189 MB free, but you've eaten over a GB of swap.

Run 'vmstat 2 20' and check the 'si' and 'so' values. If these are showing a lot of actvity, you're swapping.

Dave

nah he hasnt...

Code:

Swap: 12291 1123 11168
11168 is free

ilikejam 12-14-2009 09:40 AM

Yeah he has...
Code:

-/+ buffers/cache: 2817 189
He's got 11168MB of free /swap/ (so no OOM errors) but he's swapping out - 1123MB swap in use on a 3GB RAM host tells me he's probably swapping quite hard, which is why the machine's running slow.

Dave

Uday123 12-14-2009 09:45 AM

Thanks for the quick responses.

My question is: though I have huge SWAP space left why the machine is not using it?
So once the memory (RAM)completely utilized, then server will stop running OR it will start using SWAP space?

Please explain.

ilikejam 12-14-2009 09:52 AM

Hi.

The machine's not using it because it doesn't need it. According to the figures you gave above, your machine is using 2817MB + 1123MB = 3940MB of memory for its applications. Your RAM /is/ completely utilised, and the machine is having to use swap space on disk because of this - this is what's (probably) slowing the machine down. The server should only stop working if you run out of swap (but if you end up using all 12GB of swap, the machine will probably be so slow it might as well have crashed).

Dave

centosboy 12-15-2009 02:38 AM

Find out what is using this memory with top or htop..

salasi 12-15-2009 11:13 AM

Quote:

Originally Posted by Uday123 (Post 3790710)
Though most of the memory (RAM) utilized and just 11MB left for free, there is still HUGE swap space available. Will that not help with respect to memory? Why is the server running slow?

getting data into and out of swap space is slower than doing a similar thing with ram, by orders of magnitude, so relying on swap to substitute for ram is not going to help speed, however much swap you have left.

If you want to know anything about how much your use of swap is slowing the machine down, you need to look (or give us the chance to look) at the pages being swapped in and out.

Having swap pages in use doesn't directly slow you down, but the traffic to and from the disk does. This is why you have been asked to give the information about traffic to and from swap, but you are not answering. Why is this?

Uday123 12-16-2009 04:47 AM

I have added 1GB more RAM. So now the RAM memory is 4GB and SWAP is 12GB.

Code:

]# vmstat 2 20
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----                                                                            -
 r  b  swpd  free  buff  cache  si  so    bi    bo  in  cs us sy id wa st
 0  2 863784  22944  2788 640560    1    5    24  136  136  10  9  5 85  1  0
 0  3 873600  24528  2784 641004  448 4908  2690  4922 1303  576 10 25  0 64  0
 0  2 879472  25440  2792 641124  192 2936  1410  2956 1034  441  6 59  0 35  0
 0  4 953004  23816  2800 648944  208 36766  7768 36778 1084  644  3 24  0 73  0
 0  3 983884  23648  2804 660180  32 15440  6182 15444 1044  596  2 27  0 71  0
 1  6 1004556  20484  2824 671524  144 10336  6102 10340 1049  602  2 23  0 74  0
 1  5 1016984  25164  2816 675668  176 6214  3186  6220  998  542  2 21  0 77  0
 3  3 1026936  29668  2820 679140  48 4976  8056  5010 1088  649  8 21  0 72  0
 0  2 1026992  25204  2828 687388    0  28  4164    28 1115  567 26 27  0 47  0
 0  3 1063732  27416  2836 693588    0 18370  9546 18378 1091  669  3 26  0 70  0
 0  4 1091500  24564  2764 699876    0 13884  7430 13884 1000  585  3 31  0 66  0
10  5 1139212  26876  2760 703468    0 23856  8842 23880 1041  614  3 30  0 67  0
 0  5 1140956  23244  2764 707716  16  872  2258  872  932  516 54 31  0 16  0
 0  4 1164364  23760  2760 717424    0 11704  6278 11704 1021  558  2 25  0 73  0
 1  4 1175948  26436  2776 720972    0 5792  3590  5822  972  508  1 26  0 73  0
 1  5 1196436  20428  2776 728808    0 10244  6920 10256  957  545  3 33  0 64  0
 0  6 1210880  26148  2784 733540  64 7222  3588  7222  943  478  2 29  0 70  0
 0  5 1214904  26520  2772 733268  400 2012  3090  2012  971  527  2 31  0 66  0
 0  6 1230240  22472  2780 738612  176 7668  6390  7668 1041  631  3 30  0 67  0
 0  7 1248160  20640  2784 738192  496 8960  4082  8964 1156  683  3 19  0 79  0
#

Salasi,
Please let me know your analysis.

salasi 12-16-2009 12:08 PM

well, you asked: So here is my inadequate analysis:



Code:

-----------memory---------- ---swap-- -----io---- --system-- -----cpu-----                                                                            -
 r  b  swpd  free  buff  cache  si  so    bi    bo  in  cs us sy id wa st
 0  3 873600  24528  2784 641004  448 4908  2690  4922 1303  576 10 25  0 64 0

look at that wait percentage; any system with a wait percentage that high is spending most of its time waiting for something to happen. Swap and IO is pretty high, so its probably swapping rather than other IO.

So the questions seem to be 'what' (what is causing the swapping) and 'why' (why is taking this much time)?
  • Is there any reason that your disk could be slow?
  • What kernel are you using?
  • Any idea why the number of processes waiting for run time suddenly jumps up? (Maybe watching top (etc) gives you some idea of this.)
  • Do any processes consume what seems to be an excessive amount of memory taking into account what they are doing? (Again, top, etc)
  • Can you get more detail from iotop?


All times are GMT -5. The time now is 05:48 AM.