diff --git a/specification/resources/apps/models/app_alert_spec_rule.yml b/specification/resources/apps/models/app_alert_spec_rule.yml index ea519974..d407aa2a 100644 --- a/specification/resources/apps/models/app_alert_spec_rule.yml +++ b/specification/resources/apps/models/app_alert_spec_rule.yml @@ -16,5 +16,7 @@ enum: - FUNCTIONS_AVERAGE_WAIT_TIME_MS - FUNCTIONS_ERROR_COUNT - FUNCTIONS_GB_RATE_PER_SECOND + - REQUESTS_PER_SECOND + - REQUEST_DURATION_P95_MS type: string example: CPU_UTILIZATION diff --git a/specification/resources/apps/models/app_autoscaling_spec.yml b/specification/resources/apps/models/app_autoscaling_spec.yml new file mode 100644 index 00000000..bfc3633f --- /dev/null +++ b/specification/resources/apps/models/app_autoscaling_spec.yml @@ -0,0 +1,35 @@ +# CPU-only autoscaling for worker components. Services use app_autoscaling_spec_service.yml. +description: Configuration for automatically scaling this component based on metrics. +type: object +properties: + min_instance_count: + description: The minimum amount of instances for this component. + type: integer + format: uint32 + minimum: 1 + example: 2 + max_instance_count: + description: >- + The maximum amount of instances for this component. Maximum 250. + Consider using a larger instance size if your application requires more than 250 instances. + type: integer + format: uint32 + minimum: 1 + maximum: 250 + example: 3 + metrics: + description: The metrics that the component is scaled on. + type: object + properties: + cpu: + description: Settings for scaling the component based on CPU utilization. + type: object + properties: + percent: + description: The average target CPU utilization for the component. + type: integer + format: uint32 + minimum: 1 + maximum: 100 + default: 80 + example: 75 diff --git a/specification/resources/apps/models/app_autoscaling_spec_service.yml b/specification/resources/apps/models/app_autoscaling_spec_service.yml new file mode 100644 index 00000000..f35f72f4 --- /dev/null +++ b/specification/resources/apps/models/app_autoscaling_spec_service.yml @@ -0,0 +1,28 @@ +# Extends CPU autoscaling with request-based metrics. Only applicable to service components. +allOf: + - $ref: app_autoscaling_spec.yml + - type: object + properties: + metrics: + type: object + properties: + requests_per_second: + description: Settings for scaling the component based on requests per second. + type: object + properties: + per_instance: + description: The target number of requests per second per instance for the component. + type: integer + format: uint32 + minimum: 1 + example: 100 + request_duration: + description: Settings for scaling the component based on request duration. + type: object + properties: + p95_milliseconds: + description: The p95 target request duration in milliseconds for the component. + type: integer + format: uint32 + minimum: 1 + example: 500 diff --git a/specification/resources/apps/models/app_component_instance_base.yml b/specification/resources/apps/models/app_component_instance_base.yml index 541bbdbf..88a2a51c 100644 --- a/specification/resources/apps/models/app_component_instance_base.yml +++ b/specification/resources/apps/models/app_component_instance_base.yml @@ -50,36 +50,3 @@ properties: example: basic-xxs deprecated: true example: apps-s-1vcpu-0.5gb - - autoscaling: - description: Configuration for automatically scaling this component based on metrics. - type: object - properties: - min_instance_count: - description: The minimum amount of instances for this component. Must be less than max_instance_count. - type: integer - format: uint32 - minimum: 1 - example: 2 - max_instance_count: - description: The maximum amount of instances for this component. Must be more than min_instance_count. - type: integer - format: uint32 - minimum: 1 - example: 3 - metrics: - description: The metrics that the component is scaled on. - type: object - properties: - cpu: - description: Settings for scaling the component based on CPU utilization. - type: object - properties: - percent: - description: The average target CPU utilization for the component. - type: integer - format: uint32 - minimum: 1 - maximum: 100 - default: 80 - example: 75 diff --git a/specification/resources/apps/models/app_service_spec.yml b/specification/resources/apps/models/app_service_spec.yml index 8ecc4ccf..3e570c5f 100755 --- a/specification/resources/apps/models/app_service_spec.yml +++ b/specification/resources/apps/models/app_service_spec.yml @@ -4,6 +4,9 @@ allOf: - type: object properties: + autoscaling: + $ref: app_autoscaling_spec_service.yml + cors: allOf: - $ref: apps_cors_policy.yml diff --git a/specification/resources/apps/models/app_worker_spec.yml b/specification/resources/apps/models/app_worker_spec.yml index 84a460ec..6cf4f27b 100755 --- a/specification/resources/apps/models/app_worker_spec.yml +++ b/specification/resources/apps/models/app_worker_spec.yml @@ -3,6 +3,9 @@ allOf: - $ref: app_component_instance_base.yml - type: object properties: + autoscaling: + $ref: app_autoscaling_spec.yml + termination: $ref: app_worker_spec_termination.yml liveness_health_check: