7.6. Configure Distribution Mode (Library Mode)


The following procedure shows a distributed cache configuration in Red Hat JBoss Data Grid's Library mode.

Procedure 7.2. Distributed Cache Configuration

  1. Set the Clustered Mode

    The clustering element's mode parameter's value determines the clustering mode selected for the cache.
    <clustering mode="dist">
    
  2. Specify the Remote Call Timeout

    The sync element's replTimeout parameter specifies the maximum time period in milliseconds for an acknowledgment after a remote call. If the time period ends without any acknowledgment, an exception is thrown.
    <clustering mode="dist">
            <sync replTimeout="${TIME}" />
    
  3. Define State Transfer Settings

    The stateTransfer element specifies how state is transferred when a node leaves or joins the cluster. It uses the following parameters:
    1. Specify State Transfer Batch Size

      The chunkSize parameter specifies the size of cache entry state batches to be transferred. If this value is greater than 0, the value set is the size of chunks sent. If the value is less than 0, all states are transferred at the same time.
      <clustering mode="dist">
              <sync replTimeout="${TIME}" />
              <stateTransfer chunkSize="${SIZE}" />
      
    2. Set fetchInMemoryState Parameter

      The fetchInMemoryState parameter when set to true, requests state information from neighboring caches on start up. This impacts the start up time for the cache.
      <clustering mode="dist">
              <sync replTimeout="${TIME}" />
              <stateTransfer chunkSize="${SIZE}"
                             fetchInMemoryState="{true/false}" />
      
    3. Define the awaitInitialTransfer Parameter

      The awaitInitialTransfer parameter causes the first call to method CacheManager.getCache() on the joiner node to block and wait until the joining is complete and the cache has finished receiving state from neighboring caches (if fetchInMemoryState is enabled). This option applies to distributed and replicated caches only and is enabled by default.
      <clustering mode="dist">
              <sync replTimeout="${TIME}" />
              <stateTransfer chunkSize="${SIZE}"
                             fetchInMemoryState="{true/false}"
                             awaitInitialTransfer="{true/false}" />
      
    4. Set timeout Value

      The timeout parameter specifies the maximum time (in milliseconds) the cache waits for responses from neighboring caches with the requested states. If no response is received within the the timeout period, the start up process aborts and an exception is thrown.
      <clustering mode="dist">
              <sync replTimeout="${TIME}" />
              <stateTransfer chunkSize="${SIZE}"
                             fetchInMemoryState="{true/false}"
                             awaitInitialTransfer="{true/false}"
                             timeout="${TIME}" />
      
  4. Specify Transport Configuration

    The transport element defines the transport configuration for the cache as follows:
    1. Specify the Cluster Name

      The clusterName parameter specifies the name of the cluster. Nodes can only connect to clusters that share the same name.
      <clustering mode="dist">
              <sync replTimeout="${TIME}" />
              <stateTransfer chunkSize="${SIZE}"
                             fetchInMemoryState="{true/false}"
                             awaitInitialTransfer="{true/false}"
                             timeout="${TIME}" />
              <transport clusterName="${NAME}" />
      
    2. Set the distributedSyncTimeout Value

      The distributedSyncTimeout parameter specifies the time to wait to acquire a lock on the distributed lock. This distributed lock ensures that a single cache can transfer state or rehash state at a time.
      <clustering mode="dist">
              <sync replTimeout="${TIME}" />
              <stateTransfer chunkSize="${SIZE}"
                             fetchInMemoryState="{true/false}"
                             awaitInitialTransfer="{true/false}"
                             timeout="${TIME}" />
              <transport clusterName="${NAME}"
                         distributedSyncTimeout="${TIME}" />
      
    3. Set the Network Transport

      The transportClass parameter specifies a class that represents a network transport for the cache.
      <clustering mode="dist">
              <sync replTimeout="${TIME}" />
              <stateTransfer chunkSize="${SIZE}"
                             fetchInMemoryState="{true/false}"
                             awaitInitialTransfer="{true/false}"
                             timeout="${TIME}" />
              <transport clusterName="${NAME}"
                         distributedSyncTimeout="${TIME}"
                         transportClass="${CLASS}" />
      </clustering>
      
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.