ManagedCode.Keda.Orleans.Interfaces 7.1.0

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

// Install ManagedCode.Keda.Orleans.Interfaces as a Cake Tool
#tool nuget:?package=ManagedCode.Keda.Orleans.Interfaces&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 (2)

Showing the top 2 NuGet packages that depend on ManagedCode.Keda.Orleans.Interfaces:

Package Downloads
ManagedCode.Keda.Orleans.Scaler.Client

Keda

ManagedCode.Keda.Orleans.Scaler

Keda

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.1.0 958 3/11/2023
0.0.30 439 12/13/2022
0.0.29 8,192 12/9/2022
0.0.28 1,357 10/12/2022
0.0.27 658 10/11/2022
0.0.26 672 10/11/2022
0.0.24 658 10/11/2022
0.0.23 633 10/10/2022
0.0.22 653 10/10/2022
0.0.21 656 10/10/2022
0.0.20 644 10/10/2022
0.0.19 666 10/10/2022
0.0.18 710 10/10/2022
0.0.17 689 10/10/2022
0.0.16 698 10/10/2022
0.0.15 662 10/10/2022
0.0.14 678 10/10/2022
0.0.13 665 10/10/2022
0.0.12 670 10/7/2022
0.0.11 673 10/6/2022
0.0.10 1,814 10/4/2022
0.0.9 691 10/4/2022
0.0.8 657 10/4/2022
0.0.7 674 10/3/2022
0.0.6 681 10/3/2022
0.0.5 513 10/3/2022
0.0.4 534 10/3/2022
0.0.3 554 10/3/2022
0.0.2 430 10/3/2022