An Installed Collector uses all CPU processing resources available on a machine. Most of the time CPU processing issues don’t arise, but if a lot of log data is being generated, or if you need to protect other processes running on the machine where the Collector is installed, you can choose to set a CPU Target to limit the amount of CPU processing a Collector uses. This option is applied only to for Local and Remote file Sources.
Once you have set a CPU Target, if a Collector hits the target, collection is slowed. Logs are still collected, but there may be delays in ingesting new data. You may notice a delay in search results.
It’s important to note that a CPU target is not a hard limit. Even with a target set, there’s a chance that the Collector will exceed the limit. If you notice that a Collector is consistently exceeding the target, you can increase the CPU target, install the Collector on a more robust machine, or try using remote collection options.
To set a CPU Usage Target:
- Select Manage > Collection.
- Click the Collector name, or click the Edit link to the right of the Collector name.
- Click Advanced.
- Choose an option from the CPU Target menu, then click Save.
When should I choose a lower target?
A lower CPU Target is useful if a Collector is installed on a machine that is running other processes that you need to protect. In other words, the Collector is slowed instead of CPU resources being taken away from other processes.
How is Collector CPU Usage calculated?
The CPU Target is based on the amount of CPU being used by the Collector JVM process, java.exe. The CPU Target feature does not cap CPU usage on the host or limit the Collector JVM's access to CPU resources. Instead, the Collector monitors it's CPU usage every minute, and when the current CPU consumption exceeds the user-defined threshold set in the CPU Target parameter, it begins to throttle back its resources and the work it is performing.
When and where does the CPU Target apply?
The CPU Target only applies to Collectors running Local and Remote File Sources. Sumo Logic does not apply any throttling to Local Event Sources or Syslog Sources. So if you have a combination of both Local File Sources and Windows Event Sources, it is possible you will not see the CPU usage of the Collector go below the CPU Target setting due to those other Source types.
How Does the CPU Target Work?
Resource throttling occurs in two ways:
- By reducing the number of threads used by each Source to read local or remote files from the host. By default, a Collector has up to eight threads per Source. When CPU targeting kicks in, the Collector incrementally reduces this thread count by one, and will continue to do so until it is left with only one thread in use, or the CPU has fallen below the set target. The Collector will never reduce the thread count to 0 threads. Sumo Logic will always continue to read from the Source files.
- By increasing the scanning interval of the path expressions incrementally until the scan interval reaches a set maximum. By default, a Local File Source scans the defined path every two seconds. A Remote File Source scans the path every 30 seconds. Throttling increases either of these intervals up to 10x. This means the maximum scan interval for a Local File Source is 20 seconds, and the maximum scan interval for a Remote File Source is three minutes.
The Collector will always perform some level of work, whether it is scanning the path expressions looking for new files, or reading the files it has already found with the previous scan. So, depending on the CPU available on the host, the throttled-back collection could still require more CPU than what is defined within the CPU Target parameter. In this case, you may not see the CPU ever go below the target you set for that Collector.
How Can a CPU Target be Applied to a Collector?
The CPU Target value can be set in three ways:
- Update the CPU Target value by editing the Collector under Manage > Collection.
- Update the Collector configuration via the Collector Management API.
- Either supply the targetCPU parameter to the user.properties file or -VtargetCPU command line argument during the initial installation and registration of the Collector.
How Do You Know Targeting is Applied?
Within the Collector logs (collector.log) you can look for the following types of log lines containing info on CPU targeting and the current usage. (Where $current% and $target% will be some number.)
- "Initializing CPU Resource Monitor with a target of $target%" - This message notes the CPU Target that is set for the Collector.
- "Resource consumption $current% is higher than $target%" - This message notes the start of a CPU targeting event and throttling of the processes.
- "Resource consumption $current% is lower than $target%' - This message notes the end of a CPU targeting event and throttling of the processes.
- "Resource consumption $current% is close to $target%" - This message notes the Collector is not currently doing any targeting on the CPU or throttling the processes.
How to Reduce CPU Usage on the Collector if Targeting is not Enough
If you have a CPU Target set but you continue to see the CPU usage at a higher level than the target, review the Local File Sources on the Collector and look for any Source configuration changes that you can make to reduce the amount of processing time required. This includes:
- Define more specific path expressions and remove any recursive path expressions where possible.
- Reduce the overall volume of directories and log files found within the scanned path expression. Archiving or zipping old files periodically helps to reduce both scan and disk resources.
- Check for any unnecessary blacklists within the Source configurations and remove them.
- Review any Include/Exclude/Hash/Mask rules on the Sources and make sure they are required and optimized for that Source.
- Remove unnecessary Sources.
- Increase the Collector’s max heap size.