Want more timely Centmin Mod News Updates?
Become a Member

MariaDB Mysql Memory Usage

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Itworx4me, Jan 8, 2021.

  1. Itworx4me

    Itworx4me Member

    239
    23
    18
    Mar 14, 2017
    Ratings:
    +40
    Local Time:
    5:50 AM
    Nginx 1.17.X
    MariaDB 10.3.X
    Is 25% to much memory for mysql to be using?


    Thanks,
    Itworx4me
     
  2. eva2000

    eva2000 Administrator Staff Member

    47,292
    10,701
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,626
    Local Time:
    10:50 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Optimal memory usage is whatever amount MariaDB MySQL requires so your answer = it's relative to your usage :)

    Also read how linux reported memory usage differs from windows at https://www.linuxatemyram.com/
     
  3. eva2000

    eva2000 Administrator Staff Member

    47,292
    10,701
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,626
    Local Time:
    10:50 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Also you can use pidstat to check process usage for mysqld binary/process which should be accurate on non-openvz systems (openvz systems report memory used differently)

    Code (Text):
    pidstat -C mysqld -durhl | sed -e "s|$(hostname)|hostname|g"
    

    example output with mysqld RSS memory used = 1,331,880 bytes or 4.07%
    Code (Text):
    pidstat -C mysqld -durhl | sed -e "s|$(hostname)|hostname|g"
    Linux 3.10.0-1160.6.1.el7.x86_64 (hostname)     01/08/2021      _x86_64_        (8 CPU)
    #      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s  Command
     1610074615   994      2428    0.01    0.02    0.00    0.03     1      0.09      0.00 13245076 1331880   4.07      0.11      0.05      0.00  /usr/sbin/mysqld
    

    if you have active mysqld load, you can run pidstat at 1 second interval for 10 runs too. If you don't have active mysqld load, it will come back with empty entries
    Code (Text):
    pidstat -C mysqld -durhl 1 10 | sed -e "s|$(hostname)|hostname|g"