Hi, is this ok for a database server, or do I need to turn the memory allowance down? The machine has 48GB and mariadb is allowed about 40. The machine is a dedicated database server. Mysql seems to go up to what top says is virtually allocated under some circumstances; I don?t know what mariadb does. I don?t want anything get killed because memory runs out. Swap should prevent that anyway, but perhaps I went a bit higher than I should? Usual advice is to use 80%, and there are probably reasons for that. Perhaps it?s better to allow for more disk cache? KiB Mem : 49449424 total, 291772 free, 45891836 used, 3265816 buff/cache KiB Swap: 16777212 total, 16742928 free, 34284 used. 2985816 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4138 mysql 20 0 48.908g 0.042t 14064 S 0.0 91.8 111:23.17 mysqld
Disk cache is not recommended for databases servers. it'll slow down the performance. More ram equals more performance. This link help me understand memory usage on linux. https://www.linuxatemyram.com/ Basically you need yo worry about free memory is close to 0 used memory is close to total available memory (or "free + buffers/cache") has enough room (let's say, 20%+ of total) swap used does not change Warning signs of a genuine low memory situation that you may want to look into: available memory (or "free + buffers/cache") is close to zero swap used increases or fluctuates dmesg | grep oom-killer shows the OutOfMemory-killer at work You can monitory swap with "vmsat 1" <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Livre de v?rus. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>. <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> 2017-11-04 12:05 GMT-02:00 hw <hw at gc-24.de>:> > Hi, > > is this ok for a database server, or do I need to turn the memory allowance > down? The machine has 48GB and mariadb is allowed about 40. The > machine is a dedicated database server. > > Mysql seems to go up to what top says is virtually allocated under some > circumstances; I don?t know what mariadb does. I don?t want anything > get killed because memory runs out. Swap should prevent that anyway, > but perhaps I went a bit higher than I should? > > Usual advice is to use 80%, and there are probably reasons for that. > Perhaps it?s better to allow for more disk cache? > > > KiB Mem : 49449424 total, 291772 free, 45891836 used, 3265816 buff/cache > KiB Swap: 16777212 total, 16742928 free, 34284 used. 2985816 avail Mem > > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND > 4138 mysql 20 0 48.908g 0.042t 14064 S 0.0 91.8 111:23.17 mysqld > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos >
On 11/04/2017 10:05 AM, hw wrote:> > Hi, > > is this ok for a database server, or do I need to turn the memory > allowance > down?? The machine has 48GB and mariadb is allowed about 40. The > machine is a dedicated database server. > > Mysql seems to go up to what top says is virtually allocated under some > circumstances; I don?t know what mariadb does.? I don?t want anything > get killed because memory runs out.? Swap should prevent that anyway, > but perhaps I went a bit higher than I should? > > Usual advice is to use 80%, and there are probably reasons for that. > Perhaps it?s better to allow for more disk cache? > > > KiB Mem : 49449424 total,?? 291772 free, 45891836 used,? 3265816 > buff/cache > KiB Swap: 16777212 total, 16742928 free,??? 34284 used.? 2985816 avail > Mem > > ? PID USER????? PR? NI??? VIRT??? RES??? SHR S? %CPU %MEM TIME+ COMMAND > ?4138 mysql???? 20?? 0 48.908g 0.042t? 14064 S?? 0.0 91.8 111:23.17 > mysqld >What exactly do you mean by 'memory allowance'?? That's a pretty open question.? It all depends on your databases and usage.? The typical 'best practices' answer is to set the buffer pool to ~75-80% of RAM if the total size of all your DBs exceeds the total amount of RAM on the server.? The idea being that you want to have as much (or all) of the databases in RAM as that's much faster than going to disk for it. If the total size of your DBs is less than the total RAM, I typically allocate enough to take all DBs into RAM? +10-20% for projected growth.? You haven't mentioned the size of the DB(s) you're running on the server, nor what your usage pattern might be (heavy reads, heavy writes or a balance of the two).? You also didn't post the config file either.? I know this is a bit OT, but config files are very helpful for any issue.? Just looking at the RAM usage you posted, I would be a bit worried by the fact you only have ~300MB of 'free' RAM.? If the total in the cache is all buffer pool, it should be fine, but I typically don't run a DB server that low on physical RAM.? Swap is fine, but much slower than RAM, even on SSDs. We can take this offlist if you like, I'll be happy to help you take a look at the configs and offer suggestions. -- Mark Haney Network Engineer at NeoNova 919-460-3330 option 1 mark.haney at neonova.net www.neonova.net
Mark Haney wrote:> On 11/04/2017 10:05 AM, hw wrote: >> >> Hi, >> >> is this ok for a database server, or do I need to turn the memory allowance >> down? The machine has 48GB and mariadb is allowed about 40. The >> machine is a dedicated database server. >> >> Mysql seems to go up to what top says is virtually allocated under some >> circumstances; I don?t know what mariadb does. I don?t want anything >> get killed because memory runs out. Swap should prevent that anyway, >> but perhaps I went a bit higher than I should? >> >> Usual advice is to use 80%, and there are probably reasons for that. >> Perhaps it?s better to allow for more disk cache? >> >> >> KiB Mem : 49449424 total, 291772 free, 45891836 used, 3265816 buff/cache >> KiB Swap: 16777212 total, 16742928 free, 34284 used. 2985816 avail Mem >> >> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND >> 4138 mysql 20 0 48.908g 0.042t 14064 S 0.0 91.8 111:23.17 mysqld >> > What exactly do you mean by 'memory allowance'? That's a pretty open question. It all depends on your databases and usage. The typical 'best practices' answer is to set the buffer pool to ~75-80% of RAM if the total size of all your DBs exceeds the total amount of RAM on the server. The idea being that you want to have as much (or all) of the databases in RAM as that's much faster than going to disk for it. If the total size of your DBs is less than the total RAM, I typically allocate enough to take all DBs into RAM +10-20% for projected growth. You haven't mentioned the size of the DB(s) you're running on the server, nor what your usage pattern might be (heavy reads, heavy writes or a balance of the two). You also didn't post the config file either. I know this is a bit OT, but config files are very helpful for any issue. Just looking at the RAM usage you posted, I would be a bit worried by the fact you only have ~300MB of 'free' RAM. If the total in the cache is > all buffer pool, it should be fine, but I typically don't run a DB server that low on physical RAM. Swap is fine, but much slower than RAM, even on SSDs.I mean "allowing mariadb to use some amount of memory", which is mainly influenced by the size of the buffer pool. 300MB? It?s almost 3GB, isn?t it? Considering that the server doesn?t do anything else, it /might/ be fine, which is I?m worrying about it. Of course swap is slower; it would only be there in case memory usage goes up. I?ll monitor it and will see how it goes. If I am taking a risk with setting the allowance so high, I rather turn it down.> We can take this offlist if you like, I'll be happy to help you take a look at the configs and offer suggestions.Thanks, I?ll send you the current config :)
marcos valentine wrote:> Disk cache is not recommended for databases servers. > > it'll slow down the performance. More ram equals more performance. > > This link help me understand memory usage on linux. > > https://www.linuxatemyram.com/ > > Basically you need yo worry about > > free memory is close to 0 > used memory is close to totalAlmost 3GB available on a 48GB machine is very close to "free memory is 0" and "used memory is close to total", which is why I?m wondering what I can get away with :) This free memory can go away in less than a second. Maybe it never will, so I figured why not use as much as possible --- just not too much, and this is borderline.