In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
The main content of this article is to explain "Linux native Asynchronous Imax O Analysis in Mysql Innodb". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "Linux native Asynchronous I-Pot O Analysis in Mysql Innodb".
I. Preface
Some changes have taken place in the memory structure of Innodb Asynchronous Ibank O in 5.7. in particular, the asynchronous Ibank O array has changed from the previous structure to a class called AIO class, but it has just encapsulated some methods, while the actual request of Asynchronous iBank O has been put into the Slot structure, which corresponds to 5.6os_aio_array_t and os_aio_slot_t, respectively.
Second, several basic concepts
Asynchronous IBG O thread in MYSQL
I couldn't figure out the role of these threads before, but in order to figure this out, I decided to learn asynchronous Imax O.
Such as the following parameter settings
Mysql > show variables like'% io_threads%' +-+-+ | Variable_name | Value | +-+-+ | innodb_read_io_threads | 2 | innodb_write_io_threads | 2 | +- -+
In this data, I actually set up two read asynchronous iUnix threads and two write asynchronous iUnip O threads. In addition, they all contain one log and ibuf asynchronous iUnip O threads. In the database, we can also query these six asynchronous iUnix O threads.
Mysql > select a.thdpaperidreb. THREADauthors OSystID where b.thread_id=a.thd_id and user like'% io%'. User, a.conncorrecidddpagea.TYPELI a.sourcepapa. Programmatic name where b.thread_id=a.thd_id and user like'% io%'. +-+ | thd_id | THREAD_OS_ID | user | | conn_id | TYPE | source | program_name | + -- +-+ | 3 | 14059 | innodb/io_ibuf_thread | NULL | BACKGROUND | NULL | NULL | 4 | 14060 | innodb/io_log_thread | NULL | BACKGROUND | sync0debug.cc:1296 | NULL | | 5 | 14061 | innodb/io_read_thread | NULL | BACKGROUND | NULL | | NULL | | 6 | 14062 | innodb/io_read_thread | NULL | BACKGROUND | NULL | NULL | | 7 | 14063 | innodb/io_write_thread | NULL | BACKGROUND | sync0debug.cc:1296 | NULL | 8 | 14064 | innodb/io_write_thread | NULL | BACKGROUND | NULL | NULL | +-- | -+-+-+
The relationship between AIO class, thread, Slot
First, an AIO class corresponds to a type of async. For example, ibuf/log/read/write corresponds to an AIO class, and at the end of the class, a static global member of the class is used to point to the following:
/ * * Insert buffer * / static AIO* swarms; / * * Redo log * / static AIO* sprints log; / * * Reads * / static AIO* swatches; / * * Writes * / static AIO* s_writes
And our asynchronous s_reads O thread actually has six, that is, s_reads contains two threads / s_writes contains two threads, then the thread introduces a concept called local segment, in fact, each thread corresponds to a local segment, and what hangs under the AIO is a vertor array of Slot. The size of the array is related to the number of threads of each type (local segment) and the maximum Slot of each thread. The definition of the largest Slot in the source code is as follows:
8 * OS_AIO_N_PENDING_IOS_PER_THREAD
Where the macro defines the OS_AIO_N_PENDING_IOS_PER_THREAD=32
So for s_ibuf and s_log, there are 256 Slot because there is only one thread (local segment), while s_reads and s_writes currently have 2 threads (local segment) in my database, so there are 2 "256" 512 Slot.
Global segment
This concept is mainly related to the simulated asynchronous AIO::start O, if I currently have 6 asynchronous Imax O threads, then the global segment is 6, because when initializing the call to AIO::start, the number is always fixed and 0 and 1 correspond to the number of read and write threads, so the conversion from global segment to local segment becomes easier.
If it is not shown that all segment in this article refer to local segment
III. Initialization of memory structure
The initialization of the entire memory structure starts with the following code called by innobase_start_or_create_for_mysql:
At this point, I believe that you have a deeper understanding of the "Linux native Asynchronous Imax O Analysis in Mysql Innodb". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.