# Tuning performance

## Memory Usage

This chapter describes configuration options related to the memory consumption of a connector service.

### Hard limit

#### Description

* Specifies the maximum commit size, in bytes, for the GC heap and GC bookkeeping.
* This setting only applies to 64-bit computers.
* This setting is ignored if the [Per-object-heap limits](https://docs.microsoft.com/en-us/dotnet/core/runtime-config/garbage-collector#per-object-heap-limits) are configured.
* The default value, which only applies in certain cases, is the greater value of 20 MB or 75% of the memory limit on the container. The default value applies if:
  * The Connector Service is running inside a container that has a specified memory limit.
  * [System.GC.HeapHardLimitPercent](https://docs.microsoft.com/en-us/dotnet/core/runtime-config/garbage-collector#heap-limit-percent) is not set.

#### How to activate

* Open the installation folder for the Connector Service that you want to configure.
* Open the Novacura.Connector.MyConnector.runtimeconfig.json in a proper text editor such as VSCode or Notepad++ (create the file if it does not exist, noting that "MyConnector" must be replaced with the actual connector name).
* Locate "runtimeOptions" and add "**System.GC.HeapHardLimit**" to the "configProperties" array (note that the key-value pairs are comma separated).

```
{
   "runtimeOptions": {
      "configProperties": {
         "System.GC.Server": true,
         "System.GC.HeapHardLimit": 2097152000,
         "SomeOtherKey": "Comma separated key/value pairs above..."
      }
   }
}
```

{% hint style="success" %}
1 Mebibyte (MiB) = 1 048 576 (2^20 = 1024^2) bytes. For example, to specify a heap hard limit of 2000 mebibytes (MiB), the value would be 2 097 152 000.
{% endhint %}

### Percentage limit

#### Description

* Specifies the allowable GC heap usage as a percentage of the total physical memory.
* If [System.GC.HeapHardLimit](https://docs.microsoft.com/en-us/dotnet/core/runtime-config/garbage-collector#heap-limit) is also set, this setting is ignored.
* This setting only applies to 64-bit computers.
* If the Connector Service is running inside a container that has a specified memory limit, the percentage is calculated as a percentage of that memory limit.
* This setting is ignored if the [Per-object-heap limits](https://docs.microsoft.com/en-us/dotnet/core/runtime-config/garbage-collector#per-object-heap-limits) are configured.
* The default value, which only applies in certain cases, is the greater value of 20 MB or 75% of the memory limit on the container. The default value applies if:
  * The Connector Service is running inside a container that has a specified memory limit.
  * [System.GC.HeapHardLimit](https://docs.microsoft.com/en-us/dotnet/core/runtime-config/garbage-collector#heap-limit) is not set.

#### How to activate

* Open the installation folder for the Connector Service that you want to configure.
* Open the Novacura.Connector.MyConnector.runtimeconfig.json in a proper text editor such as VSCode or Notepad++ (create the file if it does not exist, noting that "MyConnector" must be replaced with the actual connector name).
* Locate "runtimeOptions" and add "**System.GC.HeapHardLimitPercent**" to the "configProperties" array (note that the key-value pairs are comma separated).

```
{
   "runtimeOptions": {
      "configProperties": {
         "System.GC.Server": true,
         "System.GC.HeapHardLimitPercent": 30,
         "SomeOtherKey": "Comma separated key/value pairs above..."
      }
   }
}
```

{% hint style="success" %}
For example, to limit the heap usage to 30%, the value would be 30.
{% endhint %}


---

# 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://help.novacuraflow.com/connectors/installation/tuning-performance.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.
