MySQL Key Buffer Test

To minimize disk I/O, the MyISAM storage engine exploits a strategy that is used by many database management systems. It employs a cache mechanism to keep the most frequently accessed table blocks in memory:

  • For index blocks, a special structure called the key cache (or key buffer) is maintained. The structure contains a number of block buffers where the most-used index blocks are placed.

  • For data blocks, MySQL uses no special cache. Instead it relies on the native operating system file system cache.

If the size of the key buffer is inadequate or if the buffer pool is poorly sized, then, more often than not, the requests may not be serviced by the buffer pool. If the required data is not available in the key buffer, requests may have to be serviced directly from the disk which may cause severe overheads. Similarly too many table scans may hamper the request servicing capability of the key buffer to a great extent! To avoid such overheads, it is necessary for the administrators to constantly keep a vigil on the sizing of the key buffer and the read/write requests to the key buffer. The MySQL Key Buffer test helps administrators in this regard!

This test monitors the key buffer of the MyISAM storage engine and reports the current size of the key buffer and the size that has already been utilized by the key buffer. This test also helps administrators figure out how well read/write requests are serviced by the key buffer. Using this test, administrators can also identify the execution that is frequently performed on the key buffer. The statistics reported by this test help administrators analyze the usage of the key buffer, and provides them with useful pointers to fine-tune the configuration of the key buffer.

Target of the test : A MySQL server

Agent deploying the test : An internal/remote agent

Outputs of the test : One set of results for the target database server instance being monitored

Configurable parameters for the test
Parameter Description

Test Period

How often should the test be executed.

Host

The IP address of the MySQL server.

Port

The port at which the specified host listens.

Database

Specify the name of a database on the target MySQL database server being monitored

Username and Password

The eG agent has to be configured with the credentials of a user who has server-wide Process and Select privileges on the monitored MySQL server. To know how to create such a user, refer to Pre-requisites for Monitoring the MySQL Server topic.

Confirm Password

Confirm the password by retyping it here.

Measurements made by the test
Measurement Description Measurement Unit Interpretation

Buffer used size

Indicates the size of the key buffer that had already been utilized.

MB

A value close to the key_buffer_size variable in MySQL is an indication that the key buffer is currently experiencing size constraints.

Current buffer

Indicates the current size of the key buffer.

MB

 

Write hit

Indicates the percentage of requests to write a key block to the key buffer.

Percent

 

Read hit

Indicates the percentage of requests to read a key block from the key buffer.

Percent

Ideally, the value of this measure should be high.

A low value is a cause for concern, as it could indicate a delay in servicing read requests. To avoid such delays, administrators can increase the size of the key buffer.

Select full join

Indicates the number of joins that perform table scans because they do not use indexes.

Number

If this value is not 0, you should carefully check the indexes of your tables.

Select full range

Indicates the number of joins that used a range search on a reference table.

Number

 

Set option execution rate

Indicates the rate at which set command was executed on the key buffer during the last measurement period.

Executions/sec

 

ChangeDB execution rate

Indicates the rate at which Change database command was executed on the key buffer during the last measurement period.

Executions/sec

 

Show fields execution rate

Indicates the rate at which SHOW FIELDS command was executed on the key buffer during the last measurement period.

Executions/sec