Undo logs may be stored in one or more undo tablespaces instead of the system tablespace. This layout differs from the default configuration in which undo logs reside in the system tablespace. The I/O patterns for undo logs make undo tablespaces good candidates for SSD storage, while keeping the system tablespace on hard disk storage. Undo tablespaces or individual segments inside those tablespaces cannot be dropped.
To configure separate undo tabespaces for a MySQL instance, perform the following steps. It is assumed that you are performing the procedure on a test instance prior to deploying the configuration to a production system.
The number of undo tablespaces may only be configured when
initializing a new MySQL instance, as the
can only be set at initialization time. The specified setting is
fixed for the life of the MySQL instance.
Specify a directory location for undo tablespaces using the
innodb_undo_directoryconfiguration option. If a directory location is not specified, undo tablespaces are created in the MySQL data directory.
Define the number of rollback segments using the
innodb_rollback_segmentsconfiguration option. Start with a relatively low value and increase it incrementally over time to examine the effect on performance.
One rollback segment is always assigned to the system tablespace. Therefore, to allocate rollback segments to undo tablespaces, set
innodb_rollback_segmentsto a value greater than 1. For example, if you have two undo tablespaces, set
innodb_rollback_segmentsto 3 to assign one rollback segment to each of the two undo tablespaces. Rollback segments are distributed among undo tablespaces in a circular fashion.
When you configure separate undo tablespaces, the rollback segment in the system tablespace is rendered inactive.
Define the number of undo tablespaces using the
innodb_undo_tablespacesoption. This setting is fixed for the life of the MySQL instance, so if you are uncertain about the optimal value, estimate on the high side.
Create a new MySQL test instance using the option values you have chosen.
Use a realistic workload on your test instance with data volume similar to your production servers to test the configuration.
Benchmark the performance of I/O intensive workloads.
Periodically increase the value of
innodb_rollback_segmentsand rerun performance tests until there are no further improvements in I/O performance.