Scaling and resource optimization

UI Bakery consists of various services that may need to be scaled using different approaches. The default resource specifications outline the minimum requirements for each service, but you might want to adjust these based on your specific solution and usage needs.

All services are stateless (except databases) and can be scaled using either HorizontalPodAutoscaler or by setting replicas in the deployment specification. However, scaling every service may not be necessary.

The bakery-gateway, bakery-front, and workbench-front services are simple NGINX applications that provide static resource delivery and request routing. These services are resource-efficient and typically do not require scaling.

The automation, datasource and python-runtime services may need scaling if your solution involves lots of automation runs, datasource requests or Python code executions. Since it is a Node.js app, assigning more than one CPU is not necessary. However, such features heavily rely on memory when handling large datasets. For the bakery-back service, running multiple small replicas might be less efficient than a single instance with more resources. We recommend increasing container CPU and memory resources based on your load.

Check out the example of HorizontalPodAutoscaler for the automation service:

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: ui-bakery-automation-hpa
  namespace: ui-bakery
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: ui-bakery-automation
  minReplicas: 2
  maxReplicas: 10
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70

Last updated

Was this helpful?