Let Vega monitor and be asked what is the specific meaning of requests per Second (see)? I can not answer the moment, although I probably know that it refers to the number of the region server per second, but the specific how to calculate, not clear. So decided to study the source in-depth understanding. This process is documented below.
1, first in the code base of the global search requests Per second keyword, found in a few jamon end of the file found. So Google a bit, what this is what, found to be a template engine.
2, view Regionserverlisttmpl.jamon content, need to pass in Parameters list<servername> servers and Hmaster master. And this template engine is called in render in the doget of Masterstatusservlet.java. Throw these away, look at the code below, and you'll know how requests Per second came from?
1<%java>2 inttotalregions = 0;3 inttotalrequests = 0;4 for(ServerName servername:servernames) {5 6Serverload SL =Master.getservermanager (). Getload (serverName);7 DoubleRequestspersecond = 0.0;8 intNumregionsonline = 0;9 Ten if(SL! =NULL) { OneRequestspersecond =Sl.getrequestspersecond (); ANumregionsonline =sl.getnumberofregions (); -Totalregions + =sl.getnumberofregions (); - //Is this correct? Adding a rate to a measure. theTotalrequests + =sl.getnumberofrequests (); - } - LongStartcode =Servername.getstartcode (); -</%java>
Where the value of the Requestspersecond variable is what we are looking for. It can be seen that the Getrequestspersecond function is from serverload.
3, continue to see the Getrequestspersecond function in Serverload, after getrequestspersecond-" Getnumberofrequests discovery is the value of the NUMBEROFREQUESTS_ variable in the serverload.getnumberofrequests. 4, how did the Numberofrequests_ in the clusterstatusprotos.serverload come? In the Buildserverload function in Hregionserver, you can see that it is obtained from Requestspersecond in Metricsregionserverwrapperimpl.
1 serverload.setnumberofrequests ((int) Regionserverwrapper.getrequestspersecond ());
5, how does the Requestspersecond in the Metricsregionserverwrapperimpl count? The following code can be seen based on the last total number of requests and requests, as well as the current total number of requests and request times, by subtracting and then dividing by the time difference.
if (Lastran = = 0 = Curren Ttime- period; // if We ve time traveled keep the last re Quests per second. if ((Currenttime-lastran) > 0) { long C Urrentrequestcount = Gettotalrequestcount (); Requestspersecond = (currentrequestcount-lastrequestcount)/ (Currentti Me -Lastran)/1000.0); Lastrequestcount = Currentrequestcount; } Lastran = CurrentTime;
6,gettotalrequestcount () returns the value of RegionServer.rpcServices.requestCount. While RequestCount represents the number of RPC requests recorded in Regionserver, this value is incremented by 1 whenever an RPC request (say flush,getonlineregion, etc.) comes in. At this point, it is clear that the specific meaning of requests per second is the number of RPC requests received per second in the current region server. Summary: Through the above analysis process, make clear the specific meaning of requests Per second, feel the result is not very important, is the process, through the view, debugging source in-depth understanding hbase details.
HBase Source Analysis: The specific meaning of requests Per second in the HBase UI