Put Client Configuration Operation
(for database)


  • What is the Client-Configuration:
    The Client-Configuration is a set of configuration options that apply to the client when communicating with the database. See what can be configured below.

  • Initializing the Client-Configuration (on the client):
    This configuration can be initially customized from the client code when creating the Document Store via the Conventions.

  • Overriding the initial Client-Configuration for the database (on the server):

    • From the client code:
      Use PutClientConfigurationOperation to set the client-configuration options on the server.
      See the example below.

    • From the Studio:
      Set the Client-Configuration from the Client-Configuration view.

  • Updating the running client:

    • Once the Client-Configuration is modified on the server, the running client will receive the updated settings the next time it makes a request to the database.

    • Setting the Client-Configuration on the server enables administrators to dynamically control the client behavior after it has started running.
      e.g. manage load balancing of client requests on the fly in response to changing system demands.

  • The client-configuration set for the database level overrides the server-wide client-configuration.



What can be configured

The following client-configuration options are available:

  • Identity parts separator:
    Set the separator used with automatically generated document identity IDs (default separator is /).
    Learn more about identity IDs creation here.

  • Maximum number of requests per session:
    Set this number to restrict the number of requests (Reads & Writes) per session in the client API.

  • Read balance behavior:
    Set the Read balance method the client will use when accessing a node with Read requests.
    Learn more in Balancing client requests - overview and Read balance behavior.

  • Load balance behavior:
    Set the Load balance method for Read & Write requests.
    Learn more in Load balance behavior.

Put client-configuration (for-database)

// You can customize the client-configuration options in the client
// when creating the Document Store (this is optional):
// =================================================================

const documentStore = new DocumentStore(["serverUrl_1", "serverUrl_2", "..."], "DefaultDB");

documentStore.conventions.maxNumberOfRequestsPerSession = 100;
documentStore.conventions.identityPartsSeparator = '$';
// ...

documentStore.initialize();

// Override the initial client-configuration in the server using the put operation:
// ================================================================================

// Define the client-configuration object
const clientConfiguration = {
    maxNumberOfRequestsPerSession: 200,
    readBalanceBehavior: "FastestNode",
    // ...
};

// Define the put client-configuration operation, pass the configuration 
const putClientConfigOp = new PutClientConfigurationOperation(clientConfiguration);

// Execute the operation by passing it to maintenance.send
await documentStore.maintenance.send(putClientConfigOp);

Syntax

const putClientConfigOp = new PutClientConfigurationOperation(configuration);
Parameter Type Description
configuration object Client configuration that will be set on the server (for the database)

// The client-configuration object
{
    identityPartsSeparator,
    etag,
    disabled,
    maxNumberOfRequestsPerSession,
    readBalanceBehavior,
    loadBalanceBehavior,
    loadBalancerContextSeed
}