# Change-TimeWindow-Interval-via-JMX-or-configmap_686074596
## Introduction

With Native SACM enabled, the system collects GraphQL queries from different threads at the TimeWindow interval to generate a batch query for cms-gateway. The default interval of TimeWindow is 100 ms, and you can change it to a larger value via JMX or configmap. A larger interval allows the system to collect more queries in the batch query, but it also causes a side effect that it takes a longer time to finish the processing of a single CI.

## Procedure

You can use either JMX or configmap to achieve this.

## Using JMX

For versions earlier than 23.4.P2, you can change the TimeWindow interval via JMX. To do this, follow these steps:

1. Make sure JDK 8 is installed.
2. Download the JMX widget from [https://github.com/jiaqi/jmxterm/releases/download/v1.0.2/jmxterm-1.0.2-uber.jar](https://github.com/jiaqi/jmxterm/releases/download/v1.0.2/jmxterm-1.0.2-uber.jar "https://github.com/jiaqi/jmxterm/releases/download/v1.0.2/jmxterm-1.0.2-uber.jar") to a directory on the bastion node.
3. Copy the [changeTWInterval.sh](attachments/686074596/686074599.sh) shell script to the same directory that stores jmxterm-1.0.2-uber.jar.
4. Run the “sh changeTWInterval.sh” command to set the interval to 500 ms. Or, change the interval to another value (for example, 600) with “sh changeTWInterval.sh 600”.

**Note: This method doesn't need a pod restart, however, when a pod restart does take place, the change will be rolled back.** **The Cloud Ops team needs to take care of this.**

## Using configmap

For version 24.1 and 24.2, you can change the OOTB value of GraphqlTimeWindow by modifying the configmap and deployment.

For 24.1, follow these steps:

1. Run the following command on the control plane node to create a configmap key:
	```
	kubectl patch configmap itom-xruntime-infra-config --patch '{"data": {"CMSX_TIME_WINDOW_TIME_INTERVAL": "<Interval>"}}' -n <SuiteNamespace>
	```
	**Note:** Replace *<Interval>* and *<SuiteNamespace>* with the expected time interval (ms) and the suite namespace. The minimum value of CMSX\_TIME\_WINDOW\_TIME\_INTERVAL is 100 and the maximum value is 60000000 (1 hour). If you set a value larger than this, 60000000 would be used as this interval. A suitable ***Interval*** improves the performance. For example, setting it to 200 increases the number of query batches.
2. Run the following command on the control plane node to add an environment variable in the lookup container for the platform offline deployment:
	```
	kubectl patch deployment itom-xruntime-platform-offline -n <SuiteNamespace> --patch '{"spec": {"template": {"spec": {"initContainers": [{"name": "lookup-install","env": [{"name":"CMSX_TIME_WINDOW_TIME_INTERVAL", "valueFrom":{"configMapKeyRef":{"name":"itom-xruntime-infra-config", "key": "CMSX_TIME_WINDOW_TIME_INTERVAL", "optional": true}}}]}]}}}}'
	```
	**Note:** Replace ***<SuiteNamespace>*** with the actual suite namespace.
3. If the platform offline pod doesn't restart automatically, manually restart it by running the following command on the control plane node:
	```
	kubectl rollout restart deployment itom-xruntime-platform-offline -n <SuiteNamespace>
	```
	**Note:** Replace ***<SuiteNamespace>*** with the actual suite namespace.

For 24.2, follow these steps:

1. Run the following command on the control plane node to change a configmap key:
	```
	kubectl patch configmap itom-xruntime-infra-config --patch '{"data": {"CMSX_TIME_WINDOW_TIME_INTERVAL": "<Interval>"}}' -n <SuiteNamespace>
	```
	**Note:** Replace *<Interval>* and *<SuiteNamespace>* with the expected time interval (ms) and the suite namespace. The minimum value of CMSX\_TIME\_WINDOW\_TIME\_INTERVAL is 100 and the maximum value is 60000000 (1 hour). If you set a value larger than this, 60000000 would be used as this interval. A suitable ***Interval*** improves the performance. For example, setting it to 200 increases the number of query batches.
2. Manually restart the platform offline pod by running the following command on the control plane node:
	```
	kubectl rollout restart deployment itom-xruntime-platform-offline -n <SuiteNamespace>
	```
	**Note:** Replace ***<SuiteNamespace>*** with the actual suite namespace.

**Note: This method needs a pod restart and the changes will be saved.**
