CN113742111B - Micro-service RPC adaptive scheduling method and related device - Google Patents

Micro-service RPC adaptive scheduling method and related device Download PDF

Info

Publication number
CN113742111B
CN113742111B CN202111071037.XA CN202111071037A CN113742111B CN 113742111 B CN113742111 B CN 113742111B CN 202111071037 A CN202111071037 A CN 202111071037A CN 113742111 B CN113742111 B CN 113742111B
Authority
CN
China
Prior art keywords
rpc
data
service
weight
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111071037.XA
Other languages
Chinese (zh)
Other versions
CN113742111A (en
Inventor
邹国惠
曹安瑛
裴星宇
王力伟
张勇
王超
刘行健
程庆
张骥
刘志超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Power Grid Co Ltd
Zhuhai Power Supply Bureau of Guangdong Power Grid Co Ltd
Original Assignee
Guangdong Power Grid Co Ltd
Zhuhai Power Supply Bureau of Guangdong Power Grid Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Power Grid Co Ltd, Zhuhai Power Supply Bureau of Guangdong Power Grid Co Ltd filed Critical Guangdong Power Grid Co Ltd
Priority to CN202111071037.XA priority Critical patent/CN113742111B/en
Publication of CN113742111A publication Critical patent/CN113742111A/en
Application granted granted Critical
Publication of CN113742111B publication Critical patent/CN113742111B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5011Pool
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Abstract

The application discloses a micro-service RPC self-adaptive scheduling method and a related device, which comprise the following steps: when the RPC module runs, selecting a communication mode according to the type of data to be called, performing dyeing processing and package serialization operation on the head of the data to be called, and then sending the data to the RPC Proxy module, wherein the RPC Proxy module responds to a request of the RPC module, sets the priority weight of the request, and updates the weight at intervals; carrying out dimensionality reduction on the load information through PCA to obtain a load weight factor, and thus obtaining RPC service routing information according to the load weight factor; then the RPC Proxy module calls resource nodes in the RPC service resource pool based on the priority weight of the request and the RPC service routing information, and finally returns a calling result to the RPC module. The method and the device solve the technical problems that proper bottom layer communication modes cannot be selected according to inherent attributes of the service data, the priority of the calling process is specified to be relatively solidified, and limited callable resources cannot be efficiently coordinated.

Description

Micro-service RPC adaptive scheduling method and related device
Technical Field
The application relates to the technical field of cloud computing micro-services, in particular to a micro-service RPC adaptive scheduling method and a related device.
Background
The microservice architecture is a new technology for deploying applications and services in the cloud. With the popularity of microservice architectures, more and more developers are coming into contact with and learning microservice architectures. In the micro service architecture, communication and scheduling services are a more critical ring. Therefore, the development of communication services in the microservice architecture is a significant issue of concern.
Remote Procedure Call (RPC) is a common inter-service communication method, and is widely used in system environment construction and application programming in distributed systems. A typical remote procedure call service includes a public registry, where service providers register services in the registry, and a service caller obtains a list of service providers that can provide services through the registry, and then selects an actually called service provider according to a certain route to complete the call.
The existing Remote Procedure Call (RPC) bottom layer communication mode is specified when a user code is executed by calling or is solidified in a specific service scene through a configuration mode, a proper bottom layer communication mode cannot be selected according to inherent attributes of service data, and the bottom layer communication mode is not transparent to a user. In addition, the existing micro-service framework load balancing criterion mostly adopts a strategy of distributing requests according to proportion according to a preset weight proportion or heartbeat and load information uploading based on time intervals to perform balanced switching based on CPU occupancy rate, so that the problems that the uploading of the load information frequently occupies system resources, the load information cannot be smoothly switched in a load balancing scheduling in a blank window period, and meanwhile, the priority intention of calling the service cannot be effectively judged are easily caused.
Disclosure of Invention
The application provides a micro-service RPC adaptive scheduling method and a related device, which are used for solving the technical problems that in the prior art, a proper bottom layer communication mode cannot be selected according to inherent attributes of service data, the priority of a calling process is specified to be relatively solidified, and limited callable resources cannot be efficiently coordinated.
In view of this, a first aspect of the present application provides a micro-service RPC adaptive scheduling method, which is applied to an RPC adaptive scheduling system composed of an RPC module, an RPC Proxy module, and an RPC service resource pool, and the method includes:
when the RPC module is operated, selecting a corresponding preset communication mode according to the type of data to be called, dyeing the head of the data to be called, packaging and serializing the data to be called, and then sending the data to the RPC Proxy module;
the RPC Proxy module responds to a request of the RPC module, sets the position of the data to be called in a queue to be sent according to the priority weight of the request, and updates the request priority weight of the calling data in the queue to be sent according to a preset weight updating time interval;
the RPC Proxy module judges whether the RPC service is in an operating state, if so, the step S1 is executed, otherwise, information of no available service is returned to the RPC module;
s1, judging whether a difference value between a timestamp of host load information and a current timestamp is out of limit or not, if so, predicting the load information through a Markov process, and performing dimensionality reduction on the load information through PCA to obtain a load weight factor, otherwise, performing dimensionality reduction on the load information through PCA to obtain a load weight factor;
s2, sorting the load weight factors, and selecting the optimal load weight factor to set RPC service routing information;
and S3, based on the position of the data to be called in the queue to be sent, calling resource nodes in an RPC service resource pool according to the RPC service routing information, and returning a calling result to an RPC module according to the priority weight of the data to be called.
Optionally, the method further comprises:
when the request of the RPC module is a priority preemption request and a resource node is not obtained, the RPC Proxy module suspends a call service corresponding to a first request, wherein the priority weight of the first request is lower than that of the priority preemption request;
and according to the RPC service routing information, calling resource nodes in the RPC service resource pool, and returning a calling result to the RPC module.
Optionally, the method further comprises: and the RPC module receives the call result returned by the RPC Proxy module, and performs deserialization unpacking operation on the call result.
Optionally, the performing dimension reduction on the load information through PCA to obtain a load weight factor specifically includes:
constructing a matrix with n rows and m columns according to the load information, wherein n is the dimension of the load information, and m is the number of the load information;
after zero averaging is carried out on the incoming line of the matrix, solving to obtain a covariance matrix;
solving the eigenvalue of the covariance matrix and the corresponding eigenvector;
and arranging the eigenvectors into a first matrix from top to bottom according to the size of the corresponding eigenvalue, and taking the front k rows to form a second matrix to obtain a load weight factor, wherein n, m and k are positive integers.
Optionally, the selecting a corresponding preset communication mode according to the type of the data to be called specifically includes:
the types of the data to be called comprise: the system comprises reliable data, unreliable data, streaming data and time sensitive data, wherein a preset communication mode corresponding to the reliable data is TCP, a preset communication mode corresponding to the unreliable data is UDP, a preset communication mode corresponding to the streaming data is QUIC, and a preset communication mode of the time sensitive data is KCP;
and setting the prior communication mode as http, so as to construct the corresponding relation between the data to be called and the communication mode, and enabling the RPC module to select the corresponding communication mode according to the type of the data to be called based on the corresponding relation.
Optionally, the updating the request priority weight of the call data in the queue to be sent according to the preset weight update time interval specifically includes:
setting the request priority weight to be composed of a priority preemption weight and a message blocking factor weight;
updating the message blocking factor weight based on a message blocking factor weight calculation formula, thereby updating the request priority weight;
wherein, the message blocking factor weight calculation formula is as follows:
Q=ΔtnB;
in the formula, Q is a low 16-bit blocking weight factor, Δ tn is the number of message blocking time intervals, B is a weight operator and is defined as arctan (X × δ) × 65535 × 2/π, wherein δ is a message blocking factor coefficient, and X is an arbitrary input parameter.
The second aspect of the present application provides a micro-service RPC adaptive scheduling system, the system includes:
the RPC module is used for selecting a corresponding preset communication mode according to the type of the data to be called during operation, dyeing the head of the data to be called, performing packet serialization operation on the data to be called, and then sending the data to the RPC Proxy module;
the RPC Proxy module is used for responding to a request of the RPC module, setting the position of the data to be called in the queue to be sent according to the priority weight of the request, and updating the request priority weight of the calling data in the queue to be sent according to a preset weight updating time interval;
judging whether the RPC service is in an operating state, if so, executing the step S1, otherwise, returning information of no available service to the RPC module;
s1, judging whether a difference value between a timestamp of host load information and a current timestamp is out of limit or not, if so, predicting the load information through a Markov process, and performing dimensionality reduction on the load information through PCA to obtain a load weight factor, otherwise, performing dimensionality reduction on the load information through PCA to obtain a load weight factor;
s2, sorting the load weight factors, and selecting the optimal load weight factor to set RPC service routing information;
and S3, based on the position of the data to be called in the queue to be sent, calling resource nodes in an RPC service resource pool according to the RPC service routing information, and returning a calling result to an RPC module according to the priority weight of the data to be called.
Optionally, the RPC Proxy module is further configured to:
when the request of the RPC module is a priority preemption request and a resource node is not obtained, suspending a call service corresponding to a first request, wherein the priority weight of the first request is lower than that of the priority preemption request;
and according to the RPC service routing information, calling resource nodes in the RPC service resource pool, and returning a calling result to the RPC module.
The third aspect of the present application provides a micro-service RPC adaptive scheduling device, which includes a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the steps of the micro-service RPC adaptive scheduling method according to the first aspect, according to instructions in the program code.
A fourth aspect of the present application provides a computer-readable storage medium, where the computer-readable storage medium is used to store program codes, and the program codes are used to execute the micro-service RPC adaptive scheduling method of the first aspect.
According to the technical scheme, the method has the following advantages:
1. in the RPC calling process of the user interface, when the RPC module runs internally and on the premise that a user does not forcibly specify a communication mode, the inherent characteristics of data input by the user are hidden, a proper bottom layer data transmission mode is selected in a self-adaptive manner, and details of dyeing processing are carried out on corresponding fields of interactive data, so that the process is more transparent than that of a traditional mode;
2. in the priority processing of request distribution, as the data is sent to the RPC Proxy module for unified processing, compared with the traditional mode, the user layer does not need to care about the priority distribution processing and the selection and designation details of the load balancing resource nodes. And because the unified judgment criterion combining the preemptive priority and the non-preemptive priority is adopted, the insertion and sorting operation depending on the request priority and the priority processing difficulty are simplified, so that the time complexity of the RPC Proxy module for realizing the distribution based on the priority weight is reduced;
3. the adaptive scheduling strategy for preemptive priority request resource allocation under high resource load can adaptively and dynamically regulate the running state of each task according to the resource occupation condition in the whole system to realize the timeliness and operability of preemptive priority processing, and provides adaptive strategy guarantee for preempting the resource by the task with high priority in the system;
4. the load factor method based on the combination of the Markov process and the PCA can efficiently carry out load sequencing on the resource pool and predict the current load information of the overdue load information, thereby reducing the overall performance loss of the framework caused by the load information of each resource node in the interactive resource pool on the premise of improving the fairness of load balancing under the micro-service framework.
Compared with the traditional distribution strategy of distributing requests according to proportion based on weight proportion, the method can better reflect the fairness of resource node load balance; compared with a balanced switching mode of the CPU occupancy rate, the load intensity is not only reflected on the CPU occupancy rate, and the real load condition of the resource node can be reflected more fully by the criterion. Due to the adoption of the load factor method, the system performance loss caused by frequent reporting of the resource node load information can be further reduced; the method is used for selecting the executable resource nodes by the user layer according to the executable resource node list information, and the method is transparent to the user layer, hides the selection details and reduces the development difficulty of the user. Therefore, the technical problems that in the prior art, a proper bottom layer communication mode cannot be selected according to inherent attributes of service data, the priority of a calling process is assigned to be relatively solidified, and limited available resources cannot be efficiently coordinated are solved.
Drawings
Fig. 1 is a schematic flow chart of a first embodiment of a micro-service RPC adaptive scheduling method provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of a second embodiment of a micro-service RPC adaptive scheduling method provided in the embodiment of the present application;
fig. 3 is a schematic structural diagram of an embodiment of a micro-service RPC adaptive scheduling system provided in an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Interpretation of terms:
RPC: (Remote Procedure Call) a protocol that requests services from a Remote computer program over a network without knowledge of the underlying network technology. That is to say, two servers a and B, one application is deployed on the server a, and it is desired to call the method provided by the application on the server B, because there is no memory space, it cannot be called directly, and it is necessary to express the semantics of the call and to communicate the data of the call through the network.
RPC Proxy: the remote procedure call proxy.
Load balancing: the load (work task) is balanced and distributed to a plurality of operation units for operation. The method is built on the original network structure, and provides a transparent, cheap and effective method for expanding the bandwidth of the server and the network equipment, strengthening the network data processing capacity, increasing the throughput and improving the availability and flexibility of the network.
It should be noted that, an RPC Proxy module (RPC Proxy) is deployed in a distributed manner on a plurality of resource nodes in a system resource pool, and controls the whole micro-service invocation behavior through a control center, data transceiving of each micro-service node is completed through a data Proxy module, and a micro-service code is only communicated with the data Proxy module. The control center is a central control node and is responsible for regulating and controlling all micro service nodes, realizing service registration, configuration issuing and access authority configuration, having the authority for controlling the data agent module, and having the capability of collecting any data from the data agent module, thereby sensing the service operation state of the whole micro service framework network in detail according to the operation state of the data agent module. The RPC agent module provides a uniform message receiving and service query interface for upper-layer application, is responsible for realizing service discovery, flow control and communication load balancing access in a micro-service environment, is controlled by a control center, and provides functions of flow monitoring and request tracking.
Referring to fig. 1, a micro-service RPC adaptive scheduling method provided in an embodiment of the present application is applied to an RPC adaptive scheduling system including an RPC module, an RPC Proxy module, and an RPC service resource pool, and as shown in fig. 3, the method includes:
101, when the RPC module runs, selecting a corresponding preset communication mode according to the type of the data to be called, dyeing the head of the data to be called, performing packet serialization operation on the data to be called, and then sending the data to the RPC Proxy module.
It should be noted that, the RPC module supports a synchronous mode and an asynchronous mode during operation, and the data types to be called include: reliable, unreliable, stream, short message, etc., the application selects the bottom communication mode through real-time self-adaptation.
The service RPC calling process is based on the RPC module to perform dyeing processing on the head of the data to be called of the RPC according to the service and the parameters transmitted by the RPC calling; and the default self-adaptive preference strategy is http, reliable TCP, unreliable UDP, flow mode QUIC and time sensitive data KCP. And after the dyeing treatment is finished, performing packet serialization operation on the data, and sending the data to an RPC Proxy module.
And 102, responding to the request of the RPC module by the RPC Proxy module, setting the position of the data to be called in the queue to be sent according to the priority weight of the request, and updating the request priority weight of the calling data in the queue to be sent according to a preset weight updating time interval.
It should be noted that, after receiving the request of the service RPC module, the RPC Proxy module updates the state of the relevant state machine according to the request and the response attribute of the data, and inserts the data to be called into the queue to be sent according to the request priority weight.
Specifically, the RPC Proxy module responds to the RPC module service request, and after receiving the RPC module service request, the RPC Proxy module inserts the service request into the request queue according to the priority weight in the request.
In order to accelerate the request priority operation in the RPC Proxy, the priority weight is defined to be realized by a 32-Bit field, the higher 16 bits of the field are used for preempting the priority weight, and the lower 16 bits are used for weighting the message blocking factor. An ordered queue based on the weight field is maintained in the RPC Proxy.
Defining an operator B as a message blocking factor weight operator, wherein the operator has the following characteristic requirements:
the output range of any input parameter X (X is more than or equal to 0) is [0,65535 ], the output result is increased more slowly along with the increase of X (when X is very large, a system has a very serious fault problem, and priority selection strategy execution is preferentially ensured when the system is normal).
The operator B is defined as arctan (X δ) 65535X 2/pi, where δ is the message blocking factor coefficient; and delta tn is the number of message blocking time intervals, Q = Q tnB is obtained, and Q is a low 16-Bit blocking weight factor, so that the remote procedure call data priority of 32 bits is obtained.
And the RPC Proxy module updates the message data priority in each time window of the message priority update, so that the data with high message data priority has higher data sending right.
And 103, judging whether the RPC service is in an operating state or not by the RPC Proxy module, if so, executing a step 104, and otherwise, returning information of no available service to the RPC module.
It should be noted that, the RPC Proxy module interacts with the control center, first determines whether the RPC service is available, if not, returns to the unavailable service, and if so, executes step 104.
And step 104, judging whether the difference value between the timestamp of the host load information and the current timestamp is out of limit, if so, predicting the load information through a Markov process, and performing dimensionality reduction on the load information through PCA to obtain a load weight factor, otherwise, performing dimensionality reduction on the load information through PCA to obtain the load weight factor.
It should be noted that, if available, it is determined whether the difference between the host load information timestamp and the current timestamp is out of limit when the RPC service is running.
If the load information is outdated data (the difference between the timestamp of the host load information and the current timestamp is out of limit), the load information is predicted through a Markov process. Because the server load data is similar to a random process and has Markov property, the application adopts the Markov method to predict the server running load. Then, considering that the multidimensional property of the load information (including CPU occupancy rate, memory occupancy, network bandwidth occupancy and disk IO of resource nodes) is not beneficial to rapid scheduling and sorting, the method and the device extract valuable information quantity after dimension reduction by using a principal component analysis dimension reduction mode, and facilitate subsequent unified sorting processing.
And (4) carrying out dimensionality reduction on the load information through PCA to obtain a load weight factor, and selecting an optimal load weight factor. The dimensionality reduction steps are as follows:
there are m pieces of n-dimensional data (load information).
1) The original data is grouped into a matrix X of n rows and m columns by columns.
2) Each line of X (representing an attribute field) is zero-averaged, i.e., the average of this line is subtracted.
3) And solving a covariance matrix.
4) And solving the eigenvalue of the covariance matrix and the corresponding eigenvector r.
5) And arranging the eigenvectors into a matrix from top to bottom according to the size of the corresponding eigenvalue, and taking the first k rows to form a matrix P.
6) Namely, the data after dimension reduction to 1 dimension, namely, the load weight factor.
And if the difference value between the timestamp of the host load information and the current timestamp is not out of limit, directly performing dimensionality reduction on the load information through the PCA to obtain a load weight factor.
And 105, sequencing the load weight factors, and selecting the optimal load weight factor to set RPC service routing information.
It should be noted that the load weight factors are obtained in step 104, and the optimal load weight factors are obtained in step 105 according to the load factor sorting, and the route information of the optimal RPC service is obtained when the load weight factors meet the preset conditions.
And 106, based on the position of the data to be called in the queue to be sent, calling resource nodes in the RPC service resource pool according to the RPC service routing information, and returning a calling result to the RPC module according to the priority weight of the data to be called.
And finally, the RPC Proxy module selects (requests) a certain resource node in the PRC service resource pool according to the request priority (request sequence) of the data to be called in the queue to be requested and the RPC service routing information. After the resource node (calling result) is obtained, the calling result is returned to the return RPC module according to the priority weight of the resource node.
The foregoing is an embodiment first of a micro-service RPC adaptive scheduling method provided in the embodiment of the present application, and the following is an embodiment second of the micro-service RPC adaptive scheduling method provided in the embodiment of the present application.
Referring to fig. 2, a micro-service RPC adaptive scheduling method provided in an embodiment of the present application is applied to an RPC adaptive scheduling system including an RPC module, an RPC Proxy module, and an RPC service resource pool, and the method includes:
step 201, when the RPC module is running, selecting a corresponding preset communication mode according to the type of the data to be called, dyeing the head of the data to be called, performing packet serialization operation on the data to be called, and then sending the data to the RPC Proxy module.
Step 202, the RPC Proxy module responds to the request of the RPC module, sets the position of the data to be called in the queue to be sent according to the priority weight of the request, and updates the request priority weight of the data to be called in the queue to be sent according to the preset weight update time interval.
And step 203, judging whether the RPC service is in a running state by the RPC Proxy module, if so, executing step 204, and otherwise, returning information of no available service to the RPC module.
And 204, judging whether the difference value between the timestamp of the host load information and the current timestamp exceeds the limit, if so, predicting the load information through a Markov process, and reducing the dimension of the load information through PCA to obtain a load weight factor, otherwise, reducing the dimension of the load information through PCA to obtain the load weight factor.
And step 205, sequencing the load weight factors, and selecting the optimal load weight factor to set RPC service routing information.
And step 206, based on the position of the data to be called in the queue to be sent, calling resource nodes in the RPC service resource pool according to the RPC service routing information, and returning a calling result to the RPC module according to the priority weight of the data to be called.
It should be noted that steps 201 to 206 are the same as steps 101 to 106 in the embodiment, please refer to the description of steps 101 to 106, and are not described herein again.
And step 207, when the request of the RPC module is a priority preemption request and a resource node is not obtained, suspending the call service corresponding to the first request by the RPC Proxy module, wherein the priority weight of the first request is lower than that of the priority preemption request.
And step 208, calling the resource nodes in the RPC service resource pool according to the RPC service routing information, and returning a calling result to the RPC module.
It should be noted that in steps 207-208, the RPC Proxy module acquires the resource node information according to each internally stored request priority and the route information of the resource node that the RPC Proxy module enjoys when the RPC Proxy module fails to enjoy the message distribution right according to the resource node load weight in response to the request for preempting the priority.
The request with lower priority level exists on the resource node, and is in a running state, and the average value of the request priority levels of all the requests in the running state is the lowest. And realizing the strategy of the self-adaptive scheduling method of the limited resources under the preemptive task request by suspending the low-priority service processing logic on the resource node and distributing the request task to the resource node for operation.
And step 209, the RPC module receives the call result returned by the RPC Proxy module and performs deserialization unpacking operation on the call result.
It should be noted that, when the RPC is running, the deserialization unpacking operation is performed after waiting for the RPC Proxy result response.
The foregoing is an embodiment of a micro-service RPC adaptive scheduling method provided in this embodiment, and the following is an embodiment of a micro-service RPC adaptive scheduling system provided in this embodiment.
Referring to fig. 3, in an embodiment of the present application, a micro-service RPC adaptive scheduling system includes:
the RPC module is used for selecting a corresponding preset communication mode according to the type of the data to be called during operation, dyeing the head of the data to be called, performing packet serialization operation on the data to be called, and then sending the data to the RPC Proxy module;
the RPC Proxy module is used for responding to the request of the RPC module, setting the position of the data to be called in the queue to be sent according to the priority weight of the request, and updating the request priority weight of the calling data in the queue to be sent according to a preset weight updating time interval;
judging whether the RPC service is in an operating state, if so, executing the step S1, otherwise, returning information of no available service to the RPC module;
s1, judging whether the difference value between the timestamp of the host load information and the current timestamp exceeds the limit, if so, predicting the load information through a Markov process, and reducing the dimension of the load information through PCA to obtain a load weight factor, otherwise, reducing the dimension of the load information through PCA to obtain the load weight factor;
s2, sorting the load weight factors, and selecting the optimal load weight factor to set RPC service routing information;
and S3, based on the position of the data to be called in the queue to be sent, calling resource nodes in the RPC service resource pool according to the RPC service routing information, and returning a calling result to the RPC module according to the priority weight of the data to be called.
Further, an embodiment of the present application further provides a micro-service RPC adaptive scheduling device, where the device includes a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is used for executing the micro-service RPC adaptive scheduling method according to the method embodiment according to the instruction in the program code.
Further, an embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium is configured to store program codes, and the program codes are configured to execute the micro service RPC adaptive scheduling method described in the foregoing method embodiment.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The terms "first," "second," "third," "fourth," and the like in the description of the present application and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A micro-service RPC adaptive scheduling method is characterized by being applied to an RPC adaptive scheduling system composed of an RPC module, an RPC Proxy module and an RPC service resource pool, and comprising the following steps:
when the RPC module runs, selecting a corresponding preset communication mode according to the type of data to be called, dyeing the head of the data to be called, packaging and serializing the data to be called, and then sending the data to the RPC Proxy module;
the RPC Proxy module responds to a request of the RPC module, sets the position of the data to be called in a queue to be sent according to the priority weight of the request, and updates the request priority weight of the calling data in the queue to be sent according to a preset weight updating time interval;
the RPC Proxy module judges whether the RPC service is in an operating state, if so, the step S1 is executed, otherwise, information of no available service is returned to the RPC module;
s1, judging whether a difference value between a timestamp of host load information and a current timestamp is out of limit or not, if so, predicting the load information through a Markov process, and performing dimensionality reduction on the load information through PCA to obtain a load weight factor, otherwise, performing dimensionality reduction on the load information through PCA to obtain a load weight factor;
s2, sorting the load weight factors, and selecting the optimal load weight factor to set RPC service routing information;
and S3, based on the position of the data to be called in the queue to be sent, calling resource nodes in an RPC service resource pool according to the RPC service routing information, and returning a calling result to an RPC module according to the priority weight of the data to be called.
2. The micro-service RPC adaptive scheduling method of claim 1, further comprising:
when the request of the RPC module is a priority preemption request and a resource node is not obtained, the RPC Proxy module suspends a call service corresponding to a first request, wherein the priority weight of the first request is lower than that of the priority preemption request;
and according to the RPC service routing information, calling resource nodes in the RPC service resource pool, and returning a calling result to the RPC module.
3. The micro-service RPC adaptive scheduling method of claim 2, further comprising: and the RPC module receives the call result returned by the RPC Proxy module and performs deserialization unpacking operation on the call result.
4. The micro-service RPC adaptive scheduling method of claim 1, wherein the performing dimension reduction on the load information by PCA to obtain the load weight factor specifically comprises:
constructing a matrix with n rows and m columns according to the load information, wherein n is the dimension of the load information, and m is the number of the load information;
after zero averaging is carried out on the incoming line of the matrix, solving to obtain a covariance matrix;
solving the eigenvalue of the covariance matrix and the corresponding eigenvector;
and arranging the eigenvectors into a first matrix from top to bottom according to the size of the corresponding eigenvalue, and taking the front k rows to form a second matrix to obtain a load weight factor, wherein n, m and k are positive integers.
5. The micro-service RPC adaptive scheduling method of claim 1, wherein the selecting a corresponding preset communication mode according to the type of the data to be called specifically comprises:
the types of the data to be called comprise: the system comprises reliable data, unreliable data, streaming data and time sensitive data, wherein a preset communication mode corresponding to the reliable data is TCP, a preset communication mode corresponding to the unreliable data is UDP, a preset communication mode corresponding to the streaming data is QUIC, and a preset communication mode of the time sensitive data is KCP;
and setting the prior communication mode as http, so as to construct the corresponding relation between the data to be called and the communication mode, and enabling the RPC module to select the corresponding communication mode according to the type of the data to be called based on the corresponding relation.
6. The micro-service RPC adaptive scheduling method of claim 2, wherein the updating the request priority weight of the call data in the queue to be sent according to the preset weight update time interval specifically comprises:
setting the request priority weight to be composed of a priority preemption weight and a message blocking factor weight;
updating the message blocking factor weight based on a message blocking factor weight calculation formula, thereby updating the request priority weight;
wherein, the message blocking factor weight calculation formula is as follows:
Q=ΔtnB;
in the formula, Q is a low 16-bit blocking weight factor, Δ tn is the number of message blocking time intervals, B is a weight operator and is defined as arctan (X × δ) × 65535 × 2/π, wherein δ is a message blocking factor coefficient, and X is an arbitrary input parameter.
7. A micro-service RPC adaptive scheduling system is characterized by comprising:
the RPC module is used for selecting a corresponding preset communication mode according to the type of the data to be called during operation, dyeing the head of the data to be called, performing packet serialization operation on the data to be called, and then sending the data to the RPC Proxy module;
the RPC Proxy module is used for responding to a request of the RPC module, setting the position of the data to be called in the queue to be sent according to the priority weight of the request, and updating the request priority weight of the calling data in the queue to be sent according to a preset weight updating time interval;
judging whether the RPC service is in an operating state, if so, executing the step S1, and otherwise, returning information of no available service to the RPC module;
s1, judging whether a difference value between a timestamp of host load information and a current timestamp is out of limit or not, if so, predicting the load information through a Markov process, and performing dimensionality reduction on the load information through PCA to obtain a load weight factor, otherwise, performing dimensionality reduction on the load information through PCA to obtain a load weight factor;
s2, sorting the load weight factors, and selecting the optimal load weight factor to set RPC service routing information;
and S3, based on the position of the data to be called in the queue to be sent, calling resource nodes in an RPC service resource pool according to the RPC service routing information, and returning a calling result to an RPC module according to the priority weight of the data to be called.
8. The micro-service RPC adaptive scheduling system of claim 7, wherein the RPC Proxy module is further configured to:
when the request of the RPC module is a priority preemption request and a resource node is not obtained, suspending a call service corresponding to a first request, wherein the priority weight of the first request is lower than that of the priority preemption request;
and according to the RPC service routing information, calling resource nodes in the RPC service resource pool, and returning a calling result to the RPC module.
9. A micro-service RPC adaptive scheduling device, the device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the micro-service RPC adaptive scheduling method of any of claims 1-6 according to instructions in the program code.
10. A computer readable storage medium for storing program code for performing the micro-service RPC adaptive scheduling method of any of claims 1-6.
CN202111071037.XA 2021-09-13 2021-09-13 Micro-service RPC adaptive scheduling method and related device Active CN113742111B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111071037.XA CN113742111B (en) 2021-09-13 2021-09-13 Micro-service RPC adaptive scheduling method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111071037.XA CN113742111B (en) 2021-09-13 2021-09-13 Micro-service RPC adaptive scheduling method and related device

