Sr. Content Developer at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
165981 stories
·
33 followers

Steve Smith: Clean Architecture with .NET - Episode 430

1 Share

https://clearmeasure.com/developers/forums/

Steve Smith, also known in the developer community as Ardalis, is an entrepreneur, author, and software architect with a deep passion for building effective, maintainable software. Through his company, NimblePros, Steve helps organizations — ranging from household names like Microsoft and Quicken Loans to growing teams across industries — maximize their development potential. His clients frequently describe him as a "force multiplier," amplifying the productivity and impact of the teams he supports.

Steve has been recognized as a Microsoft MVP for over two decades and continues to lead through education and mentorship. He's published numerous courses on Pluralsight and Dometrain, focusing on topics like domain-driven design, software architecture, and design patterns. He also empowers developers through his mentorship platform, DevBetter.com, helping the next generation of professionals grow their careers with intention and clarity. This is his fifth time joining me on the show, after previous conversations on DevOps quality, Domain-Driven Design, .NET 8, and software architecture, and I'm glad to have him back.

Website - https://ardalis.com/
About Page - https://ardalis.com/about
Nimble Pros - https://nimblepros.com/
LinkedIn - https://www.linkedin.com/in/stevenandrewsmith
Github - https://github.com/ardalis
Youtube - https://www.youtube.com/ardalis
Bsky Account - https://bsky.app/profile/ardalis.com 

Previous episodes with Steve Smith:
Episode 48
Episode 209 
Episode 276 
Episode 355

Want to Learn More?
Visit AzureDevOps.Show for show notes and additional episodes.





Download audio: https://traffic.libsyn.com/clean/secure/azuredevops/Episode_430.mp3?dest-id=768873
Read the whole story
alvinashcraft
just a second ago
reply
Pennsylvania, USA
Share this story
Delete

The Change Failure That Exposed Missing Leadership Sponsorship | Laurinda Antonio

1 Share

Laurinda Antonio: The Change Failure That Exposed Missing Leadership Sponsorship

Read the full Show Notes and search through the world's largest audio library on Agile and Scrum directly on the Scrum Master Toolbox Podcast website: http://bit.ly/SMTP_ShowNotes.

 

"We were unable to get the key senior leaders on board to actually sponsor this change." - Laurinda Antonio

 

Laurinda Antonio shares a painful systems-modernisation story from an organisation of more than 5,000 people. The programme was close to launch, yet a survey showed only 33% confidence in the new system. The missing ingredient was not another project plan: key leaders had not truly sponsored the change, and resistance had been visible much earlier. The launch was stopped, tying up the project team and leaving the operational team without the transition they needed. Laurinda owns her part in missing those signals, then explains what she would change: understand the organisation and its stakeholders first; study human behaviour; involve people in discovery rather than surveying them at the last minute; integrate the change into daily work; and maintain feedback loops with operations and senior leaders. Her lesson for Scrum Masters is direct: plans matter, but trust, sponsorship, and continuous connection with the people doing the work matter more.

 

Self-reflection Question: Where are you treating a late confidence signal as a surprise instead of looking for it during discovery?

 

[The Scrum Master Toolbox Podcast Community CTA]

 

About Laurinda Antonio

 

Laurinda Antonio is a Change and Transformation Leader, founder of SHIFT Change Systems, and lecturer . She helps organisations build stronger change capability, navigate complex transformation, and use AI practically to improve readiness, adoption and value realisation, combining strategic leadership with a deeply human approach to change.

 

You can link with Laurinda Antonio on LinkedIn.

 





Download audio: https://traffic.libsyn.com/secure/scrummastertoolbox/20261130_Laurinda_Antonio_M.mp3?dest-id=246429
Read the whole story
alvinashcraft
just a second ago
reply
Pennsylvania, USA
Share this story
Delete

Blazorise 2.4.4 - Report Designer Translations and SVG Charts Customization

1 Share
Blazorise 2.4.4 completes Report Designer translations, adds Class and Style support to SVG Charts, and fixes Gantt, NumericPicker, Slider, and DataGrid issues.
Read the whole story
alvinashcraft
15 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

