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 LoadBalancingPolicy
For AI agents: a documentation index is available at https://nodejs-rs-driver.docs.scylladb.com/main/llms.txt. A Markdown version of this page is at https://nodejs-rs-driver.docs.scylladb.com/main/api/policies/loadBalancing/LoadBalancingPolicy.md.

Caution

You're viewing documentation for an unstable version of ScyllaDB Node.js Driver. Switch to the latest stable version.

LoadBalancingPolicy¶

policies/loadBalancing~LoadBalancingPolicy()

Base class for Load Balancing Policies

Constructor¶

new LoadBalancingPolicy()

Source

policies/load-balancing.js, line 16

Methods¶

getDistance(host)

Returns the distance assigned by this policy to the provided host.

Parameters:
Name Type Description
host Host

Source

policies/load-balancing.js, line 33

getOptions()

Gets an associative array containing the policy options.

Source

policies/load-balancing.js, line 55

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 24

newQueryPlan(keyspace, executionOptions, callback)

Returns an iterator with the hosts for a new query. Each new query will call this method. The first host in the result will then be used to perform the query.

Parameters:
Name Type Description
keyspace String

Name of currently logged keyspace at Client level.

executionOptions ExecutionOptions | null

The information related to the execution of the request.

callback function

The function to be invoked with the error as first parameter and the host iterator as second parameter.

Source

policies/load-balancing.js, line 45

Was this page helpful?

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

On this page

  • LoadBalancingPolicy
    • Constructor
    • Methods
ScyllaDB Node.js Driver
Search Ask AI
  • main
    • main
    • v0.6.1
  • Getting Started
  • Statements
    • Executing CQL Statements - Best Practices
    • Unprepared Statements
    • Batch Statements
    • Parameterized queries
  • Fetching Large Result Sets
  • Logging
  • Policies
    • Load Balancing
    • Retry Policies
  • Authentication
  • Shutdown
  • Migration Guide
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • concurrent
      • datastax
        • graph
        • search
      • 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
        • Udt
        • UdtField
      • 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
        • BigDecimal
        • Duration
        • InetAddress
        • Integer
        • LocalDate
        • Long
        • ResultSet
        • ResultStream
        • Row
        • TimeUuid
        • Tuple
        • Uuid
        • Vector
    • Classes
      • AddressResolver
      • ByteOrderedToken
      • Client
      • ColumnInfo
      • DateRange
      • DateRangeBound
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
      • Edge
      • Element
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • ExecutionProfile
      • FrameReader
      • GraphResultSet
      • HashSet
      • LineString
      • Murmur3Token
      • Path
      • Point
      • Polygon
      • Property
      • RandomToken
      • SslOptions
      • Token
      • TokenRange
      • Vertex
      • VertexProperty
    • 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 10 Aug 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.3