Sun Java System Directory Server Enterprise Edition 6.0 Administration Guide

Configuring Client Affinity

Client affinity reduces the risk of propagation delay in load-balanced deployments. For information about client affinity, see Client Affinity in Sun Java System Directory Server Enterprise Edition 6.0 Reference. This section explains how to configure affinity between a client connection and a data source, and provides sample configurations.

ProcedureTo Configure Client Affinity

This procedure describes how to configure affinity between a client connection and a data source.

You can use DSCC to perform this task. For information, see Directory Service Control Center Interface and the DSCC online help.

  1. View the current load balancing algorithm by viewing the properties of the data source pool.


    $ dpconf get-ldap-data-source-pool-prop -h host -p port pool-name
    

    The default properties of a data source pool are as follows:


    client-affinity-policy    :  write-affinity-after-write
    client-affinity-timeout   :  20s
    description               :  -
    enable-client-affinity    :  false
    load-balancing-algorithm  :  proportional

    These parameters configure client affinity: client-affinity-policy, client-affinity-timeout, and enable-client-affinity. For a description of the properties and a list of their valid values, type:


    dpconf help-properties ldap-data-source-pool client-affinity-policy \
     client-affinity-timeout enable-client-affinity

    For more information about the properties, see these man pages: client-affinity-policy(5dpconf), client-affinity-timeout(5dpconf), and enable-client-affinity(5dpconf).

  2. Enable client affinity.


    $ dpconf set-ldap-data-source-pool-prop -h host -p port pool-name \
     enable-client-affinity:true
  3. Select a policy for client affinity.


    $ dpconf set-ldap-data-source-pool-prop -h host -p port pool-name \
     client-affinity-policy:selected-policy
    

    where selected-policy is one of the following:

    write-affinity-after-write

    Affinity for write requests after the first write request

    read-write-affinity-after-write

    Affinity for all requests after the first write request

    read-write-affinity-after-any

    Affinity for all requests after the first read request or write request

    read-affinity-after-write

    Affinity for the first read request after a write request

  4. Configure the duration of the client affinity.


    $ dpconf set-ldap-data-source-pool-prop -h host -p port pool-name \
     client-affinity-timeout:time-out[unit]

    The default unit for timeout is milliseconds.

Example Configurations for Client Affinity

This section contains example configurations related to client affinity, and includes examples for replication delay, verifying write operations, and connection-based routing.

ProcedureTo Configure Client Affinity for Replication Delay When a Data Source Pool Contains Masters and Consumers

This procedure configures client affinity for all read and write operations that occur up to three seconds after the first write operation.

You can use DSCC to perform this task. For information, see Directory Service Control Center Interface and the DSCC online help.

    Configure the affinity parameters for the data source pool.


    $ dpconf set-ldap-data-source-pool-prop -h host -p port pool-name \
     client-affinity-policy:read-write-affinity-after-write client-affinity-timeout:3000 \
     enable-client-affinity:true

ProcedureTo Configure Client Affinity to Verify Each Write Operation With a Read Operation

This procedure configures client affinity for the first read operation after each write operation. The example could be for an application where a specified bind DN validates each write operation by performing a read operation.

You can use DSCC to perform this task. For information, see Directory Service Control Center Interface and the DSCC online help.

    Configure the affinity parameters for the data source pool.


    $ dpconf set-ldap-data-source-pool-prop -h host -p port pool-name \
     client-affinity-policy:read-affinity-after-write enable-client-affinity:true

ProcedureTo Configure Client Affinity for Connection-Based Routing

In versions prior to Directory Proxy Server 6.0, one connection was opened between a client and an LDAP server. The same connection was used for all requests from the client until the connection was closed. This type of routing is called connection-based routing. This procedure describes how to configure client affinity for connection-based routing.

You can use DSCC to perform this task. For information, see Directory Service Control Center Interface and the DSCC online help.

Before You Begin

Ensure that all data sources are attached to the data source pool and that clientCredentialsForwarding is set to useBind.

    Configure the affinity parameters for the data source pool.


    $ dpconf set-ldap-data-source-pool-prop -h host -p port pool-name \
     client-affinity-policy:read-write-affinity-after-any enable-client-affinity:true