Mysql eat a lot of memory but innodb_buffer_pollsize is set to 50%

memorymysql-5.7mysqltunerUbuntu

I don't understand why my mysql eat a lot of memory even though I set innodb_buffer_poll_size to around 50%

here is my top

user@Mulia-Abadi:~$ top
top - 11:09:31 up 12 days, 16:30,  3 users,  load average: 5.43, 5.66, 5.75
Tasks: 395 total,   1 running, 284 sleeping,   0 stopped,   1 zombie
%Cpu(s): 34.5 us,  0.9 sy,  1.4 ni, 63.0 id,  0.3 wa,  0.0 hi,  0.0 si,  0.0 st

KiB Mem : 16089320 total,   168544 free, 13805028 used,  2115748 buff/cache

KiB Swap: 31231996 total, 30252540 free,   979456 used.  1948108 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND

10553 mysql     20   0 22.356g 0.012t  12644 S 544.0 80.0 363:08.77 mysqld

11251 user      30  10   52004  16708   3844 S  28.8  0.1   1:58.98 binaryring

here my.cnf

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice        = 0

[mysqld]
#
# * Basic Settings
#
#validate_password_policy=LOW
#federated
sql-mode=TRADITIONAL
innodb_lock_wait_timeout=50
transaction-isolation=READ-COMMITTED
skip-name-resolve
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /var/lib/mysql
tmpdir      = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

# coba betulin error free blocks
innodb_buffer_pool_size=4G
#untuk Scheduler
event_scheduler=ON
#Untuk Skip Error jika free block Error
innodb_doublewrite=off
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address           =127.0.0.1
bind-address        = 0.0.0.0
#
# * Fine Tuning
#
key_buffer_size     = 10M
max_allowed_packet  = 512M
thread_stack        = 192K
thread_cache_size       = 8
wait_timeout        = 3600
interactive_timeout = 3600
innodb_log_file_size    = 256M
#innodb_buffer_pool_instances = 4
#table_open_cache   = 3419
#join_buffer_size   = 1M
#read_rnd_buffer_size   = 1M
#sort_buffer_size   = 1M

# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options  = BACKUP
max_connections        = 251
table_open_cache       = 3000
performance_schema=1
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit   = 1M
query_cache_size        = 80M
query_cache_type    = 1
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#slow_query_log     = 1
#slow_query_log_file    = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id      = 1
#log_bin            = /var/log/mysql/mysql-bin.log
expire_logs_days    = 10
max_binlog_size     = 100M
#binlog_do_db       = include_database_name
#binlog_ignore_db   = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
max_heap_table_size      = 128M
tmp_table_size       = 128M
thread_stack         = 256K
innodb_stats_on_metadata = 0
optimizer_search_depth   = 0

I am using
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-42-generic x86_64)

and the Mysql version is
5.7.24

I tried article https://www.percona.com/blog/2018/06/28/what-to-do-when-mysql-runs-out-of-memory-troubleshooting-guide/

but I'm still don't understand what cause it

When I run this

SELECT event_name, current_alloc, high_alloc 
FROM sys.memory_global_by_current_bytes 
WHERE current_count > 0;

the output is this

