Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Why do my two identical VM's have such diff RAM usage?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Why do my two identical VM's have such diff RAM usage?

jeromezajeromeza Member
edited March 2014 in Help

Why is my RAM usage so different between the MASTER (NS1) and SLAVE (NS2).

Is this normal? Both exist on two different VPS nodes and both are in separate cities. Same hosting provider.

Both running Ubuntu 12.04 LTS + MySQL server + PDNS (authoritive)

NS2 = SLAVE
NS1 = MASTER

root@ns1:~# free -m
             total       used       free     shared    buffers     cached
Mem:           768        364        403          0          0         28
-/+ buffers/cache:        336        431
Swap:            0          0          0

root@ns2:~# free -m
             total       used       free     shared    buffers     cached
Mem:           768         39        728          0          0         12
-/+ buffers/cache:         26        741
Swap:            0          0          0

Comments

  • NoermanNoerman Member
    edited March 2014

    Post your TOP

    root@ns1:~# top

  • Installed services/programs.

  • @Maximum_VPS - they are IDENTICAL. Spawned at the same time, installed with the same programs. The only difference is one is the master and the other the slave in MySQL.

  • jeromezajeromeza Member
    edited March 2014

    @Noerman

    NS1

    top - 05:40:25 up 13:39,  3 users,  load average: 0.07, 0.02, 0.00
    Tasks:  27 total,   1 running,  26 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:    786432k total,   373752k used,   412680k free,        0k buffers
    Swap:        0k total,        0k used,        0k free,    80452k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
        1 root      20   0 24144 1164  464 S    0  0.1   0:00.12 init
        2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd/10966
        3 root      20   0     0    0    0 S    0  0.0   0:00.00 khelper/10966
       76 root      20   0 17188  312  204 S    0  0.0   0:00.00 upstart-udev-br
       86 root      20   0 21528  352  320 S    0  0.0   0:00.00 udevd
      110 root      20   0 49912 1092  900 S    0  0.1   0:00.07 sshd
      207 messageb  20   0 23772  288  180 S    0  0.0   0:00.00 dbus-daemon
      245 root      20   0 14924  364  360 S    0  0.0   0:00.00 xinetd
      257 root      20   0 19068  440  328 S    0  0.1   0:00.03 cron
      284 mysql     20   0 1339m  27m 3640 S    0  3.5   0:06.33 mysqld
      329 syslog    20   0 12708  524  396 S    0  0.1   0:00.12 syslogd
      399 root      20   0 21524  224  212 S    0  0.0   0:00.00 udevd
      400 root      20   0 21524  244  212 S    0  0.0   0:00.00 udevd
      474 root      20   0 15144  300  104 S    0  0.0   0:00.00 upstart-socket-
      537 root      20   0 78620  924  220 S    0  0.1   0:00.00 saslauthd
      538 root      20   0 78620  720   16 S    0  0.1   0:00.00 saslauthd
      600 root      20   0 89044 2188  496 S    0  0.3   0:00.60 sendmail-mta
      643 root      20   0 69728 1940  436 S    0  0.2   0:00.58 apache2
      646 www-data  20   0 69800 2108  544 S    0  0.3   0:00.00 apache2
     1589 root      20   0 73432 2052 1164 S    0  0.3   0:00.19 sshd
     1603 root      20   0 18028 1260  768 S    0  0.2   0:00.00 bash
     1627 root      20   0 73316 2016 1176 S    0  0.3   0:00.17 sshd
     1641 root      20   0 18028 1256  768 S    0  0.2   0:00.00 bash
     2952 www-data  20   0 69752 2084  552 S    0  0.3   0:00.00 apache2
     3345 root      20   0 73432 3660 2764 S    0  0.5   0:00.02 sshd
     3357 root      20   0 18028 1984 1492 S    0  0.3   0:00.00 bash
     3740 root      20   0 17164 1324 1052 R    0  0.2   0:00.00 top
    

    NS2

    top - 05:41:32 up 14:12,  2 users,  load average: 0.02, 0.02, 0.04
    Tasks:  27 total,   1 running,  26 sleeping,   0 stopped,   0 zombie
    Cpu(s):  0.0%us,  0.0%sy,  0.0%ni, 99.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.1%st
    Mem:    786432k total,    45664k used,   740768k free,        0k buffers
    Swap:        0k total,        0k used,        0k free,    18016k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
        1 root      20   0 24148  788  364 S    0  0.1   0:00.19 init
        2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd/11093
        3 root      20   0     0    0    0 S    0  0.0   0:00.00 khelper/11093
      106 root      20   0 17188  196  192 S    0  0.0   0:00.00 upstart-udev-br
      117 root      20   0 21528  228  224 S    0  0.0   0:00.00 udevd
      155 root      20   0 21524  192  188 S    0  0.0   0:00.00 udevd
      156 root      20   0 21524  192  188 S    0  0.0   0:00.00 udevd
      168 messageb  20   0 23772  180  176 S    0  0.0   0:00.01 dbus-daemon
      196 root      20   0 15144  124  120 S    0  0.0   0:00.00 upstart-socket-
      365 root      20   0 19068  308  236 S    0  0.0   0:00.05 cron
      431 syslog    20   0 12708  464  332 S    0  0.1   0:00.48 syslogd
      452 root      20   0 49912  492  380 S    0  0.1   0:00.20 sshd
      485 root      20   0 78620  176  172 S    0  0.0   0:00.00 saslauthd
      486 root      20   0 78620   20   16 S    0  0.0   0:00.00 saslauthd
      647 root      20   0 14924  236  232 S    0  0.0   0:00.00 xinetd
      672 root      20   0 89044  572  388 S    0  0.1   0:01.29 sendmail-mta
      705 root      20   0 69728  300  260 S    0  0.0   0:01.12 apache2
      708 www-data  20   0 69768  264  252 S    0  0.0   0:00.00 apache2
      714 root      20   0 73316 1016  752 S    0  0.1   0:00.58 sshd
      726 root      20   0 18028  224  220 S    0  0.0   0:00.03 bash
     3650 mysql     20   0 1463m 2400  400 S    0  0.3   0:09.43 mysqld
     4570 root      20   0 97956  436  372 S    0  0.1   0:02.16 pdns_server
     4836 www-data  20   0 69752  240  228 S    0  0.0   0:00.00 apache2
     4900 root      20   0  480m  640  420 S    0  0.1   0:00.02 pdns_server
     7324 root      20   0 73432 3652 2764 S    0  0.5   0:00.04 sshd
     7340 root      20   0 18028 1988 1492 S    0  0.3   0:00.00 bash
     7724 root      20   0 17164 1324 1052 R    0  0.2   0:00.01 top
    
  • @jeromeza said:
    Maximum_VPS - they are IDENTICAL. Spawned at the same time, installed with the same programs. The only difference is one is the master and the other the slave in MySQL.

    I think you have answered for yourself "The only difference is one is the master and the other the slave in MySQL."

    Thanked by 1Maximum_VPS
  • @xDragonZ is correct.

  • jeromezajeromeza Member
    edited March 2014

    @xDragonZ - does that really result in a 300 odd MB increase in RAM? If so i'm happy to have solved it - I just can't fathom why it would need so much more, considering the slave holds the same data?

    My first time running a MySQL replicated DNS server - so i'm merely curious as to the difference in resources required.

    Thanks,

  • NickMNickM Member

    Is this on OpenVZ?

  • @NickM - Yes both OpenVZ

  • NickMNickM Member

    Is there anything missing from your top output? I don't even see pdns on NS1.

  • @NickM - Hmmm somehow it PDNS stopped itself on NS1 - started it again. Still usage on NS2 is far less - must be MySQL then as, as soon as I stop it usage falls dramatically.

    So it seems master VPS needs way more specs than the slave.

    Would one be able to run master on say 512MB and Slave on 128MB or would that only work until the master falls over and the slave needs to pickup the slack?

    OR

    Would it be fine as the slave doesn't replicate back to master?

  • NickMNickM Member

    I can't really think of a reason that your master would be using that much more memory than your slave. I suppose if your ns2 isn't getting any traffic at all, your ns1 would be using a bit more memory.

    I really wouldn't recommend anything less than 512MB for a MySQL server, regardless of whether it's a slave or a master. Sure, you can tweak mysql to the point where it's using very little memory, but at that point, you're just going to be hitting the disk more as tables no longer fit into memory, etc.

    Actually... I just thought of something... Is it possible that one node is using 2.6.18 kernel and the other is using 2.6.32? OpenVZ counts memory differently depending on which kernel is being used, so you might want to check with your provider (uname -a will NOT tell you the actual kernel version being used on the node).

    Aside: Is anyone even using .18 anymore?

    Slightly off-topic: I know this is LowEndTalk, but I've never been one to worry about memory usage too much. And nowadays, considering that you can get 1GB for $5 a month from reliable providers, I care even less.

  • SplitIceSplitIce Member, Host Rep

    Linux memory is basically

    used = used
    free = free + buffers + cache

    Think of it this way.

    Ideally, you get NOTHING from ram being free (if anything your host if OpenVZ gets to oversell from you not using your ram). So its best it is put to use. Linux puts it to use caching the file system (disk = slow, ram = fast).

    BTW if you hit the ">" key in top it will change the sort by column alowing you to see what is using the memory.

  • tchentchen Member

    Master has table and query caches, slave does not - at least not with row repl.

  • Try mysqlreport to get more details on how MySQL is using RAM.

  • Maybe your queries runs on the master and consuming bufferbspace.

  • Linux also uses memory for inode caching, which is not accounted for in your "cached" memory usage.

    You need to do a sync && drop caches to see actual, real memory usage.

Sign In or Register to comment.