my webserver with 16GB ram shows all RAM as used, but is it really, see the 'top'

Posted by Alex on Server Fault See other posts from Server Fault or by Alex
Published on 2011-06-28T14:41:43Z Indexed on 2011/06/28 16:24 UTC
Read the original article Hit count: 346

Filed under:
|

I have some questions about my web server. Its a LAMP web server running centos 5.5 and php5, mysql5. The server gets hundreds (maybe thousand) of concurrent users during peak hours.

I'm trying to optimize a little and understand "top". From what I can see:

  1. all 16GB of my ram have been used up?

  2. does that mean that my server needs more memory?

  3. My swap is only 2GB, should it be increased?

  4. usually during peak hours my server load average first number is about 2.5-3. What could I do to optimize the server so that the load average even during peak doesn't go above 1? In the past I was told a good working server should stay under 1 load, is this still true? Although even during load of 2.5-3, server pages and applications seem to load with pretty good speed.

  5. what should the memory size in php.ini be set to?

    top - 14:30:18 up 2 days, 12:41,  5 users,  load average: 1.25, 1.74, 2.92                                                                                                                                                                                      
    Tasks: 305 total,   2 running, 302 sleeping,   0 stopped,   1 zombie                                                                                                                                                                                            
    Cpu(s):  6.3%us,  0.9%sy,  0.0%ni, 92.5%id,  0.2%wa,  0.0%hi,  0.1%si,  0.0%st                                                                                                                                                                                  
    Mem:  16427200k total, 16111472k used,   315728k free,  3120316k buffers                                                                                                                                                                                        
    Swap:  2104496k total,      268k used,  2104228k free,  6216756k cached                                                                                                                                                                                         

      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                                                            29080 apache    15   0  358m  36m 5192 S 20.2  0.2   2:08.40 httpd                                                                                                                                                                                              
    29093 apache    18   0  357m  36m 5192 S 18.2  0.2   2:02.52 httpd                                                                                                                                                                                              29079 apache    15   0  370m  49m 5832 S 10.0  0.3   2:32.14 httpd                                                                                                                                                                                              
     1812 apache    15   0  370m  49m 5196 S  7.3  0.3   2:25.30 httpd                                                                                                                                                                                               5204 apache    15   0  358m  36m 5168 S  5.3  0.2   0:59.28 httpd                                                                                                                                                                                              
    29075 apache    15   0  370m  48m 5184 S  3.3  0.3   2:15.93 httpd                                                                                                                                                                                               9712 apache    15   0  360m  38m 5180 S  3.0  0.2   0:54.81 httpd                                                                                                                                                                                              
    29072 apache    16   0  358m  36m 5192 S  2.7  0.2   2:24.43 httpd                                                                                                                                                                                               6310 apache    17   0  388m  67m 5180 S  2.3  0.4   0:58.85 httpd                                                                                                                                                                                              
     8674 apache    15   0  343m  21m 4980 S  2.0  0.1   0:07.91 httpd                                                                                                                                                                                              29085 apache    15   0  371m  49m 5224 S  2.0  0.3   2:16.86 httpd                                                                                                                                                                                              
    29083 apache    15   0  370m  48m 5196 S  1.7  0.3   2:10.64 httpd                                                                                                                                                                                               5575 apache    15   0  357m  36m 5228 S  1.3  0.2   0:53.78 httpd                                                                                                                                                                                              
    29066 apache    15   0  379m  59m 5860 R  1.3  0.4   2:11.93 httpd                                                                                                                                                                                              29078 apache    15   0  370m  48m 5188 S  1.3  0.3   2:14.52 httpd                                                                                                                                                                                              
    29084 apache    15   0  370m  48m 5208 S  1.0  0.3   2:02.49 httpd                                                                                                                                                                                              29089 apache    15   0  370m  48m 5188 S  1.0  0.3   2:27.61 httpd                                                                                                                                                                                              
    29082 apache    15   0  390m  68m 5188 S  0.7  0.4   2:32.48 httpd                                                                                                                                                                                              29984 apache    15   0  358m  36m 5228 S  0.7  0.2   2:08.32 httpd                                                                                                                                                                                              
     3571 root      16   0 13400 1792  848 S  0.3  0.0   2:37.89 top                                                                                                                                                                                                 4419 mysql     15   0  668m 175m 7204 S  0.3  1.1   3:32.25 mysqld                                                                                                                                                                                             
    28181 root      15   0 90460 3624 2680 S  0.3  0.0   0:17.60 sshd                                                                                                                                                                                               29091 apache    15   0  390m  69m 5196 S  0.3  0.4   2:29.99 httpd                                                                                                                                                                                              
    32476 root      15   0 12900 1320  848 R  0.3  0.0   0:06.46 top                                                                                                                                                                                                    1 root      15   0 10372  680  572 S  0.0  0.0   0:02.01 init                                                                                                                                                                                               
    2 root      RT  -5     0    0    0 S  0.0  0.0   0:00.51 migration/0                                                                                                                                                                                            3 root      34  19     0    0    0 S  0.0  0.0   0:00.07 ksoftirqd/0                                                                                                                                                                                        
    4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/0                                                                                                                                                                                             5 root      RT  -5     0    0    0 S  0.0  0.0   0:00.12 migration/1                                                                                                                                                                                        
    6 root      34  19     0    0    0 S  0.0  0.0   0:00.03 ksoftirqd/1                                                                                                                                                                                            7 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/1                                                                                                                                                                                         
    8 root      RT  -5     0    0    0 S  0.0  0.0   0:00.06 migration/2                                                                                                                                                                                            9 root      34  19     0    0    0 S  0.0  0.0   0:00.03 ksoftirqd/2                                                                                                                                                                                        
    10 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/2                                                                                                                                                                                            11 root      RT  -5     0    0    0 S  0.0  0.0   0:00.06 migration/3                                                                                                                                                                                        
    12 root      34  19     0    0    0 S  0.0  0.0   0:00.04 ksoftirqd/3                                                                                                                                                                                           13 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/3                                                                                                                                                                                         
    14 root      RT  -5     0    0    0 S  0.0  0.0   0:01.45 migration/4                                                                                                                                                                                           15 root      34  19     0    0    0 S  0.0  0.0   0:00.01 ksoftirqd/4                                                                                                                                                                                        
    16 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/4                                                                                                                                                                                            17 root      RT  -5     0    0    0 S  0.0  0.0   0:00.22 migration/5                                                                                                                                                                                        
       18 root      34  19     0    0    0 S  0.0  0.0   0:00.01 ksoftirqd/5                                                                                                                                                                                           19 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/5                                                                                                                                                                                         
       20 root      RT  -5     0    0    0 S  0.0  0.0   0:00.15 migration/6                                                                                                                                                                                           21 root      34  19     0    0    0 S  0.0  0.0   0:00.02 ksoftirqd/6                                                                                                                                                                                        
       22 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/6                                                                                                                                                                                            23 root      RT  -5     0    0    0 S  0.0  0.0   0:00.15 migration/7                                                                                                                                                                                        
       24 root      34  19     0    0    0 S  0.0  0.0   0:00.01 ksoftirqd/7                                                                                                                                                                                           25 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/7                                            
       26 root      RT  -5     0    0    0 S  0.0  0.0   0:00.19 migration/8                                              27 root      34  19     0    0    0 S  0.0  0.0   0:00.04 ksoftirqd/8                                           
       28 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/8                                               29 root      RT  -5     0    0    0 S  0.0  0.0   0:00.34 migration/9                                           
       30 root      34  19     0    0    0 S  0.0  0.0   0:00.03 ksoftirqd/9                                              31 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/9                                            
       32 root      RT  -5     0    0    0 S  0.0  0.0   0:00.16 migration/10                                             33 root      34  19     0    0    0 S  0.0  0.0   0:00.04 ksoftirqd/10                                          
       34 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/10                                              35 root      RT  -5     0    0    0 S  0.0  0.0   0:00.12 migration/11                                          
       36 root      34  19     0    0    0 S  0.0  0.0   0:00.05 ksoftirqd/11                                             37 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/11                                           
       38 root      RT  -5     0    0    0 S  0.0  0.0   0:00.35 migration/12          

© Server Fault or respective owner

Related posts about lamp

Related posts about top