LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   RAM full after dist-upgrade, apache2, php, mysql installation on a VPS (https://www.linuxquestions.org/questions/linux-server-73/ram-full-after-dist-upgrade-apache2-php-mysql-installation-on-a-vps-785970/)

motiongrafika 01-31-2010 06:19 AM

RAM full after dist-upgrade, apache2, php, mysql installation on a VPS
 
I got a new VPS with 256MB RAM and Ubuntu 9.04.

I upgraded it to 9.10 and installed apache2, php, python3, mysql5.1
Now a top is showing
Code:

top - 13:11:31 up 1 day, 16:23,  1 user,  load average: 0.02, 0.29, 0.29
Tasks:  24 total,  1 running,  23 sleeping,  0 stopped,  0 zombie
Cpu(s):  0.7%us,  0.2%sy,  0.0%ni, 99.2%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    283616k total,  268536k used,    15080k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                         
26999 root      20  0  6700 2152 1716 S    1  0.8  0:00.03 sshd                                                                                                                                             
26996 root      20  0  2336 1084  876 R    0  0.4  0:00.01 top                                                                                                                                             
    1 root      20  0  1888  832  628 S    0  0.3  0:00.58 init                                                                                                                                             
 3196 root      20  0  5432 1060  668 S    0  0.4  0:00.00 sshd                                                                                                                                             
12991 root      20  0  5356 1084  680 S    0  0.4  0:03.88 sshd                                                                                                                                             
13420 root      20  0 35492 8820 5352 S    0  3.1  0:01.13 apache2                                                                                                                                         
13557 www-data  20  0 36636 7984 3000 S    0  2.8  0:00.17 apache2                                                                                                                                         
13558 www-data  20  0 35936 4744 1068 S    0  1.7  0:00.00 apache2                                                                                                                                         
13559 www-data  20  0 35492 4552 1028 S    0  1.6  0:00.00 apache2                                                                                                                                         
13560 www-data  20  0 37192 8544 3008 S    0  3.0  0:00.09 apache2                                                                                                                                         
13561 www-data  20  0 36376 7576 2856 S    0  2.7  0:00.07 apache2                                                                                                                                         
14493 root      20  0  1748  540  444 S    0  0.2  0:00.01 mysqld_safe                                                                                                                                     
14601 mysql    20  0  125m  18m 5780 S    0  6.5  0:16.54 mysqld                                                                                                                                           
14602 root      20  0  1664  572  492 S    0  0.2  0:00.00 logger                                                                                                                                           
15043 www-data  20  0 37708 8904 2952 S    0  3.1  0:00.37 apache2                                                                                                                                         
15044 www-data  20  0 35492 4132  640 S    0  1.5  0:00.00 apache2                                                                                                                                         
15045 www-data  20  0 35492 4524 1004 S    0  1.6  0:00.00 apache2                                                                                                                                         
15046 www-data  20  0 37704 8888 2976 S    0  3.1  0:00.10 apache2                                                                                                                                         
15047 www-data  20  0 36768 7696 2816 S    0  2.7  0:00.07 apache2                                                                                                                                         
25709 root      20  0  8160 2724 2160 S    0  1.0  0:00.17 sshd                                                                                                                                             
25726 root      20  0  3052 1724 1356 S    0  0.6  0:00.05 bash                                                                                                                                             
25744 root      20  0  1892  296  204 S    0  0.1  0:00.00 vzctl                                                                                                                                           
25745 root      20  0  3020 1636 1300 S    0  0.6  0:00.01 bash                                                                                                                                             
27000 sshd      20  0  6700 1204  768 S    0  0.4  0:00.00 sshd

Only 17MB left !
I havent even uploaded a website till now ! No mysql data !
But already full !
Am I missing something ? Thanx

knudfl 01-31-2010 09:46 AM

The ideal situation is, that all RAM is used all the time.

UNIX Memory Management
http://www.dataexpedition.com/~sbnoble/Tips/memory.html
QUOTE :
Unlike traditional PC operating systems, Unix related systems use
very sophisticated memory management algorithms to make efficient
use of memory resources. This makes the questions "How much
memory do I have?" and "How much memory is being used?" rather
complicated to answer. .....
.....

motiongrafika 01-31-2010 10:09 AM

But when I was trying a sudo apt-get php5-mcrypt I was getting "Segmentation faultsts" often.
Code:

root@:~# sudo apt-get install php5-mcrypt
Segmentation faultsts... 0%
root@:~#

From support :
Quote:

The problem is due to lack of memory in your server. The memory limit of 256MB has been reached in your server.
To solve the problem, you will have to upgrade your memory. Your mysql and apache is eating up most of server memory.
So I shut down apache2 and mysql and I got back like 240MB free RAM & I managed to install php5-mcrypt - but on restarting apache2 and mysql, back to memory full and even phpMyAdmin wouldnt work - memory exhausted in php.
So I just dont understand how this RAM thing works for apache2 and mysql5.1 taking all the RAM without any load (since data is zero).

knudfl 01-31-2010 02:42 PM

Sorry, I missed that you only have 256 MB.
And I don't know, how much is required for those applications ..
.. apache2, php, mysql ..



In principle, "all" memory is cached all the time.
And given free when needed for an (other) application.

There is a million hits by Googling .. linux memory management ..
This example may be more descriptive :
http://www.linuxhowtos.org/System/Li...Management.htm
.....

sleddog 01-31-2010 04:06 PM

It looks like an OpenVz VPS (no swap; vzctl process running), so the usual rules of Linux memory management don't apply. OpenVz doesn't use memory for buffers/cache inside the VPS (only at the host node level). In the 'top' output you can see Ok buffers, 0k Cache.

motiongrafika: with 'top' running, press shift-M. That will sort the output by memory usage, with the most memory-intensive processes at top. That should give you a better idea of what's using your memory.

motiongrafika 01-31-2010 11:18 PM

Quote:

with 'top' running, press shift-M.
Code:

PID  USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                         
28679 mysql    20  0  125m  16m 4472 S    0  5.8  0:17.30 mysqld                                                                                                                                           
28704 root      20  0 35788 8120 4644 S    0  2.9  0:01.01 apache2                                                                                                                                         
28716 www-data  20  0 36236 4740 1064 S    0  1.7  0:00.00 apache2                                                                                                                                         
28708 www-data  20  0 36116 4732 1056 S    0  1.7  0:00.00 apache2                                                                                                                                         
28709 www-data  20  0 36116 4732 1056 S    0  1.7  0:00.00 apache2                                                                                                                                         
28710 www-data  20  0 36116 4732 1056 S    0  1.7  0:00.00 apache2                                                                                                                                         
28706 www-data  20  0 35788 4532 1004 S    0  1.6  0:00.00 apache2                                                                                                                                         
28707 www-data  20  0 35788 4528 1004 S    0  1.6  0:00.00 apache2                                                                                                                                         
29798 www-data  20  0 35788 4000  512 S    0  1.4  0:00.00 apache2                                                                                                                                         
29805 root      20  0  8160 2724 2160 S    0  1.0  0:00.10 sshd                                                                                                                                             
29812 root      20  0  3060 1688 1316 S    0  0.6  0:00.01 bash                                                                                                                                             
27495 root      20  0  5356 1080  676 S    0  0.4  0:00.44 sshd                                                                                                                                             
29827 root      20  0  2336 1076  876 R    0  0.4  0:00.01 top                                                                                                                                             
 3196 root      20  0  5432 1060  668 S    0  0.4  0:00.00 sshd                                                                                                                                             
    1 root      20  0  1888  832  628 S    0  0.3  0:00.64 init

I think I'll switch to SQLite instead.


All times are GMT -5. The time now is 11:09 PM.