Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This question already has an answer here:

My server started being unable to spawn PHP instances to respond to HTTP requests as there wasn't enough available RAM. Free -m shows a reasonable amount left, but top and PS don't seem to be able to explain what is using so much.

Presumably it's unable to spawn processes as the server is a VPS with 1gb memory and 2gb "burst".

Am I overlooking something?

   $ free -m
                 total       used       free     shared    buffers     cached
    Mem:          2048       1117        930          0          0          0
    -/+ buffers/cache:       1117        930
    Swap:            0       0          0

Top ordered by memory %

$ top
top - 16:13:49 up 82 days, 13 min,  1 user,  load average: 0.00, 0.12, 0.09
Tasks:  46 total,   1 running,  45 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2097152k total,  1144832k used,   952320k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1236 root      10 -10 22516  21m 1728 S  0.0  1.1   0:00.00 iscsiuio
32003 mysql     18   0  129m  20m 4876 S  0.0  1.0   8:52.62 mysqld
16111 pez       18   0 24776  17m 4108 S  0.0  0.8   4:41.36 irssi
16226 root      18   0 13536 9.9m 1556 S  0.0  0.5   0:00.04 lfd
12273 apache    17   0  283m 5184 2156 S  0.0  0.2   0:00.06 httpd
12261 root      20   0  8812 5132 1936 S  0.0  0.2   0:00.12 ruby
12250 root      15   0 13488 5072 2860 S  0.0  0.2   0:00.04 httpd
12272 apache    18   0  284m 4996 2076 S  0.0  0.2   0:00.02 httpd
12271 apache    18   0  283m 4592 2064 S  0.0  0.2   0:00.00 httpd
 3103 named     20   0 70916 4556 2084 S  0.0  0.2   0:05.78 named
12264 nobody    18   0  7876 2708 2304 S  0.0  0.1   0:00.00 PassengerLoggin
18031 root      18   0  9888 2680 2188 S  0.0  0.1   0:00.09 sshd
 1841 ftp       18   0  8760 2596 1648 S  0.0  0.1   1:01.63 proftpd
16055 pez       15   0  4384 2332 1400 S  0.0  0.1   0:00.05 bash
22372 games     15   0  4512 2324 1392 S  0.0  0.1   0:00.05 bash
25652 games     15   0  4512 2324 1392 S  0.0  0.1   0:00.06 bash

PS ordered by memory usage:

root:~$ ps aux --sort -rss | head
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      1236  0.0  1.0  22516 22508 ?        S<Lsl Mar24   0:00 iscsiuio
mysql    32003  0.0  1.0 132768 21464 ?        Sl   May20   8:52 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/mysql-bin.err --pid-file=/var/lib/mysql/tent.pegproductions.com.pid
pez      16111  0.0  0.8  24776 17816 pts/4    S+   May26   4:41 irssi
507      18171 22.7  0.8  65832 17392 ?        Sl   16:15   0:20 ./ts3server_linux_x86
root     16226  0.0  0.4  13536 10120 ?        Ss   16:07   0:00 lfd - sleeping
apache   12273  0.0  0.2 290804  5184 ?        Sl   16:03   0:00 /usr/sbin/httpd -k start -DSSL
root     12261  0.0  0.2   8812  5132 ?        Sl   16:03   0:00 Passenger spawn server
root     12250  0.0  0.2  13488  5072 ?        Ss   16:03   0:00 /usr/sbin/httpd -k start -DSSL
apache   12272  0.0  0.2 291636  4996 ?        Sl   16:03   0:00 /usr/sbin/httpd -k start -DSSL
share|improve this question

marked as duplicate by Michael Hampton Jun 14 at 15:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2  
You have a "fake" VPS based on OpenVZ, which is actually a container, not a VPS. The symptoms you're seeing are a result of that. Switch to another provider that gives you a real Xen/KVM/etc. VPS and these issues will go away. –  EEAA Jun 14 at 15:21

2 Answers 2

up vote 1 down vote accepted

frankly speaking you are only getting 1 GB which vps promises and the other 1 GB 'burstable' it is part of shared pool , it will happen only when First 1 GB is fully utilized & Shared Memory pool has memory available for your VPS to use than only burst thing works, which means no guaranty.

As far as question whether 1 GB dedicated is available, it actually is. Try counting the big boys from your top output.

32003 mysql     18   0  129m  20m 4876 S  0.0  1.0   8:52.62 mysqld
12273 apache    17   0  283m 5184 2156 S  0.0  0.2   0:00.06 httpd
12272 apache    18   0  284m 4996 2076 S  0.0  0.2   0:00.02 httpd
12271 apache    18   0  283m 4592 2064 S  0.0  0.2   0:00.00 httpd
share|improve this answer
    
I guess now I'm off to track down why each apache process is consuming so much, thank you! –  Pez Cuckow Jun 15 at 10:09

Just an idea, might not be OS memory, but might be a limit in PHP on memory use. Look in your php.ini file for the parameter memory_limit. If it's not defined, it might be defaulting to 8M, 32M, or 128M depending on which PHP version you're on.

http://php.net/manual/en/ini.core.php#ini.memory-limit

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.