[MDEV-4011] per-thread memory usage statistics Created: 2013-01-08  Updated: 2018-10-09  Due: 2013-01-11  Resolved: 2013-01-25

Status: Closed
Project: MariaDB Server
Component/s: None
Fix Version/s: 10.0.1

Type: Task Priority: Critical
Reporter: Michael Widenius Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-236 track and limit memory usage per conn... Closed
Relates
relates to MDEV-17413 Crash on shutdown in my_malloc_size_c... Closed

 Description   

Per-thread memory usage statistics
Base code and idea from comes from
http://mysql.taobao.org/index.php/Patch_source_code#per-thread_memory_usage_statistics.

User visiable changes:

  • information_schema.processlist has a new columns: MEMORY_USAGE
  • SHOW STATUS has a new variable: Memory_used.

The idea is that we mark all memory that are thread specific with MY_THREAD_SPECIFIC.
Memory counting is done per thread in the my_malloc_size_cb_func callback function from my_malloc().

The following changes in interfaces was needed to get this to work:

  • init_alloc_root() amd init_sql_alloc() has extra option so that one can mark memory with MY_THREAD_SPECIFIC
  • One now have to use alloc_root_set_min_malloc() to set min memory to be allocated by alloc_root()
  • my_init_dynamic_array() has extra option so that one can mark memory with MY_THREAD_SPECIFIC
  • my_net_init() has extra option so that one can mark memory with MY_THREAD_SPECIFIC
  • Added flag for hash_init() so that one can mark hash table to be thread specific.
  • Added flags to init_tree() so that one can mark tree to be thread specific.
  • Added flag to Warning_info::Warning_info() if the structure should be fully initialized.
  • String elements can now be marked as thread specific.

Other things:

  • Internal HEAP tables are now marking it's memory as MY_THREAD_SPECIFIC.


 Comments   
Comment by Sergei Golubchik [ 2013-01-25 ]

pushed in 10.0-base

Generated at Thu Feb 08 06:53:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.