Use this feature to limit the number of service instances that an application can run on a host; for example, you have an application that consumes a lot of memory and you want to limit the amount of memory that the application consumes on a host.
This feature uses the configured number of resources on a host to limit the number of service instances that can run on the host. A host resource can represent almost anything installed on a host such as a software license, a graphics accelerator, etc., or it can represent a virtual resource. By specifying the number of resources on a host, you can effectively control the number of service instances that an application can run on that host. When an application needs the resources, EGO does not distribute slots to it from a host unless there are sufficient available resources on that host.
In essence, this feature allows a particluar type of application to run only N service instances on a host with M slots where M >=N. The remaining slots can be used by other applications.
100 long-running tasks are submitted for Application1 and Application2.
This feature is not compatible with the exclusive slot allocation policy; refer to Exclusive slot allocation policy.
Open the ego.shared file. In the Resource section, specify a name for each type of resource you want to configure.
Begin ResourceRESOURCENAME TYPE INTERVAL INCREASING DESCRIPTION # Keywords...limited_res Numeric () N (the number of resources on a host ) ...End Resource
The first line consists of the keywords. RESOURCENAME and DESCRIPTION are mandatory. Keyword TYPE must be set to Numeric for resources used by this feature. The other keywords are optional. Subsequent lines define resources.
You can either specify the number of available resources on specific hosts or you can set the number of resources as a global default for all hosts in the cluster. The global default also applies to any dynamically added hosts whereas the host-level configuration only applies to static hosts. Note that these two methods of configuration are mutually exclusive and only one method can be used at one time for the same resource.
Open the ego.cluster file. Do one of the following:
To configure the number of resources on specific hosts, follow this step:
In the Host section, specify the host name, the resource name, and the number of resources available on the host.
To configure the number of resources as a global default for all hosts in the cluster, follow this step:
In the ResourceMap section, specify the resource name, and the default number of resources available on every host.
Open the application profile. In the consumer section, configure the number of resources each service will consume on each host you specified in the ego.cluster file.
In this example, the application needs 2 resources to run each service instance.