Category.NET

Before replacing LINQ, read what it becomes

B

TL;DR: Replacing a LINQ predicate in the Azure Service Bus receiver removed a repeated delegate allocation. Going further helped some inputs and hurt others. The useful part of that work was learning what the query became and which costs mattered to the SDK, not finding a reason to stop using LINQ. One of the Azure Service Bus changes I worked on started with a short LINQ expression in the receiver. It was readable, did what it needed to do, and sat on a path that completed messages. The...

Why would you optimize this code at all?

W

Low-level .NET performance work is worth doing when the code runs often enough, the improvement reaches enough users, and measurements justify the added complexity. Open source libraries give each improvement unusually broad reach. They also make careless optimization unusually expensive.

Event Sourcing: Is our Projection Code fast enough?

E

In this part of my event sourcing series, we take a quick, pun intended, look at how fast the projector we saw in the last post actually runs. The projector gets a list of events as input and projects them into a single value, representing the latest state. This code runs a couple hundred times a second in our system, so it needs to run fast.

Event Sourcing: A close look at the projector for values

E

In this part of my event sourcing series, we look at implementing the projector for values (uni-temporal events / normal event sourcing). You’ll see the full source code for our ValueProjector, which projects events into a single value representing the latest state.

This brings together many of the things you’ve seen in earlier posts in this series.

Event Sourcing: fun with bi-temporal timelines

E

In earlier parts of this series on event sourcing, we have seen that we can project bi-temporal events (events with two timestamps: when the system knew about the event and when the event takes effect) into so-called timelines. A timeline shows a value over time. In this post, we look at some exemplary use cases these timelines enable.

Event Sourcing: two ways to enable accept/reject workflows

E

When an employee corrects the time they started or stopped working in a time-tracking system, a workflow typically notifies their manager or HR that the data has changed. Then, the manager or HR decides whether to accept or reject this change. The same goes for requests for vacation or other kinds of absences. There are two ways to solve this: First, with normal event sourcing and multiple event streams. Second, with dedicated accept and reject functionality in the projector. In this post...

Keep the gains: performance regression testing without fooling yourself

K

TL;DR: Keep only the benchmarks that protect important hot paths. Use baseline/diff comparisons to catch regressions, but do not trust noisy shared runners blindly. Performance regression testing needs stable machines, clear thresholds, and restraint. After a successful performance investigation, the benchmark folder looks valuable. It contains the history of the work: experiments, false starts, before-and-after comparisons, warmup cases, exception cases, and small probes that helped explain...

The scheduler is part of your message pump

T

TL;DR: The async model is a contract. In .NET, async methods are expected to do little CPU work, spend most of their time awaiting input/output, and make long-running CPU work explicit. Lease renewal depends on that contract. If a handler hides blocking or CPU-heavy work inside an async method, the scheduler assumptions behind renewal can fall apart. The message pump depends on the broker API, but it also depends on the runtime’s execution model. After publishing the previous article...

Recent Posts