poorbarcode commented on code in PR #16758:
URL: https://github.com/apache/pulsar/pull/16758#discussion_r937474415


##########
pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/TxnLogBufferedWriterMetricsStats.java:
##########
@@ -0,0 +1,234 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.transaction.coordinator.impl;
+
+import io.prometheus.client.Collector;
+import io.prometheus.client.CollectorRegistry;
+import io.prometheus.client.Counter;
+import io.prometheus.client.Histogram;
+import java.io.Closeable;
+import java.util.HashMap;
+
+/***
+ * Describes the working status of the {@link TxnLogBufferedWriter}, helps 
users tune the thresholds of
+ * {@link TxnLogBufferedWriter} for best performance.
+ * Note-1: When batch feature is turned off, no data is logged at this. In 
this scenario,users can see the
+ *    {@link org.apache.bookkeeper.mledger.ManagedLedgerMXBean}.
+ * Note-2: Even if enable batch feature, if a single record is too big, it 
still directly write to Bookie without batch,
+ *    property {@link #pulsarBatchedLogTriggeringCountByForce} can indicate 
this case. But this case will not affect
+ *    other metrics, because it would obscure the real situation. E.g. there 
has two record:

Review Comment:
   Hi @asafm 
   
   For E.g. we write these data:
   
   ```java
   // max batch size = 100, max batch records = 5, max delay = 10 milliseconds
   write data_01{ size = 2}
   write data_02{ size = 2}
   write data_03{ size = 2}
   write data_04{ size = 2}
   write data_05{ size = 2}
   write data_06{ size = 111}
   ```
   We have two plans of metrics: include `data_06` or not.
   
   - Exclude `data_06`
     - avg ( batch records count ) = 5
     - avg ( batch size) = 10
   - Include `data_06`
     - avg ( batch records count ) = 3
     - avg ( batch size) = 60
   
   The first plan(exclude data_06) presents metrics that make more sense for 
adjusting the threshold.
   
   



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to