ManagedCode.Keda.Orleans.Scaler.Client 7.1.0

Prefix Reserved
dotnet add package ManagedCode.Keda.Orleans.Scaler.Client --version 7.1.0                
NuGet\Install-Package ManagedCode.Keda.Orleans.Scaler.Client -Version 7.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ManagedCode.Keda.Orleans.Scaler.Client" Version="7.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ManagedCode.Keda.Orleans.Scaler.Client --version 7.1.0                
#r "nuget: ManagedCode.Keda.Orleans.Scaler.Client, 7.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ManagedCode.Keda.Orleans.Scaler.Client as a Cake Addin
#addin nuget:?package=ManagedCode.Keda.Orleans.Scaler.Client&version=7.1.0

// Install ManagedCode.Keda.Orleans.Scaler.Client as a Cake Tool
#tool nuget:?package=ManagedCode.Keda.Orleans.Scaler.Client&version=7.1.0                

img|300x200

Keda

.NET Coverage Status nuget CodeQL

Keda is a Kubernetes autoscaler that uses the KEDA autoscaling system to automatically scale applications based on metrics such as the number of active Grains in Orleans, the number of API requests, and the number of SignalR connections. This allows your .NET applications to handle increased workloads without manual intervention.

Motivation

Kubernetes makes it easy to deploy and manage containerized applications at scale, but it can be challenging to ensure that your applications have the resources they need to handle sudden spikes in traffic. Keda solves this problem by using KEDA to automatically adjust the number of active Grains, as well as the number of API requests and SignalR connections, based on real-time metrics. This ensures that your applications have the resources they need to handle increased workloads without manual intervention.

Getting Started

To use Keda, you will need to have a Kubernetes cluster with KEDA installed. Once you have that set up, you can deploy Keda using the provided YAML files.

  • Install ManagedCode.Keda.Orleans.Scaler package into your Silo project.
  • Install ManagedCode.Keda.Orleans.Scaler.Client package into your SingalR or WebAPI projects.
  • Install ManagedCode.Keda.Orleans.Scaler.Client package into your Scaler projects (let's call it orleans-scale).

Usage

Keda is used by specifying the target metric and the desired range for that metric. Keda will then automatically adjust the number of active Grains, as well as the number of API requests and SignalR connections, to keep the metric within the specified range.

You have to create one more service, and add this logic, let's call it "orleans-scale" :

await Host.CreateDefaultBuilder(args)
    .ConfigureServices((context, services) =>
    {
        services.AddApiOrleansScaling();
        services.AddHealthChecks();
    })
    .ConfigureWebHostDefaults(webBuilder =>
    {
        webBuilder.Configure((_, app) =>
        {
            app.UseRouting();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapOrleansScaler();
                endpoints.MapApiRequestsScaler();
                endpoints.MapSignalRScaler();
                endpoints.MapHealthChecks("/health");
            });
        });
    })
    .UseConsoleLifetime()
    .RunConsoleAsync();

For add scaler for SignalR:

services.AddSignalR()
    .AddHubOptions<SomeHub>(options =>
    {
        options.AddScalerForSignalR();
    });

For add scaler for WebAPI:

app.UseScalerForRequest();

YAML configuration for Scaler project:

# Orleans Silo
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
    name: orleans-silo
spec:
  scaleTargetRef:
    name: orleans-silo
  minReplicaCount: 2
  maxReplicaCount: 6
  triggers:
    - type: metrics-api
      metadata:
        targetValue: "1500" # active grains per silo
        url: "http://orleans-scaler.#{namespace}#/api/scaling/orleans"
        valueLocation: 'grainCount'

---
# SignalR
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: signalr-scaler-object
spec:
  scaleTargetRef:
    name: api-service
  minReplicaCount: 2
  maxReplicaCount: 10
  triggers:
    - type: metrics-api
      metadata:
        targetValue: "1000" # active connectinos per node
        url: "http://orleans-scaler.#{namespace}#/api/scaling/signalr"
        valueLocation: 'count'

---
# Web API
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: http-scaler-object
spec:
  scaleTargetRef:
    name: api-service
  minReplicaCount: 2
  maxReplicaCount: 10
  triggers:
    - type: metrics-api
      metadata:
        targetValue: "500" # requests per second per node
        url: "http://orleans-scaler.#{namespace}#/api/scaling/requests"
        valueLocation: 'count'
        

This will cause Keda to automatically scale pods depend on load.

Contributing

We welcome contributions to Keda! If you have an idea for a new feature or have found a bug, please open an issue on GitHub.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.1.0 849 3/11/2023
0.0.30 361 12/13/2022
0.0.29 7,720 12/9/2022
0.0.28 1,104 10/12/2022
0.0.27 414 10/11/2022
0.0.26 426 10/11/2022
0.0.24 416 10/11/2022
0.0.23 404 10/10/2022
0.0.22 420 10/10/2022
0.0.21 423 10/10/2022
0.0.20 420 10/10/2022
0.0.19 422 10/10/2022
0.0.18 434 10/10/2022
0.0.17 443 10/10/2022
0.0.16 432 10/10/2022
0.0.15 406 10/10/2022
0.0.14 413 10/10/2022
0.0.13 402 10/10/2022
0.0.12 414 10/7/2022
0.0.11 425 10/6/2022
0.0.10 1,381 10/4/2022
0.0.9 457 10/4/2022
0.0.8 406 10/4/2022
0.0.7 400 10/3/2022
0.0.6 420 10/3/2022