Skip to content

Instantly share code, notes, and snippets.

@jovemfelix
Created July 6, 2022 19:27
Show Gist options
  • Save jovemfelix/08fa914c78ea25ebc0deceb3b0a4d7b1 to your computer and use it in GitHub Desktop.
Save jovemfelix/08fa914c78ea25ebc0deceb3b0a4d7b1 to your computer and use it in GitHub Desktop.

Variables

export NS=benchmark-operator
export ES_SERVER=${ES_SERVER:-https://search-perfscale-dev-chmf5l4sh66lvxbnadi4bznl3a.us-west-2.es.amazonaws.com:443}

Grafana

Requirements

# create a project
$ oc new-project $NS

ES

cat <<EOF | oc apply -f -
---
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: elasticsearch
  namespace: $NS
spec:
  nodeSets:
    - config:
        node.roles:
          - master
          - data
        node.attr.attr_name: attr_value
        node.store.allow_mmap: false
      podTemplate:
        metadata:
          labels:
            es: benchmark
        spec:
          containers:
            - name: elasticsearch
              resources:
                requests:
                  memory: 4Gi
                  cpu: 1
                limits:
                  memory: 4Gi
                  cpu: 2
      name: default
      count: 3
  version: 8.2.0
EOF
$ oc get svc -n $NS
NAME                             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
elasticsearch-es-default         ClusterIP   None            <none>        9200/TCP   16s
elasticsearch-es-http            ClusterIP   172.50.237.60   <none>        9200/TCP   18s
elasticsearch-es-internal-http   ClusterIP   172.50.4.137    <none>        9200/TCP   18s
elasticsearch-es-transport       ClusterIP   None            <none>        9300/TCP   18s


$ oc expose svc/elasticsearch-es-http -n $NS
route.route.openshift.io/elasticsearch-es-http exposed

$ oc get route -n $NS
NAME                    HOST/PORT                                                              PATH   SERVICES                PORT    TERMINATION   WILDCARD
elasticsearch-es-http   elasticsearch-es-http-rfelix-benchmark1.apps.middleware.rhbr-lab.com          elasticsearch-es-http   https                 None

$ oc get pods -n $NS
NAME                         READY   STATUS    RESTARTS   AGE
elasticsearch-es-default-0   1/1     Running   0          89s
elasticsearch-es-default-1   1/1     Running   0          89s
elasticsearch-es-default-2   1/1     Running   0          89s

Benchmark Operator

$ oc create sa benchmark-operator -n $NS
# If you want to run with hostnetwork on OpenShift:
$ oc adm policy add-scc-to-user privileged -z benchmark-operator -n $NS

$ oc get nodes | grep -v NotReady
export NODE_SERVER=middleware-hvs4d-worker-nwh9g
export NODE_CLIENT=middleware-hvs4d-worker-dtl8h
export ES_SVC_URL='http://elasticsearch-es-http:9200'
export ES_URL='http://elasticsearch-es-http-rfelix-benchmark1.apps.middleware.rhbr-lab.com'
export CLUSTER_NAME=$(oc project | awk '{ print $6 }' | awk -F . '{  print $2 }')

Installation (Default)

wait for pod/benchmark-controller-manager-xxxx

git clone https://github.com/cloud-bulldozer/benchmark-operator
cd benchmark-operator
make deploy

$ oc get sa,cm,deploy,pod -n $NS
NAME                                SECRETS   AGE
serviceaccount/benchmark-operator   2         74s
serviceaccount/builder              2         27m
serviceaccount/default              2         27m
serviceaccount/deployer             2         27m

NAME                                       DATA   AGE
configmap/benchmark-manager-config         1      73s
configmap/elasticsearch-es-scripts         5      26m
configmap/elasticsearch-es-unicast-hosts   1      26m
configmap/kube-root-ca.crt                 1      27m
configmap/openshift-service-ca.crt         1      27m

NAME                                           READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/benchmark-controller-manager   1/1     1            1           72s

NAME                                                READY   STATUS    RESTARTS   AGE
pod/benchmark-controller-manager-565bfbf8d5-862j2   2/2     Running   0          73s
pod/elasticsearch-es-default-0                      1/1     Running   0          26m
pod/elasticsearch-es-default-1                      1/1     Running   0          26m
pod/elasticsearch-es-default-2                      1/1     Running   0          26m

# wait be Running
$ oc get pod -o name -l control-plane=controller-manager
pod/benchmark-controller-manager-565bfbf8d5-862j2

iperf3

cat <<EOF | oc apply -f -
---
apiVersion: ripsaw.cloudbulldozer.io/v1alpha1
kind: Benchmark
metadata:
  name: iperf3-benchmark-store
  namespace: benchmark-operator
spec:
  workload:
    name: iperf3
    args:
      pairs: 1
      port: 5201
      transmit_type: time
      transmit_value: 60
      omit_start: 0
#     length_buffer: 128K
      window_size: 64k
      ip_tos: 0
      mss: 900
      streams: 1
      extra_options_server: '--forceflush '
      extra_options_client: '-R --logfile /tmp/${CLUSTER_NAME}_$(date "+%F-%H-%M-%S")'
		  store_results: true
		  results:
    		path: /opt/result-data/
EOF

Uperf

cat <<EOF | oc apply -f -
---
apiVersion: ripsaw.cloudbulldozer.io/v1alpha1
kind: Benchmark
metadata:
  name: uperf-benchmark-sdn2
  namespace: benchmark-operator
spec:
  clustername: "${CLUSTER_NAME}"
  elasticsearch:
    url: "${ES_SERVER}"
  workload:
    # cleanup: true
    name: uperf
    args:
      serviceip: false
      hostnetwork: false
      networkpolicy: false
      multus:
        enabled: false
      pin: false
      #
      # pin: true/false - default=false
      #    - true will run 'Pin' mode using 1 server (pin_server:) and 1 client (pin_clien:) nodes.
      #    - false will run 'Scale' mode. See colocate, density_range, node_range and step_size.
      pin_server: "$NODE_SERVER"
      pin_client: "$NODE_CLIENT"
      # how many gonna be made!
      samples: 3
      
      kind: pod
      pair: 1
      #
      # 'pair' sepcifies fixed number of client-server pairs for "Pin" mode,
      #  If 'pair' is NOT present, it will use 'density_range' which allows
      #  enumeration in addition to fixed number of pair.
      # stream for throughtput/rr
      test_types:
        - stream
      protos:
        - tcp
        - udp
      sizes:
        - 16384
        # kb
      nthrs:
        - 1
# how long gonna take the transaction (each)
      runtime: 30

      # The following variables are for 'Scale' mode.
      # The 'Scale' mode is activated when 'pin=false' or undefined.
      # The Scale mode params are: colocate, denstisy_range, node_range and step_size.
      #
      # colocate: true/false - default=false
      # density_range: [n, m] - default=[1,1]
      # node_range: [x, y]  - default=[1,1]
      # step_size: log2 - default=add1
      #   Valid step_size values are: addN or log2
      #   N can be any decimal number
      #   Enumeration examples:
      #      add1:  1,2,3,4 ,,,
      #      add2:  1,3,5,7 ...
      #      add10: 1,11,21,31 ...
      #      log2:  1,2,4,8,16,32 ,,,
      #
      # 'exclude_labels' specifies the list of ineligible worker nodes.
      # exclude_labels:  (OR conditional, every node that matches any of these labels is excluded)
      #    - "bad=true"
      #    - "fc640=true"
EOF
$ oc get pod -o name -l benchmark-operator-role=server
pod/uperf-server-middleware-hvs4d-ocs-tgdsd-0-e2aca1fc--1-pjkdf

# when I try to view the logs... I got nothing!?
oc logs -f $(oc get pod -o name -l benchmark-operator-role=server)

image-20220624164001655

benchmark-comparison

https://github.com/cloud-bulldozer/benchmark-comparison

mkdir -p ~/virtual/environment
python3 -m venv ~/virtual/environment
source ~/virtual/environment/bin/activate
git clone https://github.com/cloud-bulldozer/touchstone
cd touchstone
python setup.py develop
touchstone_compare -h
$ oc get benchmarks
NAME                  TYPE    STATE      METADATA STATE   SYSTEM METRICS   UUID                                   AGE
uperf-benchmark-sdn   uperf   Complete   not collected    Not collected    ed3f6c38-6d2a-5454-9133-bf1f6e42a06f   13m

$ touchstone_compare --database elasticsearch -url $ES_SERVER  -u ed3f6c38-6d2a-5454-9133-bf1f6e42a06f --config config/uperf.json

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment