DCP stats

Statistics for Database Change Protocol (DCP) are obtained via the CLI with the cbstats tool. The following table shows the commands you can use with the cbstats tool to retrieve DCP statistics:
Table 1. DCP statistics
Command Description
dcp Retrieves connections specific to statistics.
dcpagg Retrieves statistics that are logically grouped and aggregated together by prefixes.
failovers Retrieves vBucket failover logs.

Syntax

Use the following command syntax for DCP-related cbstats requests:


cbstats HOST:11210 dcp
cbstats HOST:11210 dcpagg
cbstats HOST:11210 failovers

Example: request all DCP statistics

The following example shows a cbstats request for all DCP-related statistics.


# ./cbstats 10.5.2.54:11210 dcp

Here's some output from the command. The output is quite lengthy, so this sample is truncated.


 ep_dcp_count:                                                                               6
 ep_dcp_items_remaining:                                                                     0
 ep_dcp_items_sent:                                                                          0
 ep_dcp_producer_count:                                                                      3
 ep_dcp_queue_backfillremaining:                                                             0
 ep_dcp_queue_fill:                                                                          0
 ep_dcp_total_bytes:                                                                         6630
 ep_dcp_total_queue:                                                                         0
 eq_dcpq:replication:[email protected]>[email protected]:default:connected:                      true
 eq_dcpq:replication:[email protected]>[email protected]:default:created:                        1168
 eq_dcpq:replication:[email protected]>[email protected]:default:pending_disconnect:             false
 eq_dcpq:replication:[email protected]>[email protected]:default:reserved:                       true
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_buffer_bytes:        0
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_buffer_items:        0
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_cur_snapshot_type:   none
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_end_seqno:           18446744073709551615
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_flags:               0
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_items_ready:         false
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_last_received_seqno: 0
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_opaque:              73
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_snap_end_seqno:      0
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_snap_start_seqno:    0
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_start_seqno:         0
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_state:               reading
 eq_dcpq:replication:[email protected]>[email protected]:default:stream_100_vb_uuid:             122364695596024
 ...

Example: request aggregated DCP statistics

The following example shows a cbstats request for a set of aggregated DCP statistics:


# ./cbstats 10.5.2.54:11210 dcpagg

Here's the output from the command:


 :total:backoff:                 0
 :total:count:                   6
 :total:items_remaining:         0
 :total:items_sent:              0
 :total:producer_count:          3
 :total:total_backlog_size:      0
 :total:total_bytes:             6630
 replication:backoff:            0
 replication:count:              6
 replication:items_remaining:    0
 replication:items_sent:         0
 replication:producer_count:     3
 replication:total_backlog_size: 0
 replication:total_bytes:        6630

Example: request failover logs

The following example shows a cbstats request for failover logs. The lengthy output of the command is truncated.


# cbstats 10.5.2.54:11210 failovers

Here's some output from the command. The output is quite lengthy, so this sample is truncated.


 vb_1000:0:id:        101754288503529
 vb_1000:0:seq:       0
 vb_1000:num_entries: 1
 ...

DCP statistics by connection type

DCP provides statistics for consumer, producer, and notifier connection types. The following tables describe the available consumer, producer, and notifier connection statistics. Each connection type has a group of statistics that apply to the connection overall and a group of statistics that apply to the individual streams in the connections.

The identifier for each DCP statistic begins with the string ep_dcpq: followed by a unique client_id and another colon. For example, if your client is named slave1, the identifier for the DCP statistic named created is ep_dcpq:slave1:created.

Table 2. Consumer connection statistics
Name Description
connected True if this client is connected
created Creation time of the DCP connection
pending_disconnect True if we’re hanging up on this client
reserved True if the DCP stream is reserved
supports_ack True if the connection use flow control
total_acked_bytes The amount of bytes that the consumer has acknowledged
type The connection type (producer, consumer, or notifier)
Table 3. Consumer connection per-stream statistics
Name Description
buffer_bytes The amount of unprocessed bytes
buffer_items The amount of unprocessed items
end_seqno The sequence number where this stream should end
flags The flags used to create this stream
items_ready Whether the stream has messages ready to send
opaque The unique stream identifier
snap_end_seqno The start sequence number of the last snapshot received
snap_start_seqno The end sequence number of the last snapshot received
start_seqno The start sequence number used to create this stream
state The stream state (pending, reading, or dead)
vb_uuid The vBucket UUID used to create this stream
Table 4. Producer and notifier connection statistics
Name Description
bytes_sent The amount of unacknowledged bytes sent to the consumer
connected True if this client is connected
created Creation time for the DCP connection
flow_control True if the connection uses flow control
items_remaining The amount of items remaining to be sent
items_sent The amount of items already sent to the consumer
last_sent_time The maximum amount of bytes that can be sent without receiving an acknowledgment from the consumer
noop_enabled Indicates whether this connection sends noops
noop_wait Indicates whether this connection is waiting for a noop response from the consumer
pending_disconnect True if we’re hanging up on this client
reserved True if the DCP stream is reserved
supports_ack True if the connection uses flow control
total_acked_bytes The amount of bytes that have been acknowledged by the consumer when flow control is enabled
total_bytes_sent The amount of bytes already sent to the consumer
type The connection type (producer, consumer, or notifier)
unacked_bytes The amount of bytes the consumer has not acknowledged
Table 5. Producer and notifier connection per-stream statistics
Name Description
backfilled The amount of items sent from disk
cur_snapshot_end The end sequence number of the current snapshot being received
cur_snapshot_start The start sequence number of the current snapshot being received
cur_snapshot_type The type of the current snapshot being received
end_seqno The sequence number of the last mutation to send
flags The flags supplied in the stream request
items_ready Whether the stream has items ready to send
last_sent_seqno The last sequence number sent by this stream
memory The amount of items sent from memory
opaque The unique stream identifier
snap_end_seqno The last snapshot end sequence number (used if a consumer is resuming a stream)
snap_start_seqno The last snapshot start sequence number (used if a consumer is resuming a stream)
start_seqno The sequence number to start sending mutations from
state The stream state (pending, backfilling, in-memory, takeover-send, takeover-wait, or dead)
vb_uuid The vBucket UUID used in the stream request

Aggregated DCP statistics

DCP provides aggregated statistics that logically group the DCP statistics together by prefixes. For example, if all your DCP connections started with the string xdcr: or replication:, you could use the command cbstats dcpagg : to request statistics grouped by everything before the first colon character, giving you a set for xdcr: statistics and a set for replication: statistics.

The following table describes the aggregated DCP statistics.

Table 6. Aggregated DCP statistics
Name Description
[prefix]:count Number of connections matching this prefix
[prefix]:producer_count Total producer connections with this prefix
[prefix]:items_sent Total items sent with this prefix
[prefix]:items_remaining Total items remaining to be sent with this prefix
[prefix]:total_bytes Total number of bytes sent with this prefix
[prefix]:total_backlog_size Total backfill items remaining to be sent with this prefix