Product Documentation

Service discovery using DNS SRV records

An SRV record (service record) is a specification of data in the Domain Name System that defines the location, that is the hostname and the port number of servers for specified services. The record also defines the weight and priority of each server.

Example of an SRV record:

_http._tcp.example.com. 100 IN SRV 10 60 5060 a.example.com.

The following table describes each item in an SRV record:

localized image

You can use the DNS SRV records to discover the service endpoints. Citrix ADC appliance is configured to periodically query the DNS servers with the SRV record associated with a service. On receiving the SRV record, each of the target host published in the SRV record is bound to a service group associated with the service. Each of the bindings inherits the port, priority, and weight from the SRV record. For each service deployment the user has to configure the Citrix ADC appliance once while bringing it up, thus making it a single touch deployment for applications.

Use case: Load balancing microservices

Applications are moving toward microservice architecture from monolithic architectures. Movement to microservice architecture along with backend server autoscale solution, is making application deployment more dynamic. To support such a dynamic deployment, proxies or ADC must be able to dynamically detect the backend application or service instances and absorb them into proxy configuration. The service discovery using DNS SRV records feature aids configuration of Citrix ADC appliance in such a dynamic deployment scenario. Application developers can use some of the orchestration platforms to deploy the application. Orchestration platforms while instantiating containers during application deployment, might not assign protocol specific standard port for each of these containers. In such scenarios, discovering the port information becomes the key to configuring the Citrix ADC appliance. SRV records are helpful in such a scenario. SRV record parameters such as the priority and weight can be used for better load balancing of applications.

  • Priority parameter can be used to dictate the priority of the server pool.
  • Weight parameter can be used to dictate the capacity of the backend service instances and hence can be used for weighted load balancing.
  • Whenever there is a change in the back-end server pool, for example a backend instance is removed from the pool, the instance is removed graciously only after all the existing client connections are honored.

Note:

  • An A/AAAA records based service discovery, all resolved IP addresses have the same weight because you assign the weight to the domain being resolved.

  • If the weight in SRV response is greater than 100, then services are not created.

Priority based load balancing using SRV records

You can use SRV records to perform priority-based load balancing. The priority based server pool can be an alternative for the backup virtual servers. The ns.conf file requires minimal configuration compared to the backup virtual servers.

In priority based load balancing using SRV records, a priority number is assigned to each of the server pool. Lesser the number, higher is the priority. One of the servers in the highest priority pool is selected for load balancing based on the server’s health and availability. If all the servers in the highest priority server pool are down, then the servers that have the next highest priority are selected for load balancing. However, if the servers in the highest priority server pool are up again, then the servers are selected from the highest priority pool again.

Switching from one priority server pool to another server pool occurs graciously by bleeding the existing client transactions. Therefore, the current clients do not see any break in the application access.

To enable querying for SRV records using the CLI

You must perform the following tasks to enable querying for SRV records:

1. Create a server by specifying the query type parameter as SRV.

At the command prompt, type:

add server <name> <domain> [-queryType <queryType>])

Example:

add server web_serv example.com -queryType SRV

Note:

  • By default, IPv4 queries are sent. To send IPv6 queries, you must enable the IPv6 domain.
  • The SRV target domain name must not exceed 127 characters.

2. Create a service group with the autoscale mode as DNS.

At the command prompt, type:

add serviceGroup <serviceGroupName> <serviceType> [-autoScale <autoScale>]

Example:

add servicegroup svc_grp_1 http -autoscale dns

3. Bind the server created in step 1 to the service group as a member.

At the command prompt, type:

bind serviceGroup <serviceGroupName> <serverName>

Example:

bind servicegroup svc_grp_1 web_serv

Note:

  • When binding servers to service group members, you do not have to enter the port number for SRV server types. In case you specify a port number for SRV server type, an error message appears.

  • You can optionally specify a name server and a TTL value while binding a server to the service group.

To enable querying for SRV records using the GUI

Create a server