"event_name"    "current_alloc" "high_alloc"
"memory/sql/sp_head::main_mem_root" "137.86 MiB"    "228.69 MiB"
"memory/memory/HP_PTRS" "127.66 MiB"    "2.69 GiB"
"memory/performance_schema/table_handles"   "27.19 MiB" "27.19 MiB"
"memory/sql/TABLE"  "17.60 MiB" "19.32 MiB"
"memory/mysys/TREE" "15.15 MiB" "862.44 MiB"
"memory/performance_schema/events_statements_history_long"  "13.66 MiB" "13.66 MiB"
"memory/sql/thd::main_mem_root" "9.92 MiB"  "79.77 MiB"
"memory/performance_schema/events_statements_summary_by_digest.tokens"  "9.77 MiB"  "9.77 MiB"
"memory/performance_schema/events_statements_history_long.tokens"   "9.77 MiB"  "9.77 MiB"
"memory/performance_schema/events_statements_history_long.sqltext"  "9.77 MiB"  "9.77 MiB"
"memory/innodb/mem0mem" "9.08 MiB"  "14.71 MiB"
"memory/performance_schema/events_statements_summary_by_thread_by_event_name"   "8.67 MiB"  "8.67 MiB"
"memory/performance_schema/file_instances"  "8.25 MiB"  "8.25 MiB"
"memory/sql/JOIN_CACHE" "5.75 MiB"  "38.00 MiB"
"memory/performance_schema/memory_summary_by_thread_by_event_name"  "5.62 MiB"  "5.62 MiB"
"memory/performance_schema/events_statements_summary_by_digest" "4.88 MiB"  "4.88 MiB"
"memory/performance_schema/events_statements_summary_by_account_by_event_name"  "4.33 MiB"  "4.33 MiB"
"memory/performance_schema/events_statements_summary_by_host_by_event_name" "4.33 MiB"  "4.33 MiB"
"memory/performance_schema/events_statements_summary_by_user_by_event_name" "4.33 MiB"  "4.33 MiB"
"memory/performance_schema/table_shares"    "4.00 MiB"  "4.00 MiB"
"memory/performance_schema/events_statements_history"   "3.50 MiB"  "3.50 MiB"
"memory/performance_schema/events_statements_current"   "3.50 MiB"  "3.50 MiB"
"memory/performance_schema/events_waits_summary_by_thread_by_event_name"    "3.31 MiB"  "3.31 MiB"
"memory/performance_schema/events_transactions_history_long"    "3.28 MiB"  "3.28 MiB"
"memory/sql/TABLE_SHARE::mem_root"  "2.85 MiB"  "2.87 MiB"
"memory/performance_schema/memory_summary_by_account_by_event_name" "2.81 MiB"  "2.81 MiB"
"memory/performance_schema/memory_summary_by_host_by_event_name"    "2.81 MiB"  "2.81 MiB"
"memory/performance_schema/memory_summary_by_user_by_event_name"    "2.81 MiB"  "2.81 MiB"
"memory/performance_schema/table_io_waits_summary_by_index_usage"   "2.75 MiB"  "2.75 MiB"
"memory/innodb/row0sel" "2.64 MiB"  "3.94 MiB"
"memory/performance_schema/events_statements_history.tokens"    "2.50 MiB"  "2.50 MiB"
"memory/performance_schema/events_statements_history.sqltext"   "2.50 MiB"  "2.50 MiB"
"memory/performance_schema/events_statements_current.tokens"    "2.50 MiB"  "2.50 MiB"
"memory/performance_schema/events_statements_current.sqltext"   "2.50 MiB"  "2.50 MiB"
"memory/performance_schema/rwlock_instances"    "2.00 MiB"  "2.00 MiB"
"memory/performance_schema/mutex_instances" "1.75 MiB"  "1.75 MiB"
"memory/performance_schema/events_waits_history_long"   "1.68 MiB"  "1.68 MiB"
"memory/performance_schema/events_waits_summary_by_account_by_event_name"   "1.66 MiB"  "1.66 MiB"
"memory/performance_schema/events_waits_summary_by_host_by_event_name"  "1.66 MiB"  "1.66 MiB"
"memory/performance_schema/events_waits_summary_by_user_by_event_name"  "1.66 MiB"  "1.66 MiB"
"memory/performance_schema/prepared_statements_instances"   "1.62 MiB"  "1.62 MiB"
"memory/innodb/ha_innodb"   "1.62 MiB"  "2.35 MiB"
"memory/performance_schema/table_lock_waits_summary_by_table"   "1.34 MiB"  "1.34 MiB"
"memory/performance_schema/events_stages_summary_by_thread_by_event_name"   "1.17 MiB"  "1.17 MiB"
"memory/performance_schema/events_stages_history_long"  "1015.62 KiB"   "1015.62 KiB"
"memory/performance_schema/threads" "928.00 KiB"    "928.00 KiB"
"memory/performance_schema/events_transactions_history" "860.00 KiB"    "860.00 KiB"
"memory/sql/String::value"  "768.66 KiB"    "2.47 MiB"
"memory/performance_schema/events_stages_summary_by_account_by_event_name"  "600.00 KiB"    "600.00 KiB"
"memory/performance_schema/events_stages_summary_by_host_by_event_name" "600.00 KiB"    "600.00 KiB"
"memory/performance_schema/events_stages_summary_by_user_by_event_name" "600.00 KiB"    "600.00 KiB"
"memory/performance_schema/events_statements_summary_by_program"    "448.00 KiB"    "448.00 KiB"
"memory/performance_schema/events_waits_history"    "440.00 KiB"    "440.00 KiB"
"memory/performance_schema/events_stages_history"   "260.00 KiB"    "260.00 KiB"
"memory/performance_schema/file_handle" "256.00 KiB"    "256.00 KiB"
"memory/sql/Filesort_buffer::sort_keys" "0 bytes"   "19.42 MiB"
"memory/memory/HP_SHARE"    "210.02 KiB"    "1.85 MiB"
"memory/mysys/IO_CACHE" "128.02 KiB"    "13.78 MiB"
"memory/memory/HP_INFO" "140.17 KiB"    "1.19 MiB"
"memory/performance_schema/session_connect_attrs"   "128.00 KiB"    "128.00 KiB"
"memory/performance_schema/accounts"    "88.00 KiB" "88.00 KiB"
"memory/performance_schema/socket_instances"    "80.00 KiB" "80.00 KiB"
"memory/performance_schema/users"   "80.00 KiB" "80.00 KiB"
"memory/sql/Filesort_info::record_pointers" "2.72 KiB"  "1.44 MiB"
"memory/performance_schema/hosts"   "72.00 KiB" "72.00 KiB"
"memory/innodb/rem0rec" "64.69 KiB" "91.89 KiB"
"memory/performance_schema/memory_class"    "60.00 KiB" "60.00 KiB"
"memory/performance_schema/setup_objects"   "56.00 KiB" "56.00 KiB"
"memory/performance_schema/mutex_class" "52.50 KiB" "52.50 KiB"
"memory/innodb/btr0pcur"    "51.87 KiB" "81.33 KiB"
"memory/sql/NET::buff"  "48.02 KiB" "192.08 KiB"
"memory/performance_schema/setup_actors"    "40.00 KiB" "40.00 KiB"
"memory/sql/THD::sp_cache"  "39.92 KiB" "55.89 KiB"
"memory/performance_schema/stage_class" "37.50 KiB" "37.50 KiB"
"memory/performance_schema/statement_class" "36.19 KiB" "36.19 KiB"
"memory/performance_schema/events_statements_summary_global_by_event_name"  "34.68 KiB" "34.68 KiB"
"memory/performance_schema/cond_instances"  "32.00 KiB" "32.00 KiB"
"memory/performance_schema/file_class"  "25.00 KiB" "25.00 KiB"
"memory/sql/THD::Session_tracker"   "24.94 KiB" "100.51 KiB"
"memory/performance_schema/memory_summary_global_by_event_name" "22.50 KiB" "22.50 KiB"
"memory/performance_schema/events_transactions_summary_by_thread_by_event_name" "22.00 KiB" "22.00 KiB"
"memory/performance_schema/cond_class"  "20.00 KiB" "20.00 KiB"
"memory/innodb/trx0undo"    "17.88 KiB" "20.28 KiB"
"memory/myisam/MI_INFO" "14.92 KiB" "134.30 KiB"
"memory/innodb/os0event"    "13.41 KiB" "66.80 KiB"
"memory/sql/PROFILE"    "12.24 KiB" "15.38 KiB"
"memory/sql/THD::transactions::mem_root"    "12.05 KiB" "20.08 KiB"
"memory/performance_schema/events_transactions_summary_by_account_by_event_name"    "11.00 KiB" "11.00 KiB"
"memory/performance_schema/events_transactions_summary_by_host_by_event_name"   "11.00 KiB" "11.00 KiB"
"memory/performance_schema/events_transactions_summary_by_user_by_event_name"   "11.00 KiB" "11.00 KiB"
"memory/innodb/partitioning"    "10.86 KiB" "23.28 KiB"
"memory/performance_schema/rwlock_class"    "10.00 KiB" "10.00 KiB"
"memory/mysys/lf_node"  "9.77 KiB"  "9.77 KiB"
"memory/performance_schema/thread_class"    "9.38 KiB"  "9.38 KiB"
"memory/sql/Queue::queue_item"  "7.03 KiB"  "9.38 KiB"
"memory/mysys/lf_slist" "6.28 KiB"  "6.28 KiB"
"memory/myisam/record_buffer"   "5.17 KiB"  "480.61 KiB"
"memory/innodb/std" "4.94 KiB"  "31.92 KiB"
"memory/performance_schema/scalable_buffer" "4.92 KiB"  "4.92 KiB"
"memory/performance_schema/events_stages_summary_global_by_event_name"  "4.69 KiB"  "4.69 KiB"
"memory/sql/QUICK_RANGE_SELECT::alloc"  "3.97 KiB"  "654.84 KiB"
"memory/innodb/dict0dict"   "3.68 KiB"  "20.59 KiB"
"memory/performance_schema/socket_class"    "3.12 KiB"  "3.12 KiB"
"memory/sql/MYSQL_LOCK" "3.07 KiB"  "30.20 KiB"
"memory/sql/THD::variables" "2.94 KiB"  "5.25 KiB"
"memory/sql/user_var_entry" "1.55 KiB"  "4.73 KiB"
"memory/sql/Prepared_statement_map" "1.50 KiB"  "2.50 KiB"
"memory/vio/vio"    "1.45 KiB"  "5.81 KiB"
"memory/sql/THD::db"    "765 bytes" "993 bytes"
"memory/sql/TABLE::sort_io_cache"   "560 bytes" "36.09 KiB"
"memory/sql/THD::Session_sysvar_resource_manager"   "483 bytes" "1.89 KiB"
"memory/myisam/keycache_thread_var" "400 bytes" "560 bytes"
"memory/sql/acl_cache"  "309 bytes" "309 bytes"
"memory/sql/user_var_entry::value"  "128 bytes" "128 bytes"
"memory/mysys/MY_BITMAP::bitmap"    "56 bytes"  "176 bytes"
"memory/mysys/my_file_info" "34 bytes"  "4.34 KiB"
"memory/sql/my_bitmap_map"  "4 bytes"   "668 bytes"

