Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Understanding Limits on Executed Event Policies and Memory Allocation for Scripts

You can configure limits on the maximum number of concurrently running event policies and the maximum amount of memory allocated for the data segment for specific types of scripts. Depending on the device and its function in the network, it might be necessary to configure larger or smaller limits on the number of event policies that can execute concurrently and the maximum amount of memory allocated to scripts. You might configure smaller limits on critical devices to ensure that priority processes are not adversely impacted, and that the device can perform all necessary functions in the network.

Additionally, during normal device operation, you might want to allocate disproportionate amounts of memory to different script types. A device might have a particular type of script that plays a vital role in its operation and requires a specific amount of memory to ensure proper execution. For example, when committing a configuration that is inspected by one or more commit scripts, you might need to increase the amount of memory allocated to commit scripts to accommodate the processing of large configurations.

The default number of event policies that can run concurrently in the system is 15. If the system is running the maximum number of event policies, the system ignores any triggered event policy until such time that another policy finishes. The system logs the EVENTD_POLICY_LIMIT_EXCEEDED message for any triggered event policies that were not executed.

If you do not configure any limits, the default amount of memory that a device allocates to the data segment portion of an executed script depends on the operating system and release. Table 1 outlines the default memory allocation. If a script requires more memory during execution than the set maximum limit, the script exits.

Table 1: Default Memory Allocation for Scripts
OS Release Default

Junos OS

Half of the total available memory of the system, up to a maximum value of 128 MB.

Junos OS Evolved

21.3 and earlier

128 MB

21.4R1 and later

1024 MB

To set the maximum number of event policies that can run concurrently on a device:

  • Configure the max-policies statement at the [edit event-options] hierarchy level, and specify the number of policies. You can configure a maximum of 0 through 20 policies.

    For example:

To set the maximum memory allocated to the data segment for scripts of a given type, configure the max-datasize size statement under the hierarchy appropriate for that script type, where size is the memory in bytes. To specify the memory in kilobytes, megabytes, or gigabytes, append k, m, or g, respectively, to the size. The allowed values vary by operating system, release, and script type. For more information see, max-datasize.

When you configure the max-datasize statement and execute a script, the device sets the maximum memory limit for that script to the configured value irrespective of the total memory available on the system at the time of execution. If the script exceeds the maximum memory limit during execution, it exits gracefully.