1. Navigate to Traffic Management > Load Balancing > Servers and click Add.

localized image

2. In Create Server page, select domain name.

3. Enter the details of all the required parameters.

4. In Query Type, select SRV.

5. Click Create.

Create a service group with autoscale mode as DNS

1. Navigate to Traffic Management > Load Balancing > Service Groups.

2. In Load Balancing Service Group page, enter details of all the required parameters.

3. In AutoScale Mode, select DNS.

localized image

4. Click OK.

Bind server to the service group member

1. Navigate to Traffic Management > Load Balancing > Service Groups.

2. In Service Groups page, select the service group that you have created and click Edit.

3. In Load Balancing Service Groups page, click Service Group Members.

4. In Service Group Members Binding page, select the server that you have created and click Close.

localized image

Note:

  • While binding, you do not have to enter the port number for SRV server types. In case you enter a port number for SRV server type, an error message appears.

  • You can optionally specify a name server and a TTL value while binding a server to the service group.

Overwriting TTL values

Citrix ADC appliance is configured to periodically query the DNS server for any update in SRV record associated with the application during application startup. By default, the periodicity for this query depends on the TTL published in the SRV record. In microservice or cloud world application, deployments change more dynamically. As a result, proxies have to be quicker in absorbing any changes to application deployment. Therefore, users are recommended to set the domain based service TTL parameter explicitly to a value that is lower than the SRV record TTL and is optimal for your deployment. You can overwrite the TTL value by two methods:

  • While binding a member to the service group
  • Setting the TTL value globally by using the set lb parameter command.

In case the TTL value is configured both while binding service group member and also globally, then the TTL value specified while binding the service group member takes precedence. If the TTL value is not specified either while binding a service group member or at the global level, the DBS monitor interval is derived from the TTL value in the DNS response.

Overwriting the TTL values using the CLI

  • To overwrite the TTL value while binding, at the command prompt, type:

     bind serviceGroup <serviceGroupName> (<serverName> [-dbsTTL <secs>])
    

    Example:

     bind servicegroup svc_grp_1 web_serv -dbsTTL 10
    
  • To overwrite the TTL value globally, at the command prompt, type:

     set lb parameter [-dbsTTL <secs>]
    

    Example:

     set lb parameter -dbsTTL 15
    

Overwriting the TTL values using the GUI

To overwrite the TTL value while binding:

1. Navigate to Traffic Management > Load Balancing > Service Groups.

2. In Service Groups page, select the service group that you have created and click Edit.

3. In Load Balancing Service Groups page, click Service Group Members.

4. In Service Group Members Binding page, select the server that you have created and click Edit.

5. In Domain Based Service TTL, enter the TTL value.

To overwrite the TTL value at the global level:

1. Navigate to Traffic Management > Load Balancing > Change Load Balancing Parameters.

2. In Domain Based Service TTL, enter the TTL value.

Note: If the domain based server TTL value is set to 0, then the TTL value from the data packet is used.

Specifying different name servers for service group and domain name bindings

You can configure different name servers for different domain names in a specific group. Setting the nameServer parameter is optional while binding a DBS server to the service group. When a nameserver is not specified while binding a member to the service group, the globally configured nameserver is considered.

Specifying name servers while binding a server to service groups using the CLI

At the command prompt, type:

bind serviceGroup <serviceGroupName> (<serverName> [-nameServer <ip_addr>] [-dbsTTL <secs>])

Example:

bind servicegroup svc_grp_1 web_serv  -ns.nameserver.com 10.102.27.155 -dbsTTL 10

Specifying name servers while binding a server to service groups using the GUI

1. Navigate to Traffic Management > Load Balancing > Service Groups.

2. In Service Groups page, select the service group that you have created and click Edit.

3. In Load Balancing Service Groups page, click Service Group Members.

4. In Service Group Members Binding page, select the server that you have created and click Edit.

5. In Name Server, specify the nameserver name to which the query for bound domain needs to be sent.

Version

Service discovery using DNS SRV records