failover
16 TopicsA Practical RCA Method for Azure SQL: Separating Evidence, Correlation and Root Cause
CPU hit 100%. You scaled the database. The problem went away. You still haven't proved that CPU was the root cause. We see RCAs written this way all the time, and it's easy to understand why. There's pressure to explain what happened, and a clear story feels better than an open question. But an RCA built on correlation can send a team in the wrong direction. You end up paying for capacity you don't need while the real cause waits for the next incident. Here's the method we use to keep evidence, correlation and conclusions apart. What an RCA should answer A useful RCA answers four questions: What happened? Symptoms and impact, with exact times. Why did it happen? The cause, backed by evidence. What stopped it? The mitigation. What are we still unsure about? The limits of the evidence. Most weak RCAs answer the first and third questions well and then treat the third as if it were the second. The framework Observation → Correlation → Hypothesis → Validation → Conclusion Step What it means Example Observation Something you measured directly "CPU reached 95% at 09:00 UTC" Correlation Two observations happened close together "Login failures started two minutes later" Hypothesis A possible explanation you can test "High CPU caused the failover" Validation Evidence that supports or rules out the hypothesis "Comparable CPU peaks last week caused no failover" Conclusion What the validated evidence allows you to say "CPU is not established as the cause" The step that gets skipped most often is validation, and it's the one that matters most. A worked example (synthetic) Here's an invented incident on a fictional database, SalesDB: 09:00 UTC CPU rises to 95% 09:02 UTC Login failures begin (error 40613) 09:04 UTC Database fails over to another replica 09:05 UTC Connections recover The first draft of the RCA practically writes itself: "High CPU caused the failover." Before you accept that, ask: Did CPU actually reach the limit? 95% is high, but it isn't exhaustion. Were worker or session limits reached? Check max_worker_percent and max_session_percent in sys.dm_db_resource_stats. Was memory under pressure? Was the failover triggered independently? For example, by planned maintenance. Check Resource Health and Service Health. What happened during earlier high-CPU periods? If CPU reached 95% three times last week with no failover, CPU alone doesn't explain this one. Did other databases on similar workloads see the same thing? Now classify every statement: Statement Classification CPU reached 95% Confirmed Login failures occurred Confirmed The events overlapped in time Confirmed CPU caused the failover Unconfirmed hypothesis The failover restored connectivity Confirmed The failover proves the old replica was faulty Not established That table is more honest than the first draft, and more useful too. It shows the reader exactly what's known and what still needs work. Habits that make RCAs better Use UTC everywhere. Mixed time zones are the most common reason two sets of logs "don't line up." Convert everything before you compare anything. Define the impact first. Who was affected, how badly, and for how long? "Some logins failed between 09:02 and 09:05" is far more useful than "the database was down." Keep observations and interpretation apart. "Error 40613 was returned" is an observation. "The database was unavailable because of load" is an interpretation. Write them in separate places. Consider more than one explanation. If you only have one hypothesis, you'll find evidence for it. Write down at least two, then look for evidence that would rule each one out. Compare against healthy periods. A metric only means something next to its baseline. High CPU during an incident matters less if CPU is just as high every Monday morning. Compare against unaffected resources. If two databases had the same load and only one failed, load probably isn't the whole story. Don't assume the fix explains the cause. Restarts, failovers and scale operations change many things at once: the compute node, connections, caches and sometimes the physical host. When the problem stops after one of them, you know something in that bundle mattered. You don't know which part. When "root cause unknown" is the right answer Sometimes the evidence doesn't support a definite cause. Saying so isn't failure. It's accuracy. A good RCA with an open cause still gives the reader something to act on: What was ruled out, and how. Which hypotheses remain, ranked by likelihood. What evidence would settle it next time, such as finer-grained monitoring, connection-level logging or a synthetic probe. What resilience work reduces the impact whatever the cause turns out to be, such as retry logic or alerting. A simple RCA template 1. Summary – One paragraph: what happened, the impact, the current status 2. Impact – Who/what was affected, start and end times in UTC 3. Timeline – Observations only, in UTC 4. Analysis – Hypotheses considered, evidence for and against each 5. Root cause – What the evidence supports (or "not established") 6. Mitigation – What restored service 7. Limitations – What the evidence could not show 8. Next actions – Prevention, detection, and evidence gaps to close Summary A good RCA tells you what the evidence shows, and also what it doesn't let you claim. "We restarted it and the problem went away" describes a mitigation, not automatically a root cause. Keep those two apart, and your RCAs become something people can trust and act on.109Views0likes0CommentsAzure SQL Maintenance and Failover: Turning Brief Disconnects into a Resilient Application Design
Your database disappeared for seven seconds. Was that an outage, a maintenance event, or a gap in how your application handles reconnects? We get some version of this question a lot. A batch of login failures shows up in the logs, a few commands fail with error 40613, and then everything goes back to normal before anyone can look. This post covers what's usually going on, how to investigate it properly, and how to design your application so these moments don't turn into incidents. Brief disconnects are part of running in the cloud Azure SQL Database runs every database on more than one replica. To patch, upgrade or rebalance the service, Azure moves the primary role from one replica to another. While that happens, existing connections are dropped and new connections can be refused for a short time. Most of these switch's finish within seconds. Your application will see them, though, and the planned maintenance documentation is clear that applications are expected to handle them. It helps to think of this as three responsibilities: Who Responsibility Azure SQL Keeps the service available and carries out replica switches as quickly and safely as possible Your application Reconnects safely after a short interruption You, as the operator Make planned maintenance more predictable where the service supports it If any one of these is missing, a routine event can become a customer-facing problem. What happens during a primary switch At a high level: A secondary replica is ready to take over. The current primary stops accepting work, and connections to it are closed. The new primary comes online and starts accepting connections. The gateway sends new logins to the new primary. During steps 2 and 3, your application can see: Dropped connections in the middle of a query Login failures Error 40613 Planned vs. unplanned switches Planned: maintenance, upgrades and patches. You can influence when these happen (see below). Unplanned: hardware or software failures, or recovery actions. These can happen at any time. The client has to handle both kinds of the same way. A maintenance window helps with the first. Only retry logic in your application helps with both. Recognizing transient errors Microsoft documents a list of errors that are expected to be transient and safe to retry. The ones you'll see most often: Error Meaning 40613 Database is not currently available. Please retry the connection later. 40197 The service hit an error while processing your request 40501 The service is currently busy 49918, 49919, 49920 Can't process the request right now because of too many operations in progress You'll also see lower-level network errors, such as an existing connection being forcibly closed or a TCP timeout. Network error vs. database switch: a socket or TCP error on its own doesn't prove that the database switched replicas. Firewalls, NAT timeouts, proxies and client network issues produce similar errors. Error 40613 is a much stronger signal that the database itself was briefly unavailable. One application error is not one server event When you add up the failures in your application logs, remember: One replica switch can produce dozens of errors: one for each pooled connection, thread or retry attempt. Some errors in the same time window may have nothing to do with the switch. Errors that happen at the same time as a switch aren't automatically caused by it. In one investigation we worked on, short bursts of login failures lined up closely with upgrade-related replica switches. That timing explained most of the bursts, but not every failure the application reported, and it didn't prove exactly how each login failed. In another case, command failures during a brief switch were confirmed. The high resource usage seen around the same time was kept out of the root cause, because the evidence didn't show that it contributed. That's the right standard to hold yourself to. Show the connection with evidence and be clear about what the evidence doesn't explain. Build a UTC timeline Before you draw any conclusions, put everything on one timeline in UTC: Application errors, with exact timestamps Resource Health events for the database Service Health notifications Deployments, scaling and configuration changes on your side Network changes, such as firewall, proxy or DNS updates Mixing time zones is the most common reason two sets of logs "don't line up." To make that timeline easy to build, capture these fields for every failed attempt: UTC timestamp SQL error number Client connection ID Operation attempted (login, read, write, commit) Retry number Retry outcome (succeeded / failed / gave up) Application node / host Database name If you open a support case, this information shortens the investigation a lot. Designing the reconnect The pattern is simple: try the operation ↓ failed with a transient error? ├── no → fail normally and surface the error └── yes → still within the retry limit? ├── no → fail and log it └── yes → wait (exponential backoff + jitter) → open a new connection → try again A few points matter here: Limit the retries. For example, 5 attempts with a total time limit. Endless retries just hide an outage. Back off exponentially and add jitter. For example, wait about 1 s, 2 s, 4 s, 8 s, each plus a small random delay. Without jitter, every instance retries at the same moment and you get a reconnect storm. Open a new connection for each retry. Don't keep using the one that just failed. Retry the operation, not just the login. A dropped connection in the middle of a query needs the query to run again. Use what your driver already offers. For example, Microsoft.Data.SqlClient has configurable retry logic and connection settings such as ConnectRetryCount and ConnectRetryInterval. Be careful with retried writes Retrying a read is harmless. Retrying a write can be risky. If the connection drops while a transaction is committing, you may not know whether the commit succeeded. Retrying blindly can insert duplicate orders, send a payment twice, or apply the same change twice. Ways to protect against this: Use an idempotency key, such as a unique request ID with a unique constraint, so a repeated attempt is rejected or ignored. Check before you retry. Did the row already arrive? Keep transactions short, so less work is in flight when a connection drops. Make planned maintenance predictable By default, maintenance can happen during a wide window. In supported service tiers and regions, you can choose a maintenance window that fits your business, such as weekday or weekend nights in the region's local time. Two related features: Advance notifications: when a non-default maintenance window is set, you can receive a Service Health alert ahead of planned maintenance. Service Health alerts: send planned maintenance and service issue notifications to email, Teams or your incident tooling. These make maintenance more predictable, but they don't replace reconnect handling. Unplanned switches still happen, and an application that can't reconnect will still fail inside a well-chosen window. Production resilience checklist Transient errors (including 40613) are retried with a retry limit, exponential backoff and jitter Each retry opens a new connection Writes are idempotent, or checked before they're retried Failed attempts are logged in UTC, with the error number, connection ID and retry result Alerts fire on retries that gave up, not on every transient error A maintenance window is configured where supported Service Health and Resource Health alerts go to the right team Reconnect behaviour has been tested, for example with a user-initiated manual failover in a non-production environment Summary Cloud databases switch replicas, and resilient applications reconnect. Getting those two to work together is mostly an application design problem, not a database problem. A few seconds of disconnection is normal. Whether your users notice it depends on how your application responds.Implementing Disaster Recovery for Azure App Service Web Applications
Starting March 31, 2025, Microsoft will no longer automatically place Azure App Service web applications in disaster recovery mode in the event of a regional disaster. This change emphasizes the importance of implementing robust disaster recovery (DR) strategies to ensure the continuity and resilience of your web applications. Here’s what you need to know and how you can prepare. Understanding the Change Azure App Service has been a reliable platform for hosting web applications, REST APIs, and mobile backends, offering features like load balancing, autoscaling, and automated management. However, beginning March 31, 2025, in the event of a regional disaster, Azure will not automatically place your web applications in disaster recovery mode. This means that you, as a developer or IT professional, need to proactively implement disaster recovery techniques to safeguard your applications and data. Why This Matters Disasters, whether natural or technical, can strike without warning, potentially causing significant downtime and data loss. By taking control of your disaster recovery strategy, you can minimize the impact of such events on your business operations. Implementing a robust DR plan ensures that your applications remain available and your data remains intact, even in the face of regional outages. Common Disaster Recovery Techniques To prepare for this change, consider the following commonly used disaster recovery techniques: Multi-Region Deployment: Deploy your web applications across multiple Azure regions. This approach ensures that if one region goes down, your application can continue to run in another region. You can use Azure Traffic Manager or Azure Front Door to route traffic to the healthy region. Multi-region load balancing with Traffic Manager and Application Gateway Highly available multi-region web app Regular Backups: Implement regular backups of your application data and configurations. Azure App Service provides built-in backup and restore capabilities that you can schedule to run automatically. Back up an app in App Service How to automatically backup App Service & Function App configurations Active-Active or Active-Passive Configuration: Set up your applications in an active-active or active-passive configuration. In an active-active setup, both regions handle traffic simultaneously, providing high availability. In an active-passive setup, the secondary region remains on standby and takes over only if the primary region fails. About active-active VPN gateways Design highly available gateway connectivity Automated Failover: Use automated failover mechanisms to switch traffic to a secondary region seamlessly. This can be achieved using Azure Site Recovery or custom scripts that detect failures and initiate failover processes. Add Azure Automation runbooks to Site Recovery recovery plans Create and customize recovery plans in Azure Site Recovery Monitoring and Alerts: Implement comprehensive monitoring and alerting to detect issues early and respond promptly. Azure Monitor and Application Insights can help you track the health and performance of your applications. Overview of Azure Monitor alerts Application Insights OpenTelemetry overview Steps to Implement a Disaster Recovery Plan Assess Your Current Setup: Identify all the resources your application depends on, including databases, storage accounts, and networking components. Choose a DR Strategy: Based on your business requirements, choose a suitable disaster recovery strategy (e.g., multi-region deployment, active-active configuration). Configure Backups: Set up regular backups for your application data and configurations. Test Your DR Plan: Regularly test your disaster recovery plan to ensure it works as expected. Simulate failover scenarios to validate that your applications can recover quickly. Document and Train: Document your disaster recovery procedures and train your team to execute them effectively. Conclusion While the upcoming change in Azure App Service’s disaster recovery policy may seem daunting, it also presents an opportunity to enhance the resilience of your web applications. By implementing robust disaster recovery techniques, you can ensure that your applications remain available and your data remains secure, no matter what challenges come your way. Start planning today to stay ahead of the curve and keep your applications running smoothly. Recover from region-wide failure - Azure App Service Reliability in Azure App Service Multi-Region App Service App Approaches for Disaster Recovery Feel free to share your thoughts or ask questions in the comments below. Let's build a resilient future together! 🚀SQL Server AG Failover - Automatic Failover
Hello, I am looking for a straight and definitive answer that I was hoping someone could answer for me. I want to trust what Copilot says, but I really need to hear it from Microsoft and I can't find any documentation from Microsoft confirming my question. My Environment: 2 replicas in datacenter 1 1 replica in datacenter 2 All three (3) replicas are set to synchronous-commit mode with automatic failover. I tested the failover manually between all three (3) replicas without issue. When I test the automatic failover - I take down both replicas in datacenter 1 at the same time to simulate a datacenter outage. I look at the replica in datacenter 2 and it is just says (Resolving...) next to the replica name. The replica does not come online and the DB is not moved. When I was searching I couldn't find out why. So I turned to Copilot not solve the issue, but to see if it could point me in the right direction. I tell Copilot my setup and what happened. Copilot responded stating that by design from Microsoft you cannot have more than two (2) replicas set to synchronous-commit mode with automatic failover in a SQL Server AG instance. That if more than two (2) are set for automatic failover. The SQL Server AG will use the first two (2) replicas it sees in its metadata and ignore the rest. Copilot went into detail about why this is designed this way, but the amount of information would make this post longer than it already is. If this is true - then when I took down both replicas in datacenter 1, SQL Server AG only saw those two (2) replicas in datacenter 1 as the available replicas to use for an automatic failover and thus why the replica in datacenter 2 did not come online and the DB not being moved So let's do a test. I brought back up the two (2) replicas in datacenter 1. Then I made a change in the AG proprieties. I set the 2nd replica in datacenter 1 to manual. So 1 replica is set to automatic failover and 1 replica is set to manual failover in datacenter 1. The replica in datacenter 2 is set to automatic failover I then take down both replicas in datacenter 1 again to simulate the "outage" and the replica in datacenter 2 comes online and the DB is moved. So is Copilot right? Can there only be two (2) replicas allowed to have/use automatic failover? I cannot find a definitive answer confirming this. Or is my configuration wrong/missing something and if it is, could you please point me in the right direction on how to get this resolved?656Views0likes4CommentsDHCP Failover Issue – Standby Server Responding When It Should Not
Hi everyone, I'm encountering an issue with my DHCP failover setup in Hot Standby mode, and I need insights into why the standby server is providing DHCP leases when it shouldn’t. Setup Overview: I manage a network with over 100 sites worldwide, each having a local DHCP server. Each site has a dedicated DHCP server running on the server VLAN. Clients reside on different VLANs, and IP helpers (DHCP relay) are configured on a Checkpoint firewall at each site. The IP helper forwards DHCP requests to: The local DHCP server (primary) in the site's server VLAN. The standby DHCP server (failover), located at an on-premises data center (DC). DHCP servers are configured in Hot Standby mode using Microsoft DHCP Failover. Issue: Despite the Hot Standby configuration, I noticed that my Cisco Meraki dashboard frequently reports a new DHCP server detected, referring to the standby DHCP server, even though the primary DHCP server at the local site is available. Cisco Meraki triggers this alert when it detects DHCPACK packets from the standby DHCP server traversing the local networks. However, in Hot Standby mode, the failover server should only issue leases if the primary server is unreachable. Example: Site-1's primary DHCP server (DHCP-1) has a failover partnership with Failover-1 at the DC. Site-1's connectivity to the DC is stable, yet Cisco Meraki occasionally detects DHCPACK packets from Failover-1, triggering alerts. Troubleshooting Done So Far: Verified that failover mode is correctly set to Hot Standby (not Load Balance). Confirmed that the primary DHCP server is healthy and responding. Checked DHCP logs on both servers but found no clear failover events. Performed packet captures of DHCP traffic, but the results were inconclusive. Investigated whether Checkpoint firewall’s IP helper can prioritize the primary DHCP server, but it appears not to support this functionality. Created a PowerShell script to check for failover-related event logs (Event IDs: 20254 and 20255). This provided better visibility but did not correlate with the Meraki alerts. Questions: Are there any known scenarios where a standby DHCP server in Hot Standby mode might mistakenly issue leases, even when the primary is active? Is there any detailed information on the failover “heartbeat” mechanism between primary and standby servers? I found that it uses TCP port 647, but I couldn’t locate official documentation on the interval and failure conditions. Could failover state synchronization delays cause this behavior? Are there specific logs or PowerShell commands I should check to confirm why the standby server is responding? Is there a way to prevent the standby server from responding unless the primary is truly unreachable (e.g., registry settings, advanced configuration)? Any guidance or troubleshooting steps would be greatly appreciated! Thanks in advance.1.7KViews0likes3CommentsSQL Server Distributed AG's Forwarder Is Not Syncing After Primary AG's Internal Failover
I have set up a SQL Server Distributed Availability Group (DAG) in Kubernetes using SQL Server on Ubuntu images. The setup consists of two availability groups (AGs) across two separate clusters: Setup Details: Primary Cluster (AG1) Pods: ag1-0 (Primary), ag1-1, ag1-2. The Primary is Exposed via the LoadBalancer service. Remote Cluster (AG2): Pods: ag2-0 (The Primary of AG2, Acting as a forwarder of DAG), ag2-1, ag2-2. The Forwarder (ag2-0) is Exposed via the LoadBalancer service. Distributed AG Configuration: AG1 and AG2 are part of the DAG. Each AG’s primary is dynamically selected using the pod's label role=primary. LISTENER_URL in the DAG configuration points to the LoadBalancer service of each AG. Issue: DAG Not Syncing After AG1 Failover For testing, I triggered a failover in AG1 using: `ALTER AVAILABILITY GROUP [AG1] FORCE_FAILOVER_ALLOW_DATA_LOSS;` The global primary changed from ag1-0 to ag1-1, and I updated the role=primary label accordingly (removed from ag1-0, added to ag1-1. However, AG2 (the forwarder and its replicas) stopped syncing and became unhealthy. From ag2-0 (forwarder) logs, I only see connection timeouts and disconnections from the global primary. AG2 is not automatically reconnecting to the new primary (ag1-1), even though the LoadBalancer service in LISTENER_URL now points to ag1-1. Logs from ag2-0 (Forwarder) Shows Like A connection timeout has occurred while attempting to establish a connection to GLOBAL PRIMARY. Either a networking or firewall issue exists, or the endpoint address provided for the replica is not the database mirroring endpoint of the host server instance Steps I Tried: - Checked DAG Configuration – The LISTENER_URL is correctly set to the LoadBalancer of AG1, which now points to ag1-1. - Ran the Resume Command: `ALTER DATABASE [agtestdb] SET HADR RESUME;` This did not resolve the issue. - Verified Network Connectivity Questions: - What steps are required to ensure AG2 correctly syncs with the new global primary (ag1-1) after an AG1's internal failover? - Is there a specific command that needs to be run on the forwarder (ag2-0) or the new global primary (ag1-1) to reestablish synchronization? - Why isn’t AG2 automatically reconnecting, even though the LoadBalancer service points to the correct primary? - Are there any best practices for handling SQL Server DAG failovers in Kubernetes? Any insights would be greatly appreciated!648Views0likes2CommentsASR Failover network architecture
I'm new to Azure and I have requirement to set up disaster recovery for an on-prem server. I am aware of the process in replicating the server to the cloud. However, I am not able to grasp how networking should be in a disaster situation. Server is in 172.x.x.x network and I know that s2s VPN should be set up between the Azure network and the on-prem network And Azure network and on-prem can't be on the same subnet for s2s to work. So when I failover to cloud, how would the cloud server talk to the on-prem network? And devices in on-prem talk to the server in the cloud?3.6KViews0likes4Comments