Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose MaxConnsPerNode from AeroSpike to allow easier performance tuning #187

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
};
farmerau marked this conversation as resolved.
Show resolved Hide resolved

_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 @@
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 / integration

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 / unit

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

View workflow job for this annotation

GitHub Actions / unit

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