Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add target based scaling support for MSSQL #169

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

bachuv
Copy link
Contributor

@bachuv bachuv commented May 4, 2023

This PR adds support for target based scaling. It builds upon Azure/azure-functions-durable-extension#2452. This PR is in draft mode since it hasn't been tested E2E yet.

Changes:

  • Add SqlMetricsProvider and move GetMetricsAsync() code from SqlScaleMonitor here
  • Add SqlTargetScaler (implements ITargetScaler)
  • Override TryGetTargetScaler in SqlDurabilityProvider
  • Add unit tests
  • E2E testing

@bachuv bachuv self-assigned this May 4, 2023
this.TargetScalerDescriptor = new TargetScalerDescriptor(functionId);
}

public TargetScalerDescriptor TargetScalerDescriptor { get; private set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove the private set to make this a read-only property. You'll still be able to assign it from the constructor.

@bachuv bachuv marked this pull request as ready for review May 17, 2023 19:25
return true;
}

#if NETCOREAPP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the #if NETCOREAPP? Is there any problem if this code exists in both the netstandard2.0 and netcoreapp3.1 targets?

public class SqlTargetScaler : ITargetScaler
{
readonly SqlMetricsProvider sqlMetricsProvider;
readonly TargetScalerResult scaleResult;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we cache the TargetScalerResult object instead of creating a new one for each call?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants