Tales From A Lazy Fat DBA

Its all about Databases, their performance, troubleshooting & much more …. ¯\_(ツ)_/¯

Optimizing MySQL Redo Log Performance in OCI

Posted by FatDBA on February 16, 2025

When deploying databases in the cloud, ensuring efficient redo log handling is crucial for maintaining performance and consistency. Many organizations struggle with suboptimal commit times due to increased latency introduced by virtualized cloud environments. This article explores common redo log bottlenecks and provides practical strategies to optimize transaction commit performance in cloud-based databases.

In a database, redo logs play a vital role in maintaining durability and crash recovery. Every commit operation involves writing changes to redo logs before confirming the transaction to the user. In an on-premise setup, disk latencies are relatively stable and predictable. However, in the cloud, factors like shared storage, networked disks, and hypervisor scheduling introduce additional delays that impact redo log efficiency.

To diagnose redo log-related latency, you can use Oracle wait events or MySQL’s performance schema. In Oracle, the event “log file sync” can indicate significant wait times on redo logs. Similarly, in MySQL, the following query provides insights into log-related latencies:

SELECT EVENT_NAME, SUM_TIMER_WAIT / 1000000000 AS wait_time_ms
FROM performance_schema.events_waits_summary_global_by_event_name
WHERE EVENT_NAME LIKE 'wait/io/file/innodb_log%';

High wait times suggest potential issues with redo log performance that need addressing.

Optimizing Redo Log Writes in the Cloud

Use Low-Latency Storage Options – OCI offers various storage tiers, and selecting the right one is crucial for redo log performance. Use Block Storage with Auto-Tuning Performance or BM.DenseIO shapes for optimized log writes.

Additionally, placing redo logs on separate disks ensures that redo writes don’t compete with regular data file operations.

Tune Log Buffer Size In MySQL, adjusting innodb_log_buffer_size can reduce the frequency of disk writes:

SET GLOBAL innodb_log_buffer_size = 128M;

Optimize Commit Strategies For high-throughput applications, batching commits can reduce redo log contention. Instead of committing after each transaction, applications can group multiple changes into a single commit. Example in MySQL using autocommit OFF:

START TRANSACTION;
INSERT INTO orders VALUES (1, 'New Order');
INSERT INTO orders VALUES (2, 'Second Order');
COMMIT;

Increase Parallelism for Redo Processing – In MySQL, enabling multiple redo log writer threads can improve log writing efficiency:

SET GLOBAL innodb_log_write_ahead_size = 8192;

Leverage Cloud-Native Optimizations – OCI offers database-specific optimizations. Utilize Exadata Storage Indexes to minimize redo log writes and optimize disk I/O performance.

Redo log performance is a key factor in ensuring efficient and reliable database transactions in cloud environments. By selecting low-latency storage, tuning log buffer settings, optimizing commit strategies, increasing parallelism, and leveraging cloud-specific optimizations, you can significantly reduce commit latency and improve overall database responsiveness.

Hope It Helped!
Prashant Dixit

Leave a comment