Related Documentation
Example: Configuring Separate Resource Limits for a Process
In this example there are 10 programs in the application package. The programs have resource limits inherited from a Level II policy. The administrative user wants to limit the number of open files and the stack size but does not want to apply the same limits to the jnx-example-service program.
Limits set for a process will override those set for packages. Any limits not set inherit the Level II limits.
In the example output for this example, the maximum configurable amounts normally shown in the left column are omitted to make room for notation showing which policy level the maximum allowed values come from.
- Commit the following configuration. It specifies limits
for the jnx-example package. these limits will be in place except
for any process (program) that has other limits set. There is a block
that configures limits for the process jnx-example-service. Any limits
not specified inherit the limits from the Level II policy. [edit]resource-limits {package jnx-example {resources {file {open 8;}memory {stack-size 4m;}}}process jnx-example-service {resources {memory {resident-set-size 8m;}}}}
- Use the show system processes resource-limits process-name ui-process-name command to see the resource limits
for each of the processes. For nine of them (represented by jnx-foo-service),
the file/open and memory/stack-size fields show
the more stringent limits you committed for the package.
user@router> show system processes resource-limits process-name jnx-foo-service
Resource Limits Area Max. allowed cpu/priority 10 <-- inherited from Level II file/open 8 <-- defined in config memory/data-size 32MB <-- inherited from Level II memory/locked-in 16MB <-- inherited from Level II memory/resident-set-size 24MB <-- inherited from Level II memory/stack-size 4MB <-- defined in config
- Use the show system processes resource-limits process-name process-ui-name command to see the resource limits
for the jnx-example-service process. Since separate limits were set
for jnx-example-service, it uses those limits defined in the CLI configuration
and any not so set revert to the inherited values from Level II.
user@router> show system processes resource-limits process-name jnx-example-service
Resource Limits Area Max. allowed cpu/priority 10 <-- inherited from Level II file/open 64 <-- inherited from Level II memory/data-size 32MB <-- inherited from Level II memory/locked-in 16MB <-- inherited from Level II memory/resident-set-size 8MB <-- defined in config memory/stack-size 8MB <-- inherited from Level II