Publications (2)

Publication Number Publication Date
CN113742111A CN113742111A (en) 2021-12-03
CN113742111B true CN113742111B (en) 2023-01-13

Family

ID=78738417

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111071037.XA Active CN113742111B (en) 2021-09-13 2021-09-13 Micro-service RPC adaptive scheduling method and related device

Country Status (1)

Country Link
CN (1) CN113742111B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114301875A (en) * 2021-12-21 2022-04-08 锐捷网络股份有限公司 Management and control method and device for DHCP proxy side and electronic equipment
CN114915663A (en) * 2022-03-21 2022-08-16 北京沃东天骏信息技术有限公司 Request response method, device, system, electronic equipment and medium
US20230100935A1 (en) * 2022-10-17 2023-03-30 Intel Corporation Microservice deployments using accelerators

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109618002A (en) * 2019-01-11 2019-04-12 武汉斗鱼鱼乐网络科技有限公司 A kind of micro services gateway optimization method, device and storage medium
CN112437147A (en) * 2020-11-19 2021-03-02 浙江大学滨海产业技术研究院 Micro-service load balancing optimal routing algorithm, device, equipment and medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109618002A (en) * 2019-01-11 2019-04-12 武汉斗鱼鱼乐网络科技有限公司 A kind of micro services gateway optimization method, device and storage medium
CN112437147A (en) * 2020-11-19 2021-03-02 浙江大学滨海产业技术研究院 Micro-service load balancing optimal routing algorithm, device, equipment and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
应用层通信任务调度模型;冯径等;《东南大学学报(自然科学版)》;20080920;全文 *