The Locked Row Maze: Find the Only Route

1 Share

The locked row maze starts at S and ends at R. Do not cross a wall; there is exactly one route.

A good maze makes you feel that the answer is one turn away. A good database investigation can feel that way too, although I do not recommend drawing the latter as a maze when somebody is waiting for a fix. Today we can enjoy the first kind.

Start in the cell marked S at the upper left. Finish at R near the lower right. Move one cell at a time, up, down, left or right. You may not cross a dark wall, and diagonal moves do not count. Trace with a finger if you like. The maze was generated as a connected tree of cells, which means there is one route between any two cells. This is not a trick with an invisible doorway.

A shortcut that seems to cross a line probably does. Give yourself a minute and keep moving. The answer below lists the moves so you can check the result even if you are reading on a small screen.

The locked row maze is a six-by-six grid with S in the upper-left cell and R in the lower-right cell.

The Locked Row Maze Answer

The route from S is: right, down, left, down, right, down, down, down, right, up, up, right, down, right, right, down. The final move reaches R. If you left out one of the two upward steps, you probably ran into the central wall.

The generator opens one wall each time it adds a new cell to the maze. It never opens a second route back into a visited cell. That construction makes the maze a tree, and a tree has one path between S and R. I also ran a solver over the finished grid instead of trusting the picture by eye.

The little connection to SQL is about not forcing a path because it looks shortest. An optimizer can only choose among paths allowed by the data and available access methods. Our drawn wall is far simpler than a real plan, but it makes the difference between a wish and a possible route visible.

If you solved it with a finger, good. If you solved it by marking dead ends, also good. There is no prize for pretending you saw the whole path at once.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.

First appeared on The Locked Row Maze: Find the Only Route

Read the whole story
alvinashcraft
31 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

Parameter Sensitive Plan Optimization: When Does It Fire?

1 Share

In brief

  • Parameter Sensitive Plan optimization is on by default in SQL Server 2025. It did nothing for a table where one customer held 60 percent of the rows. Its own event said why: SkewnessThresholdNotMet.
  • It is not about the heavy value’s share, and not about plan cost. Fourteen tables separate cleanly on one number. It is the heaviest value’s row count divided by the estimate for the compiled value.
  • In this lab the dispatcher plan appeared above a ratio somewhere between 90,000 and 122,500, and never below it.

A scientific diagram of Parameter Sensitive Plan optimization, with fourteen small circles arranged along a horizontal axis labelled ratio on a log scale, hollow circles on the left, filled circles on the right, and a shaded band between ninety thousand and a hundred and twenty thousand.

Parameter Sensitive Plan optimization is the feature that was supposed to end parameter sniffing. Compile one plan for the small customer, another for the giant, and dispatch each call to the right one.

I had a giant customer with 200,052 orders among accounts of 52. The same cached plan served both and cost the giant 613,018 reads. The feature was on. No dispatcher plan appeared.

So I set out to find where it does appear. It took fourteen tables.

What I ruled out first

Share. I built four order tables where the giant held 4.8, 16.7, 35.5 and 60 percent of all rows. Each had indexes on the customer and the date. No dispatcher on any of them.

Cost. All four plans were cheap, around 0.2, and the optimiser had stopped early with “good enough plan found”. So I added a constant subquery that scans 2.5 million rows, pushing the cost to 33.9 with full optimisation. Still nothing. A cross-join shape at cost 8.3, nothing.

Shape. With and without ORDER BY. SELECT star. Through sp_executesql instead of a procedure. Nothing.

Then I asked SQL Server why. There’s an extended event, parameter_sensitive_plan_optimization_skipped_reason, with a map of 45 reasons on this build. Three of them are thresholds: SkewnessThresholdNotMet, OtherThresholdNotMet and CompilationTimeThresholdExceeded.

My first capture proved nothing. I stopped the session before reading its ring buffer, and stopping empties it. That was my error and I’m leaving it in.

With an event file instead, every one of these compiles fired the same reason: SkewnessThresholdNotMet. The feature had looked at the predicate and named the problem. The skew wasn’t enough.

