| 1 | # Performance Tuning |
| 2 | |
| 3 | Out of the box the EDC provides a set of default configurations that aim to find a good balance for performances. |
| 4 | The extensibility nature of the EDC permits the user to configure it deeply. |
| 5 | |
| 6 | Here will be showed how performance could be improved. |
| 7 | |
| 8 | ## State Machines |
| 9 | At the core of the EDC there are different [`State Machines`](state-machine.md), and their configuration is crucial to |
| 10 | reach the best performances. |
| 11 | |
| 12 | ### Settings |
| 13 | The most important settings for configuring a state machine are: |
| 14 | - `iteration-wait` |
| 15 | - the time that the state machine will pass before fetching the next batch of entities to process in the case in the |
| 16 | last iteration there was no processing; Otherwise no wait is applied. |
| 17 | - `batch-size` |
| 18 | - how many entities are fetched from the store for processing by the connector instance. The entities are locked |
| 19 | pessimistically against mutual access, so for the time of the processing no other connector instances can read |
| 20 | the same entities. |
| 21 | |
| 22 | ### How to tune them |
| 23 | In the control-plane there are 3 state machines: |
| 24 | - `negotiation-consumer`: the state machine that handles the contract negotiations from a consumer perspective |
| 25 | - `negotiation-provider`: the state machine that handles the contract negotiations from a provider perspective |
| 26 | - `transfer-process`: the state machine that handles the transfer processes |
| 27 | |
| 28 | For every state machine you can set the `iteration-wait` (actually for the `negotiation-*` there's a single setting |
| 29 | used for both) and the `batch-size`, so the settings (and their default value) are: |
| 30 | |
| 31 | - `edc.negotiation.state-machine.iteration-wait-millis` = 1000 |
| 32 | - `edc.negotiation.consumer.state-machine.batch-size` = 20 |
| 33 | - `edc.negotiation.provider.state-machine.batch-size` = 20 |
| 34 | - `edc.transfer.state-machine.iteration-wait-millis` = 1000 |
| 35 | - `edc.transfer.state-machine.batch-size` = 20 |
| 36 | |
| 37 | Thus, by default all the control-plane state machines will have an iteration of 1 second if no |
| 38 | entities are found/processed. There will be no wait but the next iteration will start as soon as all the entities are |
| 39 | processed. At every iteration 20 entities are fetched. |
| 40 | |
| 41 | Changing these values you could tune your connector, for example reducing the `iteration-wait` will mean that the state |
| 42 | machine will be more reactive, and increasing the `batch-size` will mean that more entities will be processed in the |
| 43 | same iteration. Please note increasing `batch-size` too much could bring to longer processing time in the case that |
| 44 | there are a lot of different entities and that reducing `iteration-wait` too much will make the state machine spend more |
| 45 | time in the fetch operation. |
| 46 | |
| 47 | If tweaking the settings doesn't give you a performance boost, you can achieve them through horizontal scaling. |