ManagedCode.Keda.Orleans.Scaler 7.1.0

Prefix Reserved
dotnet add package ManagedCode.Keda.Orleans.Scaler --version 7.1.0                
NuGet\Install-Package ManagedCode.Keda.Orleans.Scaler -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" 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 --version 7.1.0                
#r "nuget: ManagedCode.Keda.Orleans.Scaler, 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 as a Cake Addin
#addin nuget:?package=ManagedCode.Keda.Orleans.Scaler&version=7.1.0

// Install ManagedCode.Keda.Orleans.Scaler as a Cake Tool
#tool nuget:?package=ManagedCode.Keda.Orleans.Scaler&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 634 3/11/2023
0.0.30 386 12/13/2022
0.0.29 4,154 12/9/2022
0.0.28 854 10/12/2022
0.0.27 404 10/11/2022
0.0.26 430 10/11/2022
0.0.24 434 10/11/2022
0.0.23 418 10/10/2022
0.0.22 425 10/10/2022
0.0.21 416 10/10/2022
0.0.20 418 10/10/2022
0.0.19 400 10/10/2022
0.0.18 451 10/10/2022
0.0.17 472 10/10/2022
0.0.16 441 10/10/2022
0.0.15 422 10/10/2022
0.0.14 433 10/10/2022
0.0.13 457 10/10/2022
0.0.12 409 10/7/2022
0.0.11 424 10/6/2022
0.0.10 1,193 10/4/2022
0.0.9 426 10/4/2022
0.0.8 421 10/4/2022
0.0.7 427 10/3/2022
0.0.6 437 10/3/2022
0.0.5 397 10/3/2022
0.0.4 429 10/3/2022
0.0.3 435 10/3/2022
0.0.2 429 10/3/2022
0.0.1 504 9/23/2022