Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

a.gheshlaghy_177282 avatar image
a.gheshlaghy_177282 asked ·

What is back pressure and how does it work?

Hi,

I Could not find much details about Backpressure,except below:
https://docs.datastax.com/en/dse/6.0/dse-admin/datastax_enterprise/config/configCassandra_yaml.html#Backpressuresettings
is there any other backpressure strategy other than:

org.apache.cassandra.net.RateBasedBackPressure

it sounds to be safe parameter but why the defaults value is false, is there any drawbacks setting it to true?

backpressure
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

Definitions

According to Wikipedia, back pressure is defined as:

"a resistance or force opposing the desired flow of fluid through pipes, leading to friction loss and pressure drop."

Software engineering borrowed this concept from fluid dynamics and refers to software "action" of resisting the flow of data either through:

  • buffering the incoming requests,
  • controlling the flow from the source, or
  • dropping them altogether

to prevent the system from getting overwhelmed or overloaded.

Cassandra strategy

Backpressure support was added in C* 3.10 (CASSANDRA-9318). The idea is for the coordinator to apply a backpressure strategy with each mutation sent to replicas to reduce the pressure on overloaded replicas.

RateBasedBackPressure is the only strategy available out of the box but users can add their own custom implementation.

This strategy uses an algorithm that imposes limits based on the ratio of incoming mutations and outgoing rates. In simple terms, the coordinator limits the rate at which mutations are sent to replicas when the rate of incoming requests is greater than the rate that replicas can process within a sliding time window.

The factor by which the rate is increased or decreased is configurable. Larger values allow replicas to recover faster since the rate at which mutations are sent by the coordinator is significantly decreased but the tradeoff is a lot more dropped mutations (missed writes).

Backpressure is disabled by default since it isn't always necessary to throttle the load, particularly for clusters which are sized correctly and can handle peak traffic from the application.

Enabling backpressure is beneficial for clusters where the application's access pattern is unpredictable and "bursty". In this scenario, the cluster might handle the load most of the time but falls over when application traffic goes through the roof. Think of use cases which are susceptible to distributed denial-of-service (DDoS) attacks. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.