when it query

SELECT  SUBSTRING_INDEX(
    SUBSTRING_INDEX(event_name, '/', 2), 
    '/', 
    -1
    )  AS event_type, 
    ROUND(SUM(CURRENT_NUMBER_OF_BYTES_USED)/1024/1024, 2) AS MB_CURRENTLY_USED
    FROM performance_schema.memory_summary_global_by_event_name 
    GROUP BY event_type
    HAVING MB_CURRENTLY_USED>0;

the result is this

"event_type"    "MB_CURRENTLY_USED"
"innodb"    "12.42"
"memory"    "6.11"
"myisam"    "0.04"
"mysys" "0.02"
"performance_schema"    "170.93"
"sql"   "141.86"

update:
I am using mysqltuner now
this is the result

     >>  MySQLTuner 1.7.2 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering

[--] Skipped version check for MySQLTuner script
[OK] Logged in using credentials from debian maintenance account.
[OK] Currently running supported MySQL version 5.7.24-0ubuntu0.18.04.1
[OK] Operating on 64-bit architecture

-------- Log file Recommendations ------------------------------------------------------------------
[--] Log file: /var/log/mysql/error.log(2K)
[OK] Log file /var/log/mysql/error.log exists
[OK] Log file /var/log/mysql/error.log is readable.
[OK] Log file /var/log/mysql/error.log is not empty
[OK] Log file /var/log/mysql/error.log is smaller than 32 Mb
[OK] /var/log/mysql/error.log doesn't contain any warning.
[!!] /var/log/mysql/error.log contains 15 error(s).
[--] 0 start(s) detected in /var/log/mysql/error.log
[--] 0 shutdown(s) detected in /var/log/mysql/error.log

