Technical Documentation

Example: Configuring Separate Resource Limits for a Process

In this example there are 10 processes in the SDK application package, and 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 process. To do this, the user must specify limits for the jnx-example package and for the jnx-example-service process. Any limits not set inherit the Level III limits (if any) or Level II limits (if no Level III limits exist).


user@host# show
resource-limits {
   package jnx-example {
      resources {
         file {
            open 8;
         }
         memory {
            stack-size 4m;
         }
      }
   }
   process jnx-example-service {
      resources {
         memory {
            resident-set-size 8m;
         }
      }
   }
}

[edit]

user@host# commit

The show system processes resource-limits process-name command output shows a maximum configurable column, which, in the following examples, has been omitted to make room for showing from which policy level the maximum allowed values come from.


user@host> 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

The above output is the same for all other programs in the jnx-example package except the jnx-example-service process, for which there is a special configuration. The process-level configuration overrides the package-level configuration.


user@host> 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

Published: 2010-05-09