- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Core Tech
Concurrency Management and Resilience Patterns
In this hands-on lab, you will diagnose and resolve SQL Server concurrency issues on a financial database with 500,000 transaction records replicated across a two-node Always On Availability Group. You will generate blocking chains and deadlocks, diagnose them using Dynamic Management Views like `sys.dm_exec_requests` and `sys.dm_tran_locks`, analyze deadlock graphs from Extended Events, and enable Read Committed Snapshot Isolation to eliminate reader-writer blocking. You will implement application-side resilience patterns including a Circuit Breaker with full state transitions, Queue-Based Load Leveling using Amazon SQS, and Command Query Responsibility Segregation with read replica routing. You will then tune connection pooling, optimize memory allocation, implement table partitioning to reduce lock escalation, and validate all improvements under a concurrent load test with zero blocked requests and zero errors.
Lab Info
Table of Contents
-
Challenge
Resolve Lock Contention and Deadlock Scenarios
- Generate a blocking chain by holding an exclusive lock in a background job while a second job attempts to update the same row.
- Diagnose the blocking chain to identify the waiting session, lock type, and blocked query.
- Generate a deadlock with two transactions acquiring locks in opposite order and analyze the deadlock graph.
- Enable Read Committed Snapshot Isolation and verify that concurrent reads complete without blocking during an active write transaction.
-
Challenge
Implement Application-Side Resilience Patterns
- Build a Circuit Breaker that transitions through all three states: Closed during normal operations, Open after three consecutive failures, and Half-Open with a trial recovery call.
- Implement Queue-Based Load Leveling by sending transaction messages to an Amazon SQS queue, then processing them one by one into the database with receive, insert, and delete operations.
- Configure Command Query Responsibility Segregation by routing writes to SQL1 and reads to SQL2, verifying data replication through the Always On Availability Group within seconds.
-
Challenge
Tune System Resources for Maximum Concurrency
- Configure connection pooling parameters, including Min Pool Size, Max Pool Size, and Connection Timeout, and monitor pool behavior.
- Set max server memory to reserve 4 GB for the operating system and verify buffer pool efficiency.
- Implement table partitioning on the Transactions table by year, verify partition distribution across four partitions, and confirm partition elimination in execution plans.
- Check lock escalation statistics and run a concurrent load test with 25 readers and 10 writers to validate zero blocked requests and an error rate below 5%.
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.