Databases 2 min read

Diagnosing Sudden Increase in MySQL File Handle Count

This article explains how to diagnose a sudden rise in MySQL file handle usage by reproducing the issue with large tables, using Linux perf to trace open system calls, analyzing hash join behavior, and querying performance_schema.file_instances to pinpoint the underlying cause.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Diagnosing Sudden Increase in MySQL File Handle Count

The article presents a step‑by‑step experiment to reproduce a rapid increase in MySQL file handles by creating and enlarging tables a and b , adding columns, and executing a query that triggers a hash join.

During the query execution the author monitors MySQL’s file‑handle count and observes a continuous rise, indicating that some internal operation is opening many descriptors.

Linux perf is then employed to trace the open system calls. The perf script output shows that the handles are associated with the hash‑join phase, where probe rows are written to temporary files on disk.

The article references the MySQL worklog describing the hash‑join implementation, confirming that temporary spill files can cause additional file descriptors.

To further verify the source of the handles, the author queries the Performance Schema with select * from performance_schema.file_instances; , which lists the active file instances and confirms their relation to the hash‑join operation.

The conclusion is that the rising file‑handle count is caused by the hash‑join’s need to spill data to disk, and deeper analysis with perf is required to isolate the exact step.

MySQLPerformance SchemaDiagnosisHash JoinperfFile Handles
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.