// Module included in the following assemblies:
//
// * backup_and_restore/application_backup_and_restore/installing/overriding-kopia-algorithms.adoc          

:_mod-docs-content-type: PROCEDURE
[id="oadp-kopia-algorithms-benchmarking_{context}"]
= Benchmarking Kopia hashing, encryption, and splitter algorithms

[role="_abstract"]
Run Kopia commands to benchmark the hashing, encryption, and splitter algorithms. Based on the benchmarking results, you can select the most suitable algorithm for your workload. You run the Kopia benchmarking commands from a pod on the cluster. The benchmarking results can vary depending on CPU speed, available RAM, disk speed, current I/O load, and so on.

include::snippets/kopia-repo-config.adoc[]

.Prerequisites

* You have installed the {oadp-short} Operator.
* You have an application with persistent volumes running in a separate namespace.
* You have run a backup of the application with Container Storage Interface (CSI) snapshots.



.Procedure

. Configure the `must-gather` pod as shown in the following example. Make sure you are using the `oadp-mustgather` image for {oadp-short} version 1.3 and later.
+
.Example pod configuration

[source,yaml]
----
apiVersion: v1
kind: Pod
metadata:
  name: oadp-mustgather-pod
  labels:
    purpose: user-interaction
spec:
  containers:
  - name: oadp-mustgather-container
    image: registry.redhat.io/oadp/oadp-mustgather-rhel9:v1.3
    command: ["sleep"]
    args: ["infinity"]
----
+
The Kopia client is available in the `oadp-mustgather` image.


. Create the pod by running the following command:
+
[source,terminal]
----
$ oc apply -f <pod_config_file_name>
----
Replace `<pod_config_file_name>` with the name of the YAML file for the pod configuration.


. Verify that the Security Context Constraints (SCC) on the pod is `anyuid`, so that Kopia can connect to the repository.
+ 
[source,terminal]
----
$ oc describe pod/oadp-mustgather-pod | grep scc
----
+
.Example output

[source,terminal]
----
openshift.io/scc: anyuid
----

. Connect to the pod via SSH by running the following command:
+ 
[source,terminal]
----
$ oc -n openshift-adp rsh pod/oadp-mustgather-pod
----

. Connect to the Kopia repository by running the following command:
+
[source,terminal]
----
sh-5.1# kopia repository connect s3 \
  --bucket=<bucket_name> \
  --prefix=velero/kopia/<application_namespace> \
  --password=static-passw0rd \
  --access-key="<access_key>" \
  --secret-access-key="<secret_access_key>" \
  --endpoint=<bucket_endpoint>
----
+
where:
+
`<bucket_name>`:: Specifies the object storage provider bucket name.
`<application_namespace>`:: Specifies the namespace for the application.
`static-passw0rd`:: This is the Kopia password to connect to the repository.
`<access_key>`:: Specifies the object storage provider access key.
`<secret_access_key>`:: Specifies the object storage provider secret access key.
`<bucket_endpoint>`:: Specifies the bucket endpoint. You do not need to specify the bucket endpoint, if you are using {aws-short} S3 as the storage provider.

+

This is an example command. The command can vary based on the object storage provider.


. To benchmark the hashing algorithm, run the following command:
+
[source,terminal]
----
sh-5.1# kopia benchmark hashing
----
+
.Example output
[source,terminal]
----
Benchmarking hash 'BLAKE2B-256' (100 x 1048576 bytes, parallelism 1)
Benchmarking hash 'BLAKE2B-256-128' (100 x 1048576 bytes, parallelism 1)


Fastest option for this machine is: --block-hash=BLAKE3-256
----

. To benchmark the encryption algorithm, run the following command:
+
[source,terminal]
----
sh-5.1# kopia benchmark encryption
----
+
.Example output
[source,terminal]
----
Benchmarking encryption 'AES256-GCM-HMAC-SHA256'
Benchmarking encryption 'CHACHA20-POLY1305-HMAC-SHA256'

Fastest option for this machine is: --encryption=AES256-GCM-HMAC-SHA256
----

. To benchmark the splitter algorithm, run the following command:
+
[source,terminal]
----
sh-5.1# kopia benchmark splitter
----
+
.Example output
[source,terminal]
----
splitting 16 blocks of 32MiB each, parallelism 1
DYNAMIC                     747.6 MB/s count:107 min:9467 10th:2277562 25th:2971794 50th:4747177 75th:7603998 90th:8388608 max:8388608
DYNAMIC-128K-BUZHASH        718.5 MB/s count:3183 min:3076 10th:80896 25th:104312 50th:157621 75th:249115 90th:262144 max:262144
DYNAMIC-128K-RABINKARP      164.4 MB/s count:3160 min:9667 10th:80098 25th:106626 50th:162269 75th:250655 90th:262144 max:262144

----

