diff options
author | ny0312 <49037844+ny0312@users.noreply.github.com> | 2021-12-16 21:56:59 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-16 21:56:59 -0800 |
commit | 792afb443211f190b3f8bea15e945661453fbddf (patch) | |
tree | ae3a50c8adc9ed0a3adb3d1093e7f0129b469a2b /src/cluster.h | |
parent | 687210f1550cf9048bed5f5539c9411fb22cd3b0 (diff) | |
download | redis-792afb443211f190b3f8bea15e945661453fbddf.tar.gz |
Introduce memory management on cluster link buffers (#9774)
Introduce memory management on cluster link buffers:
* Introduce a new `cluster-link-sendbuf-limit` config that caps memory usage of cluster bus link send buffers.
* Introduce a new `CLUSTER LINKS` command that displays current TCP links to/from peers.
* Introduce a new `mem_cluster_links` field under `INFO` command output, which displays the overall memory usage by all current cluster links.
* Introduce a new `total_cluster_links_buffer_limit_exceeded` field under `CLUSTER INFO` command output, which displays the accumulated count of cluster links freed due to `cluster-link-sendbuf-limit`.
Diffstat (limited to 'src/cluster.h')
-rw-r--r-- | src/cluster.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cluster.h b/src/cluster.h index e0cf5c4dd..d64e2a5b9 100644 --- a/src/cluster.h +++ b/src/cluster.h @@ -39,7 +39,8 @@ typedef struct clusterLink { char *rcvbuf; /* Packet reception buffer */ size_t rcvbuf_len; /* Used size of rcvbuf */ size_t rcvbuf_alloc; /* Allocated size of rcvbuf */ - struct clusterNode *node; /* Node related to this link if any, or NULL */ + struct clusterNode *node; /* Node related to this link. Initialized to NULL when unknown */ + int inbound; /* 1 if this link is an inbound link accepted from the related node */ } clusterLink; /* Cluster node flags and macros. */ @@ -137,7 +138,8 @@ typedef struct clusterNode { int pport; /* Latest known clients plaintext port. Only used if the main clients port is for TLS. */ int cport; /* Latest known cluster port of this node. */ - clusterLink *link; /* TCP/IP link with this node */ + clusterLink *link; /* TCP/IP link established toward this node */ + clusterLink *inbound_link; /* TCP/IP link accepted from this node */ list *fail_reports; /* List of nodes signaling this as failing */ } clusterNode; @@ -192,11 +194,13 @@ typedef struct clusterState { /* The following fields are used by masters to take state on elections. */ uint64_t lastVoteEpoch; /* Epoch of the last vote granted. */ int todo_before_sleep; /* Things to do in clusterBeforeSleep(). */ + /* Stats */ /* Messages received and sent by type. */ long long stats_bus_messages_sent[CLUSTERMSG_TYPE_COUNT]; long long stats_bus_messages_received[CLUSTERMSG_TYPE_COUNT]; long long stats_pfail_nodes; /* Number of nodes in PFAIL status, excluding nodes without address. */ + unsigned long long stat_cluster_links_buffer_limit_exceeded; /* Total number of cluster links freed due to exceeding buffer limit */ } clusterState; /* Redis cluster messages header */ |