How to improve the performance of my Saga under load


I have a very simple Saga built with NSB7 using SQL Transport and NHibernate persistence.

The Saga listens on a queue and for each message received runs through 4 handlers. These are called in a sequential order, with 2 handles run in parallel and the last handler only runs once both the parallel handlers are complete. The last handler writes a record to DB

Let’s say for a single message, each handler takes 1 second. When a new message is received, which starts the Saga, the expected result is that 3-4 seconds later the record is written to the DB.

If the queue backs up with say 1000 messages, once they begin processing again, it takes almost 2000 seconds before a new record is created in the last handle. Basically, instead of running through the expected 4 second processing time for each message, they effectively bunch up in the initial handlers until the queue is emptied and then does that again for the next handler and on and on.

Any ideas on how I could improve the performance of this system when under load so that a constant stream of processed messages come out the end rather than the bunching of messages and long delay before a single new record comes out the other side?


Hi Will

Have you had a glance at our saga concurrency guidance?