System Business Rules

You can use System Extender business rules with Azure Server Sets for enhanced scalability at the Azure Database and Server Sets level. You can perform Server and eDTU scaling manually or using System business rules. If System business rules is selected as a Scaling Type, then a user-defined System Extender business rule determines if scaling is needed. You must implement the scaling function and return the proper scaling object by adding a System Extender business rule and assigning it appropriately.

Under each Case statement, use these rules and related Args and BRApis to check the current Server Set capacity, query metrics about a Server Set or Azure Database, and identify the impact of the Server Sets volume or level of Azure Database deployed. See Azure Database Connection Settings.

Example starting point of empty System Extender business rule upon creation:

 

Copy
Namespace OneStream.BusinessRule.SystemExtender.ServerSet2
    Public Class MainClass
        Public Function Main(ByVal si As SessionInfo,
                             ByVal globals As BRGlobals,
                             ByVal api As Object,
                             ByVal args As SystemExtenderArgs) As Object
            Try
                Select Case args.FunctionType
                    Case SystemExtenderFunctionType.Unknown
                        ' Handle unknown function type

                    Case SystemExtenderFunctionType.GetDesiredServerSetCapacity
                        ' Handle desired server set capacity

                    Case SystemExtenderFunctionType.GetDesiredElasticDatabasePoolCapacity
                        ' Handle desired elastic database pool capacity

                    Case SystemExtenderFunctionType.GetDesiredExternalServerSetCapacity
                        ' Handle desired external server set capacity
                End Select

                Return Nothing
            Catch ex As Exception
                ' Log and throw exception
                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
            End Try
        End Function
    End Class
End Namespace

Sample System Business Rule

Metrics are passed to this function to help users determine if a server or database needs scaling. For server scaling, Environment metrics and Scale Set metrics are passed. For database scaling, Environment metrics and SQL Server Elastic Pool metrics are passed.

Copy

Select Case args.FunctionType

    Case SystemExtenderFunctionType.Unknown

    Case SystemExtenderFunctionType.GetDesiredScaleSetCapacity
        Dim systemExtenderScaleSetResult As New SystemExtenderScaleSetResult
        systemExtenderScaleSetResult.Capacity = args.ScaleSetArgs.CurrentScaleSetCapacity

        If args.ScaleSetArgs.ScaleSetMetricValues.AvgCPUUtilization > 50 Then
            systemExtenderScaleSetResult.Capacity = args.ScaleSetArgs.CurrentScaleSetCapacity + 1
        End If

        Return systemExtenderScaleSetResult

    Case SystemExtenderFunctionType.GetDesiredElasticDatabasePoolCapacity
        Dim systemExtenderSQLServerElasticPoolResult As New SystemExtenderSQLServerElasticPoolResult
        systemExtenderSQLServerElasticPoolResult.AzureElasticPoolDTU = args.SQLServerElasticPoolArgs.DatabaseAndPoolDTU.AzureElasticPoolDTU

        If args.SQLServerElasticPoolArgs.AzureElasticPoolLevelMetricValues.DTUConsumptionPercent > 90 Then
            systemExtenderSQLServerElasticPoolResult.AzureElasticPoolDTU = 1600
        End If

        Return systemExtenderSQLServerElasticPoolResult

    Case SystemExtenderFunctionType.GetDesiredExternalScaleSetCapacity

End Select