我遇到了两种不同的方法来衡量一个特定的指标,我想知道有什么区别,在我的情况下是否有这种情况。
我在 GKE 上有一个部署,包括从应用程序中抓取特定指标并将其导出到 stackdriver。使用 prometheus-to-sd 边车。该指标在堆栈驱动程序中显示为 custom.googleapis.com/dummy/foo
现在,通常当我为自定义指标执行 HPA 时,我会像下面这样使用它:
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: custom-metric-prometheus-sd
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1beta1
kind: Deployment
name: custom-metric-prometheus-sd
minReplicas: 1
maxReplicas: 5
metrics:
- type: External
external:
metricName: "custom.googleapis.com|dummy|foo"
targetAverageValue: 20
现在,同样的 hpa 也可以使用 Pod 度量方法。喜欢:
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: custom-metric-prometheus-sd
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1beta1
kind: Deployment
name: custom-metric-prometheus-sd
minReplicas: 1
maxReplicas: 5
metrics:
- type: Pods
pods:
metricName: "custom.googleapis.com|dummy|foo"
targetAverageValue: 20
它的工作原理相同。我知道在使用 Pod Metrics 时,HPA 将从所有 pod 中获取指标,并计算一个平均值,该平均值将与目标值进行比较以确定副本数。它与在外部指标上使用 targetAverageValue 基本相同。所以,就我而言,两者的作用基本相同,对吧?在性能,延迟等方面有什么不同吗?
谢谢陈