The event names the threshold and doesn’t print the number. The rest of this post is about measuring the number from the outside.

A positive control

Before you say a feature doesn’t fire, you need one case where it does. Otherwise you can’t tell “it never fires here” from “you’re measuring it wrong”.

A table of a million rows with one index. One value holds 990,001 rows. Each other value holds one. SELECT * WHERE val = @v, compiled for a small value.

Dispatcher plan. The statement text in the plan grew a clause I’d never typed: option (PLAN PER VALUE(...)). That’s the feature, working.

Now I had two ends of a rope. One end at 60 percent, no dispatcher and a SkewnessThresholdNotMet event. The other at 99 percent, a dispatcher and no skipped event at all. Somewhere in between was the boundary.

Finding the boundary, and a confound

Seven tables of 500,000 rows. The giant held 60, 70, 80, 90, 95, 98 and 99 percent, with the remainder spread over 10,000 other values. Compile each for a small value.

No dispatcher at 60, 70, 80 or 90. Dispatcher at 95, 98 and 99.

That looked like a share boundary near 95 percent. It wasn’t, and the confound is visible in the same table. As the giant grew, the small values shrank. Twenty rows each at 60 percent, 5 rows at 90, 2 rows at 95. Two things moved together.

Two scientific line plots sharing an axis, one rising and one falling, with an arrow showing they cross at the same point where the outcome changes.

Pulling them apart

Four more tables, built to move one thing at a time.

A 90 percent giant with the remainder spread so thin that each small value estimated at one row: dispatcher. A 95 percent giant with the remainder over only 1,000 values, 25 rows each: no dispatcher. An 80 percent giant, thin remainder: dispatcher. A 98 percent giant, 20 rows per small value: no dispatcher.

So it wasn’t the share. A 98 percent giant failed and an 80 percent giant passed. What mattered was the small side.

Then three more. They tested whether the rule was “small side under about two rows” or a ratio between the two.

A giant of only 50,000 rows with a one-row small side: no dispatcher. A giant of 250,000 with the same one-row small side: dispatcher. A 98 percent giant with a four-row small side: dispatcher.

The first of those kills the absolute rule. A one-row small side wasn’t enough when the giant was small. The last one kills it from the other direction. Four rows was fine when the giant was big enough.

The number that separates all fourteen

Rows at the heaviest value, divided by the optimiser’s estimate for the value the plan was compiled for.

Table Giant rows Estimate for compiled value Ratio Dispatcher
60% giant, 10,000 others 300,000 20 15,000 no
95% giant, 1,000 others 475,000 25 19,000 no
70% giant 350,000 15 23,333 no
98% giant, 500 others 490,000 20 24,500 no
Orders table, 60% giant 1,500,050 50 30,001 no
80% giant 400,000 10 40,000 no
10% giant, thin remainder 50,000 1 50,000 no
90% giant 450,000 5 90,000 no
98% giant, four-row remainder 490,000 4 122,500 yes
95% giant 475,000 2 237,500 yes
50% giant, thin remainder 250,000 1 250,000 yes
80% giant, thin remainder 400,000 1 400,000 yes
90% giant, thin remainder 450,000 1 450,000 yes
99% giant 495,000 1 495,000 yes

Sorted by that ratio, the answers separate perfectly. Every table under 90,000 said no. Every table over 122,500 said yes. Nothing else I varied predicts the outcome. That describes these results, not the engine’s rule.

The problem I opened with, 200,052 orders against an estimate of 51.25, has a ratio of about 3,903. It sits far below the boundary I measured.

What I can and can’t claim

I can claim what fired and what didn’t on build 17.0.4085.5. That’s for a single equality predicate on an indexed integer column.

I can’t claim the engine computes this ratio. It may bucket cardinalities on a log scale. It may then require the compiled value and the heavy value to land far enough apart. That would produce the same boundary and I couldn’t tell the difference from outside.

I also can’t claim the boundary is exactly 100,000. It’s between 90,000 and 122,500. Two more tables would narrow it. They wouldn’t change the lesson.

The lesson about Parameter Sensitive Plan optimization

