rdhabalia opened a new pull request #9788:
URL: https://github.com/apache/pulsar/pull/9788


   ### Motivation
   
   We frequently see consumer gets stuck and broker is not dispatching messages 
though it should. We need additional pending-read metrics of the topic for 
better debugging. eg: when subscription is stuck, we want to know `pendingRead` 
and `pendingReplayRead` for better debugging. 
   for now, we have to validate from heapdump.
   
   eg:
   below example is stuck subscription which doesn't show subscription pending 
read in metrics
   stats
   ```
   subscriptions" : {
       "stuckSub" : {
         "msgRateOut" : 0.0,
         "msgThroughputOut" : 0.0,
         "msgRateRedeliver" : 0.0,
         "msgBacklog" : 3658305,
         "blockedSubscriptionOnUnackedMsgs" : false,
         "msgDelayed" : 0,
         "unackedMessages" : 1341,
         "type" : "Shared",
         "msgRateExpired" : 1894,
         "consumers" : [ {
           "msgRateOut" : 0.0,
           "msgThroughputOut" : 0.0,
           "msgRateRedeliver" : 0.0,
           "consumerName" : "c105b",
           "availablePermits" : 915,
           "unackedMessages" : 0,
           "blockedConsumerOnUnackedMsgs" : false,
           "metadata" : { },
           "connectedSince" : "2021-01-24T17:58:57.134185Z",
           "address" : "/1.1.1.1:4444"
         }, {
   ```
   
   stats-internal
   ```
   "cursors" : {
       "stuckSub" : {
         "markDeletePosition" : "1111111:101782",
         "readPosition" : "1111111:101783",
         "waitingReadOp" : false,
         "pendingReadOps" : 0,
         "messagesConsumedCounter" : 168673209,
         "cursorLedger" : 1111112,
         "cursorLedgerLastEntry" : 61,
         "individuallyDeletedMessages" : "[]",
         "lastLedgerSwitchTimestamp" : "2021-01-25T13:39:44.82Z",
         "state" : "Open",
         "numberOfEntriesSinceFirstNotAckedMessage" : 1,
         "totalNonContiguousDeletedMessagesRange" : 0,
         "properties" : { }
       }
   ```
   
![image](https://user-images.githubusercontent.com/2898254/109893429-7fdeef80-7c40-11eb-8847-7268fc854409.png)
   
   
   
    


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to