Salve a tutti: ho preso un vps da 350Mb di ram che uso per tenere un piccolo server di Minecraft.
Contemporaneamente a questo, c'è installato anche Httpd per fare un piccolo spazio web con le statistiche di gioco.
Quando chiudo il server minecraft e poi (ad esempio) vado a dormire, la mattina seguente mi ritrovo con questo:
Codice:
[root@pianetaminecraft ~]# free -m
total used free shared buffers cached
Mem: 364 326 37 0 17 243
-/+ buffers/cache: 65 298
Swap: 767 1 766
Mentre quando chiudevo il server avevo:
Codice:
[root@pianetaminecraft ~]# free -m
total used free shared buffers cached
Mem: 364 74 290 0 12 2
-/+ buffers/cache: 12 2
Swap: 767 0 767
Com'è che durante la notte un processo alloca così tanta memoria? Allora ho fatto un test con "ps aux".
Codice:
[root@pianetaminecraft ~]# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 19112 416 ? Ss Mar10 0:00 /sbin/init
root 2 0.0 0.0 0 0 ? S Mar10 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S Mar10 0:00 [migration/0]
root 4 0.0 0.0 0 0 ? S Mar10 0:00 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S Mar10 0:00 [watchdog/0]
root 6 0.0 0.0 0 0 ? S Mar10 0:00 [migration/1]
root 7 0.0 0.0 0 0 ? S Mar10 0:00 [ksoftirqd/1]
root 8 0.0 0.0 0 0 ? S Mar10 0:00 [watchdog/1]
root 9 0.0 0.0 0 0 ? S Mar10 0:00 [events/0]
root 10 0.0 0.0 0 0 ? S Mar10 0:00 [events/1]
root 11 0.0 0.0 0 0 ? S Mar10 0:00 [cpuset]
root 12 0.0 0.0 0 0 ? S Mar10 0:00 [khelper]
root 13 0.0 0.0 0 0 ? S Mar10 0:00 [netns]
root 14 0.0 0.0 0 0 ? S Mar10 0:00 [async/mgr]
root 15 0.0 0.0 0 0 ? S Mar10 0:00 [pm]
root 16 0.0 0.0 0 0 ? S Mar10 0:00 [xenwatch]
root 17 0.0 0.0 0 0 ? S Mar10 0:00 [xenbus]
root 18 0.0 0.0 0 0 ? S Mar10 0:00 [sync_supers]
root 19 0.0 0.0 0 0 ? S Mar10 0:00 [bdi-default]
root 20 0.0 0.0 0 0 ? S Mar10 0:00 [kintegrityd/0]
root 21 0.0 0.0 0 0 ? S Mar10 0:00 [kintegrityd/1]
root 22 0.0 0.0 0 0 ? S Mar10 0:00 [kblockd/0]
root 23 0.0 0.0 0 0 ? S Mar10 0:00 [kblockd/1]
root 24 0.0 0.0 0 0 ? S Mar10 0:00 [ata/0]
root 25 0.0 0.0 0 0 ? S Mar10 0:00 [ata/1]
root 26 0.0 0.0 0 0 ? S Mar10 0:00 [ata_aux]
root 27 0.0 0.0 0 0 ? S Mar10 0:00 [ksuspend_usbd]
root 28 0.0 0.0 0 0 ? S Mar10 0:00 [khubd]
root 29 0.0 0.0 0 0 ? S Mar10 0:00 [kseriod]
root 32 0.0 0.0 0 0 ? S Mar10 0:00 [khungtaskd]
root 33 0.0 0.0 0 0 ? S Mar10 0:04 [kswapd0]
root 34 0.0 0.0 0 0 ? SN Mar10 0:00 [ksmd]
root 35 0.0 0.0 0 0 ? S Mar10 0:00 [aio/0]
root 36 0.0 0.0 0 0 ? S Mar10 0:00 [aio/1]
root 37 0.0 0.0 0 0 ? S Mar10 0:00 [crypto/0]
root 38 0.0 0.0 0 0 ? S Mar10 0:00 [crypto/1]
root 44 0.0 0.0 0 0 ? S Mar10 0:00 [khvcd]
root 45 0.0 0.0 0 0 ? S Mar10 0:00 [kpsmoused]
root 46 0.0 0.0 0 0 ? S Mar10 0:00 [usbhid_resumer]
root 74 0.0 0.0 0 0 ? S Mar10 0:00 [kstriped]
root 218 0.0 0.0 0 0 ? S Mar10 0:03 [kjournald]
root 551 0.0 0.0 0 0 ? S Mar10 0:00 [kauditd]
root 778 0.0 0.0 3972 8 tty1 Ss+ Mar10 0:00 /sbin/mingetty /dev/tty1
root 780 0.0 0.0 3972 8 tty2 Ss+ Mar10 0:00 /sbin/mingetty /dev/tty2
root 782 0.0 0.0 3972 8 tty3 Ss+ Mar10 0:00 /sbin/mingetty /dev/tty3
root 784 0.0 0.0 3972 8 tty4 Ss+ Mar10 0:00 /sbin/mingetty /dev/tty4
root 786 0.0 0.0 3972 8 tty5 Ss+ Mar10 0:00 /sbin/mingetty /dev/tty5
root 788 0.0 0.0 3972 8 tty6 Ss+ Mar10 0:00 /sbin/mingetty /dev/tty6
root 793 0.0 0.0 3984 8 hvc0 Ss+ Mar10 0:00 /sbin/agetty /dev/hvc0 38400 vt100-nav
root 981 0.0 0.0 10700 156 ? S<s Mar10 0:00 /sbin/udevd -d
root 1049 0.0 0.1 64096 428 ? Ss Mar10 0:00 /usr/sbin/sshd
root 1069 0.0 0.1 183212 520 ? Sl Mar10 0:00 /sbin/rsyslogd -i /var/run/syslogd.pid -c 4
root 8940 0.0 1.2 241228 4636 ? Ss Mar10 0:00 /usr/sbin/httpd
apache 8942 0.0 1.2 241228 4548 ? S Mar10 0:00 /usr/sbin/httpd
apache 8943 0.0 1.2 241228 4696 ? S Mar10 0:00 /usr/sbin/httpd
apache 8944 0.0 1.3 241228 5124 ? S Mar10 0:00 /usr/sbin/httpd
apache 8945 0.0 1.2 241228 4532 ? S Mar10 0:00 /usr/sbin/httpd
apache 8946 0.0 1.2 241228 4596 ? S Mar10 0:00 /usr/sbin/httpd
apache 8947 0.0 1.2 241228 4612 ? S Mar10 0:00 /usr/sbin/httpd
apache 8948 0.0 1.2 241228 4596 ? S Mar10 0:00 /usr/sbin/httpd
apache 8949 0.0 1.2 241228 4596 ? S Mar10 0:00 /usr/sbin/httpd
root 9406 0.0 0.5 119672 1872 ? Ss Mar10 0:00 SCREEN
root 9407 0.0 0.2 108388 1048 pts/2 Ss+ Mar10 0:00 /bin/bash
root 9417 0.0 0.3 108352 1404 pts/1 Ss Mar10 0:00 /bin/bash
root 9497 0.0 0.0 0 0 ? S 09:15 0:01 [flush-202:1]
root 9605 0.0 0.9 98024 3652 ? S 09:23 0:00 sshd: root@pts/0
root 9608 0.0 0.4 108356 1520 pts/0 Ss 09:23 0:00 -bash
root 9619 0.0 0.2 118744 1064 pts/0 S+ 09:23 0:00 screen -r
root 9746 0.0 0.3 110284 1180 pts/1 R+ 09:51 0:00 ps aux
Come si può vedere, il processo apache apre un sacco di processi che usano un sacco di ram, o almeno, la allocano, visto che i visitatori sono pari a zero.
apache 8942 0.0 1.2 241228 4548 ? S Mar10 0:00 /usr/sbin/httpd
apache 8943 0.0 1.2 241228 4696 ? S Mar10 0:00 /usr/sbin/httpd
apache 8944 0.0 1.3 241228 5124 ? S Mar10 0:00 /usr/sbin/httpd
apache 8945 0.0 1.2 241228 4532 ? S Mar10 0:00 /usr/sbin/httpd
apache 8946 0.0 1.2 241228 4596 ? S Mar10 0:00 /usr/sbin/httpd
apache 8947 0.0 1.2 241228 4612 ? S Mar10 0:00 /usr/sbin/httpd
apache 8948 0.0 1.2 241228 4596 ? S Mar10 0:00 /usr/sbin/httpd
apache 8949 0.0 1.2 241228 4596 ? S Mar10 0:00 /usr/sbin/httpd
Ma c'è anche ssh che non scherza:
root 9605 0.0 0.9 98024 3652 ? S 09:23 0:00 sshd: root@pts/0
La domanda è: come posso fare in modo che un processo abbia un limite della ram allocata? Perchè per farci girare il server minecraft ho bisogno di almeno ~60Mb di ram liberi!
Grazie.