【问题标题】:Is solr avgTimePerRequest statistic in ms or seconds? (Solr 3.5)solr avgTimePerRequest 统计数据是以毫秒还是秒为单位? (溶胶 3.5)
【发布时间】:2014-07-04 02:07:09
【问题描述】:

有谁知道 avgTimePerRequest 是否真的以毫秒为单位?从我可以扣除的值以秒为单位?

我当前的数据显示 avgTimePerRequest 约为 0.095,这意味着几分之一毫秒? 另一方面,请求除以总时间(我假设以毫秒为单位!?) - 51831/4968 - 得出 10.4。如果后者的值以秒为单位,那将是一个非常接近 0.095 的数字。 solr 速度如此之快,可以处理不到十分之一毫秒的请求并且可以测量,这真的有意义吗?

当前统计数据(来自我的 solr 安装):

standard: {
   class: "org.apache.solr.handler.component.SearchHandler",
   version: "$Revision: 1052938 $",
   description: "Search using components:        org.apache.solr.handler.component.QueryComponent,org.apache.solr.handler.component.FacetComponent,org.apache.solr.handler.component.MoreLikeThisComponent,org.apache.solr.handler.component.HighlightComponent,org.apache.solr.handler.component.StatsComponent,org.apache.solr.handler.component.DebugComponent,",
   srcId: "$Id: SearchHandler.java 1052938 2010-12-26 20:21:48Z rmuir $",
   src: "$URL: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_3_5/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java $",
   docs: null,
   stats: {
          handlerStart: 1400149470564,
          requests: 51831,
          errors: 0,
          timeouts: 0,
          totalTime: 4968,
          avgTimePerRequest: 0.095849976,
          avgRequestsPerSecond: 16.772387
       }
}

【问题讨论】:

    标签: java performance solr statistics


    【解决方案1】:

    这些值来自 org.apache.solr.handler.RequestHandlerBase,它使用 org.apache.solr.util.stats.Timer 进行测量。定时器有这个构造函数:

    public Timer(TimeUnit durationUnit, TimeUnit rateUnit, Clock clock)
    

    还有这个默认构造函数

      public Timer() {
        this(TimeUnit.MILLISECONDS, TimeUnit.SECONDS, Clock.defaultClock());
      }
    

    如您所见,默认构造函数将 MILLISECONDS 实例化为 durationUnit 并将 SECONDS 实例化为 rateUnit。

    您可以通过在 Timer.Timer(TimeUnit durationUnit, TimeUnit rateUnit, Clock clock) 中设置断点来确认这一点。

    所以 totalTime、avgTimePerRequest、medianRequestTime、75thPcRequestTime、95thPcRequestTime、99thPcRequestTime、999thPcRequestTime 都是毫秒。

    【讨论】:

      【解决方案2】:

      avgTimePerRequest 是总时间/请求。在您的示例中,totalTime = 4968 和 requests = 51831。算一算,您会得到 0.09584997,它与统计数据中的 0.095849976 匹配,因此 avgTimePerRequest 是其他两个成员的派生值。

      这意味着如果 totalTime 以秒为单位,那么 avgTimePerRequest 也以秒为单位。

      有意义吗?

      【讨论】:

      • 伙计,太棒了。您是假设总时间以秒为单位还是您从某些文档中知道(谷歌让我失望了)?
      • 我无法 100% 确认我所阅读的内容 - 但您应该能够通过重新启动 Solr 快速检查,运行查询并检查统计信息 - 如果它在几秒钟内它应该是相当小的数字,如果它以毫秒为单位,它应该大 1000 倍,这应该是显而易见的。
      • 以毫秒为单位,另外检查了#irc频道。
      猜你喜欢
      • 1970-01-01
      • 2019-02-24
      • 2014-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-26
      相关资源
      最近更新 更多