// Module included in the following assemblies:
//
// * virt/virtual_machines/creating_vms_custom/virt-creating-vms-by-cloning-pvcs.adoc

:_mod-docs-content-type: PROCEDURE
[id="virt-optimizing-clone-performance-at-scale-in-openshift-data-foundation_{context}"]
= Optimizing clone Performance at scale in {rh-storage}

[role="_abstract"]
When you use {rh-storage}, the storage profile configures the default cloning strategy as `csi-clone`. However, this method has limitations, as shown in the following link.

After a certain number of clones are created from a persistent volume claim (PVC), a background flattening process begins, which can significantly reduce clone creation performance at scale.

To improve performance when creating hundreds of clones from a single source PVC, use the `VolumeSnapshot` cloning method instead of the default `csi-clone` strategy.

.Procedure

. Create a `VolumeSnapshot` custom resource (CR) of the source image by using the following content:
+
[source,yaml]
----
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata: 
  name: golden-volumesnapshot
  namespace: golden-ns
spec:
  volumeSnapshotClassName: ocs-storagecluster-rbdplugin-snapclass
  source:
    persistentVolumeClaimName: golden-snap-source
----

. Add the  `spec.source.snapshot` stanza to reference the `VolumeSnapshot` as the source for the `DataVolume clone`:
+
[source,yaml]
----
spec:
  source:
    snapshot:
      namespace: golden-ns
      name: golden-volumesnapshot
----
