Sql transport & performance consideration

Hello,

We are using SQL transport with NSB 5, Want to understand few details with respect to SQL transport & performance. I have gone through documents at https://docs.particular.net/transports/sql/?version=sqltransport_2

NSB execute below query to poll queue.

WITH message AS (SELECT TOP(1) * FROM QueueName WITH (UPDLOCK, READPAST, ROWLOCK) ORDER BY [RowVersion] ASC)
DELETE FROM message
OUTPUT deleted.Id, deleted.CorrelationId, deleted.ReplyToAddress,
deleted.Recoverable, CASE WHEN deleted.Expires IS NOT NULL THEN DATEDIFF(ms, GETUTCDATE(), deleted.Expires) END, deleted.Headers, deleted.Body;

Question :

  1. As per document mentioned above, polling intervel is one second,
    1.1 Does it mean each endpoint can read one message per second ? or its depends on number of thread or value of MaximumConcurrencyLevel ?
    1.2 can we reduce polling interval to milliseconds ?

Ultimate goal is to process more number of messages parallel, please suggest on same.

No, this means that is checks every second if there are messages. If not, we sleep one second. If yes, the message is processed and after processing we immediately try to read the next message.

If you want to achieve parallelism then increase the maximum concurrency by specifying a value above 1. A good starting point is to use the number of CPU cores on the server.

In the above doc we also mention MaximumMessageThroughputPerSecond, you do not have to configure this value.

No, the version for NServiceBus 5 cannot be adjusted.

The version for NServiceBus 6 and higher can be adjusted by invoking the WithPeekDelay configuration API:

Please note that NServiceBus 5 is out of regular support. You are missing out an huge performance improvements in both core and the sql transport:

1 Like

so if i set value for Maximum concurrency to 8(having 8 core CPU) then it should pick 8 messages in a second , process those message parallel & will pick another message once done , is this correct ?

No, that means it can process 8 messages concurrently.

If processing one message takes 2 seconds this results in in average throughput of 4 message per second (8/2=4).

If processing one messages takes 200 milliseconds this results in an average throughput of 40 messages per second (8/0.2=40).

We are considering to migrate from nservicebus 5 to 6-7, can you please provide me changes been done with respect to performance improvement or can you please redirect me some documentation where performance improvement changes mentioned in latest release for core & SQL transport ? This will help us to take right decision.

We do not have specific documentation on performance but the message processing in v6 has been made more efficient.

Performance is very dependant on the type of workload, the network and hosting environment.

What kind of performance are you currently getting and which performance do you need?

Have you set up metrics?

– Ramon