zoukankan      html  css  js  c++  java
  • mariadb 10.1查看per connection内存消耗

    在mariadb 10.1版本中,在information_schema.processlist表中,新增了几个字段,其中有一个memory_used,其记录的是连接的内存消耗。

    同时新增了一个状态变量memory_used,其记录的应该是所有连接加起来消耗的内存(官方并没有特别详细地解释https://mariadb.com/kb/en/mariadb/show-processlist/),应该类似于oracle pga的概念。

    为了再检查下mysql占用内存远超过buffer pool的原因,我们特地让运维将某个线上实例从percona切换到了mariadb 10.1.21进行观察。如下:

    [root@iZbp13xgu1d7hpg1gca4ndZ ~]# mysql -uroot -pmysql
    Welcome to the MariaDB monitor.  Commands end with ; or g.
    Your MariaDB connection id is 1046786
    Server version: 10.1.20-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    MariaDB [(none)]> show status like '%memory_used%';
    +---------------+-------+
    | Variable_name | Value |
    +---------------+-------+
    | Memory_used   | 67464 |
    +---------------+-------+
    1 row in set (0.00 sec)
    
    MariaDB [(none)]> show global status like '%memory_used%';
    +---------------+-----------+
    | Variable_name | Value     |
    +---------------+-----------+
    | Memory_used   | 568761128 |
    +---------------+-----------+
    1 row in set (0.00 sec)
    
    MariaDB [(none)]> select user,host,memory_used from information_schema.processlist;
    +-----------------+----------------------+-------------+
    | user            | host                 | memory_used |
    +-----------------+----------------------+-------------+
    | root            | localhost            |       84576 |
    | osm             | 10.253.106.167:47847 |       95376 |
    | osm             | 10.253.106.167:47843 |       94616 |
    | osm             | 10.253.106.167:47845 |       94224 |
    | osm             | 10.253.106.167:47841 |       93856 |
    | osm             | 10.253.106.167:47835 |       94224 |
    | osm             | 10.253.106.167:47836 |       94616 |
    | osm             | 10.253.106.167:47831 |       67464 |
    | osm             | 10.253.106.167:47832 |       67464 |
    | osm             | 10.253.106.167:47815 |       71312 |
    | osm             | 10.253.106.167:47791 |       67464 |
    | osm             | 10.253.106.167:47792 |       67464 |
    | osm             | 10.253.106.167:47780 |       67464 |
    | event_scheduler | localhost            |       39784 |
    +-----------------+----------------------+-------------+
    14 rows in set (0.00 sec)

    在其内存输出中,没有办法得出global memory_used是如何组成的?processlist汇总起来也不是这个值,这确实比较奇怪,官方和各种forum也没找到各种解释。。。

    该服务器buffer pool配置的是4GB,外有一些临时表在用,当前的进程内存消耗如下:

    所以,就算4GB+memory_used也差不多4.55G差不多,和实际的6.4G差距还是蛮大的,看来mysql在这方面还是需要有较大的改进。

  • 相关阅读:
    洛谷[ZJOI2008]骑士(基环树二次DP法+树形DP)
    洛谷P5022 旅行(基环树+断环法)
    AtCoder Beginner Contest 174 ——D.Alter Altar(思维)
    洛谷P1972 [SDOI2009]HH的项链(离线+树状数组)
    CF1365D Solve The Maze (BFS)
    codeforces1426——F. Number of Subsequences(DP)
    codeforces1324——E.Sleeping Schedule(DP+初始化)
    codeforces319——B. Psychos in a Line(思维+单调栈)
    codeforces292——D. Connected Components(并查集+前缀和优化)
    codeforces1013——D. Chemical table(思维+转化+并查集)
  • 原文地址:https://www.cnblogs.com/zhjh256/p/6295457.html
Copyright © 2011-2022 走看看