CN-122027543-A - Routing method, routing middleware and electronic equipment
Abstract
The application provides a routing method, a routing middleware and electronic equipment, which relate to the technical field of communication and can improve the routing efficiency and the adaptability of a routing strategy; the routing method comprises the steps of responding to a service request of a client, obtaining performance index data of at least one candidate service end, determining a service comprehensive score corresponding to each candidate service end based on the performance index data, enabling the service comprehensive score to be used for quantitatively representing the capacity of the corresponding candidate service end for processing the service request of the client, determining a target service end from the at least one candidate service end according to the service comprehensive score corresponding to each candidate service end, and routing the service request of the client to the target service end.
Inventors
- LI TENGYU
- PENG XIANGHUI
- Pan Zhongsi
- ZHAO JINWEN
- YANG XUHUI
- ZHU ZHENHONG
Assignees
- 南航数智科技(广东)有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260115
Claims (10)
- 1. A routing method, wherein the method is applied to a routing middleware, the method comprising: Responding to a service request of a client, and acquiring performance index data of at least one candidate server; Determining a service comprehensive score corresponding to each candidate service end based on the performance index data, wherein the service comprehensive score is used for quantitatively representing the capacity of the corresponding candidate service end for processing the service request of the client; determining a target service end from the at least one candidate service end according to the service comprehensive score corresponding to each candidate service end; and routing the service request of the client to the target server.
- 2. The method of claim 1, wherein the performance index data comprises at least one of CPU usage, memory usage, and number of active connections.
- 3. The method of claim 1, wherein determining a service composite score corresponding to each of the candidate service terminals based on the performance index data comprises: Configuring corresponding weight coefficients for the performance index data; And carrying out weighted calculation based on the performance index data and the weight coefficient corresponding to the performance index data to obtain the service comprehensive score corresponding to each candidate service end.
- 4. The method of claim 1, wherein the target server is a candidate server with a highest comprehensive score of services among the at least one candidate server.
- 5. The method of claim 1, wherein the routing the service request of the client to the target server comprises: establishing communication connection with the target client, wherein the communication connection is idle connection in a preset server connection pool or communication connection established in real time, and the preset server connection pool is used for storing TCP long connection between the routing middleware and a server; and routing the service request of the client to the target server through the communication connection.
- 6. The method of claim 1, wherein the routing the service request of the client to the target server comprises: packaging the service request of the client into a target message format, wherein the target format is a request data format supported by the target server; And sending the packaged service request in the target message format to the target server.
- 7. The method according to claim 1, wherein the method further comprises: under the condition that the route configuration parameters are updated, the updated configuration parameters are sent to each route node; Receiving an update execution response sent by each routing node, wherein the update execution response reflects whether the routing node can execute configuration parameter update or not; If all the update execution responses are executable updates, sending update execution commands to all the routing nodes; And if at least one update execution response is non-executable update, sending a termination update command to all the routing nodes.
- 8. The method of claim 1, wherein prior to obtaining performance index data for at least one candidate service in response to a service request from the client, the method further comprises: And analyzing the service request data of the client according to a preset data analysis rule to obtain the service request.
- 9. The routing middleware is characterized by comprising a client access layer, a routing core layer, a server collaboration layer and a configuration management and control layer; The client access layer is used for establishing communication connection between a client and the routing middleware and obtaining a service request of the client; The routing core layer is used for determining a routing strategy between the client and the target server of the service request; The server collaboration layer is used for establishing communication connection between the routing middleware and the target server and routing the service request to the target server; the configuration management and control layer is used for executing configuration management of the routing middleware.
- 10. An electronic device, comprising a processor and a memory; the memory stores instructions executable by the processor; The processor is configured to, when executing the instructions, cause the electronic device to implement the routing method of any of claims 1-8.
Description
Routing method, routing middleware and electronic equipment Technical Field The present application relates to the field of communications technologies, and in particular, to a routing method, a routing middleware, and an electronic device. Background In network communication systems, the Netty framework is widely used as a high-performance asynchronous event driven network application framework for constructing communication interactions between a server and a client. In a traditional Netty server architecture, a client typically communicates directly with a single-function server (e.g., a Netty server for receiving logs and service data). With the expansion of service scale and the improvement of scene complexity, the interactive mode gradually presents the problems of limited function expansibility, low communication efficiency and the like. Disclosure of Invention The invention aims to provide a routing method, a routing middleware and electronic equipment, which relate to the technical field of communication and can improve the routing efficiency and the adaptability of a routing strategy. In a first aspect, the application provides a routing method, which comprises the steps of responding to a service request of a client, obtaining performance index data of at least one candidate service end, determining a service comprehensive score corresponding to each candidate service end based on the performance index data, enabling the service comprehensive score to quantitatively represent the capacity of the corresponding candidate service end for processing the service request of the client, determining a target service end from the at least one candidate service end according to the service comprehensive score corresponding to each candidate service end, and routing the service request of the client to the target service end. According to the routing method provided by the application, the service comprehensive score is calculated by acquiring the various performance index data of the candidate service end, so that the request processing capacity of the service end is accurately quantized, and the optimal target service end is screened out to finish the request routing. The method can avoid the distribution of the request to the service end with high load, ensure the request transmission to follow the standard network protocol, effectively improve the efficiency and stability of service request processing, adapt to different service demands according to the set screening rule, and reduce the problems of request blocking, incapability of receiving and the like. In some embodiments, the performance index data includes at least one of CPU usage, memory usage, and number of active connections. In some embodiments, determining the service composite score corresponding to each candidate service terminal based on the performance index data includes configuring a corresponding weight coefficient for the performance index data, and performing weighted calculation based on the performance index data and the weight coefficient corresponding to the performance index data to obtain the service composite score corresponding to each candidate service terminal. In some embodiments, the target service end is a candidate service end with the highest service comprehensive score in at least one candidate service end. In some embodiments, routing the service request of the client to the target server includes establishing a communication connection with the target client, the communication connection being an idle connection or a communication connection established in real time in a preset server connection pool, the preset server connection pool being used for storing a routing middleware and a TCP long connection of the server, and routing the service request of the client to the target server through the communication connection. In some embodiments, routing the service request of the client to the target server includes encapsulating the service request of the client into a target message format, the target format being a request data format supported by the target server, and sending the encapsulated service request in the target message format to the target server. In some embodiments, the method further comprises the steps of sending updated configuration parameters to each routing node when the routing configuration parameters are updated, receiving update execution responses sent by each routing node, wherein the update execution responses reflect whether the routing node can execute the configuration parameter update or not, the update execution responses comprise executable updates or non-executable updates, sending update execution commands to all routing nodes if all update execution responses are executable updates, and sending update termination commands to all routing nodes if at least one update execution response is non-executable update. In some embodiments, before the performance index data of at least one