Skip to content

Commit 615114f

Browse files
authored
Merge pull request #404 from percona/ps-9461
PS-9461 [DOCS] - Update kill idle transactions in 8.4
2 parents 327da09 + 5086f65 commit 615114f

File tree

1 file changed

+59
-7
lines changed

1 file changed

+59
-7
lines changed

docs/kill-idle-trx.md

+59-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,60 @@
1-
# Kill idle transactions
1+
# Kill idle transaction
22

3-
This feature limits the age of idle transactions, for all transactional storage
4-
engines. If a transaction is idle for more seconds than the threshold
5-
specified, it will be killed. This prevents users from blocking *InnoDB* purge
6-
by mistake.
3+
Database servers face a constant challenge: managing resources efficiently while maintaining system stability. The kill idle transactions timeout option is a strategic tool to address this challenge. When you set a time limit, any transaction that stays inactive beyond this limit is automatically stopped. This action prevents forgotten or stuck transactions from slowing down your database by blocking critical cleanup processes.
4+
5+
The option has the following benefits:
6+
7+
* Automatically terminates long-running, inactive database connections
8+
9+
* Prevents resource hogging by abandoned or forgotten transactions
10+
11+
* Frees up database connection pools
12+
13+
* Reduces unnecessary memory consumption
14+
15+
* Protects against potential connection leaks
16+
17+
* Prevents unnecessary server load from dormant sessions
18+
19+
You must also be consider the following:
20+
21+
* May interrupt legitimate long-running queries
22+
23+
* Requires careful configuration to avoid disrupting critical processes
24+
25+
* Can cause unexpected application behavior if timeout is too aggressive
26+
27+
* Might create additional overhead in monitoring and logging
28+
29+
* Requires precise tuning for different application requirements
30+
31+
32+
We recommend that you start with conservative timeout settings and review the logs frequently to track terminated transactions.
33+
34+
This feature works with all types of database storage that support transactions.
35+
36+
## Determine the idle transaction threshold
37+
38+
When setting up a database, you must decide how long to let inactive transactions sit before ending them. This decision affects the database's performance.
39+
40+
| Items to consider | Description |
41+
|---------------------------------|------------------------------------------------------------------------------------------------------|
42+
| How your database is used | Look at how long transactions usually take and how often they happen. If most transactions finish quickly, you should end idle ones sooner. |
43+
| How many things happen at once | Count how many transactions your system handles simultaneously. If it's a lot, you might need to end idle transactions faster to free up space for new ones. |
44+
| How it affects speed | Watch how idle transactions change your database's speed. If they slow things down a lot, ending them sooner can help keep everything running smoothly. |
45+
| What your business needs | Consider what's important for your work. Some important transactions might need more time, so you shouldn't end them too quickly. |
46+
47+
## InnoDB purge
48+
49+
The InnoDB purge process in MySQL removes outdated row versions (undo logs) from the system. When a transaction modifies data, InnoDB keeps old row versions for rollback and to support transactions running with multi-version concurrency control (MVCC). Once these versions are no longer needed, the purge process deletes them to free up space and improve performance.
50+
51+
Blocking the InnoDB purge can lead to increased disk space usage and potential performance degradation. This feature helps prevent issues such by:
52+
53+
* Limiting idle transactions: It kills any idle transaction after a specified threshold, ensuring transactions don’t remain idle for too long.
54+
55+
* Preventing mistakes: Users can’t accidentally block the InnoDB purge by leaving transactions idle.
56+
57+
* Improving performance: Keeping the purge process running smoothly helps maintain optimal database performance.
758

859
## System variables
960

@@ -16,6 +67,7 @@ by mistake.
1667
| Dynamic: | Yes |
1768
| Data type | Integer |
1869
| Default value | 0 (disabled) |
19-
| Units | Seconds |
70+
| Unit | Seconds |
71+
72+
If set to a non-zero value, the server kills any idle transaction after it stays idle for this number of seconds.
2073

21-
If non-zero, any idle transaction will be killed after being idle for this many seconds.

0 commit comments

Comments
 (0)