Some spam about memory usage in vServers...

Introduce yourself, create test postings or talk nonsense
Post Reply
User avatar
thenktor
Salix Wizard
Posts: 2426
Joined: 6. Jun 2009, 14:47
Location: Franconia
Contact:

Some spam about memory usage in vServers...

Post by thenktor »

At the moment I'm having to vServers and I'm trying to run a mediawiki on it:
1. Salix64, 128 MB RAM, OpenVZ
2. Salix32, 200 MB RAM, 500 MB swap, Xen

It seems the memory usage of both systems differs greatly. Could it be related to the 32/64 bit version of mysql?
Here is output of the Salix64, 128 MB RAM, OpenVZ right after boot and with mysql server started. Another strange thing is that there are no cache/buffers used (perhaps related to OpenVZ?):

Code: Select all

root@darkstar:~# ps ax
  PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:00 init [3]      
   53 ?        S<s    0:00 /sbin/udevd --daemon
  118 ?        Ss     0:00 /usr/sbin/syslogd
  248 ?        Ss     0:00 /usr/sbin/inetd
  251 ?        Ss     0:00 /usr/sbin/sshd
  264 ?        S      0:00 /usr/sbin/crond -l10
  266 ?        Ss     0:00 /usr/sbin/atd -b 15 -l 1
  285 ?        Ss     0:00 sshd: root@pts/0 
  287 pts/0    Ss     0:00 -bash
  302 pts/0    R+     0:00 ps ax

root@darkstar:~# free -m
             total       used       free     shared    buffers     cached
Mem:           128          9        118          0          0          0
-/+ buffers/cache:          9        118
Swap:            0          0          0

root@darkstar:~# chmod +x /etc/rc.d/rc.mysqld
root@darkstar:~# /etc/rc.d/rc.mysqld start
root@darkstar:~# nohup: leite Standardfehlerausgabe auf Standardausgabe um
Starting mysqld daemon with databases from /var/lib/mysql

root@darkstar:~# free -m
             total       used       free     shared    buffers     cached
Mem:           128         98         29          0          0          0
-/+ buffers/cache:         98         29
Swap:            0          0          0
Here is the same for the Salix32, 200 MB RAM server. The mysql server only needs additional 10 MB:

Code: Select all

root@slackware_pristine:~# ps ax 
  PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:00 init [3]  
    2 ?        S<     0:00 [kthreadd]
    3 ?        S<     0:00 [migration/0]
    4 ?        S<     0:00 [ksoftirqd/0]
    5 ?        S<     0:00 [watchdog/0]
    6 ?        S<     0:00 [events/0]
    7 ?        S<     0:00 [khelper]
   19 ?        S<     0:00 [xenwatch]
   20 ?        S<     0:00 [xenbus]
   50 ?        S<     0:00 [kblockd/0]
   59 ?        S<     0:00 [ksuspend_usbd]
   65 ?        S<     0:00 [khubd]
   68 ?        S<     0:00 [kseriod]
  100 ?        S      0:00 [pdflush]
  101 ?        S      0:00 [pdflush]
  102 ?        S<     0:00 [kswapd0]
  103 ?        S<     0:00 [aio/0]
  223 ?        S<     0:00 [net_accel/0]
  536 ?        S<     0:00 [kstriped]
  541 ?        S<     0:00 [ksnapd]
  569 ?        S<     0:00 [kjournald]
  629 ?        S<s    0:00 /sbin/udevd --daemon
  874 ?        Ss     0:00 /usr/sbin/syslogd
  878 ?        Ss     0:00 /usr/sbin/klogd -c 3 -x
 1123 ?        Ss     0:00 /usr/sbin/sshd
 1144 ?        S      0:00 /usr/sbin/crond -l10
 1148 ?        Rs     0:00 sshd: root@pts/0 
 1150 pts/0    Rs     0:00 -bash
 1163 pts/0    R+     0:00 ps ax

root@slackware_pristine:~# free -m
             total       used       free     shared    buffers     cached
Mem:           200         32        167          0          2         12
-/+ buffers/cache:         18        181
Swap:          249          0        249

root@slackware_pristine:~# chmod +x /etc/rc.d/rc.mysqld 
root@slackware_pristine:~# /etc/rc.d/rc.mysqld start
root@slackware_pristine:~# nohup: redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql

root@slackware_pristine:~# free -m
             total       used       free     shared    buffers     cached
Mem:           200         51        148          0          2         20
-/+ buffers/cache:         28        171
Swap:          249          0        249
Perhaps I'll try to get Salix32 on that other server to see what happens then :)
Image
burnCDDA (burns audio CDs)
geBIERt (German beer blog)
User avatar
thenktor
Salix Wizard
Posts: 2426
Joined: 6. Jun 2009, 14:47
Location: Franconia
Contact:

Re: Some spam about memory usage in vServers...

Post by thenktor »

OK, I've installed Salix32 on that small server and got the same results:

Code: Select all

root@darkstar:/# ps ax
  PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:00 init [3]      
   53 ?        S<s    0:00 /sbin/udevd --daemon
  118 ?        Ss     0:00 /usr/sbin/syslogd
  247 ?        Ss     0:00 /usr/sbin/inetd
  250 ?        Ss     0:00 /usr/sbin/sshd
  263 ?        S      0:00 /usr/sbin/crond -l10
  265 ?        Ss     0:00 /usr/sbin/atd -b 15 -l 1
  281 ?        Rs     0:00 sshd: root@pts/0 
  283 pts/0    Ss     0:00 -bash
  386 pts/0    R+     0:00 ps ax

root@darkstar:/# free -m
             total       used       free     shared    buffers     cached
Mem:           128          9        118          0          0          0
-/+ buffers/cache:          9        118
Swap:            0          0          0

root@darkstar:/# /etc/rc.d/rc.mysqld start
root@darkstar:/# nohup: leite Standardfehlerausgabe auf Standardausgabe um
Starting mysqld daemon with databases from /var/lib/mysql

root@darkstar:/# free -m
             total       used       free     shared    buffers     cached
Mem:           128        102         25          0          0          0
-/+ buffers/cache:        102         25
Swap:            0          0          0
So what can we learn from this? RAM usage can differ greatly for no reason :P
Or perhaps OpenVZ vservers suck and you should go for an Xen vserver? Or the kernel on the OpenVZ host sucks? Or... damn it... it's friday night... give me a beer :mrgreen:
Image
burnCDDA (burns audio CDs)
geBIERt (German beer blog)
User avatar
thenktor
Salix Wizard
Posts: 2426
Joined: 6. Jun 2009, 14:47
Location: Franconia
Contact:

Re: Some spam about memory usage in vServers...

Post by thenktor »

If I understand this article right: http://hostingfu.com/article/xen-or-openvz
The OpenVZ doesn't use buffers/cache at all. Every RAM that is allocated by a process is just counted as used RAM. MySQL seems to allocated a quite huge amount of RAM at start (topvalues: VIRT ~90MB, RES ~13 MB, SHR ~3 MB). This and the fact, that there is no swap available on OpenVZ it makes it quite unusable on small RAM sizes.
Image
burnCDDA (burns audio CDs)
geBIERt (German beer blog)
Post Reply