-1

I’m using .NET Aspire to orchestrate my services, and everything is deployed to Azure Container Apps.

By default for replication, Container Apps seem to use HTTP scaler with a concurrency target of 10 requests per replica, but I’d like to increase this limit to 1000 requests per replica.

Here’s an example of what I’m doing in my AppHost project:

var webBuilder = builder.AddProject<Project_Web>(ProjectWebResourceName)
    .WithExternalHttpEndpoints()
    .WithHttpHealthCheck("/health")
    .PublishAsAzureContainerApp((infrastructure, app) =>
    {
        app.Template.Scale.MinReplicas = appHostOptions.Web.MinReplicas;
        app.Template.Scale.CooldownPeriod = appHostOptions.Web.CooldownPeriodSeconds;
    });

However, I can’t find where or how to override the HTTP scaler’s concurrency target (default 10). I want to configure it directly through Aspire.

enter image description here

0

1 Answer 1

-2
using Microsoft.Azure.Provisioning.ContainerApps; // Ensure this namespace is available via NuGet

// ... (other builder configurations)

var webBuilder = builder.AddProject<Project_Web>(ProjectWebResourceName)
    .WithExternalHttpEndpoints()
    .WithHttpHealthCheck("/health")
    .PublishAsAzureContainerApp((infrastructure, app) => // app is ContainerAppResource
    {
        // Basic scale settings
        app.Template.Scale.MinReplicas = appHostOptions.Web.MinReplicas;
        app.Template.Scale.MaxReplicas = appHostOptions.Web.MaxReplicas ?? 10; // Example fallback
        app.Template.Scale.CooldownPeriod = appHostOptions.Web.CooldownPeriodSeconds;

        // Optional: Clear default rules if they interfere
        // app.Template.Scale.Rules.Clear();

        // Add custom HTTP scale rule with increased concurrency
        app.Template.Scale.Rules.Add(new ScaleRule
        {
            Name = "custom-http-rule", // Unique name for the rule
            Http = new HttpScaleRule
            {
                Metadata = new Dictionary<string, string>
                {
                    ["concurrentRequests"] = "1000" // Your desired target
                }
            }
        });
    });
Sign up to request clarification or add additional context in comments.

1 Comment

No package like Microsoft.Azure.Provisioning.ContainerApps, available only Azure.Provisioning.AppContainers. Also, this syntax is not right, because ScaleRule not proper parameter for Rules.Add() function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.