ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB Node.js Driver API Reference Modules policies loadBalancing LegacyDefaultLoadBalancingPolicy

LegacyDefaultLoadBalancingPolicy¶

policies/loadBalancing~LegacyDefaultLoadBalancingPolicy(optionsopt)

A load-balancing policy implementation that attempts to fairly distribute the load based on the amount of in-flight request per hosts. The local replicas are initially shuffled and between the first two nodes in the shuffled list, the one with fewer in-flight requests is selected as coordinator.

Additionally, it detects unresponsive replicas and reorders them at the back of the query plan.

For graph analytics queries, it uses the preferred analytics graph server previously obtained by driver as first host in the query plan.

Constructor¶

new LegacyDefaultLoadBalancingPolicy(optionsopt)

Creates a new instance of LegacyDefaultLoadBalancingPolicy.

Parameters:
Name Type Attributes Description
options String | Object <optional>

The local data center name or the optional policy options object.

Note that when providing the local data center name, it overrides localDataCenter option at Client level.

Properties
Name Type Attributes Description
localDc String <optional>

local data center name. This value overrides the 'localDataCenter' Client option and is useful for cases where you have multiple execution profiles that you intend on using for routing requests to different data centers.

filter function <optional>

A function to apply to determine if hosts are included in the query plan. The function takes a Host parameter and returns a Boolean.

Source

policies/load-balancing.js, line 284

Methods¶

getDistance(host)

Returns the distance assigned by this policy to the provided host, relatively to the client instance.

Parameters:
Name Type Description
host Host

Source

policies/load-balancing.js, line 356

getOptions()

Gets an associative array containing the policy options.

Source

policies/load-balancing.js, line 630

init(client, hosts, callback)

Initializes the load balancing policy, called after the driver obtained the information of the cluster.

Parameters:
Name Type Description
client Client
hosts HostMap
callback function

Source

policies/load-balancing.js, line 335

newQueryPlan(keyspace, executionOptions, callback)

Returns a host iterator to be used for a query execution.

Parameters:
Name Type Description
keyspace String
executionOptions ExecutionOptions
callback function

Source

policies/load-balancing.js, line 379

(generator) yieldReplicasFirst(replicas)

Yields the local replicas followed by the rest of local nodes.

Parameters:
Name Type Description
replicas Array:.<Host:>

The local replicas

Source

policies/load-balancing.js, line 535

Was this page helpful?

PREVIOUS
DefaultLoadBalancingPolicy
NEXT
LoadBalancingConfig
  • Create an issue
  • Edit this page

On this page

  • LegacyDefaultLoadBalancingPolicy
    • Constructor
    • Methods
ScyllaDB Node.js Driver
Search Ask AI
  • main
    • main
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • concurrent
      • datastax
      • errors
        • ArgumentError
        • AuthenticationError
        • BusyConnectionError
        • DriverInternalError
        • NoHostAvailableError
        • NotSupportedError
        • OperationTimedOutError
        • ResponseError
      • geometry
      • mapping
        • DefaultTableMappings
        • Mapper
        • ModelBatchItem
        • ModelMapper
        • Result
        • UnderscoreCqlToCamelCaseMappings
        • TableMappings
      • metadata
        • Aggregate
        • ClientState
        • ColumnMetadata
        • Index
        • KeyspaceMetadata
        • MaterializedView
        • Metadata
        • SchemaFunction
        • Strategy
        • TableMetadata
        • UdtField
        • UserDefinedType
      • metrics
        • DefaultMetrics
        • ClientMetrics
      • policies
        • addressResolution
          • AddressTranslator
          • EC2MultiRegionTranslator
          • MappingAddressTranslator
        • loadBalancing
          • AllowListPolicy
          • DCAwareRoundRobinPolicy
          • DefaultLoadBalancingPolicy
          • LegacyDefaultLoadBalancingPolicy
          • LoadBalancingConfig
          • LoadBalancingPolicy
          • RoundRobinPolicy
          • TokenAwarePolicy
        • reconnection
          • ConstantReconnectionPolicy
          • ExponentialReconnectionPolicy
          • ReconnectionPolicy
        • retry
          • FallthroughRetryPolicy
          • RetryPolicy
        • speculativeExecution
          • ConstantSpeculativeExecutionPolicy
          • NoSpeculativeExecutionPolicy
          • SpeculativeExecutionPolicy
        • timestampGeneration
          • MonotonicTimestampGenerator
          • TimestampGenerator
      • tracker
        • RequestLogger
        • RequestTracker
      • types
        • Duration
        • InetAddress
        • Integer
        • LocalDate
        • Long
        • ResultSet
        • ResultStream
        • Row
        • TimeUuid
        • Vector
    • Classes
      • AddressResolver
      • ByteOrderedToken
      • Client
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • ExecutionProfile
      • FrameReader
      • HashSet
      • Host
      • HostMap
      • LineString
      • Murmur3Token
      • Point
      • Polygon
      • PreparedInfo
      • RandomToken
      • SslOptions
      • Token
      • TokenRange
    • Interfaces
    • Events
    • Global Functions and Constants
Docs Tutorials University Contact Us About Us
© 2026 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 14 May 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.2