The documentation says the feature helps with skewed data. In these test cases on this build, it did at a ratio between 90,000 and 122,500. That’s the heaviest value’s rows against the estimate for the compiled value. It is an observed separation, not an established threshold.

A customer with 200,000 orders in a table where most have 50 is a skew of 4,000 to one. That’s a real production problem. It’s the one people mean when they say parameter sniffing, and in this lab the feature didn’t see it.

So the answer to “doesn’t 2025 handle this now” is: in this lab, yes for the rare giant. Not for the ordinary one. For the ordinary giant the fixes are still the old ones.

A scientific illustration of a ratio scale in three bands. Everything below ninety thousand is shaded as no dispatcher plan, a narrow band between ninety thousand and a hundred and twenty two thousand five hundred is marked boundary unresolved, and everything above it is shaded as dispatcher plan. The ordinary giant is marked at three thousand nine hundred and three.

If you’d like this run against your own skew before you rely on it, the fourteen scripts take an afternoon.

Skewed is not a feeling, it is a ratio, and I measured where this one starts to count.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.

First appeared on Parameter Sensitive Plan Optimization: When Does It Fire?

Read the whole story
alvinashcraft
38 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

Your server wasn’t slow, it was waiting. We fixed it with this paper

1 Share

Under the Hood: The Research Behind Microsoft SQL, part 4

This is a really interesting type of engineering paper. No new architecture, no new theory. Just a team looking hard at a bottleneck everyone had accepted for twenty years, and removing it.

The bottleneck was a single byte. Yes, really.

Concurrent Updates to Pages with Fixed-Size Rows Using Lock-Free Algorithms (VLDB 2020) is about how SQL Server keeps track of free space, and how fixing one small piece of that produced up to 5x throughput on some workloads.

The setup

Start with something you’d actually write in an app. Each request to your app runs a stored procedure that creates a temp table, fills it with a few thousand rows, does some work, and drops it. Or you have an ingestion service where a few hundred sessions insert rows at the same time. Nothing too crazy, but likely pretty common.

SQL Server stores everything in 8 KB pages. Permanent tables, temp tables, indexes, all of it. When the page you’re writing to fills up, the engine needs a fresh one and has to find one that isn’t already in use. When you drop that temp table, its pages go back into circulation. So every insert-heavy operation is quietly also a stream of “give me a free page” and “here’s one back” requests. One call from your application can trigger hundreds of them.

To answer those quickly, SQL Server keeps a sign-out sheet. It’s called a Page Free Space page (now I know what PFS stands for!), and it has one line for every page it tracks: taken or free, how full, a few other details. One Page Free Space page (aka a sheet) covers about 64 MB worth of pages. I’m not sure if I’m laughing or frustrated at that choice of naming “Page Free Space page,” perhaps I can revisit later.

Grabbing a page means marking its line. Handing one back means clearing it. You never see this. It’s bookkeeping. Another one of those things I never really thought about a database engine, before reading this paper.

The problem

Here’s the rule that caused twenty years of trouble: only one person could touch the sheet at a time.

Not one person per line. One person, period. Two sessions creating two completely unrelated temp tables, needing two different pages, took turns. Not because they wanted the same thing, but because their bookkeeping happened to live on the same sheet.

“The exclusive latch on the page prevents other threads from modifying the page at the same time, reducing the concurrency, and negatively impacting the throughput of the system.”

The paper is refreshingly blunt about how long this had been going on:

“Customers of SQL Server have faced similar contention on space management pages like PFS for decades.”

If you’ve ever watched a server crawl while the CPU sat mostly idle, this is one of the classic causes. In the wait statistics it shows up as PAGELATCH_UP. I should note for all the Microsoft SQL veterans, you know this much better than I do. You experienced it and suffered with it, and tried to find ways around it. Please forgive me for just learning about it without truly experiencing it!

Then Constant Time Recovery, the subject of part 2 of this blog series, made it worse. That feature needs to update the sheet more often (because it made the row history store durable). A change that removed hour-long outages pushed harder on a twenty-year-old traffic jam.

The fix

