<jupyter_start><jupyter_text>Benchmarking with Argo Worfklows & VegetaIn this notebook we will dive into how you can run bench marking with batch processing with Argo Workflows, Seldon Core and Vegeta.Dependencies:* Seldon core installed as per the docs with Istio as an ingress * Argo Workfklows installed in cluster (and argo CLI for commands)  Setup Install Seldon CoreUse the notebook to [set-up Seldon Core with Ambassador or Istio Ingress](https://docs.seldon.io/projects/seldon-core/en/latest/examples/seldon_core_setup.html).Note: If running with KIND you need to make sure do follow [these steps](https://github.com/argoproj/argo/issues/2376issuecomment-595593237) as workaround to the `/.../docker.sock` known issue.  Install Argo WorkflowsYou can follow the instructions from the official [Argo Workflows Documentation](https://github.com/argoproj/argoquickstart).You also need to make sure that argo has permissions to create seldon deployments - for this you can just create a default-admin rolebinding as follows:<jupyter_code>!kubectl create rolebinding default-admin --clusterrole=admin --serviceaccount=default:default<jupyter_output>rolebinding.rbac.authorization.k8s.io/default-admin created<jupyter_text>Create Benchmark Argo WorkflowIn order to create a benchmark, we created a simple argo workflow template so you can leverage the power of the helm charts.Before we dive into the contents of the full helm chart, let's first give it a try with some of the settings.We will run a batch job that will set up a Seldon Deployment with 1 replicas and 4 cpus (with 100 max workers) to send requests.<jupyter_code>!helm template seldon-batch-workflow helm-charts/seldon-batch-workflow/ \
    --set workflow.name=seldon-batch-process \
    --set seldonDeployment.name=sklearn \
    --set seldonDeployment.replicas=1 \
    --set seldonDeployment.serverWorkers=1 \
    --set seldonDeployment.serverThreads=10 \
    --set benchmark.cpus=4 \
    | argo submit -
!argo list
!argo get seldon-batch-process
!argo logs -w seldon-batch-process 
def print_vegeta_results(results):
    print("Latencies:")
    print("\tmean:", results["latencies"]["mean"] / 1e6, "ms")
    print("\t50th:", results["latencies"]["50th"] / 1e6, "ms")
    print("\t90th:", results["latencies"]["90th"] / 1e6, "ms")
    print("\t95th:", results["latencies"]["95th"] / 1e6, "ms")
    print("\t99th:", results["latencies"]["99th"] / 1e6, "ms")
    print("")
    print("Throughput:", str(results["throughput"]) + "/s")
    print("Errors:", len(results["errors"]) > 0)
import json
wf_logs = !argo logs -w seldon-batch-process 
wf_bench = wf_logs[-1]
wf_json_str = wf_bench[24:]
wf_json = json.loads(wf_json_str)
print_vegeta_results(wf_json)
!argo delete seldon-batch-process<jupyter_output>Workflow 'seldon-batch-process' deleted
{'fraction_non_alphanumeric': 0.11182336182336182, 'fraction_numerical': 0.019230769230769232, 'mean_word_length': 4.901260504201681, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '390066', 'license': 'Apache-2.0', 'n_tokens_mistral': 938, 'n_tokens_neox': 876, 'n_words': 273, 'path': 'examples/batch/benchmarking-argo-workflows-vegeta/README.ipynb', 'repo_name': 'simon-cj/seldon-core', 'size': '2808'}