Optimizing a live K8s deployment

In this live optimization, the goal is to minimize the cost of a Kubernetes deployment with a single replica while matching, some performance-related constraints (e.g. the response time).

Notice that the workload selection refers to the service throughput metric provided by Istio.

name: Optimize a Kubernetes Container
system: My Deployment
workflow: workflow

goal:
  objective: minimize
  function:
    formula: container.cost
  constraints:
    absolute:
      - name: response-time-slo
        formula: shippingservice_istio.istio_incoming_response_time_90_ms:max <= 10
      - name: shippingservice-restart-slo
        formula: shippingservice_pod.k8s_pod_container_restarts:max == 0
      - name: shippingservice-failures-slo
        formula: shippingservice_istio.istio_incoming_failed_transactions / shippingservice_istio.istio_incoming_success_transactions <= 0.1

workloadsSelection:
  - name: shippingservice_istio.istio_incoming_service_throughput

optimizerOptions:
  onlineMode: RECOMMEND
  experimentsWithBeta: 0

windowing:
  type: trim
  trim: [1m, 0s]
  task: Test

parametersSelection:
  - name: shippingservice.cpu_request
    domain: [10, 600]
  - name: shippingservice.memory_request
    domain: [64, 512]

parameterConstraints:
  - name: limits_over_cpu_usage_bsl
    formula: shippingservice.cpu_request >= 11

steps:
  - name: baseline
    type: baseline
    numberOfTrials: 14
    values:
      shippingservice.cpu_request: 200
      shippingservice.memory_request: 128

  - name: optimize
    type: optimize
    numberOfTrials: 14
    numberOfExperiments: 1000
    numberOfInitExperiments: 0
    maxFailedExperiments: 1000

An example of how this study can be extended to also include the JVM layer is provided by Optimizing a live full-stack deployment (K8S + JVM).

Last updated