美文网首页
延时监控

延时监控

作者: 04974ba324f9 | 来源:发表于2018-07-04 10:33 被阅读46次

    TotalTimeMs=queue + local + remote(线上环境这个占比99%以上) + response send time

    produce: kafka.network:type=RequestMetrics,name=TotalTimeMs,request=Produce
    consumer: kafka.network:type=RequestMetrics,name=TotalTimeMs,request=FetchConsumer
    follower:kafka.network:type=RequestMetrics,name=TotalTimeMs,request=FetchFollower

    以consumer为例:一个请求FetchFollower耗费的所有时间

    ObjectName:kafka.network:type=RequestMetrics,name=TotalTimeMs,request=FetchConsumer
    ClassName:com.yammer.metrics.reporting.JmxReporter$Histogram
    说明:Information on the management interface of the MBean

    属性值:

    名称
    50thPercentile 1.0
    75thPercentile 1.0
    95thPercentile 3.0
    98thPercentile 6.0
    999thPercentile 83.826
    99thPercentile 10.0
    Count 4820
    Max 441.0
    Mean-平均 1.7898340248962656
    Min 0.0
    StdDev-标准差 8.634806791760138

    Demo:

    JMXConnector conn = null;
            MBeanServerConnection mbsc = null;
            ObjectName objectName = null;
            double mean = 0;
            try {
                conn = KafkaJmxUtil.getJmxConnection("localhost", 9999);
                mbsc = conn.getMBeanServerConnection();
                objectName = new ObjectName("kafka.network:type=RequestMetrics,name=TotalTimeMs,request=FetchConsumer");
                mean = (Double) mbsc.getAttribute(objectName, "Mean");
            } catch (Exception e) {
                e.printStackTrace();
            }
            System.out.println("Mean:" + mean);
    
    Mean:1.7898340248962656
    

    相关文章

      网友评论

          本文标题:延时监控

          本文链接:https://www.haomeiwen.com/subject/xmljuftx.html