Method 2: UA API to locate the least-loaded (or low-loaded) service.
- The application issues SL_Open to open a session with SLP.
- If a scope is not configured or is not otherwise made available to the app, the application issues an SL_GetAttrs API call for the desired service type with an attribute tag filter of 'SCOPE' to obtain valid, reachable scopes. Supplying a service name of one of the administrated Communications Server services on this API call will ensure that you will be returned only scopes that apply to the supplied service type.
- The application then issues SL_GetService specifying the desired service, one of the obtained scope names, and the query string indicating which service attributes are required. For illustration purposes the service attributes specified in this example query would be LUPOOL, and LOAD. The Service reply will contain either an indication the no matching services were located, or a list of URLs that can provide the service, while satisfying the query string requirements.
- The application analyzes the returned list:
- If no URLs are returned, the application either modifies and reissues the original SL_GetService request illustrated in step 3 with a new LOAD criterion range, or informs the end user that the service is not currently available.
- If a single URL is returned, the analysis is done.
- If a list of URLs is returned:
- Option 1 - "least load" location
- The application issues SL_GetAttrs for each URL returned in the Service Reply. It specifies the LOAD attribute in the select clause on each call. The LOAD value is returned in the Get Attributes reply.
- The application selects the URL with the lowest LOAD value.
- The application connects to the server represented by the selected URL and begins its SNA session.
- The application issues SL_Close to close the SLP session.
- Option 2 - "low load" selection
- Randomly select a URL from the returned list.
- The application connects to the server represented by the selected URL and begins its SNA session.
- The application issues SL_Close to close the SLP session.
- Option 1 - "least load" location
Note that there are two options presented for load-balancing among a large number of servers. The key difference between the two options is this: option 1 guarantees that the least-loaded server is selected, but it generates more LAN traffic than option 2. Option 2 guarantees only that a "low-loaded" server is selected, but there is less potential line traffic on the LAN during the selection process than option 1.