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
@@ -74,9 +73,9 @@ This section explains how Memory Statistics feature works, focusing on user cont
74
73
75
74
### Feature Overview
76
75
77
-
-**Feature Scope:** Memory Statistics feature offers a systematic approach to monitoring system-wide memory usage. It automatically records crucial metrics such as Total Memory, Used Memory, Free Memory, and Available Memory. For those requiring more in-depth analysis, additional metrics like Active Memory, Inactive Memory, and others are accessible via extended command options, providing a more detailed view.
78
-
-**Configurability:** This feature offers customizable options for data collection frequency and the duration of data retention according to their specific operational needs. By default, the system is configured to collect memory data every 5 minutes and retains this information for 15 days, ensuring a balance between granularity and storage management.
79
-
-**Enable/Disable Functionality:** This feature is enabled by default to ensure continuous monitoring but can be easily disabled to conserve system resources, suiting various administrative preferences.
76
+
-**Feature Scope:** Memory Statistics feature offers a systematic approach to monitoring system-wide memory usage. It automatically records crucial metrics such as Total Memory, Used Memory, Free Memory, Available Memory, Cached Memory, Shared Memory and Buffers.
77
+
-**Configurability:** This feature offers customizable options for data collection frequency and the duration of data retention according to their specific operational needs. By default, the system is configured to collect memory at all times and sample it every 5 minutes and retains this information for 15 days, ensuring a balance between granularity and storage management.
78
+
-**Enable/Disable Functionality:** This feature is disabled by default to conserve system resources , suiting various administrative preferences but can be easily enabled to ensure continuous monitoring.
80
79
81
80
82
81
### Feature Specification
@@ -90,9 +89,9 @@ Memory Statistics utilizes a dedicated systemd process for the periodic collecti
90
89
User interaction with the Memory Statistics feature is designed to be straightforward and efficient, utilizing a set of powerful CLI commands that enable administrators to manage and analyze memory data effectively.The CLI interface includes commands for:
91
90
92
91
-**Viewing Memory Statistics:** Users can view memory data over custom time intervals with `--from` and `--to` options for defining the start and end times. This allows for flexible and targeted data analysis.
93
-
-**Default Memory Overview:** For a quick general overview without specific parameters, the default command displays system memory statistics covering the last 15 days. This will provides a summary of crucial metrics such as Total Memory, Used Memory, Free Memory, and Available Memory, ideal for routine checks.
92
+
-**Default Memory Overview:** For a quick general overview without specific parameters, the default command displays system memory statistics covering the last 15 days. This will provide a summary of crucial metrics such as Total Memory, Used Memory, Free Memory, Available Memory, Cached Memory, Shared Memory and Buffers, ideal for routine checks.
94
93
-**Selecting Specific Memory Metrics:** This feature enables users to choose specific memory metrics to display, such as Total Memory or Free Memory, which helps in focusing on relevant data points and reducing output clutter.
95
-
-**Configuring Data Collection and Retention:** Administrators can adjust the frequency of data collection and the duration of data retention through commands and can specify how long to retain the collected data.
94
+
-**Configuring Data Collection and Retention:** Administrators can adjust the frequency of data collection and the duration of data retention through commands and can specify how long to retain the collected data for.
96
95
-**Enabling/Disabling the Feature:** To adapt to different operational requirements, users can enable or disable the Memory Statistics feature as needed.
97
96
98
97
### Functional Requirements
@@ -104,19 +103,19 @@ User interaction with the Memory Statistics feature is designed to be straightfo
104
103
105
104
The overall SONiC architecture will remain the same. However, the following updates and additions will be implemented:
106
105
107
-
-**New Daemon Process:**
108
-
- **memorystatsd:** A new systemd daemon process that will be implemented to gather and log memory statistics, utilizing configuration settings read from a designated configuration file.
109
-
- **memstatsmgrd:** A new manager daemon that will monitor changes in the ConfigDB's `MEMORY_STATS_TABLE` and update the memorystats configuration file accordingly. `memstatsmgrd` will restart the `memorystatsd` service to apply the new settings.
106
+
-**Daemon Process:**
107
+
- **memorystatsd:** A new system daemon process that will be implemented to gather and log memory statistics.
108
+
- **hostcfgd:** The existing host config daemon will monitor changes in the ConfigDB's `MEMORY_STATISTICS_TABLE` and will reload the `memorystatsd` service to apply the new settings.
110
109
111
110
-**Log File Directories:** Supporting log file directories will be established via SONiC Buildimage.
112
-
-**SONiC Utilities Updates:** Changes will be made in the SONiC Utilities container to add new "show" commands for displaying memory statistics and "config" commands.
113
-
-**New Configuration Table:** A new table, MEMORY_STATS_TABLE, will be added to ConfigDB to store memory-stats configuration parameters.
111
+
-**SONiC Utilities Updates:** Changes will be made in the SONiC Utilities container to add new "show" and "config" commands.
112
+
-**New Configuration Table:** A new table, MEMORY_STATISTICS_TABLE, will be added to ConfigDB to store memory-stats configuration parameters.
114
113
The high-level feature design diagram is shown below.
115
114
116
115
<palign="center">
117
116
<img src="./images/architecture_diagram.svg" alt="architecture diagram for memory data" width="80%"/>
118
117
<br>
119
-
Figure 1: Feature architecture diagram showing the unix socket, daemon, ConfigDB, and data file
118
+
Figure 1: Feature architecture diagram showing the unix socket, daemon, ConfigDB and data file
120
119
</p>
121
120
122
121
### Sequence Diagram
@@ -178,28 +177,30 @@ No SAI API change or addition is needed for this HLD.
178
177
To configure the interval for memory data collection, use the following command:
-**--from <date-time>:** Display memory statistics from the specified start date-time.
204
205
-**--to <date-time>:** Display memory statistics up to the specified end date-time.
205
206
-**--select <metric>:** Display specific memory statistics, such as total memory.
@@ -208,13 +209,11 @@ To display basic or detailed memory usage statistics, use the following command
208
209
209
210
Below is an example of the Memory Statistics output as it appears in the CLI. This display provides a summary of system memory metrics over a default time period, ideal for routine monitoring and analysis:
To display the current configuration parameters data collection frequency, retention period, and enable/disable status in the MEMORY_STATS_TABLE, use the following command:
231
+
To display the current configuration parameters such as data collection frequency, retention period, and enable/disable status in the MEMORY_STATISTICS_TABLE, use the following command:
230
232
231
233
admin@sonic:~$ show memory-stats config
232
234
@@ -267,13 +269,13 @@ module memory-stats {
267
269
268
270
leaf enabled {
269
271
type boolean;
270
-
default true;
272
+
default false;
271
273
description "Enable or disable memory statistics";
272
274
}
273
275
274
276
leaf sampling-interval {
275
277
type uint16;
276
-
units "minutes"";
278
+
units "minutes";
277
279
description "Interval for sampling memory statistics";
278
280
}
279
281
@@ -288,7 +290,7 @@ module memory-stats {
288
290
289
291
### Config DB Enhancements
290
292
291
-
A new table, `MEMORY_STATS_TABLE`, will be introduced in `ConfigDB` to store the configuration settings of the Memory Statistics feature. This table will allow for management of data collection frequency, retention period, and enable/disable status. The relevant configuration parameters and the schema for this table are detailed below.
293
+
A new table, `MEMORY_STATISTICS_TABLE`, will be introduced in `ConfigDB` to store the configuration settings of the Memory Statistics feature. This table will allow for management of data collection frequency, retention period, and enable/disable status. The relevant configuration parameters and the schema for this table are detailed below.
292
294
293
295
**MEMORY_STATS Configuration Parameters**
294
296
@@ -310,41 +312,23 @@ MEMORY_STATS_TABLE: {
310
312
}
311
313
```
312
314
313
-
### Configuration File for Memory Statistics Daemon
314
-
315
-
A configuration file will be created to store the settings for the `memorystatsd` daemon. This file will be read by the daemon to determine its operating parameters, such as the sampling interval and data retention period.
316
-
317
-
**Example Configuration File**
318
-
319
-
```
320
-
# Memory Statistics Daemon Configuration
321
-
322
-
# Enable or disable memory statistics collection
323
-
enabled=true
324
-
325
-
# Interval for memory data collection
326
-
sampling_interval=5
327
-
328
-
# Duration for which memory data is retained
329
-
retention_period=15
330
-
```
331
-
**Daemon Configuration Management**
315
+
6.**Daemon Configuration Management**
332
316
333
-
The `memorystatsd`daemon will read its configuration from the configuration file. The daemon and its manager, `memstatsmgrd`, will be designed to:
317
+
The `memorystatsd` will dynamically manage its configuration using the `hostcfgd`. The design will:
334
318
335
-
-**Read Configuration at Startup:** On startup, `memorystatsd` will read the configuration file to get the initial settings.
336
-
-**Monitor ConfigDB for Changes:**`memstatsmgrd` will watch the `MEMORY_STATS_TABLE` in ConfigDB for any configuration changes.
337
-
-**Update Configuration File:** When configurations are updated via CLI, `memstatsmgrd` will update the configuration file based on changes detected in ConfigDB.
338
-
-**Restart to Apply Changes:**`memstatsmgrd` will restart the `memorystatsd` service to apply the new settings if necessary.
319
+
1.**Read Configuration at Startup**: On startup, `memorystatsd` will read its configuration directly from the ConfigDB to initialize its settings.
320
+
2.**Monitor ConfigDB for Changes**: `hostcfgd` will monitor the `MEMORY_STATISTICS_TABLE` in ConfigDB for any changes to the configurations.
321
+
3.**Signal Daemon to Reload Configuration**: When configurations are updated via CLI and written to ConfigDB, hostcfgd will detect these changes and signal `memorystatsd` to reload its configuration.
322
+
4.**Reload to Apply Changes**: `memorystatsd` will reload its configurations upon receiving the signal and apply the new settings.
339
323
340
324
**Workflow for Configuration Management**
341
325
342
-
1.**Initial Setup:** On deployment, default settings are written to both ConfigDB and the configuration file.
343
-
2.**Daemon Startup:**`memorystatsd` reads the configuration file to initialize its parameters.
344
-
3.**Runtime Configuration Changes:** Administrators update settings via CLI, which writes changes to ConfigDB.
345
-
4.**Monitor ConfigDB for Changes:**`memstatsmgrd` detects these changes in ConfigDB.
346
-
5.**Update Configuration File:**`memstatsmgrd` updates the configuration file to reflect the new settings.
347
-
6.**Restart Daemon:**`memstatsmgrd` restarts the `memorystatsd` service to apply the new settings.
326
+
1.**Initial Setup**: On deployment, default settings are written to the ConfigDB.
327
+
2.**Daemon Startup**:`memorystatsd` reads configuration from ConfigDB and initializes its parameters.
328
+
3.**Runtime Configuration Changes**: Administrators update settings via CLI, which writes changes to ConfigDB.
329
+
4.**Monitor ConfigDB for Changes**: `hostcfgd` detects changes in ConfigDB.
330
+
5.**Signal Daemon to Reload Configuration**: hostcfgd signals `memorystatsd`to reload its configuration.
331
+
6.**Reload Daemon**: `memorystatsd` reloads the configuration to apply the new settings.
348
332
349
333
## Warmboot and Fastboot Design Impact
350
334
@@ -356,17 +340,16 @@ There is no impact on warmboot/fastboot functionalities by this HLD.
0 commit comments