Simplerpcscheduler
After scheduling with this policy, all Callrunner products are divided into 3 groups according to the different request types:
(1) If the request of its encapsulation is based on the operation of the meta-table, it is divided into the Priorityexecutor group;
(2) If the request of its encapsulation is based on the operation of the user table, it is divided into the Callexecutor group;
(3) If it encapsulates a replication request, divide it into the Replicationexecutor group.
Each product group is then assigned an unequal number of handler, allowing handler to consume only the products in the specified group. The number of handler assigned by different product groups is also declared by a specific service, taking Hregionserver for example:
The number of handler assigned to the Priorityexecutor group is specified by the Hbase.regionserver.metahandler.count parameter, which defaults to 10;
The number of handler assigned to the Callexecutor group is specified by the Hbase.regionserver.handler.count parameter, which defaults to 30;
The number of handler assigned to the Replicationexecutor group is specified by the Hbase.regionserver.replication.handler.count parameter, which defaults to 3.
Each product group can also be subdivided into multiple product queues, by default each product group contains only one product queue. All handler in the product group compete for the resources in that queue, and in order to prevent a fierce competition, each product group can be divided into multiple product queues, allowing each handler to preempt only the resources in the specified queue. In Hregionserver, you can calculate how many product queues a callexecutor group can be divided into by the following methods:
Math.max (1,hbase.regionserver.handler.count*hbase.ipc.server.callqueue.handler.factor)
Where the Hbase.ipc.server.callqueue.handler.factor property value defaults to 0, that is, by default, only the product group is divided into one product queue.
The capacity of a single product queue is not infinitely growing on demand, and HBase has a corresponding threshold control over its length and space size, where:
Hbase.ipc.server.max.callqueue.length is used to limit the length of the product queue (default is handler number multiplied by 10)
Hbase.ipc.server.max.callqueue.size is used to limit the amount of space in the product queue (default is 1G)
After the Callrunner product is successfully assigned to handler, the handler begins to consume it, and the consumption process is mainly done by invoking the Rpcserver call method to execute the corresponding method of the specified service. The results of the execution of the method are returned to the client through responder.
Responder is responsible for returning processing results from the server to the client
The communication messages returned to the client by the server are organized in the following format:
Where Responseheader is serialized using PROTOBUF, its Protocol declaration is as follows:
Message Responseheader { optional UInt32 call_id = 1; Optional Exceptionresponse exception = 2; Optional Cellblockmeta Cell_block_meta = 3;}
Its internal mainly encapsulates the service side of the execution exception information, as well as cellblock metadata information; result is used to encapsulate the return result of the execution method, whose serialization method needs to be determined according to the specific return value type; Cellblock is used to encapsulate keyvalue data returned by the server (such as the query results for a scan operation).