From 65a05c527c6c4f67269b87afbdd22c9560a80ee1 Mon Sep 17 00:00:00 2001 From: Nan Mu Date: Fri, 9 Aug 2024 11:18:04 -0500 Subject: [PATCH 01/10] Introduce MaxConnsPerNode --- CHANGELOG.md | 6 ++++++ src/AeroSharp/Connection/ClientProvider.cs | 7 ++++--- src/AeroSharp/Connection/ConnectionConfiguration.cs | 6 ++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50c6506..178f709 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.1.1] - 2024-08-12 + +### Changed + +Expose MaxConnsPerNode from AeroSpike to allow easier performance tuning. + ## [1.1.0] - 2023-04-11 ### Changed diff --git a/src/AeroSharp/Connection/ClientProvider.cs b/src/AeroSharp/Connection/ClientProvider.cs index 69d91fe..ab67175 100644 --- a/src/AeroSharp/Connection/ClientProvider.cs +++ b/src/AeroSharp/Connection/ClientProvider.cs @@ -20,12 +20,13 @@ internal ClientProvider(ConnectionContext connection, Credentials credentials, C user = credentials.Username, password = credentials.Password, asyncMaxCommandAction = GetMaxCommandAction(configuration.MaxCommandAction), - asyncMaxCommands = configuration.AsyncMaxCommands + asyncMaxCommands = configuration.AsyncMaxCommands, + maxConnsPerNode = configuration.MaxConnsPerNode }; _hosts = connection.BootstrapServers.Select(s => new Host(s, connection.Port)).ToArray(); - } - + } + public ClientWrapper GetClient() { if (_client is null || !_client.Client.Connected) diff --git a/src/AeroSharp/Connection/ConnectionConfiguration.cs b/src/AeroSharp/Connection/ConnectionConfiguration.cs index 81097fd..66ccbaf 100644 --- a/src/AeroSharp/Connection/ConnectionConfiguration.cs +++ b/src/AeroSharp/Connection/ConnectionConfiguration.cs @@ -18,6 +18,7 @@ public ConnectionConfiguration() ConnectionTimeout = TimeSpan.FromSeconds(10); AsyncMaxCommands = 500; MaxCommandAction = MaxCommandAction.DELAY; // Recommended by Aerospike Enterprise Support (behavior when asyncMaxCommands is exceeded) + MaxConnsPerNode = 100; // Leave it as default value from Aerospike } /// @@ -34,5 +35,10 @@ public ConnectionConfiguration() /// Defines how to handle cases when the maximum number of concurrent database commands has been exceeded for the async client. /// public MaxCommandAction MaxCommandAction { get; set; } + + /// + /// The maximum sync connections per node. + /// + public MaxConnsPerNode MaxConnsPerNode { get; set; } } } \ No newline at end of file From d5b5932e0841946b9ff0fe76a5ae5057ade9adce Mon Sep 17 00:00:00 2001 From: Nan Mu Date: Fri, 9 Aug 2024 11:57:05 -0500 Subject: [PATCH 02/10] Bump version --- src/AeroSharp/AeroSharp.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AeroSharp/AeroSharp.csproj b/src/AeroSharp/AeroSharp.csproj index 894afd5..466501a 100644 --- a/src/AeroSharp/AeroSharp.csproj +++ b/src/AeroSharp/AeroSharp.csproj @@ -3,10 +3,10 @@ net6.0;net7.0 true - 1.1.0 + 1.1.1 Wayfair Wrapper around the .NET Aerospike client that provides a variety of methods for storing and retrieving data in Aerospike - Wayfair ©2023 + Wayfair ©2024 LICENSE https://github.com/wayfair-incubator/AeroSharp https://github.com/wayfair-incubator/AeroSharp From 9c2ef7f61533ca1c5f215bdf193917da625673e5 Mon Sep 17 00:00:00 2001 From: Nan Mu Date: Fri, 9 Aug 2024 12:09:28 -0500 Subject: [PATCH 03/10] Fix build error --- src/AeroSharp/Connection/ConnectionConfiguration.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AeroSharp/Connection/ConnectionConfiguration.cs b/src/AeroSharp/Connection/ConnectionConfiguration.cs index 66ccbaf..7e0b3a0 100644 --- a/src/AeroSharp/Connection/ConnectionConfiguration.cs +++ b/src/AeroSharp/Connection/ConnectionConfiguration.cs @@ -39,6 +39,6 @@ public ConnectionConfiguration() /// /// The maximum sync connections per node. /// - public MaxConnsPerNode MaxConnsPerNode { get; set; } + public int MaxConnsPerNode { get; set; } } } \ No newline at end of file From 06c17b9772f953dbfa09cc0f8d0d206b21adeb71 Mon Sep 17 00:00:00 2001 From: Nan Mu Date: Mon, 12 Aug 2024 20:43:45 -0500 Subject: [PATCH 04/10] Fix some github warnings --- src/AeroSharp/Connection/ClientProvider.cs | 5 +++-- src/AeroSharp/Connection/ClientWrapper.cs | 2 +- src/AeroSharp/Connection/ConnectionConfiguration.cs | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/AeroSharp/Connection/ClientProvider.cs b/src/AeroSharp/Connection/ClientProvider.cs index ab67175..3243bfc 100644 --- a/src/AeroSharp/Connection/ClientProvider.cs +++ b/src/AeroSharp/Connection/ClientProvider.cs @@ -1,5 +1,5 @@ -using System.Linq; -using Aerospike.Client; +using Aerospike.Client; +using System.Linq; namespace AeroSharp.Connection { @@ -39,6 +39,7 @@ public ClientWrapper GetClient() } } } + return _client; } diff --git a/src/AeroSharp/Connection/ClientWrapper.cs b/src/AeroSharp/Connection/ClientWrapper.cs index a9b1cdb..f1598a4 100644 --- a/src/AeroSharp/Connection/ClientWrapper.cs +++ b/src/AeroSharp/Connection/ClientWrapper.cs @@ -17,6 +17,6 @@ public ClientWrapper(IAsyncClient client) Client = client; } - public Node[] ClientNodes => Client.Nodes; + public Node[] ClientNodes => Client.Nodes; } } diff --git a/src/AeroSharp/Connection/ConnectionConfiguration.cs b/src/AeroSharp/Connection/ConnectionConfiguration.cs index 7e0b3a0..5f67c64 100644 --- a/src/AeroSharp/Connection/ConnectionConfiguration.cs +++ b/src/AeroSharp/Connection/ConnectionConfiguration.cs @@ -1,6 +1,6 @@ -using System; +using AeroSharp.Enums; +using System; using System.Diagnostics.CodeAnalysis; -using AeroSharp.Enums; namespace AeroSharp.Connection { From a148d73d2d32f1740193ba2b9fdeb9d0689b4d39 Mon Sep 17 00:00:00 2001 From: Nan Mu Date: Mon, 12 Aug 2024 20:53:16 -0500 Subject: [PATCH 05/10] Update Codecov version --- .github/workflows/integration.yml | 2 +- .github/workflows/unit.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 86c245e..c8bbdf9 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -36,7 +36,7 @@ jobs: /p:CoverletOutputFormat=opencover \ /p:CoverletOutput=/home/runner/work/AeroSharp/AeroSharp/ \ - name: Publish Code Coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4.0.1 with: files: /home/runner/work/AeroSharp/AeroSharp/coverage.net7.0.opencover.xml,/home/runner/work/AeroSharp/AeroSharp/coverage.net6.0.opencover.xml fail_ci_if_error: true diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 5be4d65..d30ebfb 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -34,7 +34,7 @@ jobs: /p:CoverletOutputFormat=opencover \ /p:CoverletOutput=/home/runner/work/AeroSharp/AeroSharp/ \ - name: Publish Code Coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4.0.1 with: files: /home/runner/work/AeroSharp/AeroSharp/coverage.net7.0.opencover.xml,/home/runner/work/AeroSharp/AeroSharp/coverage.net6.0.opencover.xml fail_ci_if_error: true From cb06becc7cdeeccac227a546d58b37a3f3c61008 Mon Sep 17 00:00:00 2001 From: Nan Mu Date: Mon, 12 Aug 2024 20:55:36 -0500 Subject: [PATCH 06/10] Downgrade Codecov version --- .github/workflows/integration.yml | 2 +- .github/workflows/unit.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index c8bbdf9..86c245e 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -36,7 +36,7 @@ jobs: /p:CoverletOutputFormat=opencover \ /p:CoverletOutput=/home/runner/work/AeroSharp/AeroSharp/ \ - name: Publish Code Coverage - uses: codecov/codecov-action@v4.0.1 + uses: codecov/codecov-action@v3 with: files: /home/runner/work/AeroSharp/AeroSharp/coverage.net7.0.opencover.xml,/home/runner/work/AeroSharp/AeroSharp/coverage.net6.0.opencover.xml fail_ci_if_error: true diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index d30ebfb..5be4d65 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -34,7 +34,7 @@ jobs: /p:CoverletOutputFormat=opencover \ /p:CoverletOutput=/home/runner/work/AeroSharp/AeroSharp/ \ - name: Publish Code Coverage - uses: codecov/codecov-action@v4.0.1 + uses: codecov/codecov-action@v3 with: files: /home/runner/work/AeroSharp/AeroSharp/coverage.net7.0.opencover.xml,/home/runner/work/AeroSharp/AeroSharp/coverage.net6.0.opencover.xml fail_ci_if_error: true From 38b2a5cc53d5656d7a03100d70353791953ca49b Mon Sep 17 00:00:00 2001 From: Nan Mu Date: Tue, 13 Aug 2024 08:35:55 -0500 Subject: [PATCH 07/10] formatting --- src/AeroSharp/Connection/ClientProvider.cs | 2 +- src/AeroSharp/Connection/ClientWrapper.cs | 4 ++-- src/AeroSharp/Connection/ConnectionConfiguration.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/AeroSharp/Connection/ClientProvider.cs b/src/AeroSharp/Connection/ClientProvider.cs index 3243bfc..e60279d 100644 --- a/src/AeroSharp/Connection/ClientProvider.cs +++ b/src/AeroSharp/Connection/ClientProvider.cs @@ -39,7 +39,7 @@ public ClientWrapper GetClient() } } } - + return _client; } diff --git a/src/AeroSharp/Connection/ClientWrapper.cs b/src/AeroSharp/Connection/ClientWrapper.cs index f1598a4..1a6494b 100644 --- a/src/AeroSharp/Connection/ClientWrapper.cs +++ b/src/AeroSharp/Connection/ClientWrapper.cs @@ -1,5 +1,5 @@ -using System; -using Aerospike.Client; +using Aerospike.Client; +using System; namespace AeroSharp.Connection { diff --git a/src/AeroSharp/Connection/ConnectionConfiguration.cs b/src/AeroSharp/Connection/ConnectionConfiguration.cs index 5f67c64..6b5183b 100644 --- a/src/AeroSharp/Connection/ConnectionConfiguration.cs +++ b/src/AeroSharp/Connection/ConnectionConfiguration.cs @@ -41,4 +41,4 @@ public ConnectionConfiguration() /// public int MaxConnsPerNode { get; set; } } -} \ No newline at end of file +} From d8c90fe7733c495e4e084086c6da9198bd1775ab Mon Sep 17 00:00:00 2001 From: Nan Mu Date: Tue, 13 Aug 2024 10:38:51 -0500 Subject: [PATCH 08/10] comment out code cov temporarily --- .github/workflows/integration.yml | 10 +++++----- .github/workflows/unit.yml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 86c245e..ab7bcc1 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -35,8 +35,8 @@ jobs: /p:CollectCoverage=true \ /p:CoverletOutputFormat=opencover \ /p:CoverletOutput=/home/runner/work/AeroSharp/AeroSharp/ \ - - name: Publish Code Coverage - uses: codecov/codecov-action@v3 - with: - files: /home/runner/work/AeroSharp/AeroSharp/coverage.net7.0.opencover.xml,/home/runner/work/AeroSharp/AeroSharp/coverage.net6.0.opencover.xml - fail_ci_if_error: true + # - name: Publish Code Coverage + # uses: codecov/codecov-action@v3 + # with: + # files: /home/runner/work/AeroSharp/AeroSharp/coverage.net7.0.opencover.xml,/home/runner/work/AeroSharp/AeroSharp/coverage.net6.0.opencover.xml + # fail_ci_if_error: true diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 5be4d65..81457ed 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -33,8 +33,8 @@ jobs: /p:CollectCoverage=true \ /p:CoverletOutputFormat=opencover \ /p:CoverletOutput=/home/runner/work/AeroSharp/AeroSharp/ \ - - name: Publish Code Coverage - uses: codecov/codecov-action@v3 - with: - files: /home/runner/work/AeroSharp/AeroSharp/coverage.net7.0.opencover.xml,/home/runner/work/AeroSharp/AeroSharp/coverage.net6.0.opencover.xml - fail_ci_if_error: true + # - name: Publish Code Coverage + # uses: codecov/codecov-action@v3 + # with: + # files: /home/runner/work/AeroSharp/AeroSharp/coverage.net7.0.opencover.xml,/home/runner/work/AeroSharp/AeroSharp/coverage.net6.0.opencover.xml + # fail_ci_if_error: true From fb978c64ea9da43f3aed6e36891772229174f9e7 Mon Sep 17 00:00:00 2001 From: Nan Mu Date: Tue, 13 Aug 2024 11:08:07 -0500 Subject: [PATCH 09/10] Add more comments --- src/AeroSharp/Connection/ConnectionConfiguration.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/AeroSharp/Connection/ConnectionConfiguration.cs b/src/AeroSharp/Connection/ConnectionConfiguration.cs index 6b5183b..c79457a 100644 --- a/src/AeroSharp/Connection/ConnectionConfiguration.cs +++ b/src/AeroSharp/Connection/ConnectionConfiguration.cs @@ -18,7 +18,11 @@ public ConnectionConfiguration() ConnectionTimeout = TimeSpan.FromSeconds(10); AsyncMaxCommands = 500; MaxCommandAction = MaxCommandAction.DELAY; // Recommended by Aerospike Enterprise Support (behavior when asyncMaxCommands is exceeded) - MaxConnsPerNode = 100; // Leave it as default value from Aerospike + // Leave it as default value from Aerospike Client. + // Note: Aerospike client has updated their default settings, see the change reasons from Aerospike forum: https://discuss.aerospike.com/t/client-1772-client-configurations-changes-reasons/9699 + // We will update AsyncMaxCommands to 100 when we bump up Aerospike version so we align with Aerospike settings. + // Relationship between asyncMaxConnsPerNode and MaxConnsPerNode can be found from here: https://aerospike.com/apidocs/csharp/html/f_aerospike_client_asyncclientpolicy_asyncmaxconnspernode + MaxConnsPerNode = 100; } /// From afe1ca4e878ba2dfaac81df11ebc78cbb6536211 Mon Sep 17 00:00:00 2001 From: Nan Mu Date: Tue, 13 Aug 2024 11:12:21 -0500 Subject: [PATCH 10/10] Make github happy --- src/AeroSharp/Connection/ConnectionConfiguration.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/AeroSharp/Connection/ConnectionConfiguration.cs b/src/AeroSharp/Connection/ConnectionConfiguration.cs index c79457a..643a34b 100644 --- a/src/AeroSharp/Connection/ConnectionConfiguration.cs +++ b/src/AeroSharp/Connection/ConnectionConfiguration.cs @@ -18,6 +18,7 @@ public ConnectionConfiguration() ConnectionTimeout = TimeSpan.FromSeconds(10); AsyncMaxCommands = 500; MaxCommandAction = MaxCommandAction.DELAY; // Recommended by Aerospike Enterprise Support (behavior when asyncMaxCommands is exceeded) + // Leave it as default value from Aerospike Client. // Note: Aerospike client has updated their default settings, see the change reasons from Aerospike forum: https://discuss.aerospike.com/t/client-1772-client-configurations-changes-reasons/9699 // We will update AsyncMaxCommands to 100 when we bump up Aerospike version so we align with Aerospike settings.