The team noticed something that had been true the whole time: two sessions never actually need to write on the same line. Before you can touch a line on the sheet, you already have exclusive control of the page that line describes. So the conflict the rule was preventing couldn’t happen in the first place. Everyone was queuing to avoid a collision that was already impossible. So they changed the rule! Now many sessions can stand at the sheet at once, and each writes only its own line. Each write uses a processor instruction that completes as one indivisible step, so a line can never be caught half-updated.

That’s the whole idea! The rest of the paper is the unglamorous work of making it safe that I can’t admit to grokking fully, but to summarize: keeping a shared counter on the sheet readable while people are writing to it, making sure the background process that saves changes to disk doesn’t take its snapshot mid-update, and a few similar details.

The part I find most interesting is how they handled old code. Plenty of existing code assumed the old rule and read the entire sheet expecting it to hold still. Rather than track down and rewrite every one of those callers, they made any request that asks for the old behavior automatically get it. Old code keeps its guarantee. New code gets the speed. That’s the difference between a clever idea and a shippable one.

What it bought

A transaction processing benchmark on a 40-core machine:

Throughput CPU used
Before 475,423 45.3%
After 787,100 98.5%

About 65% more work. But look at the CPU column. The machine wasn’t slow. It was waiting.

A workload doing nothing but creating temp tables, 400 sessions at once:

Machine Before After
2-socket, 256 GB 10 min, 10% CPU under 2 min, 32% CPU
8-socket, 6 TB 11.5 min, 1% CPU 5 min, 83% CPU

Roughly 5x and 2x. That 1% CPU on a large server is the number I’d put on a slide.

A real customer workload:

Requests/sec CPU Top wait
Before 350 35% PAGELATCH_UP at 38.5%
After 1,035 63% gone from the top waits

Three times the throughput. Same hardware, same application, no code changes. The overhead was about 156 KB of memory for a 100 GB database. At publication the feature was running on more than five million databases in Azure SQL Database.

Where you see this today

You don’t configure this. It’s how the engine works now, on by default in SQL Server 2019 and later and in Azure SQL/Fabric SQL. Pretty neat!

What’s changed since the paper

The same technique spread to the other maps. PFS pages aren’t the only bookkeeping SQL Server keeps. SQL Server 2022 added similar concurrency improvements for GAM and SGAM pages, which track space at a coarser level and had the same style of bottleneck. Don’t ask me about these in detail, I don’t know much about them (yet).

A lot of old tuning advice is now obsolete. For years the standard workaround for allocation contention was trace flags 1117 and 1118 plus a specific number of tempdb data files (so I’m told). Those two trace flags stopped being necessary in SQL Server 2016, when the behavior became built in. Combined with this paper’s work and memory-optimized tempdb metadata, much of the folklore (lol sorry) you’ll find in older blog posts is solving problems the engine no longer has.

If you’re carrying tuning steps from a 2016 runbook, that’s worth a fresh look. Hopefully you aren’t, because it’s out of support, but I’ve heard of earlier versions running in production…

Why this matters if you think the engine has stopped changing

The perception that Microsoft SQL is finished software is understandable. SQL Server has been around a long time and the surface looks stable. The reality is that someone questioned a rule from the 1990s, proved the thing it was protecting against couldn’t happen, and removed it. A customer workload went from 350 to 1,035 requests per second without touching the application or the hardware.

The authors’ own conclusion is a decent engineering principle:

“The work showed that taking a closer look at a particular subsystem that is based on lock-based algorithms and changing them to be lock-free can help in significantly boosting the performance of the entire system.”

Most systems have a byte like this somewhere, can you find another??

Credits

Concurrent Updates to Pages with Fixed-Size Rows Using Lock-Free Algorithms was written by Raghavendra Thallam Kodandaramaih, Hanuma Kodavalla, and Girish Mittur Venkataramanappa (Microsoft).

Next steps

 

The post Your server wasn’t slow, it was waiting. We fixed it with this paper appeared first on Azure SQL Dev Corner.

Read the whole story
alvinashcraft
45 seconds ago
reply
Pennsylvania, USA
Share this story
Delete
Next Page of Stories