Skip to main content

Particular Software Blog

Latest articles

  • Banish ghost messages and zombie records from your web tier

    Because it’s hard to write idempotent code effectively, NServiceBus provides the outbox feature to make your business data transaction and any sent or received messages atomic. That way, you don’t get any ghost messages or zombie records polluting your system. 1

    But the outbox can only be used inside a message handler. What about web applications and APIs?

    With the new NServiceBus.TransactionalSession package, you can use the outbox pattern outside of a message handler too.

    Read more

    1. For details on ghost messages, zombie records, and why they pose a problem for distributed systems, check out our blog post What does idempotent mean?

    2. Which is sad for the messages, I guess?

    3. …which you can learn about in our webinar Implementing an Outbox – model-checking first.

  • How we achieved 5X faster pipeline execution by removing closure allocations

    Divers in front of a gigantic shark

    The NServiceBus messaging pipeline strives to achieve the right balance of flexibility, maintainability, and wicked fast…ummm…ability. It needs to be wicked fast because it is executed at scale. For our purposes, “at scale” means that throughout the lifetime of an NServiceBus endpoint, the message pipeline will be executed hundreds, even thousands of times per second under high load scenarios.

    Previously, we were able to achieve 10X faster pipeline execution and a 94% reduction in Gen 0 garbage creation by building expression trees at startup and then dynamically compiling them. One of the key learnings of those expression tree adventures is that reducing Gen 0 allocation makes a big difference. The less Gen 0 allocation used, the more speed can be squeezed out of the message handling pipeline, which ultimately means more speed for our users.

    Read more
  • Let's talk about Kafka

    Statue of Franz Kafka in Prague, Czech Replubic
    Head of Franz Kafka, a kinetic sculpture in Prague, Czech Republic

    We get a lot of questions about Kafka. Is it good? Does it live up to the hype? And most frequently, when are we going to support Kafka in NServiceBus.

    But to fully answer these questions, it’s essential to understand what Kafka is, and more importantly what it isn’t, and then think about the kinds of problems that Kafka solves. So, let’s dive into the (heavily footnoted) details…

    Read more

    1. An overloaded term if ever there was one, but that's a subject for another post. Suffice it to say, this does not mean the same thing as an NServiceBus event.

    2. This is a bit of an oversimplification. Ordering in Kafka is only guaranteed per partition, and the number of partitions heavily influences how your topic can scale with the load.

    3. While this may sound like a small detail, it's one of the most important aspects that make technologies like Kafka so popular for data distribution. Guaranteed ordering is one of the fundamental requirements to ensure correct data replication.

    4. That is, assuming that the retention period or maximum size has not been reached, at which point Kafka will start overwriting data. On the other hand, queues will not apply retention settings by default, and if your queue gets full, it will reject further writes until you consume messages from it to free up space. That may sound bad, but it ensures you don't overwrite critical business data.

    5. A NACK or negative acknowledgment

    6. See how NServiceBus retries message processing to determine if a message is a poison message before forwarding it to an error queue in I caught an exception. Now what?

    7. See Error Handling Patterns for Apache Kafka Applications and Kafka Connect Deep Dive – Error Handling and Dead Letter Queues for more information.

    8. …and the folks at Kafka will back us up on this one.

    9. We've seen customers use Azure Event Hubs (which is architecturally similar to Kafka) in this way. They host code in Azure Functions using an EventHubTrigger to monitor event streams, then raise business events in Azure Service Bus (using either a send-only NServiceBus endpoint or native sends) which are processed by NServiceBus endpoints.

  • Simpler configuration in ServiceControl

    The Particular Service Platform is packed full of features that help you monitor your NServiceBus systems. Among other things, it enables you to:

    • manage messages that require a manual retry
    • see when endpoints go offline and back online
    • detect connectivity problems with databases, brokers, and other systems using custom checks
    • troubleshoot message processing performance, both per-message and across an entire flow, using ServiceInsight

    Many of these capabilities have been developed over time as separate plugin packages. Each one has brought its own code-first configuration API. This approach has led to a situation where getting the most from the platform means installing six different NuGet packages and calling seven different configuration APIs.

    We knew we could make it easier. What if it was just one package, and one configuration API?

    Read more
  • More powerful Cosmos DB persistence

    The key to a successful Cosmos DB system is its data partitioning strategy. Like the rows of shrubs in a hedge maze, the logical partitions that divide data must be carefully planned, because that affects the scalability of the system and defines the boundaries for logical transactions.

    In version 1.1 of our CosmosDB persistence package, we’ve made defining the partition key for each message processed by NServiceBus much more straightforward, without needing a custom pipeline behavior. We’ve also added pessimistic concurrency support for more reliable processing of sagas with high contention patterns.

    Read more

    1. Maybe a little too powerful in this case, as there's a risk that the behavior for identifying the Cosmos DB partition could break the outbox feature.

    2. Unless you want to.

    3. For more details, see Optimizations to scatter-gather sagas.

  • Supercharging saga development

    Sagas are one of the most powerful tools available in the NServiceBus toolbox. With a saga, a business process that would otherwise have been implemented as a clunky batch job 1 can be built in a much more elegant and real-time manner.

    We’ve focused on supercharging your ability to develop NServiceBus sagas in our latest round of releases. As a result, you’re going to feel like you’ve got your own “heads-up display” when developing sagas. We’ll give you suggestions and point out problems before you even hit compile. You focus on your business logic.

    Read more

    1. …which we all hate

    2. Squiggly lines? Squigglies? It's hard to know if there's really an official name for these, but this post on C++ getting IntelliSense says squiggles so that's what we're going with.

  • When distributed systems get frustrated

    One of the greatest ever contributions to video games was the invention of the pause button. There are some sequences—those that require absolute perfect timing—where your repeated failure can make you so frustrated you just need to pause, walk away, and try again later until you get it right.

    Read more

    1. It would also be good to be notified that the web service the endpoint depends on is having issues. Check out our sample on how to monitor 3rd-party systems with custom checks to see how this is done.

  • RPC vs. Messaging – which is faster?

    Sometimes developers only care about speed. Ignoring all the other advantages messaging has, they’ll ask us the following question:

    “But isn’t RPC faster than messaging?”

    In place of RPC, 1 they may substitute a different term or technology like REST, microservices, gRPC, WCF, Java RMI, etc. However, no matter the specific word used, the meaning is the same: remote method calls over HTTP. So we’ll just use “RPC” for short.

    Some will claim that any type of RPC communication ends up being faster (meaning it has lower latency) than any equivalent invocation using asynchronous messaging. But the answer isn’t that simple. It’s less of an apples-to-oranges comparison and more like apples-to-orange-sherbet.

    Let’s take a look at the bigger picture.

    Read more

    1. short for remote procedure call

    2. Did you notice we build a product that helps you build message-driven systems? So yeah, maybe we're selling you something too, but at least we're honest about it. 😉

    3. Note: This is not and should not be considered the only definition of microservices.

    4. In NServiceBus, we default to 2 * LogicalProcessorCount, but this is fully configurable.

  • What's new with NServiceBus and Azure Functions

    Do you think Azure Functions are pretty great? Us too! Do you hate boilerplate code? Yeah, us too.

    Have you heard of C# source generators 1 and thought they sounded pretty cool but didn’t really know how they could be useful?

    In the newest version of our Azure Functions integration, we’ve used source generators to reduce the boilerplate needed to set up an NServiceBus endpoint on Azure Service Bus down to just a few lines of code.

    Read more

    1. A source generator is a new type of Roslyn analyzer that runs during compilation, inspects the code you're building, and produces additional source files that are compiled together with the rest of your code. Check out the blog post introducing source generators or the Microsoft source generator docs for more info.

  • Cosmos DB Persistence — Questions & Answers

    We recently released NServiceBus.Persistence.CosmosDB version 1.0, which provides saga and outbox storage for NServiceBus endpoints that is transactionally consistent with the business data you store in Cosmos DB.

    This component was previously offered as a preview package. Now that it has reached version 1.0, our full support policy applies, including API stability and backporting of bugfixes.

    Now that our Cosmos DB persistence has reached general availability, let’s answer some common questions about Cosmos DB and what it means to use Cosmos DB with NServiceBus.

    Read more

    1. For reference, in one year, that's 5 minutes 16 seconds of downtime.

    2. A noisy neighbor problem is where one tenant in a multi-tenant hosting scenario monopolizes too many of the resources such that performance is impacted for the other tenants sharing the same resources.

    3. Data committed to the database but without an accompanying message sent out due to a failure between the database commit and message send operations. See What does idempotence mean? for more details.

    4. A message sent before a failure occurs that can't be recalled, so the message refers to data that never got saved to the database. See What does idempotence mean? for more details.

    5. The two package names are NServiceBus.Persistence.AzureStorage and NServiceBus.Persistence.AzureTable. They're the same thing, we just renamed the package between versions 2 and 3 to make it more clear what it does.

Need help getting started?