In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you what Table cache is in MySQL 5.6. I hope you will get something after reading this article. Let's discuss it together.
1. Table Cache
After MySQL 5.6, the parameter "table_cache_instances" is introduced to control the number of table cache instance. Currently, the maximum value is 64 and the default value is 1. The recommended value is 16, when the number of system CPU cores is higher than 16:00. This parameter is introduced to improve concurrency. This is equivalent to splitting the table cache into multiple partitions, and the number of open table handles for each partition is: table_open_cache / table_open_cache_instances. It has the same effect as innodb_buffer_pool_instances parameter.
The maximum value of table_cache_instances is 64, and which table cache instance will be used for each thread. According to the module of thread id, you will get m_table_cache [thread_id% table_cache_instances]. Where m_table_cache is the instance partition array of table cache. The source code is defined as follows:
Table cache instance is uniformly managed by the Table_cache_manager class. Table_cache_manager is responsible for initializing and destroying table cache instance.
In addition, 64 m_lock mutex have replaced the LOCK_open lock. As a result, the contention for table cache locks is greatly reduced, which is apportioned to the m_lock mutex on 64 instance.
However, DDL statements involving objects in multiple table cache still require a lock at the entire table cache level, that is, Lock_open. In addition, when locking all table cache instances and table definition cache, you also need to hold a Lock_open lock.
2. Table cache & Table definition cache
Table cache and Table definition cache are two completely different concepts.
Table cache: commonly known as table open cache. Holds the currently open table handle, related to the storage engine specified when the table was created. The embodiment of this piece of source code is that table object has both a pointer to table share and a handler pointer to a specific storage engine.
Table definition cache: stores the definition information of the table. Is the mapping of frm files in memory. MySQL needs to open the frm file and initialize its contents as a Table Share object. It stores information about independent table definitions that are independent of the storage engine.
Why MySQL appears these two concepts is because: MySQL supports different storage engines, each storage engine, the format of data storage is different, so you need to specify a storage engine-related handler. This has the function of table cache. In addition, the definition of the table also needs to be stored in memory, and the definition of the table frm file is common to each storage engine and needs to be separate, so there is table definition cache.
After reading this article, I believe you have a certain understanding of "what is Table cache in MySQL 5.6". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.