This article provides information on the datad collection of processes, as well as the steps required to increase the memory and timeout allocated to it.
The data collection processes called datad is responsible for the roll-up of data from samples every ten seconds into values that are averaged over a more extended period. These roll-ups occur at standard times, e.g., 5 minutes, half hour, hour, daily, or monthly. If the datad process fails in doing the roll-up of the data, there can be gaps in graphs because the data is not in the database. Several things, including the following reasons, can cause the failure of data roll-ups:
- The process is not running.
- The process timed out while performing the roll-up.
- The process does not have enough memory to operate for a large dataset.
Datad is a Java-based process, which means that when the process launches, it does so using a Java Virtual Machine (JVM) to operate. The JVM has a specific amount of memory that is allocated to it, and it will not use additional memory. The datad process uses a calculation based on values located in the /etc/init.d/internal_startup.inc file to determine how much RAM it will use when launching. That calculation is as follows:
Total RAM use = BM + (number of 4GB multiples in RAM)*(SMM)
- BM = the Base Memory assigned to datad (the 'DATAD_BASE_MEMORY_IN_MEGABYTES' parameter in the file)
- SMM = the Scaled Memory Multiplier assigned (the 'DATAD_SCALED_MEMORY_MULTIPLIER_IN_MEGABYTES' parameter in the file). The SMM is an increase of RAM per every 4GB of RAM in the device. For example, in a device with 8GB of RAM, the SMM would be done twice (2 x 4GB).
These values can be changed in the internal_startup.inc file so that on the launch, the RAM values are calculated appropriately. If datad is running out of memory on a high-end device, increasing these values (and thus allocating more RAM to the process) can help with errors. The below table contains the default parameters in the startup file and their respective value:
Any modification to these values should be discussed with engineering, since increasing them will change the amount of the RAM given to the JVM process. Such values can be calculated by hand using the formula provided above. Additionally, attached in this article, you will find the Calculating Datad RAM Usage spreadsheet that also does these calculations, and show how much total datad RAM usage will be based on parameters and the system's RAM.
In the spreadsheet, there are three columns with values. The top rows (1, 2, 3, and 4) indicate the values in the internal_startup.inc file and the column indicates three scenarios with three different sets of parameters. By inserting the SYSTEM_MEMORY_IN_MEGABYTES in each column, it is possible to determine how changing the settings will affect total RAM usage. See the example below:
In this example, by inserting 4096MB of RAM into each column, you can see the result of the calculations in the DATAD_TOTAL_MEMORY row.
With the default parameters (128/64) and a system RAM of 4096MB, the total memory obtained for datad is 192MB. If you double those parameters (256/128), the RAM usage will 384MB, and if you double again (512/256), the RAM usage will be 768MB.
The default values can be doubled (except for the MAXIMUM_MEMORY) without impacting performance. However, if the device heavily uses RAM as it is, an increase in memory usage can cause performance issues.
Steps to Increase Memory to datad
- Install a restricted license on the Exinda device through SSH.
- Go to the shell using the
- Edit the currently running copy of datad to increase the memory so that a system reboot will not be necessary. When doing this step, use the calculation to determine the value of datad memory for the startup file:
mdreq set modify - /pm/process/datad/launch_params/1/param string -Xmx[value_in_mega]m
mdreq action /pm/actions/restart_process process_name string datad
- Edit the startup file so the changes will be persistent after a reboot:
- In that file, change the corresponding lines to update the values:
DATAD_BASE_MEMORY_IN_MEGABYTES = 256
DATAD_SCALED_MEMORY_MULTIPLIER_IN_MEGABYTES = 128
If the device has more than 8GB of RAM, you can also modify the parameter below; this should not be changed on a device with less than 8GB of RAM, i.e., models 2061, 4010, and early models of the 4061.
DATAD_MAXIMUM_MEMORY_IN_MEGABYTES = 4096
- Save and quit the file using the
Steps to Increase Timeout to datad
In some cases, datad may timeout during roll-ups due to large datasets. When it tries to parse a table for a high amount of database records, it can take some time to go through all of them. The connection that datad opens to the database is set to close after 3600 seconds (one hour). If the roll-up is not completed by that time, the connection will close and datad will generate an exception with either of the below messages in the datad-server.log file:
- The connection was lost.
- The connection was closed.
- Missing data.
Warning: Increasing the timeout from one hour to a higher value will have an impact on the system's performance, so consider RAM and CPU usage before doing these changes.
- Install a restricted license in the Exinda device through SSH.
- Go to the shell using the
- Open up the connection properties for datad.
- In that file, find the
removeAbandonedTimeoutparameter and edit it as shown below:
- Once you are done, save and quit the file using the
- Restart datad through the command-line using the
pm process datad restartcommand.