• Glossary
  • Support
  • Downloads
  • DataStax Home
Get Live Help
Expand All
Collapse All

Developing applications with DataStax drivers

    • Getting started
    • Best practices
    • Connecting to the database
      • Connecting to DataStax Astra databases
      • Authentication in DataStax drivers
      • Using SSL in DataStax drivers
      • Load balancing with DataStax drivers
      • Connection pooling
      • Retry policies
      • Reconnection policies
      • Execution profiles
    • Submitting queries
      • Working with multi-workload clusters
      • Using DSE Search with the DataStax drivers
      • Submitting DSE Graph queries with the DataStax drivers
      • Result paging with DataStax drivers
      • Synchronous and asynchronous query execution
      • Managing concurrency in asynchronous query execution
      • Speculative query execution
      • Query idempotence
      • Driver metrics
      • Object mappers in DSE drivers
      • Query timestamps
    • Error handling
      • Server errors
      • Client errors
    • Example applications
      • Connecting to Astra
      • Executing CQL statements
      • Executing bound statements
  • Developing applications with DataStax drivers
  • Connecting to the database
  • Retry policies

Retry policies

Retry policies allow the DataStax drivers to automatically retry a request upon encountering specific types of server errors.

  • read timeouts

  • write timeouts

  • unavailable exceptions

In these scenarios, a node is designated as a coordinator for the request by the load balancing policy. The coordinator routes the request to the replicas and returns the response to the driver.

Each DataStax driver implements a default retry policy.

C/C++

C#

Java

Node.js

PHP

Python

Ruby

Along with the driver-included retry policies, some drivers allow extended retry policies to implement custom behavior based on read timeout, write timeout, unavailable exceptions, and request errors.

Default retry policy

The default retry policy retries a request when it is safe to do so while preserving the consistency level of the original request. Use this policy for most deployments.

Read timeout

If the number of replicas that reply is greater than or equal to the number of required responses per the consistency level, the default retry policy retries the request. In all other cases, it returns an error.

Read timeout
Figure 1. Read timeout

Write timeout

If the request is a logged batch request and fails to write to the batch log, the default retry policy retries the request. In all other cases, it returns an error.

Write timeout
Figure 2. Write timeout

Unavailable errors

If the request encounters an unavailable error, the default retry policy retries the request using the next host in the load balancing policy.

Unavailable
Figure 3. Unavailable errors

Fall-through retry policy

The fall-through retry policy never retries or ignores a failed request. In all cases, the fall-through retry policy returns an error. Use this policy for applications that need to implement their own business logic to handle retrying a request.

Fall-through retry
Figure 4. Fall through retry

Logging retry policy

The logging retry policy is intended to be a parent policy for another retry policy implementation and only logs the retry decision made by its child policy. This policy is typically used to debug driver retry behavior.

Logging retry
Figure 5. Logging retry policy
Connection pooling Reconnection policies

General Inquiries: +1 (650) 389-6000 info@datastax.com

© DataStax | Privacy policy | Terms of use

DataStax, Titan, and TitanDB are registered trademarks of DataStax, Inc. and its subsidiaries in the United States and/or other countries.

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries.

Kubernetes is the registered trademark of the Linux Foundation.

landing_page landingpage