Log Write Latency: Is Your SQL Server Getting Slower?
Commits that felt instant last month now drag. No deployment explains it, no single query stands out, and nobody can say when it started. Log write latency is a prime suspect, because every transaction in the database waits on that write when it commits. A slide from 1 ms to 8 ms over a month is easy to miss on any one day.
How do I tell whether log write latency is getting worse in SQL Server? To tell whether log write latency is getting worse, divide the added write stall milliseconds by the added writes between regular snapshots, total them by day, then compare the median of the last 7 days with the 28 days before. Check write volume too, so a busier file is not mistaken for a slower one.
Why the usual numbers mislead
Drive latency is often the first stop. It matters, but it blends every file on that drive. Database Health Monitor also keeps the timing for each file separately, which database I/O reports in bytes cannot give you: bytes say how much moved, not how long anyone waited.
SQL Server does count the waiting, per file, in counters such as io_stall_write_ms. The catch is that they accumulate from the moment the instance starts. Divide the totals as they stand and you get one average for the whole uptime, where a bad last week can vanish under months of good ones.
The honest number comes from differences. Take two snapshots, subtract, then divide the added stall milliseconds by the added operations. Do that every hour and total by day before dividing, so busy hours carry more weight than quiet ones.
File Latency Trend is one of the reports in Database Health Monitor. It runs against your own servers, and it takes about a minute to have this same screen open on one of them.
Trending log write latency by file
The File Latency Trend report does that arithmetic for every file of one database, day by day, across the last 90 days. It reads hourly counters stored in dbo.trackingOverTime in DBHealthHistory. Expand a database in the server tree, then choose Historic > File Latency Trend. Every database except model has it, tempdb included.
Bad data is kept out. Snapshot pairs that span a restart are dropped, and so are pairs more than a day apart. A day with fewer than 1,000 reads or writes gets no latency figure for that kind and shows as a hollow point, since the timing of a handful of operations is noise.
The grid gives one row per file with type, drive, size, median daily read and write latency for the last 7 days and the 28 before them, a trend in milliseconds per week, and a verdict. Targets are 20 ms for reads and writes on data files and 5 ms for log writes.
| Verdict | What it means |
|---|---|
| Regressed | Recent median is at least double the prior one and above target |
| Over target | Above target, without having doubled |
| OK | At or under target |
| Too little IO | No day in the last 7 had enough operations |
A file takes the worse of its read and write verdicts. Regressed also needs at least 3 usable days in the earlier period. Watch the trend column on files still marked OK: a log that went from 1 ms to 4 ms has quadrupled and is still under target. That slope is a Theil-Sen estimate, the median of the slopes between every pair of days, so one awful day does not move it.
Slower, or just busier?
A rising line alone does not convict the storage. Under the daily latency chart, with its dashed targets, a second panel draws the selected file's operations per second as bars on the same days. If the bars climb with the line, load is part of the story. If latency doubles while the bars stay flat, the same work is now taking longer.
A third panel shows hourly latency for the last 7 days. Use Read latency and Write latency to switch what the charts draw.
Then look at the neighbors. When every file on a drive has regressed, the headline says so once, which points at the drive rather than your database. Open Storage Saturation Curve next to see whether the drive or the load explains it. If only one file moved, start with that file and what changed in its workload.
All of this depends on collected history. An instance that is not monitored has nothing to trend, and the page says so. A recently added file has a shorter record. For the wider view of what that history database can tell you, read SQL Server Historic Reporting: One Page, One Click. Column and verdict details are in the File Latency Trend documentation.
What to check on your own server
- Check each log file's recent write latency against 5 ms, and each data file's reads and writes against 20 ms
- Compare the median daily latency of the last 7 days with the median of the 28 days before
- Compare operations per second across the same days to see whether a slower file is also a busier one
- Check whether every file on the same drive slowed down before blaming any one database
Try Database Health Monitor Today
Stop guessing whether a database file has become slower or simply busier over the past few weeks. Database Health Monitor shows it on every instance you connect, in the time it takes to open the report.
Download Database Health Monitor and run the File Latency Trend report against your own server. There is nothing to configure first, and you will know inside a few minutes whether it tells you something you did not already know.