You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "subramanian raghunathan (JIRA)" <ji...@apache.org> on 2011/09/08 14:12:09 UTC

[jira] [Commented] (HBASE-4304) requestsPerSecond counter stuck at 0

    [ https://issues.apache.org/jira/browse/HBASE-4304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13100252#comment-13100252 ] 

subramanian raghunathan commented on HBASE-4304:
------------------------------------------------

I want to provide my analysis & background since its relatd to HBASE-3807 fixed 
by me earlier

1) Previously the problem was present only in the region server.  

As part of defect 

HBASE-3807:Fix units in RS UI metrics 

I had changed the HServerLoad also to use the region server metrics and made it to be consistent as  {color:green}requestPerSecond {color}.

{code}
return new HServerLoad(requestCount.get(),(int)metrics.getRequests(),
      (int)(memory.getUsed() / 1024 / 1024),
      (int) (memory.getMax() / 1024 / 1024), regionLoads);      
{code}

Request per second value derived from here :{color:green}(int)metrics.getRequests(){color}

2) But what i missed to find out was the region server metrics itself was not functioning properly.

Digged in and found following things.

1) HRegionServer.run() method is the major source of value provided for request.It runs by default every three seconds 

{code}
if ((now - lastMsg) >= msgInterval) {
{code}

The request count is populated here into the metrics as part of the doMetrics method.

{code}
this.metrics.incrementRequests(this.requestCount.get())
{code}

will go and update the metrics rate thro the method 
{code}
   public synchronized void inc(final int incr) {
    value += incr;
  }
{code}  

{color:green}This gives the request received between the previous run and current run.{color}  

But the request per second value will be populated only when the following piece gets executed of the class MetricsRate 

{code}
 
  private synchronized void intervalHeartBeat() {
    long now = System.currentTimeMillis();
    long diff = (now-ts)/1000;
    if (diff == 0) diff = 1; // sigh this is crap.
    this.prevRate = (float)value / diff;
    this.value = 0;
    this.ts = now;
  }
  
    @Override
  public synchronized void pushMetric(final MetricsRecord mr) {
    intervalHeartBeat();
    try {
      mr.setMetric(getName(), getPreviousIntervalValue());
    } catch (Exception e) {
      LOG.info("pushMetric failed for " + getName() + "\n" +
          StringUtils.stringifyException(e));
    }
  }
{code}
    
{color:red} pushMetric wont be invoked by default since the metrics won't be enabled by default 
hbase.class=org.apache.hadoop.metrics.spi.NullContext.
Please do correct me if i am  wrong here{color}

So ideally the value is always displayed as zero.

> requestsPerSecond counter stuck at 0
> ------------------------------------
>
>                 Key: HBASE-4304
>                 URL: https://issues.apache.org/jira/browse/HBASE-4304
>             Project: HBase
>          Issue Type: Bug
>          Components: master, regionserver
>    Affects Versions: 0.92.0
>            Reporter: Todd Lipcon
>            Assignee: Li Pi
>            Priority: Critical
>             Fix For: 0.92.0
>
>
> Running trunk @ r1163343, all of the requestsPerSecond counters are showing 0 both in the master UI and in the RS UI. The writeRequestsCount metric is properly updating in the RS UI.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira