Build Cloud-Native apps with Apache Cassandra

GOT QUESTIONS from the Workshop? You're in the right place! Post a question here and we'll get you answers.

Click here for Week 7 Materials and Homework.

Registrations still open!


question

chmeghana03_193926 avatar image
chmeghana03_193926 asked ·

What is the significance of heartbeat in gossip?

How exactly should we interpret the heart beat information that is used in node gossip communication?

workshopgossip
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

bettina.swynnerton avatar image
bettina.swynnerton answered ·

Hi,

according to the gossip protocol, each node has a heartbeat state associated with it. The heartbeat state consists of two parts:

  • generation: this is the Unix timestamp in miliseconds when node last started.
  • version: this increases with every gossip sync message being sent.

For example, on a freshly restarted node:

 nodetool gossipinfo
/10.101.33.233
  generation:1594623689
  heartbeat:52
  STATUS:15:NORMAL,-9223372036854775808
  LOAD:19:215320.0
  SCHEMA:11:e21a1723-3532-3f2c-9b33-c9008587574f
  DC:7:datacenter1
  RACK:9:rack1
  RELEASE_VERSION:5:3.11.6
  RPC_ADDRESS:4:10.101.33.233
  NET_VERSION:2:11
  HOST_ID:3:01dcde72-e24e-4aee-b961-3073cce2d0d2
  RPC_READY:27:true
  TOKENS:14:<hidden>

The generation timestamp translates to 07/13/2020 @ 7:01am UTC when I restarted the node.

The heartbeat (version number) increases throughout:

This is the gossipinfo ca 30 mins later:

$ nodetool gossipinfo
/10.101.33.233
  generation:1594623689
  heartbeat:1773
  STATUS:15:NORMAL,-9223372036854775808
  LOAD:1756:155219.0
  SCHEMA:11:e21a1723-3532-3f2c-9b33-c9008587574f
  DC:7:datacenter1
  RACK:9:rack1
  RELEASE_VERSION:5:3.11.6
  RPC_ADDRESS:4:10.101.33.233
  NET_VERSION:2:11
  HOST_ID:3:01dcde72-e24e-4aee-b961-3073cce2d0d2
  RPC_READY:27:true
  TOKENS:14:<hidden> 

Version number is shared with application states and guarantees ordering. ApplicationState version number guarantees that an older value will not overwrite a newer one.

You can read more about the gossip architecture here:

https://cwiki.apache.org/confluence/display/CASSANDRA2/ArchitectureGossip

I hope this helps to answer your question.


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.