Skip to content

Commit

Permalink
Expose MaxConnsPerNode from AeroSpike to allow easier performance tun…
Browse files Browse the repository at this point in the history
…ing (#187)

Expose MaxConnsPerNode from AeroSpike to allow easier performance tuning.
  • Loading branch information
munan-geo authored Aug 13, 2024
1 parent ce2f061 commit f50b597
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 23 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/AeroSharp/AeroSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.1.0</Version>
<Version>1.1.1</Version>
<Authors>Wayfair</Authors>
<Description>Wrapper around the .NET Aerospike client that provides a variety of methods for storing and retrieving data in Aerospike</Description>
<Copyright>Wayfair ©2023</Copyright>
<Copyright>Wayfair ©2024</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/wayfair-incubator/AeroSharp</PackageProjectUrl>
<RepositoryUrl>https://github.com/wayfair-incubator/AeroSharp</RepositoryUrl>
Expand Down
12 changes: 7 additions & 5 deletions src/AeroSharp/Connection/ClientProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Linq;
using Aerospike.Client;
using Aerospike.Client;
using System.Linq;

namespace AeroSharp.Connection
{
Expand All @@ -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)
Expand All @@ -38,6 +39,7 @@ public ClientWrapper GetClient()
}
}
}

return _client;
}

Expand Down
6 changes: 3 additions & 3 deletions src/AeroSharp/Connection/ClientWrapper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using Aerospike.Client;
using Aerospike.Client;
using System;

namespace AeroSharp.Connection
{
Expand All @@ -17,6 +17,6 @@ public ClientWrapper(IAsyncClient client)
Client = client;
}

public Node[] ClientNodes => Client.Nodes;
public Node[] ClientNodes => Client.Nodes;
}
}
17 changes: 14 additions & 3 deletions src/AeroSharp/Connection/ConnectionConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using AeroSharp.Enums;
using System;
using System.Diagnostics.CodeAnalysis;
using AeroSharp.Enums;

namespace AeroSharp.Connection
{
Expand All @@ -18,6 +18,12 @@ public ConnectionConfiguration()
ConnectionTimeout = TimeSpan.FromSeconds(10);
AsyncMaxCommands = 500;
MaxCommandAction = MaxCommandAction.DELAY; // Recommended by Aerospike Enterprise Support (behavior when asyncMaxCommands is exceeded)

Check warning on line 21 in src/AeroSharp/Connection/ConnectionConfiguration.cs

View workflow job for this annotation

GitHub Actions / publish

Check warning on line 21 in src/AeroSharp/Connection/ConnectionConfiguration.cs

View workflow job for this annotation

GitHub Actions / unit

Check warning on line 21 in src/AeroSharp/Connection/ConnectionConfiguration.cs

View workflow job for this annotation

GitHub Actions / unit

Check warning on line 21 in src/AeroSharp/Connection/ConnectionConfiguration.cs

View workflow job for this annotation

GitHub Actions / integration

Check warning on line 21 in src/AeroSharp/Connection/ConnectionConfiguration.cs

View workflow job for this annotation

GitHub Actions / integration

// 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;
}

/// <summary>
Expand All @@ -34,5 +40,10 @@ public ConnectionConfiguration()
/// Defines how to handle cases when the maximum number of concurrent database commands has been exceeded for the async client.
/// </summary>
public MaxCommandAction MaxCommandAction { get; set; }

/// <summary>
/// The maximum sync connections per node.
/// </summary>
public int MaxConnsPerNode { get; set; }
}
}
}

0 comments on commit f50b597

Please sign in to comment.