You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/nim/fundamentals/tech-specs.md
+116Lines changed: 116 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,6 +132,122 @@ The table below shows the estimated storage requirements for **NGINX OSS**, base
132
132
|| 250 | 14 | 4 GiB |
133
133
{{</bootstrap-table>}}
134
134
135
+
#### ClickHouse Tunings {#Clickhouse-tuning}
136
+
137
+
The default configuration that comes with clickhouse works with NIM efficiently. But if you make any changes to the configuration and clickhouse is running out of memory, please follow below steps.
138
+
There are system tables in ClickHouse that provide logging and telemetry mechanisms to monitor and debug the behavior of the database. These logs are not typical event logs that store user activity but are internal logs designed for diagnostics and telemetry related to system operations.
139
+
Below is an explanation of three such tables which may cause an out of memory issue:
140
+
141
+
-**trace_log**: The trace_log table records detailed execution traces and profiling information. It is mainly used for query debugging and performance analysis in ClickHouse. The logs here provide insight into CPU usage and stack traces for specific parts of query execution. Stores stack traces collected by query profilers and inserted into this table. You can modify the settings for trace_log under <trace_log> section in /etc/clickhouse-server/config.xml file. The flush_interval_milliseconds controls the Interval for flushing data from the buffer in memory to the table and the default value is 7500. Any value below default can cause the excessive debug rows captured in the table and eventually eat up more memory.
You can use the below command to view the current memory occupied by each table in the clickhouse database using the below command from clickhouse-client.
159
+
```shell
160
+
SELECT
161
+
database,
162
+
table,
163
+
formatReadableSize(sum(bytes_on_disk)) AS total_size
164
+
FROM system.parts
165
+
GROUP BY database, table
166
+
ORDER BY sum(bytes_on_disk) DESC;
167
+
```
168
+
If you observe that this table is utilizing more memory, you can configure the TTL to ensure that outdated records are removed after the specified TTL duration. The TTL configuration guarantees that your table does not expand excessively and automatically deletes old records following the TTL.
169
+
170
+
```shell
171
+
ALTER TABLE system.trace_log
172
+
MODIFY TTL event_time + INTERVAL 7 DAY;
173
+
```
174
+
You can also relieve the memory if its running very low using the below command. Change the interval in the command to how many days of records you want to retain and delete the remaining records.
175
+
```shell
176
+
ALTER TABLE system.trace_log DELETE WHERE event_time <now() - INTERVAL 30 DAY;
177
+
```
178
+
-**metric_log**: The `system.metric_log` contains history of metrics values from tables system.metrics and system.events, periodically flushed to disk. It serves as a time-series table that periodically records historical data from system.metrics and system.events over time. This table acts like an essential tool providing historical tracking of captured metrics and event data, making it easier to debug performance trends, spikes, or irregularities. Too much of historical data in this table can occupy more memory and make the clickhouse run out of memory if not properly configured.
You can use the below command to view the current memory occupied by each table in the clickhouse database using the below command from clickhouse-client.
195
+
```shell
196
+
SELECT
197
+
database,
198
+
table,
199
+
formatReadableSize(sum(bytes_on_disk)) AS total_size
200
+
FROM system.parts
201
+
GROUP BY database, table
202
+
ORDER BY sum(bytes_on_disk) DESC;
203
+
```
204
+
205
+
If it is observed that system.metric_log table is taking more memory, you can set the TTL(Time to Live) so that old records will be deleted after the TTL time. The TTL setting makes sure your table does not grow uncontrollably and delete the old records automatically after the TTL.
206
+
```shell
207
+
ALTER TABLE system.metric_log
208
+
MODIFY TTL event_time + INTERVAL 7 DAY;
209
+
```
210
+
211
+
You can also relieve the memory immediately if its running very low using the below command. Change the interval in the command to how many days of records you want to retain and delete the remaining records.
212
+
```shell
213
+
ALTER TABLE system.metric_log DELETE WHERE event_time <now() - INTERVAL 30 DAY;
214
+
```
215
+
Note: We also have a table called nms.metrics table which stores the metrics collected from the data plane in NIM. Make sure you don't delete the records accidentally from nms.metrics table as deleting from nms.metrics will loose the metrics from the data planes.
216
+
217
+
-**text_log**: The text_log table contains general logging information, including warnings, errors, system messages, and query-processed events. It is a human-readable diagnostic log for operational debugging. The logging level which goes to this table can be limited to the text_log.level server setting as shown in the below xml snippet.
You can use the below command to view the current memory occupied by each table in the clickhouse database using the below command from clickhouse-client.
231
+
```shell
232
+
SELECT
233
+
database,
234
+
table,
235
+
formatReadableSize(sum(bytes_on_disk)) AS total_size
236
+
FROM system.parts
237
+
GROUP BY database, table
238
+
ORDER BY sum(bytes_on_disk) DESC;
239
+
```
240
+
241
+
If it is observed that this table is taking more memory, you can set the TTL(Time to Live) so that old records will be deleted after the TTL time. The TTL setting makes sure your table does not grow uncontrollably and delete the old records automatically after the TTL.
242
+
```shell
243
+
ALTER TABLE system.text_log
244
+
MODIFY TTL event_time + INTERVAL 7 DAY;
245
+
```
246
+
You can also relieve the memory immediately if its running very low using the below command. Change the interval in the command to how many days of records you want to retain and delete the remaining records.
247
+
```shell
248
+
ALTER TABLE system.text_log DELETE WHERE event_time <now() - INTERVAL 30 DAY;
249
+
```
250
+
135
251
## Firewall ports {#firewall}
136
252
137
253
NGINX Instance Manager and NGINX Agent use the Unix domain socket by default and proxy through the gateway on port `443`.
0 commit comments