{"id":1549,"date":"2026-11-02T02:09:25","date_gmt":"2026-11-02T02:09:25","guid":{"rendered":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/?p=1549"},"modified":"2026-11-02T02:09:25","modified_gmt":"2026-11-02T02:09:25","slug":"database-replication-lag-dedicated-disk-percentile99","status":"publish","type":"post","link":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/","title":{"rendered":"Replication Lag on Dedicated Hardware: Reading Disk p99 Instead of Average"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Replication lag is usually diagnosed against the wrong metric. Monitoring shows average disk IOPS fine, average write latency at 0.8ms, and a replica sitting 40 seconds behind the primary. Nothing looks broken. The reason is that replication is a latency-sensitive consumer: the SQL thread waits on relay log fsync and apply, and it only needs one badly-timed stall per commit batch to fall behind by seconds.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On a dedicated box with a single tenant, average IOPS is dominated by the bulk of well-behaved small writes. The slow tail \u2014 queue depth spikes, storage write cache flushes, controller garbage collection \u2014 is what actually delays the relay log apply. p99 is the metric that correlates, and p99.9 correlates better still.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Measure it precisely: <code>fio --rw=write --ioengine=libaio --bs=16k --iodepth=64 --lat_percentiles=1 --output-format=json<\/code>, or read <code>node_disk_io_time_seconds_total<\/code> and the per-device <code>iodepth<\/code> from the kernel. Watch <code>SHOW REPLICA STATUS<\/code> fields <code>Seconds_Behind_Source<\/code> and <code>Relay_Log_Space<\/code> on the <a href=\"https:\/\/bestdedicatedwebhostingserver.com\/\">dedicated database servers<\/a> while you push a write-load test at the primary.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why p99 beats average here<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Averaging hides the exact event that breaks replication. If 99% of writes complete in 0.5ms and 1% take 40ms, the average is 0.9ms \u2014 but that 40ms tail occurs 10 times per 1,000 writes, and the apply thread processes writes serially. Two slow tail events inside one commit group delay the whole group, and the backlog compounds because the primary never slows down.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Queue depth is the leading indicator. When <code>aqu-sz<\/code> exceeds 4\u20138 on a single NVMe device, the device is queuing, and any write that arrives behind the queue waits for everything ahead of it. Lag shows up 10\u201330 seconds later, after the backlog has formed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Relay log fsync settings<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL 8 writes the relay log to disk with its own durability settings. With <code>sync_relay_log=1<\/code> and <code>relay_log_info_repository=TABLE<\/code>, every batch fsyncs the relay log and updates the table \u2014 two durable operations per transaction group, both hitting the same device. Setting <code>sync_relay_log=10000<\/code> or <code>0<\/code> (rely on OS flush) removes that cost but means a crash can replay relay log from an earlier point; because the replica can re-fetch from the primary via GTID, that is usually safe on a dedicated replica.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>sync_binlog=1<\/code> on primary \u2014 required for durability, costs one fsync per commit<\/li>\n<li><code>sync_relay_log=0<\/code> on replica \u2014 biggest single lag reduction, safe with GTID<\/li>\n<li><code>binlog_group_commit_sync_delay=0<\/code> default; raise to 100\u2013500\u00b5s only if commit rate is extreme<\/li>\n<li><code>innodb_flush_log_at_trx_commit=1<\/code> on replica \u2014 do not lower it to chase lag<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Group commit interaction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On the primary, group commit batches concurrent transactions into one fsync, so throughput scales without extra IOPS. On the replica, the parallel appliers (<code>replica_parallel_workers=8<\/code>, with <code>replica_preserve_commit_order=1<\/code>) replay a batch but must respect commit ordering, which means a single slow worker stalls the group. If one schema has a hot table and the others are cold, parallel workers buy little until you split the hot table or use <code>WRITESET<\/code> dependency tracking.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A useful test: set <code>replica_parallel_workers=16<\/code> and watch whether lag falls. If it does not, your workload has a single serial dependency and the disk tail is the true limit.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One more interaction worth knowing: <code>binlog_transaction_dependency_tracking=WRITESET<\/code> lets the replica derive dependencies per row rather than per commit, which increases how many workers can apply safely at once. On a box with 8\u201316 cores, this is often worth 30\u201350% more apply throughput without touching a single disk setting.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Storage write cache policy<\/h2>\n\n\n<p class=\"wp-block-paragraph\">RAID controllers with a battery-backed cache absorb bursts, but the policy matters. Write-back with a healthy BBU is fast and safe; write-through is safe and slow; write-back with a failed or missing BBU is a data-loss risk that vendors sometimes ship by default. Check <code>storcli \/c0 \/v0 show<\/code> or <code>megacli -LDInfo -Lall -aAll<\/code> and confirm the cache state, then confirm the policy is write-back only when protected.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On NVMe with no RAID, the device&#8217;s volatile write cache is the equivalent. Disabling it (<code>hdparm -W0<\/code>) roughly doubles write latency but removes the flush cliff. On a replica, where re-fetching is cheap, keeping the cache enabled is a reasonable trade you should make explicitly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Watch for the flush cliff in monitoring rather than guessing at it: if p99 write latency is flat until a certain queue depth and then jumps tenfold, you are hitting the device&#8217;s internal cache flush or garbage collection window. Reducing sustained writes by 20% is often enough to move the whole workload below that knee.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">p99 thresholds and expected lag<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These are observed on single-tenant NVMe replicas applying a mixed OLTP stream at 2,000\u20135,000 writes\/s.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Disk write p99<\/th><th>Queue depth<\/th><th>Expected lag<\/th><th>Action<\/th><\/tr><\/thead><tbody>\n<tr><td>&lt; 1ms<\/td><td>&lt; 2<\/td><td>0\u20131s<\/td><td>Healthy<\/td><\/tr>\n<tr><td>1\u20133ms<\/td><td>2\u20134<\/td><td>1\u20135s<\/td><td>Watch<\/td><\/tr>\n<tr><td>3\u20138ms<\/td><td>4\u20138<\/td><td>5\u201320s<\/td><td>Check relay fsync, parallel workers<\/td><\/tr>\n<tr><td>8\u201320ms<\/td><td>8\u201316<\/td><td>20\u201390s<\/td><td>Saturation \u2014 investigate device<\/td><\/tr>\n<tr><td>&gt; 20ms<\/td><td>&gt; 16<\/td><td>Minutes<\/td><td>Replace disk or reduce write rate<\/td><\/tr>\n<\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">The order of fixes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First, cut the write rate at the source \u2014 batch updates, drop redundant indexes, move audit logging off the hot path. Second, set <code>sync_relay_log=0<\/code> and verify parallel workers actually apply in parallel. Third, check write cache policy is what you think it is. Only then consider faster disks; most lag cases resolve at step one or two.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Plot p99 write latency and lag on the same graph. When they diverge \u2014 lag rises while p99 stays flat \u2014 the problem is inside MySQL: a serial dependency, a metadata lock, or a worker applying a single hot table. When they move together, it is the disk, and no amount of worker tuning will fix it. A dedicated box with a known, measured p99 and no noisy neighbours is what keeps both lines flat, and <a href=\"https:\/\/bestdedicatedwebhostingserver.com\/\">picking dedicated hardware on measured percentiles<\/a> is the difference between guessing and knowing.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Replication lag is usually diagnosed against the wrong metric. Monitoring shows average disk IOPS fine, average write latency at 0.8ms, and a replica sitting 40 seconds behind the primary. Nothing&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1549","post","type-post","status-publish","format-standard","hentry","category-server-guides-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Replication Lag on Dedicated Hardware: Reading Disk p99 Instead of Average - Best Dedicated Web Hosting Server Blog<\/title>\n<meta name=\"description\" content=\"Replication lag is usually diagnosed against the wrong metric. Monitoring shows average disk IOPS fine, average write latency at 0.8ms, and a replica\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Replication Lag on Dedicated Hardware: Reading Disk p99 Instead of Average\" \/>\n<meta property=\"og:description\" content=\"Replication Lag on Dedicated Hardware: Reading Disk p99 Instead of Average\" \/>\n<meta property=\"og:url\" content=\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/\" \/>\n<meta property=\"og:site_name\" content=\"Best Dedicated Web Hosting Server Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-02T02:09:25+00:00\" \/>\n<meta name=\"author\" content=\"bestdedicatedwebhostingserver\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bestdedicatedwebhostingserver\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"bestdedicatedwebhostingserver\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/\",\"url\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/\",\"name\":\"Replication Lag on Dedicated Hardware: Reading Disk p99 Instead of Average - Best Dedicated Web Hosting Server Blog\",\"isPartOf\":{\"@id\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/#website\"},\"datePublished\":\"2026-11-02T02:09:25+00:00\",\"author\":{\"@id\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/#\/schema\/person\/6eb5f9ea35033fe8e67df44397e089b1\"},\"description\":\"Replication lag is usually diagnosed against the wrong metric. Monitoring shows average disk IOPS fine, average write latency at 0.8ms, and a replica\",\"breadcrumb\":{\"@id\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Replication Lag on Dedicated Hardware: Reading Disk p99 Instead of Average\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/#website\",\"url\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/\",\"name\":\"Best Dedicated Web Hosting Server Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/#\/schema\/person\/6eb5f9ea35033fe8e67df44397e089b1\",\"name\":\"bestdedicatedwebhostingserver\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/462a07aa37399bdb149e5f91dc3cd8906656bc4c7ed391a3b6f0199c5d2ab964?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/462a07aa37399bdb149e5f91dc3cd8906656bc4c7ed391a3b6f0199c5d2ab964?s=96&d=mm&r=g\",\"caption\":\"bestdedicatedwebhostingserver\"},\"sameAs\":[\"https:\/\/bestdedicatedwebhostingserver.com\/blog\",\"https:\/\/x.com\/bestdedicatedwebhostingserver\"],\"url\":\"https:\/\/bestdedicatedwebhostingserver.com\/blog\/author\/bestdedicatedwebhostingserver\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Replication Lag on Dedicated Hardware: Reading Disk p99 Instead of Average - Best Dedicated Web Hosting Server Blog","description":"Replication lag is usually diagnosed against the wrong metric. Monitoring shows average disk IOPS fine, average write latency at 0.8ms, and a replica","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/","og_locale":"en_US","og_type":"article","og_title":"Replication Lag on Dedicated Hardware: Reading Disk p99 Instead of Average","og_description":"Replication Lag on Dedicated Hardware: Reading Disk p99 Instead of Average","og_url":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/","og_site_name":"Best Dedicated Web Hosting Server Blog","article_published_time":"2026-11-02T02:09:25+00:00","author":"bestdedicatedwebhostingserver","twitter_card":"summary_large_image","twitter_creator":"@bestdedicatedwebhostingserver","twitter_misc":{"Written by":"bestdedicatedwebhostingserver","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/","url":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/","name":"Replication Lag on Dedicated Hardware: Reading Disk p99 Instead of Average - Best Dedicated Web Hosting Server Blog","isPartOf":{"@id":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/#website"},"datePublished":"2026-11-02T02:09:25+00:00","author":{"@id":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/#\/schema\/person\/6eb5f9ea35033fe8e67df44397e089b1"},"description":"Replication lag is usually diagnosed against the wrong metric. Monitoring shows average disk IOPS fine, average write latency at 0.8ms, and a replica","breadcrumb":{"@id":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/database-replication-lag-dedicated-disk-percentile99\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Replication Lag on Dedicated Hardware: Reading Disk p99 Instead of Average"}]},{"@type":"WebSite","@id":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/#website","url":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/","name":"Best Dedicated Web Hosting Server Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/#\/schema\/person\/6eb5f9ea35033fe8e67df44397e089b1","name":"bestdedicatedwebhostingserver","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/462a07aa37399bdb149e5f91dc3cd8906656bc4c7ed391a3b6f0199c5d2ab964?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/462a07aa37399bdb149e5f91dc3cd8906656bc4c7ed391a3b6f0199c5d2ab964?s=96&d=mm&r=g","caption":"bestdedicatedwebhostingserver"},"sameAs":["https:\/\/bestdedicatedwebhostingserver.com\/blog","https:\/\/x.com\/bestdedicatedwebhostingserver"],"url":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/author\/bestdedicatedwebhostingserver\/"}]}},"_links":{"self":[{"href":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/wp-json\/wp\/v2\/posts\/1549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/wp-json\/wp\/v2\/comments?post=1549"}],"version-history":[{"count":1,"href":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/wp-json\/wp\/v2\/posts\/1549\/revisions"}],"predecessor-version":[{"id":1552,"href":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/wp-json\/wp\/v2\/posts\/1549\/revisions\/1552"}],"wp:attachment":[{"href":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/wp-json\/wp\/v2\/media?parent=1549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/wp-json\/wp\/v2\/categories?post=1549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bestdedicatedwebhostingserver.com\/blog\/wp-json\/wp\/v2\/tags?post=1549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}