ManagedCode.Keda.Orleans.Interfaces 0.0.30

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package ManagedCode.Keda.Orleans.Interfaces --version 0.0.30                
NuGet\Install-Package ManagedCode.Keda.Orleans.Interfaces -Version 0.0.30                
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="0.0.30" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ManagedCode.Keda.Orleans.Interfaces --version 0.0.30                
#r "nuget: ManagedCode.Keda.Orleans.Interfaces, 0.0.30"                
#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=0.0.30

// Install ManagedCode.Keda.Orleans.Interfaces as a Cake Tool
#tool nuget:?package=ManagedCode.Keda.Orleans.Interfaces&version=0.0.30                

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 950 3/11/2023
0.0.30 435 12/13/2022
0.0.29 7,918 12/9/2022
0.0.28 1,353 10/12/2022
0.0.27 654 10/11/2022
0.0.26 666 10/11/2022
0.0.24 653 10/11/2022
0.0.23 628 10/10/2022
0.0.22 648 10/10/2022
0.0.21 652 10/10/2022
0.0.20 638 10/10/2022
0.0.19 662 10/10/2022
0.0.18 704 10/10/2022
0.0.17 685 10/10/2022
0.0.16 694 10/10/2022
0.0.15 658 10/10/2022
0.0.14 674 10/10/2022
0.0.13 661 10/10/2022
0.0.12 666 10/7/2022
0.0.11 669 10/6/2022
0.0.10 1,808 10/4/2022
0.0.9 685 10/4/2022
0.0.8 651 10/4/2022
0.0.7 668 10/3/2022
0.0.6 675 10/3/2022
0.0.5 507 10/3/2022
0.0.4 528 10/3/2022
0.0.3 548 10/3/2022
0.0.2 424 10/3/2022