-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA
[--] Data in InnoDB tables: 5G (Tables: 2595)
[OK] Total fragmented tables: 0

-------- Security Recommendations ------------------------------------------------------------------
[OK] There are no anonymous accounts for any database users
[!!] User 'root@localhost' has no password set.
[--] Bug #80860 MySQL 5.7: Avoid testing password when validate_password is activated

-------- CVE Security Recommendations --------------------------------------------------------------
[OK] NO SECURITY CVE FOUND FOR YOUR VERSION

-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 16h 38m 44s (1M q [22.915 qps], 1K conn, TX: 1G, RX: 152M)
[--] Reads / Writes: 61% / 39%
[--] Binary logging is disabled
[--] Physical Memory     : 15.3G
[--] Max MySQL memory    : 4.5G
[--] Other process memory: 331.1M
[--] Total buffers: 4.2G global + 1.1M per thread (251 max threads)
[--] P_S Max memory usage: 72B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 4.3G (28.27% of installed RAM)
[OK] Maximum possible memory usage: 4.5G (29.36% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (0/1M)
[OK] Highest usage of available connections: 39% (99/251)
[OK] Aborted connections: 0.06%  (1/1557)
[!!] Query cache may be disabled by default due to mutex contention.
[OK] Query cache efficiency: 90.3% (1M cached / 1M selects)
[OK] Query cache prunes per day: 0
[!!] Sorts requiring temporary tables: 26% (17K temp sorts / 67K sorts)
[!!] Joins performed without indexes: 12962
[OK] Temporary tables created on disk: 19% (27K on disk / 144K total)
[OK] Thread cache hit rate: 88% (172 created / 1K connections)
[!!] Table cache hit rate: 4% (2K open / 50K opened)
[OK] Open file limit used: 0% (20/5K)
[OK] Table locks acquired immediately: 100% (11K immediate / 11K locks)

-------- Performance schema ------------------------------------------------------------------------
[--] Memory used by P_S: 72B
[--] Sys schema is installed.

-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is disabled.

-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 19.2% (2M used / 10M cache)
[OK] Key buffer size / total MyISAM indexes: 10.0M/53.0K
[OK] Read Key buffer hit rate: 99.1% (1K cached / 15 reads)

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[!!] InnoDB buffer pool / data size: 4.0G/6.0G
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (12.5 %): 256.0M * 2/4.0G should be equal 25%
[!!] InnoDB buffer pool instances: 8
[--] Number of InnoDB Buffer Pool Chunk : 32 for 8 Buffer Pool Instance(s)
[OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
[OK] InnoDB Read buffer efficiency: 100.00% (10193882200 hits/ 10193933386 total)
[!!] InnoDB Write Log efficiency: 19.11% (9155 hits/ 47900 total)
[OK] InnoDB log waits: 0.00% (0 waits / 57055 writes)

-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is disabled.

-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.

-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.

-------- RocksDB Metrics ---------------------------------------------------------------------------
[--] RocksDB is disabled.

-------- Spider Metrics ----------------------------------------------------------------------------
[--] Spider is disabled.

-------- Connect Metrics ---------------------------------------------------------------------------
[--] Connect is disabled.

-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.

-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] This is a standalone server.

-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
    Control error line(s) into /var/log/mysql/error.log file
    Set up a Password for user with the following SQL statement ( SET PASSWORD FOR 'user'@'SpecificDNSorIp' = PASSWORD('secure_password'); )
    MySQL started within last 24 hours - recommendations may be inaccurate
    Adjust your join queries to always utilize indexes
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C
    Beware that open_files_limit (5000) variable
    should be greater than table_open_cache (2369)
Variables to adjust:
    query_cache_size (=0)
    query_cache_type (=0)
    sort_buffer_size (> 256K)
    read_rnd_buffer_size (> 256K)
    join_buffer_size (> 256.0K, or always use indexes with joins)
    table_open_cache (> 2369)
    innodb_buffer_pool_size (>= 5G) if possible.
    innodb_log_file_size * innodb_log_files_in_group should be equal to 1/4 of buffer pool size (=2G) if possible.
    innodb_buffer_pool_instances(=4)

Best Answer

Your SHOW FULL PROCESSLIST results, clearly indicates your processing requests are NOT followed with QUIT (or CLOSE() function) to release resources. Please review this URL, https://dev.mysql.com/doc/refman/5.7/en/connecting-disconnecting.html. Notice in your SHOW FULL PROCESSLIST the 'time column' has many Sleeping tasks that have been around for more than 60 seconds (some for thousands of seconds SLEEPing). If you use PHP to CONNECT to your MySQL server, typically when DONE with processing you would conclude with CLOSE() to release resources used by MySQL for the CONNECTion.

Updated: Follow this Man Journey in https://developer.okta.com/blog/2015/05/22/tcmalloc

The short answer is to use Jemmaloc plug in for memory management in MySQL

Hope this help