Also Published As

Publication number Publication date
CN113742111A (en) 2021-12-03

Similar Documents

Publication Publication Date Title
CN113742111B (en) Micro-service RPC adaptive scheduling method and related device
CA2471594C (en) Method and apparatus for web farm traffic control
US5881268A (en) Comparative performance modeling for distributed object oriented applications
US6766348B1 (en) Method and system for load-balanced data exchange in distributed network-based resource allocation
US9092269B2 (en) Offloading virtual machine flows to physical queues
US7076545B2 (en) Load balancing the servicing of received packets
Qi et al. SPRIGHT: extracting the server from serverless computing! high-performance eBPF-based event-driven, shared-memory processing
JP2015537307A (en) Component-oriented hybrid cloud operating system architecture and communication method thereof
CN109995669A (en) Distributed current-limiting method, device, equipment and readable storage medium storing program for executing
CN110221920B (en) Deployment method, device, storage medium and system
Boukerche et al. A task-centric mobile cloud-based system to enable energy-aware efficient offloading
JPH0563821B2 (en)
CN116032767A (en) Intelligent fusion identification network-oriented computing power service chain management and control system architecture
Szalay et al. Real-time faas: Towards a latency bounded serverless cloud
Knob et al. Improving container deployment in edge computing using the infrastructure aware scheduling algorithm
Jyothi et al. Towards An Application {Objective-Aware} Network Interface
CN110727511B (en) Control method for application program, network side device and computer readable storage medium
Staffolani et al. RLQ: Workload allocation with reinforcement learning in distributed queues
EP3430510B1 (en) Operating system support for game mode
CN111752728B (en) Message transmission method and device
Pakhrudin et al. Cloud service analysis using round-robin algorithm for quality-of-service aware task placement for internet of things services
Liu et al. Hcloud: A serverless platform for jointcloud computing
CN117076133B (en) Cloud game platform heterogeneous resource allocation method, computer device and storage medium
US20020129144A1 (en) Data processing method and apparatus
Sang et al. A simulation testbed based on lightweight processes

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant