InnoDB存储引擎后台线程与内存池
InnoDB完整支持ACID事务、行锁设计、支持MVCC、提供一致性非锁定读、支持外键-gt;事务安全,适合OLTP应用(在线事务处理)。Mytri
InnoDB完整支持ACID事务、行锁设计、支持MVCC、提供一致性非锁定读、支持外键->事务安全,适合OLTP应用(在线事务处理)。
Mytrix.,Inc.在InnoDB上存储超过1TB的数据,,还有一些其他站点在InnoDB上处理平均每次800插入/更新操作->证明InnoDB是一个高性能、高可用、高可扩展性的存储引擎。
事务ACID:
atomicity原子性:事务commit提交或rollback回滚
consistency一致性:事务发生前后完整性约束不被破坏
isolation隔离性:两个事务互不干扰(即一个事务不可能看到其他事务中间时刻数据)
durability持久性:更改持久(commit后不发生rollback)
InnoDB体系结构如下:
其中:
后台线程,负责:
刷新内存池中的数据;
将已修改的数据文件刷新到磁盘文件中;
保证数据库发生异常情况下InnoDB能恢复到正常运行状态。
默认情况下,后台线程有7个:
1个master thread;
4个IO thread(insert buffer、log、read、write)->可通过配置文件中的innodb_file_io_threads参数进行修改,在mysql5.5以及innodb plugin版本中,默认IO线程均增加到了4个,读写线程分别用参数innodb_read_io_thread和innodb_write_io_thread来表示;
1个lock锁监控线程;
1个error错误监控线程。
内存池,由多个内存块组成一个大的内存池,负责:
维护所有进程/线程需要访问的多个内存数据结构;
缓存磁盘上的数据,方便快速读取,并且在对磁盘文件的数据进行修改之前在这缓存;
重做日志缓冲;
……
内存池结构如下:
其中:
buffer pool缓冲池:包括data page数据页、index page索引页、插入缓冲、锁信息、自适应哈希索引、数据字典信息;
redo log buffer重做日志缓冲池:每秒产生的事务量在这个缓冲大小之内;
additional memory buffer额外的内存池:每个缓冲池中的帧缓冲还有对应的缓冲控制对象,如LRU、锁等待等。
InnoDB的工作方式是将数据文件按页(每页16K)读取到缓冲池,然后按LRU最近最少使用算法来保留在缓冲池中的缓存数据;如果文件需要修改,总是首先修改在缓冲池中的页(发生修改后,该页即为脏页),然后按照一定的频率将脏页flush刷新到文件。
参考:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











InnoDB is one of the database engines of MySQL. It is now the default storage engine of MySQL and one of the standards for binary releases by MySQL AB. InnoDB adopts a dual-track authorization system, one is GPL authorization and the other is proprietary software authorization. InnoDB is the preferred engine for transactional databases and supports transaction security tables (ACID); InnoDB supports row-level locks, which can support concurrency to the greatest extent. Row-level locks are implemented by the storage engine layer.

InnoDB is a storage engine that stores data in tables on disk, so our data will still exist even after shutdown and restart. The actual process of processing data occurs in memory, so the data in the disk needs to be loaded into the memory. If it is processing a write or modification request, the contents in the memory also need to be refreshed to the disk. And we know that the speed of reading and writing to disk is very slow, which is several orders of magnitude different from reading and writing in memory. So when we want to get certain records from the table, does the InnoDB storage engine need to read the records from the disk one by one? The method adopted by InnoDB is to divide the data into several pages, and use pages as the basic unit of interaction between disk and memory. The size of a page in InnoDB is generally 16

1. Roll back and reinstall mysql. In order to avoid the trouble of importing this data from other places, first make a backup of the database file of the current library (/var/lib/mysql/location). Next, I uninstalled the Perconaserver 5.7 package, reinstalled the original 5.1.71 package, started the mysql service, and it prompted Unknown/unsupportedtabletype:innodb and could not start normally. 11050912:04:27InnoDB:Initializingbufferpool,size=384.0M11050912:04:27InnoDB:Complete

MySQL storage engine selection comparison: InnoDB, MyISAM and Memory performance index evaluation Introduction: In the MySQL database, the choice of storage engine plays a vital role in system performance and data integrity. MySQL provides a variety of storage engines, the most commonly used engines include InnoDB, MyISAM and Memory. This article will evaluate the performance indicators of these three storage engines and compare them through code examples. 1. InnoDB engine InnoDB is My

1. Mysql transaction isolation level These four isolation levels, when there are multiple transaction concurrency conflicts, some problems of dirty reading, non-repeatable reading, and phantom reading may occur, and innoDB solves them in the repeatable read isolation level mode. A problem of phantom reading, 2. What is phantom reading? Phantom reading means that in the same transaction, the results obtained when querying the same range twice before and after are inconsistent as shown in the figure. In the first transaction, we execute a range query. At this time, there is only one piece of data that meets the conditions. In the second transaction, it inserts a row of data and submits it. When the first transaction queries again, the result obtained is one more than the result of the first query. Data, note that the first and second queries of the first transaction are both in the same

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

MySQL is a widely used database management system, and different storage engines have different impacts on database performance. MyISAM and InnoDB are the two most commonly used storage engines in MySQL. They have different characteristics and improper use may affect the performance of the database. This article will introduce how to use these two storage engines to optimize MySQL performance. 1. MyISAM storage engine MyISAM is the most commonly used storage engine for MySQL. Its advantages are fast speed and small storage space. MyISA

Tips and strategies to improve the read performance of MySQL storage engine: Comparative analysis of MyISAM and InnoDB Introduction: MySQL is one of the most commonly used open source relational database management systems, mainly used to store and manage large amounts of structured data. In applications, the read performance of the database is often very important, because read operations are the main type of operations in most applications. This article will focus on how to improve the read performance of the MySQL storage engine, focusing on a comparative analysis of MyISAM and InnoDB, two commonly used storage engines.
