# Modify Prune Configuration

ESS includes a [Prune](/ess/2.4/services/service-pod-management/service-pod-storage.md#prune-hard-delete-feature) feature to perform hard delete (i.e., permanently delete):

* soft-deleted resources (i.e., files marked as deleted) and
* orphan data (i.e., data that are no longer referenced by metadata).

Specifically, Prune consists of two [Kubernetes CronJobs](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/) :

* [One](/ess/2.4/services/service-pod-management/service-pod-storage.md#pruning-soft-deleted-resources) to delete “prunable” resources. Prunable resources are resources that have been marked for deletion (i.e., soft-deleted) and are past their [**`INRUPT_STORAGE_PRUNE_RETENTION_WINDOW`**](/ess/2.4/services/service-pod-management/service-pod-storage.md#inrupt_storage_prune_retention_window) .
* [One](/ess/2.4/services/service-pod-management/service-pod-storage.md#pruning-orphan-data) to delete orphan data.

You can use Kustomize to modify the two CronJobs.

## Example Customizations

### Configure CronJob to Prune Soft-Deleted Resources

{% hint style="warning" %}
**Important**\
Pruning operations may negatively affect performance. If possible, schedule the CronJob to run at times when you can minimize its impact.
{% endhint %}

The provided overlays are configured to:

* Use a job schedule of every 30 minutes.
* Use a [**`INRUPT_STORAGE_PRUNE_RETENTION_WINDOW`**](/ess/2.4/services/service-pod-management/service-pod-storage.md#inrupt_storage_prune_retention_window) of **`P3D`** (3 days).
* Use [**`INRUPT_STORAGE_PRUNE_PRUNABLE_BATCH_SIZE`**](/ess/2.4/services/service-pod-management/service-pod-storage.md#inrupt_storage_prune_prunable_batch_size) of **`10000`** .
* Use [**`INRUPT_STORAGE_PRUNE_ORPHAN_BATCH_SIZE`**](/ess/2.4/services/service-pod-management/service-pod-storage.md#inrupt_storage_prune_orphan_batch_size) of **`0`** . <mark style="background-color:red;">**Do not modify for pruning soft-deleted resources**</mark>**.**
* Use the default [**`COM_INRUPT_STORAGE_METADATA_JDBC_CONNECTIONLIMITER_OPENCONNECTION_TIMEOUT_VALUE`**](/ess/2.4/services/service-pod-management/service-pod-storage.md#com_inrupt_storage_metadata_jdbc_connectionlimiter_openconnection_timeout_value) of **`5000`** milliseconds.

If instead you wish to schedule the job to run every day at midnight ( **`0 0 * * *`** ) and to decrease the [**`INRUPT_STORAGE_PRUNE_RETENTION_WINDOW`**](/ess/2.4/services/service-pod-management/service-pod-storage.md#inrupt_storage_prune_retention_window) to 2 days **`P2D`** :

1. Go to your ESS installation directory:

   ```sh
   cd ${HOME}/ess
   ```
2. Create a **`kustomize-prune-resources.yaml`** file with the following content:

   ```javascript
   apiVersion: batch/v1
   kind: CronJob
   metadata:
     name: ess-prune-prunable
   spec:
     jobTemplate:
       spec:
         template:
           spec:
             containers:
             - env:
               - name: INRUPT_STORAGE_PRUNE_RETENTION_WINDOW
                 value: P2D
               name: ess-prune-prunable
     schedule: '0 0 * * *'
   ```
3. Modify the **`kustomization.yaml`** (i.e., step 3 of the [Applying Your Customizations](/ess/2.4/installation/customize-configurations.md#applying-your-customizations) procedure) to use **`kustomize-prune-resources.yaml`** .\
   Specifically, add the highlighted content to the **`kustomization.yaml`** file to the **`patches`** section:

{% hint style="info" %}
**Tip**

If **`patches`** key does not exist in **`kustomization.yaml`** , add the **`patches`** key as well.
{% endhint %}

<pre class="language-yaml"><code class="lang-yaml"># kustomization.yaml in your ESS installation directory

# ...  Preceding content omitted for brevity 
# ...

patches:
<strong>  - path: kustomize-prune-resources.yaml
</strong></code></pre>

4\. Continue with the rest of the [Applying Your Customizations](/ess/2.4/installation/customize-configurations.md#applying-your-customizations) procedure.

### Configure CronJob to Prune Orphan Data

{% hint style="warning" %}
**Important**\
Pruning operations may negatively affect performance. If possible, schedule the job to run at times when you can minimize its impact.
{% endhint %}

The provided overlays are configured to:

* Use a job schedule of every 30th minutes from 10 minutes past the hour through 50 minutes past the hour.
* Use a [**`INRUPT_STORAGE_PRUNE_RETENTION_WINDOW`**](/ess/2.4/services/service-pod-management/service-pod-storage.md#inrupt_storage_prune_retention_window) of **`P3D`** (3 days). **Does not affect the pruning of orphan data.**
* Use [**`INRUPT_STORAGE_PRUNE_PRUNABLE_BATCH_SIZE`**](/ess/2.4/services/service-pod-management/service-pod-storage.md#inrupt_storage_prune_prunable_batch_size) of **`0`** . **Do not modify for pruning orphan data.**
* Use [**`INRUPT_STORAGE_PRUNE_ORPHAN_BATCH_SIZE`**](/ess/2.4/services/service-pod-management/service-pod-storage.md#inrupt_storage_prune_orphan_batch_size) of **`80000`** .
* Use the default [**`COM_INRUPT_STORAGE_METADATA_JDBC_CONNECTIONLIMITER_OPENCONNECTION_TIMEOUT_VALUE`**](/ess/2.4/services/service-pod-management/service-pod-storage.md#com_inrupt_storage_metadata_jdbc_connectionlimiter_openconnection_timeout_value) of **`5000`** milliseconds.

If instead you wish to increase the [**`INRUPT_STORAGE_PRUNE_ORPHAN_BATCH_SIZE`**](/ess/2.4/services/service-pod-management/service-pod-storage.md#inrupt_storage_prune_orphan_batch_size) to **`140000`** and [**`COM_INRUPT_STORAGE_METADATA_JDBC_CONNECTIONLIMITER_OPENCONNECTION_TIMEOUT_VALUE`**](/ess/2.4/services/service-pod-management/service-pod-storage.md#com_inrupt_storage_metadata_jdbc_connectionlimiter_openconnection_timeout_value) to **`10000`** milliseconds.

1. Go to your ESS installation directory:

   ```sh
   cd ${HOME}/ess
   ```
2. Create a **`kustomize-prune-orphans.yaml`** file with the following content:

   ```javascript
   apiVersion: batch/v1
   kind: CronJob
   metadata:
     name: ess-prune-orphans
   spec:
     jobTemplate:
       spec:
         template:
           spec:
             containers:
             - env:
               - name:  INRUPT_STORAGE_PRUNE_ORPHAN_BATCH_SIZE
                 value: "140000"
               - name:  COM_INRUPT_STORAGE_METADATA_JDBC_CONNECTIONLIMITER_OPENCONNECTION_TIMEOUT_VALUE
                 value: "10000"
               name: ess-prune-orphans
   ```
3. Modify the **`kustomization.yaml`** (i.e., step 3 of the [Applying Your Customizations](/ess/2.4/installation/customize-configurations.md#applying-your-customizations) procedure) to use **`kustomize-prune-orphans.yaml`** .\
   Specifically, add the highlighted content to the **`kustomization.yaml`** file to the **`patches`** section:

{% hint style="info" %}
**Tip**

If **`patches`** key does not exist in **`kustomization.yaml`** , add the **`patches`** key as well.
{% endhint %}

<pre class="language-yaml"><code class="lang-yaml"># kustomization.yaml in your ESS installation directory

# ...  Preceding content omitted for brevity 
# ...

patches:
<strong>  - path: kustomize-prune-orphans.yaml
</strong></code></pre>

4. Continue with the rest of the [Applying Your Customizations](/ess/2.4/installation/customize-configurations.md#applying-your-customizations) procedure.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.inrupt.com/ess/2.4/installation/customize-configurations/customization-pod-maintenance/modify-prune.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
