diff --git a/nservicebus/gateway/troubleshooting.md b/nservicebus/gateway/troubleshooting.md index 9076c56543d..7090ed2f991 100644 --- a/nservicebus/gateway/troubleshooting.md +++ b/nservicebus/gateway/troubleshooting.md @@ -60,7 +60,3 @@ netsh http show urlacl For more information see the relevant [Netsh commands for HTTP ](https://msdn.microsoft.com/en-us/library/windows/desktop/cc307236). - -## ServicePointManager HTTP connections - -include: servicepoint-manager-connection-limit \ No newline at end of file diff --git a/transports/servicepoint-manager-connection-limit.include.md b/transports/servicepoint-manager-connection-limit.include.md deleted file mode 100644 index b6c8d1cb4b9..00000000000 --- a/transports/servicepoint-manager-connection-limit.include.md +++ /dev/null @@ -1,13 +0,0 @@ -During message handling an endpoint is expected to be able to connect to external resources, such as remote services via HTTP. - -If the endpoint is hosted in a process outside IIS, such as a Windows Service, by default the .NET Framework allows 2 concurrent outgoing HTTP requests per process. This can be a limitation on the overall throughput of the endpoint itself that ends up having outgoing HTTP requests queued and, as a consequence, a limitation in its ability to process incoming messages. - -It is possible to change the default connection limit of a process via the static `DefaultConnectionLimit` property of the `ServicePointManager` class, as in the following sample: - -```cs -ServicePointManager.DefaultConnectionLimit = 10; -``` - -The above code can be placed in the process startup. - -See [ServicePointManager on MSDN](https://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.aspx) for more information. diff --git a/transports/sqs/performance-tuning.md b/transports/sqs/performance-tuning.md index 7e60244f2a8..5fdeabcfc17 100644 --- a/transports/sqs/performance-tuning.md +++ b/transports/sqs/performance-tuning.md @@ -2,10 +2,10 @@ title: Performance Tuning summary: Guidance to tweak the performance of the SQS transport component: SQS -reviewed: 2023-05-02 +reviewed: 2025-03-06 --- -> [!NOTE] +> [!IMPORTANT] > It is difficult to give performance tuning guidelines that will be generally applicable. Results may vary greatly depending on many factors such as bandwidth, latency, client version, and much more. As always with performance tuning: Measure, don't assume. The Amazon SQS transport uses HTTP/S connections to send and receive messages from the AWS web services. The performance of the operations performed by the transport are subjected to the latency of the connection between the endpoint and SQS. @@ -14,7 +14,7 @@ The Amazon SQS transport uses HTTP/S connections to send and receive messages fr It is possible to increase the maximum concurrency to increase the throughput of a single endpoint. For more information about how to tune the endpoint message processing, consult the [tuning guide](/nservicebus/operations/tuning.md). -In Version 4 and higher, the transport will automatically increase the degree of parallelism by applying the following formula. +The transport will automatically increase the degree of parallelism by applying the following formula. ``` Degree of parallelism = Math.Ceiling(MaxConcurrency / NumberOfMessagesToFetch) @@ -22,51 +22,32 @@ Degree of parallelism = Math.Ceiling(MaxConcurrency / NumberOfMessagesToFetch) The following examples illustrate how the formula is applied when the concurrency is greater or equal to 10. -|`MaxConcurrency` | `DegreeOfReceiveParallelism` | `NumberOfMessagesToFetch` | +|DegreeOfReceiveParallelism | MaxConcurrency | NumberOfMessagesToFetch | | :-: |:-:|:-:| | 1 | 1 | 1 | -| 2 | 1 | 2 | -| 3 | 1 | 3 | -| 4 | 1 | 4 | -| 5 | 1 | 5 | -| 6 | 1 | 6 | -| 7 | 1 | 7 | -| 8 | 1 | 8 | -| 9 | 1 | 9 | -| 10 | 1 | 10 | -| 19 | 2 | 10 | -| 21 | 3 | 10 | -| 100 | 10 | 10 | +| 1 | 2 | 2 | +| 1 | 3 | 3 | +| 1 | 4 | 4 | +| 1 | 5 | 5 | +| 1 | 6 | 6 | +| 1 | 7 | 7 | +| 1 | 8 | 8 | +| 1 | 9 | 9 | +| 1 | 10 | 10 | +| 2 | 19 | 10 | +| 3 | 21 | 10 | +| 10 | 100 | 10 | Each parallel message retrieval requires one long polling connection. -> [!NOTE] +> [!WARNING] > Changing the maximum concurrency will influence the total number of operations against SQS and can result in higher costs. ## Number of connections A single endpoint requires multiple connections. Connections might be established or reused due to the connection pooling of the HTTP client infrastructure. By default, a single SQS client has a connection limit of 50 connections. When more than 50 connections are used, the endpoint connections will get queued up, and performance might decrease. -It is possible to set the `ConnectionLimit` property on the client programmatically by overriding the [SQS client](/transports/sqs/configuration-options.md#sqs-client) or the [SNS client](/transports/sqs/configuration-options.md#sns-client) as needed, or by setting the `ServicePointManager.DefaultConnectionLimit` (recommended). - -include: servicepoint-manager-connection-limit - -## Sending small messages - -If the endpoint is sending a lot of small messages (http message size < 1460 bytes) it might be beneficial to turn off the [NagleAlgorithm](https://en.wikipedia.org/wiki/Nagle's_algorithm). - -To disable Nagle for a specific endpoint URI use: - -``` -var servicePoint = ServicePointManager.FindServicePoint(new Uri("sqs-endpoint-uri")); -servicePoint.UseNagleAlgorithm = false; -``` - -to find the endpoint URIs used, consult the [AWS Regions and Endpoints](https://docs.aws.amazon.com/general/latest/gr/rande.html) documentation. It is also possible to disable Nagle globally for the Application Domain by applying: - -``` -ServicePointManager.UseNagleAlgorithm = false; -``` +It is possible to set the `ConnectionLimit` property on the client programmatically by overriding the [SQS client](/transports/sqs/configuration-options.md#sqs-client) or the [SNS client](/transports/sqs/configuration-options.md#sns-client) as needed. ## Known Limitations