Rechercher dans le manuel MySQL
15.7.6 Transaction Scheduling
InnoDB
uses the Contention-Aware Transaction
Scheduling (CATS) algorithm to prioritize transactions that are
waiting for locks. When multiple transactions are waiting for a
lock on the same object, the CATS algorithm determines which
transaction receives the lock first.
The CATS algorithm prioritizes waiting transactions by assigning a scheduling weight, which is computed based on the number of transactions that a transaction blocks. For example, if two transactions are waiting for a lock on the same object, the transaction that blocks the most transactions is assigned a greater scheduling weight. If weights are equal, priority is given to the longest waiting transaction.
Prior to MySQL 8.0.20, InnoDB
also uses a
First In First Out (FIFO) algorithm to schedule transactions,
and the CATS algorithm is used under heavy lock contention only.
CATS algorithm enhancements in MySQL 8.0.20 rendered the FIFO
algorithm redundant, permitting its removal. Transaction
scheduling previously performed by the FIFO algorithm is
performed by the CATS algorithm as of MySQL 8.0.20. In some
cases, this change may affect the order in which transactions
are granted locks.
You can view transaction scheduling weights by querying the
TRX_SCHEDULE_WEIGHT
column in the
INFORMATION_SCHEMA.INNODB_TRX
table.
Weights are computed for waiting transactions only. Waiting
transactions are those in a LOCK WAIT
transaction execution state, as reported by the
TRX_STATE
column. A transaction that is not
waiting for a lock reports a NULL
TRX_SCHEDULE_WEIGHT
value.
INNODB_METRICS
counters are provided
for monitoring of code-level transaction scheduling events. For
information about using
INNODB_METRICS
counters, see
Section 15.15.6, “InnoDB INFORMATION_SCHEMA Metrics Table”.
lock_rec_release_attempts
The number of attempts to release record locks. A single attempt may lead to zero or more record locks being released, as there may be zero or more record locks in a single structure.
lock_rec_grant_attempts
The number of attempts to grant record locks. A single attempt may result in zero or more record locks being granted.
lock_schedule_refreshes
The number of times the wait-for graph was analyzed to update the scheduled transaction weights.
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-innodb-transaction-scheduling.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.