Why Is Every Commit Slow? Diagnosing log file sync on Exadata in Oracle Database@Azure
Few wait events cause as much confusion as log file sync. It appears at the top of an AWR report, someone concludes that the storage is slow, and a request for faster disks goes out. On Exadata, with Smart Flash Log writing redo to flash and disk at the same time, the storage is rarely the problem. The wait means only that a session issued COMMIT and is waiting for the log writer to confirm that its redo is on disk, and there are several reasons why that can take longer than it should.
This post takes a slow order-entry system on Exadata Database Service in Oracle Database@Azure and works through the possible causes in order: the redo write itself, the log writer, the redo logs, a synchronous standby, and the application's commit pattern. Each check takes a minute, and together they point to the fix.
The Use Case
The order-entry application in Azure Kubernetes Service writes to a two-node RAC database on Exadata Database Service in Oracle Database@Azure. After a new release, the order screen became noticeably slower. AWR for the busiest hour shows log file sync as the top wait event, with an average of about 9 milliseconds per wait, compared with less than 1 millisecond before the release. The storage team says the Exadata cells are healthy.
Environment used in this runbook
Service: Exadata Database Service on Dedicated Infrastructure in Oracle Database@Azure
Database: Oracle Database 19c (19.24), PDB SALESPDB, two-node RAC
Redo: four groups of 4 GB per thread in the DATAC1 disk group
Standby: physical standby in OCI, Maximum Performance, asynchronous transport
Licence: the V$ views used here are part of Enterprise Edition; AWR reports require the Diagnostics Pack, included in licence-included Exadata Database Service
What log file sync Measures
The session's view. log file sync is the time from a session's COMMIT until the log writer tells it that the redo is written.
The log writer's view. log file parallel write is the time the log writer spends writing redo to the log files; on Exadata it is usually well under a millisecond.
The gap between them. If log file sync is much longer than log file parallel write, the time is spent outside the write: in scheduling, waiting for the log writer, or waiting for a synchronous standby.
The number of commits. Each commit costs at least one round trip to the log writer, so an application that commits after every row pays that price thousands of times a second.
Step 1: Compare log file sync with log file parallel write
Start with the averages of the two events on each instance. Their ratio tells you whether the problem is the write or everything around it.
SQL |
-- Connected to the CDB root as a DBA COLUMN event FORMAT A24
SELECT inst_id, event, total_waits, ROUND(time_waited_micro / NULLIF(total_waits, 0) / 1000, 2) AS avg_ms FROM gv$system_event WHERE event IN ('log file sync', 'log file parallel write') ORDER BY inst_id, event; |
Expected output |
INST_ID EVENT TOTAL_WAITS AVG_MS
---------- ------------------------ ----------- ----------
1 log file parallel write 48211037 .41
1 log file sync 391842266 8.73
2 log file parallel write 45187702 .39
2 log file sync 377519084 9.12What to expect: The log writer writes redo in about 0.4 milliseconds, as Exadata should, while sessions wait about 9 milliseconds for their commits. The write itself is fast, so the storage is not the cause. Also note the counts: there are eight times more commit waits than redo writes, because each write covers many commits. The time is lost between the commit and the write.
Step 2: Look at the Distribution of the Waits
An average can hide a few very long waits. The histogram shows whether most commits are fast with some outliers, or whether every commit has become slow.
SQL |
SELECT wait_time_milli AS up_to_ms, wait_count FROM v$event_histogram WHERE event = 'log file sync' ORDER BY wait_time_milli; |
Expected output |
UP_TO_MS WAIT_COUNT
---------- ----------
1 98214773
2 41208116
4 62418833
8 97112650
16 71834109
32 18902447
64 2108331
128 43007What to expect: The waits are spread across the whole range, with most between 2 and 32 milliseconds; only a quarter of the commits finish within a millisecond. That is the pattern of a log writer that is busy, or of sessions that queue for it, rather than of an occasional slow write, which would show as a short peak at the high end.
Step 3: Check the Commit Rate
Before looking further into the database, measure how often the application commits. Compare the current rate with a quiet period or with the time before the release.
SQL |
COLUMN metric_name FORMAT A24
SELECT inst_id, metric_name, ROUND(value) AS per_second FROM gv$sysmetric WHERE metric_name IN ('User Commits Per Sec', 'User Transaction Per Sec', 'Executions Per Sec') AND group_id = 2 ORDER BY inst_id, metric_name; |
Expected output |
INST_ID METRIC_NAME PER_SECOND
---------- ------------------------ ----------
1 Executions Per Sec 41837
1 User Commits Per Sec 18422
1 User Transaction Per Sec 18430
2 Executions Per Sec 40109
2 User Commits Per Sec 17908
2 User Transaction Per Sec 17915What to expect: Over 18,000 commits a second per instance, almost one commit for every two statements. Before the release, AWR showed about 2,000 commits a second for the same order volume. Something in the new release commits far more often, which is the most likely cause; the next steps confirm that nothing else is wrong.
Step 4: Read the Log Writer Trace
The log writer writes a warning to its trace file whenever a single write takes longer than a threshold. Check it on both nodes, because a few slow writes can still add up.
Shell |
# On each database server, as the oracle user cd /u02/app/oracle/diag/rdbms/sales_az/SALES1/trace grep -h "Warning: log write elapsed time" SALES1_lgwr_*.trc | tail -3 grep -c "Warning: log write elapsed time" SALES1_lgwr_*.trc |
Expected output |
Warning: log write elapsed time 612ms, size 2KB
Warning: log write elapsed time 588ms, size 1KB
Warning: log write elapsed time 541ms, size 3KB
SALES1_lgwr_88412.trc:3What to expect: Only three slow writes in the current trace file, each a little over half a second. A handful of such warnings is normal and does not explain an average of 9 milliseconds across hundreds of millions of commits. Hundreds of warnings an hour would point to the storage or the network to the cells, and would be a case for the Exadata support team.
Step 5: Check the Redo Log Switches
Redo logs that are too small cause frequent log switches and checkpoints, which can make the log writer wait. Count the switches per hour for the busy period.
SQL |
COLUMN hour FORMAT A13
SELECT thread#, TO_CHAR(first_time, 'YYYY-MM-DD HH24') AS hour, COUNT(*) AS switches FROM v$log_history WHERE first_time >= TIMESTAMP '2026-11-30 07:00:00' GROUP BY thread#, TO_CHAR(first_time, 'YYYY-MM-DD HH24') ORDER BY hour, thread#; |
Expected output |
THREAD# HOUR SWITCHES
---------- ------------- ----------
1 2026-11-30 07 3
2 2026-11-30 07 3
1 2026-11-30 08 4
2 2026-11-30 08 4What to expect: Three or four switches an hour per thread with 4 GB logs, well within the usual guideline of a switch every 15 to 20 minutes at peak. The redo logs are not the problem. Many short commits produce a lot of small writes, but not much redo volume, which is why the switch rate stayed low after the release.
Step 6: Rule Out a Synchronous Standby
If any standby destination uses SYNC transport, every commit also waits for the standby to acknowledge the redo, which adds the network round trip between the clouds to every log file sync. Check the transport mode and the related wait event.
SQL |
COLUMN dest_name FORMAT A20 COLUMN transmit_mode FORMAT A13
SELECT dest_name, status, transmit_mode FROM v$archive_dest WHERE target = 'STANDBY';
SELECT event, total_waits FROM v$system_event WHERE event = 'SYNC Remote Write'; |
Expected output |
DEST_NAME STATUS TRANSMIT_MODE
-------------------- --------- -------------
LOG_ARCHIVE_DEST_2 VALID ASYNCHRONOUS
no rows selectedWhat to expect: The only standby destination is asynchronous, and the SYNC Remote Write event has never occurred, so the standby in OCI adds nothing to the commit time. If this check had shown SYNCHRONOUS, the network latency between Azure and OCI would be the first thing to measure, and a Far Sync instance close to the primary would be the usual answer.
Step 7: Find the Sessions That Commit Most
All signs point to the application. Find which programs and modules issue the commits, so the developers know where to look.
SQL |
COLUMN module FORMAT A28 COLUMN program FORMAT A20
SELECT s.program, s.module, SUM(st.value) AS commits FROM gv$sesstat st JOIN gv$statname sn ON sn.inst_id = st.inst_id AND sn.statistic# = st.statistic# JOIN gv$session s ON s.inst_id = st.inst_id AND s.sid = st.sid WHERE sn.name = 'user commits' AND s.username = 'ORDER_SVC' GROUP BY s.program, s.module ORDER BY commits DESC FETCH FIRST 3 ROWS ONLY; |
Expected output |
PROGRAM MODULE COMMITS
-------------------- ---------------------------- ----------
order-service StockReservationService 96402118
order-service OrderService 8114207
order-service PaymentCallbackHandler 1208455What to expect: One module, StockReservationService, accounts for over 90 percent of the commits. In the new release, it reserves stock for each order line and commits after every line instead of once per order. With ten lines per order, that is ten times as many commits for the same work.
Tip: Ask developers to set the module and action with DBMS_APPLICATION_INFO, or through the module attribute of their driver. Without it, every session in this query would show the same program name, and finding the offending code would take much longer.
Step 8: Fix the Commit Pattern and Measure Again
The fix belongs in the application: commit once per business transaction, not once per row. After the corrected release is deployed, run the first query again.
SQL |
SELECT inst_id, event, total_waits, ROUND(time_waited_micro / NULLIF(total_waits, 0) / 1000, 2) AS avg_ms FROM gv$system_event WHERE event IN ('log file sync', 'log file parallel write') ORDER BY inst_id, event;
-- Note: these are cumulative since instance start; compare AWR snapshots for an exact before-and-after |
Expected output |
INST_ID EVENT TOTAL_WAITS AVG_MS
---------- ------------------------ ----------- ----------
1 log file parallel write 2418307 .38
1 log file sync 4102214 .71
2 log file parallel write 2290841 .37
2 log file sync 3918507 .74What to expect: These figures come from instances restarted during the next maintenance window, so they reflect the corrected release only. The average log file sync is back under a millisecond, close to the write time, and the order screen responds as before. In AWR, User Commits Per Sec drops from about 18,000 to about 2,000 per instance for the same order volume.
Step 9: Know What Not to Change
When commits are slow, two settings are often suggested: COMMIT_WAIT = NOWAIT and COMMIT_LOGGING = BATCH. Check that nobody has set them as a quick fix, because they change what a commit guarantees.
SQL |
COLUMN name FORMAT A16 COLUMN value FORMAT A10
SELECT name, NVL(value, '(default)') AS value FROM v$parameter WHERE name IN ('commit_wait', 'commit_logging'); |
Expected output |
NAME VALUE
---------------- ----------
commit_logging (default)
commit_wait (default)What this does: Both parameters are at their defaults, which is correct for order entry. With COMMIT_WAIT set to NOWAIT, a session no longer waits for its redo to be written, so a crash can lose transactions the application believes are committed. That may be acceptable for a log table, but never for orders or payments, and it hides an application problem instead of fixing it.
Summary
log file sync is the price of a commit, and on Exadata the price is usually set by how often the application commits rather than by the storage. Compare log file sync with log file parallel write to see whether the write itself is slow, read the histogram, and measure the commit rate. Check the log writer trace for slow writes, the redo log switch rate, and whether any standby uses synchronous transport. When those are clean, find the modules that commit most, fix the commit pattern in the application, and measure again. Leave COMMIT_WAIT and COMMIT_LOGGING at their defaults for business data.
Comments