Skip to content

v1.0.0-beta.13

Compare
Choose a tag to compare
@maslow maslow released this 10 Nov 12:15
· 201 commits to main since this release

Intro

Performance Enhanced

In this version, we have restructured the cloud function runtime, enhancing the execution performance of cloud functions by over 400%, HTTP request QPS by more than 300% (with CPU usage savings of over 200% under the same concurrency), and Websocket long connection performance by over 500%.

New logger implementent of runtime

Additionally, we have restructured the function log implementation, now directly using Runtime Pod log streams, which supports real-time log viewing and beautification of log formats.

New billing & monitoring implement of application

We have also rewritten application resource monitoring and metered billing, enabling laf in the sealos user namespace to support resource monitoring and metered billing functions.

What's Changed

Full Changelog: v1.0.0-beta.12...v1.0.0-beta.13

Migration Guides

Update laf-server & laf-web images:

# upgrade laf SERVER
kubectl set image deployments/laf-server -n laf-system \
	laf-server=docker.io/lafyun/laf-server:1.0.0-beta.13

# upgrade laf WEB
kubectl set image deployments/laf-web -n laf-system \
	laf-web=docker.io/lafyun/laf-web:1.0.0-beta.13

Update sys_db.Runtime to upgrade runtime images in MongoDb

use sys_db
// runtime version
const version = "1.0.0-beta.13"

const main_image = `docker.io/lafyun/runtime-node:${version}`
const init_image = `docker.io/lafyun/runtime-node:${version}`

db.Runtime.updateOne({ latest: true }, {
  $set: {
    version: version,
    image: {
      main: main_image,
      init: init_image
    }
  }
})

db.Runtime.find().pretty()

Restart all Running applications by update sys_db.Application in MongoDb

use sys_db
db.Application.updateMany({ state: 'Running' }, {
    $set: {
        state: 'Restarting'
    }
})

Enabling Resource Monitoring

This version of Laf uses a specialized runtime exporter for runtime resource metrics collection, so you will need to install the runtime exporter into the cluster to enable resource monitoring

kubectl apply  --namespace=laf-system  -f  - <<EOF
apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/name: runtime-exporter
  name: runtime-exporter
spec:
  ports:
    - name: http
      port: 2342
      protocol: TCP
      targetPort: http
  selector:
    app.kubernetes.io/name: runtime-exporter
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: runtime-exporter
  name: runtime-exporter
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: runtime-exporter
  template:
    metadata:
      labels:
        app.kubernetes.io/name: runtime-exporter
    spec:
      automountServiceAccountToken: true
      serviceAccountName: laf-server # It's the same as the laf server's sa.
      securityContext: {}
      containers:
        - image: docker.io/lafyun/runtime-exporter:latest
          imagePullPolicy: Always
          name: runtime-exporter
          ports:
            - name: http
              containerPort: 2342
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /healthz
              port: http
          readinessProbe:
            httpGet:
              path: /healthz
              port: http
          env:
            - name: API_SECRET
              value: "fafafafa"
            - name: NAMESPACE
              value: "laf-system" # Depends on the namespace of the runtime.
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    app.kubernetes.io/name: runtime-exporter
    release: prometheus
  name: runtime-exporter
spec:
  endpoints:
    - interval: 60s
      path: "/runtime/metrics/fafafafa"    # fafafafa is consistent with the runtime exporter's environment variable API_SECRET
      scrapeTimeout: 10s
      honorLabels: true
  namespaceSelector:
    matchNames:
      - laf-system # Depends on the namespace of the runtime exporter.
  selector:
    matchLabels:
      app.kubernetes.io/name: runtime-exporter
---
# Application billing rules
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  labels:
    app.kubernetes.io/name: runtime-exporter
    release: prometheus
  name: prometheus-laf-billing.rules
spec:
  groups:
    - name: prometheus-laf-billing.rules
      interval: 60s
      rules:
        - record: laf:billing:cpu
          expr: max_over_time(sum by (appid) (laf_runtime_cpu_limit{container!=""})[1h:])
        - record: laf:billing:memory
          expr: max_over_time(sum by (appid) (laf_runtime_memory_limit{container!=""})[1h:])
EOF