[go: up one dir, main page]

WO2023087679A1 - Routing method and apparatus based on micro-service, and device and storage medium - Google Patents

Routing method and apparatus based on micro-service, and device and storage medium Download PDF

Info

Publication number
WO2023087679A1
WO2023087679A1 PCT/CN2022/097857 CN2022097857W WO2023087679A1 WO 2023087679 A1 WO2023087679 A1 WO 2023087679A1 CN 2022097857 W CN2022097857 W CN 2022097857W WO 2023087679 A1 WO2023087679 A1 WO 2023087679A1
Authority
WO
WIPO (PCT)
Prior art keywords
routing
performance parameters
service requests
node device
microservice
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.)
Ceased
Application number
PCT/CN2022/097857
Other languages
French (fr)
Chinese (zh)
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.)
WeBank Co Ltd
Original Assignee
WeBank 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 WeBank Co Ltd filed Critical WeBank Co Ltd
Publication of WO2023087679A1 publication Critical patent/WO2023087679A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0631Resource planning, allocation, distributing or scheduling for enterprises or organisations
    • G06Q10/06311Scheduling, planning or task assignment for a person or group
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0631Resource planning, allocation, distributing or scheduling for enterprises or organisations
    • G06Q10/06315Needs-based resource requirements planning or analysis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0633Workflow analysis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/02Banking, e.g. interest calculation or account maintenance
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • the present application relates to the technical field of data processing of financial technology (Fintech), involving but not limited to a routing method, device, device and storage medium based on microservices.
  • the routing method of the microservice system in the related art is only to make random calls, or to find out nodes with relatively few calls on a random basis to increase calls, or to reduce calls to nodes with low processing capabilities. Most are local call adjustments between nodes and between one system and adjacent systems. This routing method is relatively simple and cannot accurately implement dynamic routing.
  • Embodiments of the present application provide a microservice-based routing method, device, device, and storage medium to solve the problem that the routing method of the microservice system in the related art is simple and cannot dynamically adjust the routing path.
  • the embodiment of this application provides a routing method based on microservices, including:
  • the processor usage, memory usage, queue depth and number of connections of the node device n under the microservice system m, wherein, the m and the n are positive integers greater than or equal to 2, and the queue depth represents a preset
  • route paths corresponding to the multiple service requests are determined.
  • An embodiment of the present application provides a routing device based on microservices, including:
  • the obtaining module is used to obtain the processor usage rate, memory usage rate, queue depth and connection number of the node device n under the microservice system m, wherein the m and the n are positive integers greater than or equal to 2, and the The queue depth represents the preset processing performance of the processing request of the node device n, and the number of connections represents the number of external connections supported by the port of the node device n;
  • a processing module configured to determine system performance parameters of the node device n based on the processor usage, memory usage, queue depth, and number of connections;
  • the processing module is configured to predict the routing performance parameters of the selected node devices under the multiple micro-service systems when the routing process passes through multiple micro-service systems based on the system performance parameters and the statistical service request time-consuming ;
  • the processing module is configured to, if multiple service requests are received, determine routing paths corresponding to the multiple service requests based on the routing performance parameters.
  • An embodiment of the present application provides a routing device based on microservices, including:
  • the memory is used to store executable instructions; the processor is used to implement the above microservice-based routing method when executing the executable instructions stored in the memory.
  • An embodiment of the present application provides a storage medium, which stores executable instructions, and is used to cause a processor to implement the above method when executed.
  • the queue depth represents the preset node device n processing Request processing performance
  • the number of connections represents the number of external connections supported by the port of node device n
  • based on processor usage, memory usage, queue depth and number of connections determine the system performance parameters of node device n
  • Statistical service request time-consuming predict routing performance parameters of selected node devices under multiple micro-service systems when passing through multiple micro-service systems in the routing process; if multiple service requests are received, based on routing performance parameters, determine how many The routing path corresponding to each service request; that is to say, the embodiment of the present application collects the following parameters affecting performance in the actual routing: processor usage rate, memory usage rate, queue depth, number of connections, and service request time-consuming statistics for analysis, to achieve Collect and analyze the relevant information of node devices under each micro-service system in the request path,
  • FIG. 1 is a schematic diagram of an optional architecture of a server provided in an embodiment of the present application
  • FIG. 2 is a first schematic flow diagram of a microservice-based routing method provided by an embodiment of the present application
  • FIG. 3 is a second schematic flow diagram of the microservice-based routing method provided by the embodiment of the present application.
  • FIG. 4 is a third schematic flow diagram of the microservice-based routing method provided by the embodiment of the present application.
  • Fig. 5 is a schematic diagram of the microservice system through which the microservice process provided by the embodiment of the present application passes;
  • FIG. 6 is a schematic diagram of a microservice adjustment process under the microservice architecture provided by the embodiment of the present application.
  • the exemplary application of the microservice-based routing device provided by the embodiment of the present application is described below.
  • the microservice-based routing device provided by the embodiment of the present application can be implemented as a notebook computer, a tablet computer, a desktop computer, a mobile device (for example, a mobile phone) , portable music player, personal digital assistant, dedicated message device, portable game device), intelligent robot and any terminal with screen display function can also be implemented as a server.
  • a mobile device for example, a mobile phone
  • portable music player portable music player
  • personal digital assistant dedicated message device
  • portable game device portable game device
  • FIG. 1 is a schematic structural diagram of a server 100 provided by an embodiment of the present application.
  • the server 100 shown in FIG. Various components in the server 100 are coupled together through the bus system 140 . It can be understood that the bus system 140 is used to realize connection and communication between these components.
  • the bus system 140 includes not only a data bus, but also a power bus, a control bus and a status signal bus. However, for clarity of illustration, the various buses are labeled as bus system 140 in FIG.
  • Processor 110 can be a kind of integrated circuit chip, has signal processing capability, such as general-purpose processor, digital signal processor (DSP, Digital Signal Processor), or other programmable logic device, discrete gate or transistor logic device, discrete hardware Components, etc., wherein the general-purpose processor can be a microprocessor or any conventional processor, etc.
  • DSP digital signal processor
  • DSP Digital Signal Processor
  • User interface 130 includes one or more output devices 131 that enable presentation of media content, including one or more speakers and/or one or more visual displays.
  • the user interface 130 also includes one or more input devices 132, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
  • Memory 150 may be removable, non-removable or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, and the like. Memory 150 optionally includes one or more storage devices located physically remote from processor 110 . Memory 150 includes volatile memory or nonvolatile memory, and may include both volatile and nonvolatile memory. The non-volatile memory can be read-only memory (Read Only Memory, ROM), and the volatile memory can be random access memory (Random Access Memory, RAM). The memory 150 described in the embodiment of the present application is intended to include any suitable type of memory. In some embodiments, the memory 150 is capable of storing data to support various operations, examples of which include programs, modules, and data structures, or subsets or supersets thereof, as exemplified below.
  • Operating system 151 including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
  • Network communication module 152 for reaching other computing devices via one or more (wired or wireless) network interfaces 120
  • exemplary network interfaces 120 include: Bluetooth, Wireless Compatibility Authentication (Wi-Fi), and Universal Serial Bus (Universal Serial Bus, USB), etc.;
  • the input processing module 153 is configured to detect one or more user inputs or interactions from one or more of the input devices 132 and translate the detected inputs or interactions.
  • FIG. 1 shows a microservice-based routing device 154 stored in a memory 150.
  • the microservice-based routing device 154 may be
  • the microservice-based routing device in the server 100 can be software in the form of programs and plug-ins, and includes the following software modules: an acquisition module 1541 and a processing module 1542. These modules are logical, so they can be processed according to the functions implemented. Arbitrary combinations or further splits. The function of each module will be explained below.
  • the device provided in the embodiment of the present application may be implemented in hardware.
  • the device provided in the embodiment of the present application may be a processor in the form of a hardware decoding processor, which is programmed to execute the In the microservice-based routing method provided by the embodiment, for example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (Application Specific Integrated Circuit, ASIC), DSP, Programmable Logic Device (Programmable Logic Device, PLD), Complex Programmable Logic Device (Complex Programmable Logic Device, CPLD), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other electronic components.
  • ASIC Application Specific Integrated Circuit
  • DSP Digital Signal Processing
  • Programmable Logic Device Programmable Logic Device
  • PLD Complex Programmable Logic Device
  • CPLD Complex Programmable Logic Device
  • Field-Programmable Gate Array Field-Programmable Gate Array
  • FPGA Field-Programmable Gate Array
  • FIG. 2 is an optional flow chart of the microservice-based routing method provided by the embodiment of the present application, which will be described in conjunction with the steps shown in FIG. 2.
  • Step S201 acquiring processor usage, memory usage, queue depth and connection number of node device n under the microservice system m.
  • m and n are positive integers greater than or equal to 2
  • the queue depth represents the processing performance of the preset node device n for processing requests
  • the number of connections represents the number of external connections supported by the port of the node device n.
  • the node device provided by the embodiment of the present application can be implemented as any A terminal with screen display function can also be implemented as a server.
  • the node device is implemented as a server as an example for description.
  • the queue depth reflects the processing performance when the node device n provides a corresponding function, and when different node devices provide the same function, there are generally differences in processing performance.
  • This application can pre-set the queue depth for any node device.
  • the queue depth of any node device can be manually set; of course, other methods can also be used to set the queue depth, for example, the node device selects a matching queue depth based on the influence of hardware conditions.
  • the queue depth refers to the messages that node device n needs to process
  • the queue depth of node device n is relatively large, it means that it takes longer to wait in line for processing; when the queue depth of node device n is relatively small, it means that it needs to wait in line for processing relatively short time.
  • a client initiates an http request to a node device such as a server, it needs to establish a TCP connection first, and then send a data packet to the http service.
  • the connection request will occupy the port of the node device, and the request is received After the response, determine whether to close the connection according to whether the header is maintained.
  • the number of ports is limited, so the number of connections is also limited.
  • this application fully collects relevant information of the node device n such as processor usage, memory usage, queue depth, and number of connections, so as to ensure more accurate and comprehensive routing performance ranking among subsequent different paths.
  • the server serves as the configuration center in the microservice architecture, including but not limited to realizing the display and management of configuration and services.
  • the microservice architecture includes a server serving as a configuration center, a registration center, and multiple microservice systems.
  • the registration center involves the management of registration services after starting the overall system.
  • random algorithms can be used at the beginning of system operation, and then on the basis of maintaining system operation, node devices provide various relevant information for analysis by the configuration center.
  • the service requests involved in this application include, but are not limited to, real-time online transaction processing (On-Line Transaction Processing, OLTP), also known as service requests in transaction-oriented processing.
  • OLTP real-time online transaction processing
  • the feature of the above service request is that the user data received by the front desk can be immediately transmitted to the computing center for processing, and the processing result will be given in a very short time.
  • the microservice-based routing method provided by the present application is an intelligent routing method, which analyzes the existing routing paths, and the analysis results are used for the configuration center to dynamically adjust the paths.
  • the configuration center can set a reasonable cycle in the process of collecting relevant parameters that affect performance in actual routing. For example, for a microservice system including multi-node devices, based on the heartbeat mechanism in network communication, the heartbeat method is adopted. After a heartbeat cycle, the relevant parameters of all node devices are synchronized.
  • the intelligent routing algorithm can take the heartbeat cycle as a reference, and according to the total number of messages in a heartbeat cycle, and the minimum number of messages that the algorithm needs to collect, it is most reasonable to use several heartbeat cycles as a message collection cycle, which is less than the minimum number of messages, samples Fewer cycles can be eliminated.
  • Each cycle collects all routing information of existing requests, and waits for the next cycle before putting the analysis results into specific routing scheduling. This cycle is used to achieve the purpose of relatively real-time and dynamic routing adjustment.
  • Step S202 Determine system performance parameters of node device n based on processor usage, memory usage, queue depth, and number of connections.
  • the processor usage rate includes, but is not limited to, a central processing unit (central processing unit, CPU) usage rate.
  • CPU central processing unit
  • the system performance parameters of the node device n determined in this application are used as an important reference factor to select which node devices under the multiple micro-service systems to form a route that satisfies the reasonable path length condition when the routing process passes through multiple micro-service systems .
  • a heartbeat period is used as a message collection period to obtain the processor usage, memory usage, queue depth and connection number of the node device n under the microservice system m, and then based on Processor usage, memory usage, queue depth, and number of connections determine the system performance parameters of node device n; further, taking the system performance parameters determined as a heartbeat cycle as a reference factor, the time-consuming service requests in subsequent collection statistics , execute the prediction of the routing path of the next heartbeat cycle, and finally wait for the arrival of the next heartbeat cycle, and then put the analysis results into specific routing scheduling.
  • Step S203 based on the system performance parameters and the statistical time-consuming service requests, predict the routing performance parameters of the selected node devices under the multiple micro-service systems when the routing process passes through multiple micro-service systems.
  • the statistical service request time consumption refers to the numerical value accounting for x% proportion in the statistical series within a message collection period, where x is a positive number.
  • x is 95.
  • x can also take other parameters, such as 98, which is not specifically limited in the present application.
  • the value of 95% in the statistical series as an example, assuming that there are 100 service requests, arranged in ascending order of response time, and the value at position 95, that is, the value of 95% is also called the P95 value . Assuming that the value is 180ms, it means that the response time for 95% of the users is within 180ms, and only 5% of the users are longer than 180ms. Based on this, the application can determine more accurate service response time-consuming information.
  • the configuration center can collect the processor usage rate of all node devices of each microservice system, such as CPU usage rate, memory usage rate, queue depth and number of connections, and based on the time-consuming statistics of service requests Add these system performance parameters in the actual routing process to estimate the future request delivery time of selected node devices in different routing paths.
  • Step S204 if multiple service requests are received, determine routing paths corresponding to the multiple service requests based on routing performance parameters.
  • the configuration center determines the arrival of the next heartbeat cycle, puts the analysis results into specific routing scheduling, and determines the routes corresponding to multiple service requests based on routing performance parameters Path, to achieve the purpose of dynamically adjusting the routing path and optimizing the overall service call time.
  • the microservice-based routing method obtains the processor usage, memory usage, queue depth, and number of connections of node device n under the microservice system m, where m and n are positive integers greater than or equal to 2 , the queue depth represents the processing performance of the preset node device n processing requests, and the number of connections represents the number of external connections supported by the port of the node device n; based on the processor usage, memory usage, queue depth and the number of connections, determine the node device The system performance parameters of n; based on the system performance parameters and statistical service request time-consuming, predict the routing performance parameters of the selected node devices under the multiple micro-service systems when the routing process passes through multiple micro-service systems; if multiple micro-service systems are received A service request, based on routing performance parameters, determine the routing path corresponding to multiple service requests; that is, this application collects the following parameters that affect performance in the actual routing Processor usage rate, memory usage rate, queue depth, number of connections, and statistics time-consuming analysis of service requests, to realize the collection
  • step S202 determines the system performance parameters of the node device n based on the processor usage rate, memory usage rate, queue depth and number of connections, which can be implemented through the steps shown in Figure 3:
  • A11 configure weight parameters for processor usage, memory usage, queue depth and number of connections respectively;
  • the processor usage is characterized by pct cpu , the weight parameter corresponding to pct cpu is W cpu , the memory usage is represented by pct memory , the weight parameter corresponding to pct memory is W memory , and the weight parameter corresponding to the queue depth is W queue depth ,
  • the weight parameter corresponding to the number of connections is the number of W connections .
  • the threshold depth is also called the maximum depth limited by node devices, and the threshold number of connections is also called the maximum number of connections limited by node devices.
  • Each node device can customize the distribution ratio of the weight according to the above formula and according to the functional requirements of the node device, so as to make the result more accurate.
  • step S203 based on the system performance parameters and statistical service request time-consuming, the routing performance parameters of the selected node devices under the multiple micro-service systems can be predicted when the routing process passes through multiple micro-service systems.
  • the weight parameters are respectively configured for the sum of the system performance parameters of the selected node devices under the multiple microservice systems and the statistical service request time consumption.
  • the selected node device includes each node device selected under each microservice system in the multiple microservice systems.
  • routing performance parameter is represented by R:
  • the statistical service request time consumption is represented by T
  • the corresponding weight parameter is W T
  • the total number of multiple microservice systems is N
  • the system performance parameters of selected node devices under any microservice system are represented by PS i
  • the system The weight parameter corresponding to the sum of the performance parameters is W ps
  • the value range of i is a positive integer greater than 0 and less than or equal to N.
  • T includes but is not limited to T p95 .
  • the statistical service request time consumption is a summary of the existing request time consumption
  • the sum of system performance parameters is an estimate of future performance.
  • the system performance can be appropriately reduced
  • the weight factor before the sum of parameters When the sum of system performance parameters is large or grows rapidly, it means that the sum of system performance parameters is likely to become the bottleneck of the overall performance. At this time, the corresponding weight can be increased in due course.
  • the weight change curve is similar to an exponential curve. For example, from the weight coefficient before T p95 , in the initial stage The average request time is short, and it is difficult to see the performance of this path from the perspective of request time.
  • this application often has a preliminary estimate of the request time based on experience and the specific requirements and implementation of the program.
  • the application takes into account two points of interest. One is the acceptable request duration set by this application. Responding within this duration is regarded as having better performance. If it exceeds this time, you need to pay a little attention to whether it can be optimized. The other time point is the confirmation timeout.
  • the confirmation timeout period is determined by the microservice system according to the service type provided, for example, the timeout period of different service types can be different, and different service types correspond to different confirmation timeout periods , so that the overtime of the confirmation is adaptively different, so that the weight of the microservice system of different service types is also adaptively and dynamically changed; the acceptable request duration is determined through mutual negotiation between the microservice system and the initiator of the service request.
  • the timeout period for confirmation and the acceptable request duration can also be manually set in combination with the services provided by the microservice system.
  • the growth curve of W T is similar to an exponential function. Before reaching an acceptable request time point, it is basically a straight horizontal line. There may be a little growth, but the speed is very slow, which has little effect on the overall result. Large; at this point in time, there is an inflection point, and the growth of W T is accelerating, and the growth rate per unit time is getting larger and larger, until the timeout reaches the peak value.
  • W ps is a variable, and W ps changes with the change of the sum of the system performance parameters. If the sum of the system performance parameters increases quickly, then increase W ps , the sum of system performance parameters increases slowly, then reduce W ps , so, combined with the sum of system performance parameters, flexibly adjust the request amount of the request path corresponding to the selected node device, when the sum of system performance parameters is larger Next, reduce the request volume of this request path. When the sum of system performance parameters is smaller, increase the request volume of this request path to ensure the optimal overall performance.
  • microservice system A In a realizable microservice-based intelligent routing scenario, as shown in Figure 5, it is assumed that the overall microservice process is divided into the following four necessary microservice systems, microservice system A, microservice system B, and microservice system C And microservice system D, each microservice system has 3 node devices with different Internet Protocol Address (IP), then there can be a total of routes for completing a complete message routing Based on the method provided by this application, the routing route with the best performance can be dynamically found among 81 routes.
  • IP Internet Protocol Address
  • system A has a total of 3 node devices a1, a2, and a3.
  • the performance influencing factors of each node device in system A are as follows: CPU usage, memory usage, queue depth, and number of connections, the calculation formula of system performance parameters including these four factors is as follows:
  • each node device due to its different functionality, may have different settings for the maximum number of connections and maximum queue depth, and the requirements for CPU and memory may not be exactly the same, so each system can use the above formula, according to the system According to the functional requirements, the distribution ratio of the custom setting weight makes the result more accurate.
  • the overall routing performance calculation formula is calculated by combining the P95 average request time consumption and the sum of PS of each node device under all systems passing through the route.
  • the formula is as follows:
  • PS A represents the system performance parameters of the selected node devices in system A
  • PS B represents the system performance parameters of selected node devices in system B
  • PS C represents the system performance parameters of selected node devices in system C
  • PS D represents System performance parameters of the selected node devices under the D system.
  • the configuration center can calculate the R values of the above 81 paths.
  • the routing path corresponding to multiple service requests can be determined, which can be achieved through the following steps:
  • the configuration center can weight the number of requests preset in advance. When service requests come, allocate the number of requests reasonably.
  • the path R value of A1-B1-C1-D1 is the smallest, the system can set the weight of the number of requests to 0.4, the path R value of A2-B2-C2-D2 ranks second, set the weight of the number of requests to 0.3, and the weight of A3-B3-C3- If the R value of the D3 path ranks third, the weight of the number of requests can be set to 0.2, and the R value of the path A4-B4-C4-D4 ranks fourth, and the weight of the number of requests can be set to 0.1. Furthermore, when a service request is initiated, the request route can be allocated according to the weight.
  • A1-B1-C1-D1 has a total of 400 routes
  • A2-B2- C2-D2 has a total of 300 routes
  • A3-B3-C3-D3 has a total of 200 routes
  • A4-B4-C4-D4 has a total of 100 routes.
  • the top five paths may also be selected, which is not specifically limited in this application.
  • node devices under A system when there are 3 node devices under A system, use a1, a2, and a3 to represent each node device; when there are 4 node devices under A system, use the above-mentioned A1, A2 , A3, and A4 represent each node device, and the different designations are only for convenience of description.
  • the microservice-based intelligent routing method provided by the present application can intelligently and dynamically provide request paths according to the actual deployment of the system. According to the number of service requests and the probability that each system may be called, modify the corresponding weight in time, and it can be applied to the collection and calculation of the path in the next cycle, which is very convenient and fast.
  • the routing path corresponding to multiple service requests can be determined through the following Steps to achieve:
  • D11 determines the ID of the Internet data center to which the selected node devices corresponding to different paths belong; here, the ID of the Internet data center is used to determine whether the node devices selected in each path belong to the same Internet data center (Internet Data Center, IDC) is like a computer room.
  • IDC Internet Data Center
  • D12 from the routing performance parameters of the selected node devices corresponding to different paths, select the target routing performance parameters of the selected node devices corresponding to at least one target path, wherein at least two of the selected node devices corresponding to the target path have the same Internet data center logo;
  • step S203 based on system performance parameters and statistical service request time consumption, the routing performance of selected node devices under multiple microservice systems is predicted when the routing process passes through multiple microservice systems
  • parameters based on the condition of whether the node devices are deployed in the same IDC, filter out the target routing performance parameters of the selected node devices corresponding to at least one target path, that is, at least one of the selected node devices in the selected routing path Both devices have the same Internet data center identity, so to save routing time.
  • the configuration center can preferentially select node devices deployed in the IDC, and then select services according to the intelligent routing method based on microservices of this application.
  • the configuration center evaluates that this factor may not be considered at the beginning of the system operation; of course, the configuration center may also remove the same The impact factor of an IDC, after waiting for the system to run for a period of time, the memory begins to become an aspect that limits performance, and then add the same IDC factor as a higher priority reference factor, combined with the routing performance parameters of the selected path, together Perform real-time routing path adjustments.
  • the microservice architecture includes a server as a configuration center, a registration center, and multiple microservice systems.
  • the registration center contains all the services registered by the system provided to the service, and the services provided by each system may not be exactly the same; the configuration center can read all registered services from the registration center.
  • the services they provide may need to call downstream microservice systems.
  • the service provided by microservice system A may need to call downstream microservice system B, microservice system C, and microservice system D; the service provided by microservice system B may need to call downstream microservice system C and microservice system D;
  • the service provided by service system C may need to call the downstream microservice system D.
  • the configuration center In the process of determining the routing path in this application, the configuration center has fully collected the relevant information of all node devices under each microservice system, such as processor usage, memory usage, queue depth, and number of connections, to ensure the subsequent routing between different paths. Routing performance sorting is more accurate and comprehensive. Furthermore, based on the relevant information fed back by the node device and the statistical service request time-consuming, the configuration center statistically calculates the ranking of routing paths, and feeds back the routing paths to the downstream system. It should be noted that, between the various microservice systems and the configuration center in this application, the configuration center collects all routing information of existing requests every cycle, and waits for the next cycle to put the analysis results into specific routing scheduling. This cycle is used to achieve the purpose of relatively real-time and dynamic routing adjustment.
  • microservice system A After microservice system A receives the routing path fed back by the configuration center, it executes the routing process, and microservice system A feeds back the actual routing records to the configuration center, so that the configuration center can get the real The routing situation of the microservice system is used as a reference for the next analysis.
  • the routing paths corresponding to multiple service requests can be determined through the following Step E11 to step E12 or, step E11, step E13 to step E15 realize:
  • the timeliness information is used to indicate the timeliness requirements of the service requests.
  • synchronous service requests and asynchronous service requests have different timeliness information
  • the timeliness information of synchronous service requests has higher requirements on timeliness than the timeliness information of asynchronous service requests.
  • the routing paths corresponding to some service requests with high timeliness requirements are determined. ; and/or in the scenario where the amount of requests reaches the threshold number, based on the routing performance parameters, determine the routing path corresponding to some service requests, that is, a part of all service requests, so as to timely determine a routing solution suitable for the current microservice architecture.
  • the remaining service requests include requests with lower timeliness requirements.
  • the remaining service requests include the rest of all service requests. It should be noted that, for the remaining service requests, this application uses a random algorithm to determine the routing path, thereby reducing the amount of calculation and improving the overall processing efficiency of all service requests.
  • the random algorithm in the process of adopting the random algorithm, includes a hash (hash) modulo algorithm, that is, the remainder hash() mod n is taken for the hash result, and the node equipment is numbered from 0 to n-1 according to
  • the custom hash() algorithm moduloes the hash() value of each request by n to obtain the remainder i, and then distributes the request to the node device numbered i.
  • the role of the intelligent routing algorithm is relatively more obvious.
  • the optimal path and the relatively high-ranked path can significantly reduce the time from the request to the receipt of the processing completion message.
  • the intelligent routing method based on microservices provided by this application can also reflect the processing capabilities of services to a certain extent.
  • the software module may be a microservice-based routing device in the server 100, including:
  • the obtaining module 1541 is used to obtain the processor usage rate, memory usage rate, queue depth and connection number of the node device n under the microservice system m, where m and n are positive integers greater than or equal to 2, and the queue depth represents a preset
  • the processing performance of the node device n processing the request, the number of connections represents the number of external connections supported by the port of the node device n;
  • a processing module 1542 configured to determine system performance parameters of node device n based on processor usage, memory usage, queue depth, and number of connections;
  • the processing module 1542 is used to predict the routing performance parameters of the selected node devices under the multiple micro-service systems when the routing process passes through multiple micro-service systems based on system performance parameters and statistical service request time;
  • the processing module 1542 is configured to determine routing paths corresponding to multiple service requests based on routing performance parameters if multiple service requests are received.
  • the processing module 1542 is configured to configure weight parameters for processor usage, memory usage, queue depth and connection number respectively; processor usage, memory usage, queue depth, connection number, each weight
  • the parameters, the threshold depth of node device n, and the threshold number of connections are substituted into the following calculation formula to calculate the system performance parameters of node device n.
  • the system performance parameters of node device n are represented by PS:
  • the processor usage is characterized by pct cpu
  • the weight parameter corresponding to pct cpu is W cpu
  • the memory usage is represented by pct memory
  • the weight parameter corresponding to pct memory is W memory
  • the weight parameter corresponding to the queue depth is W queue depth
  • the weight parameter corresponding to the number of connections is the number of W connections .
  • the processing module 1542 is configured to respectively configure the weight parameters for the sum of system performance parameters and statistical service request time consumption of selected node devices under multiple microservice systems; the sum of system performance parameters, statistical Substituting the service request time and each weight parameter into the following calculation formula to predict the routing performance parameters, the routing performance parameters are represented by R:
  • the statistical service request time consumption is represented by T
  • the corresponding weight parameter is W T
  • the total number of multiple microservice systems is N
  • the system performance parameters of selected node devices under any microservice system are represented by PS i
  • the system The weight parameter corresponding to the sum of the performance parameters is W ps
  • the value range of i is a positive integer greater than 0 and less than or equal to N.
  • the processing module 1542 is configured to set the request quantity weight parameter for the routing performance parameters of the selected node devices corresponding to different paths under multiple microservice systems; if multiple service requests are received, based on the request quantity The weight parameter and the number of requests for multiple service requests determine the routing paths corresponding to multiple service requests.
  • the processing module 1542 is configured to, if multiple service requests are received, determine the identifier of the Internet data center to which the selected node devices corresponding to different paths belong; from the routing performance parameters of the selected node devices corresponding to different paths, Screen out the target routing performance parameters of the selected node devices corresponding to at least one target path, wherein at least two of the selected node devices corresponding to the target path have the same Internet data center identifier; based on the target routing performance parameters, determine multiple service The routing path corresponding to the request.
  • the obtaining module 1541 is configured to obtain the timeliness information and/or request quantity of multiple service requests if multiple service requests are received; the processing module 1542 is configured to obtain partial service requests among the multiple service requests The timeliness information of the timeliness meets the timeliness condition, and/or the number of requests for multiple service requests is greater than the threshold number, based on the routing performance parameters, determine the routing path corresponding to some service requests.
  • the processing module 1542 is configured to, for the remaining service requests among the plurality of service requests, perform hash calculation on the primary key field of each request in the remaining service requests to obtain a hash value; The number of all node devices under the service system m is subjected to a modulo calculation to obtain a modulo result; based on the modulo result, each request is sent to the corresponding node device.
  • the microservice routing device obtains the processor usage rate, memory usage rate, queue depth and connection number of the node device n under the microservice system m, wherein m and n are positive integers greater than or equal to 2,
  • the queue depth represents the processing performance of the preset node device n processing requests, and the number of connections represents the number of external connections supported by the port of the node device n;
  • the node device n is determined system performance parameters; based on system performance parameters and statistical service request time-consuming, predict the routing performance parameters of selected node devices under multiple micro-service systems when the routing process passes through multiple micro-service systems; if multiple Service requests, based on routing performance parameters, determine the routing paths corresponding to multiple service requests; that is, this application collects the following parameters that affect performance in actual routing Processor usage, memory usage, queue depth, number of connections, and statistics Time-consuming analysis of service requests enables the collection and analysis of relevant information about node devices under each micro-service system in
  • the embodiment of the present application provides a storage medium storing executable instructions, and the executable instruction is stored therein.
  • the executable instruction When executed by the processor, it will cause the processor to execute the method provided in the embodiment of the present application, for example, as shown in FIG. 2 shows the method.
  • the storage medium provided by this application obtains the processor usage rate, memory usage rate, queue depth and connection number of the node device n under the microservice system m, where m and n are positive integers greater than or equal to 2, and the queue depth represents The preset processing performance of node device n processing requests, the number of connections represents the number of external connections supported by the port of node device n; based on processor usage, memory usage, queue depth and number of connections, determine the system performance of node device n Parameters; based on system performance parameters and statistical service request time-consuming, predict routing performance parameters of selected node devices under multiple micro-service systems when passing through multiple micro-service systems in the routing process; if multiple service requests are received, Based on routing performance parameters, determine the routing paths corresponding to multiple service requests; that is, this application collects the following parameters that affect performance in actual routing: processor usage, memory usage, queue depth, number of connections, and statistical service request consumption Real-time analysis to realize the collection and analysis of relevant information of node devices under each micro-service system in the request path,
  • the storage medium can be a computer-readable storage medium, for example, a ferroelectric memory (FRAM, Ferromagnetic Random Access Memory), a read-only memory (ROM, Read Only Memory), a programmable read-only memory (PROM, Programmable Read Only Memory), Erasable Programmable Read Only Memory (EPROM, Erasable Programmable Read Only Memory), Electrically Erasable Programmable Read Only Memory (EEPROM, Electrically Erasable Programmable Read Only Memory), flash memory, magnetic surface memory, optical disc, Or memory such as CD-ROM (Compact Disk-Read Only Memory); It can also be various devices including one or any combination of the above-mentioned memories.
  • FRAM Ferroelectric memory
  • ROM Read Only Memory
  • PROM programmable read-only memory
  • EPROM Erasable Programmable Read Only Memory
  • EEPROM Electrically Erasable Programmable Read Only Memory
  • flash memory magnetic surface memory
  • optical disc Or memory such as CD-ROM (Compact Disk-Read Only Memory); It can also be various
  • executable instructions may take the form of programs, software, software modules, scripts, or code written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages, and its Can be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
  • executable instructions may, but do not necessarily correspond to files in a file system, may be stored as part of a file that holds other programs or data, for example, in Hyper Text Markup Language (HTML, Hyper Text Markup Language) in one or more scripts in a document, in a single file dedicated to the program in question, or in multiple cooperating files (for example, a file that stores one or more modules, subroutines, or code sections )middle.
  • executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or alternatively, on multiple computing devices distributed across multiple sites and interconnected by a communication network. to execute.
  • the microservice-based routing method, device, device, and storage medium provided in the embodiments of the present application obtain the processor usage rate, memory usage rate, queue depth, and connection number of node device n under the microservice system m, wherein, m and n are positive integers greater than or equal to 2, the queue depth represents the processing performance of the preset node device n processing requests, and the number of connections represents the number of external connections supported by the port of the node device n; based on processor usage and memory usage , queue depth and number of connections to determine the system performance parameters of the node device n; based on the system performance parameters and statistical service request time-consuming, when the routing process passes through multiple micro-service systems, the selected nodes under multiple micro-service systems
  • the routing performance parameters of the device if multiple service requests are received, based on the routing performance parameters, determine the routing path corresponding to the multiple service requests; that is to say, the embodiment of the present application collects the following parameters that affect performance in actual routing Processor usage rate , memory usage, queue depth, number of

Landscapes

  • Business, Economics & Management (AREA)
  • Human Resources & Organizations (AREA)
  • Engineering & Computer Science (AREA)
  • Economics (AREA)
  • Strategic Management (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Theoretical Computer Science (AREA)
  • Development Economics (AREA)
  • Marketing (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Game Theory and Decision Science (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Operations Research (AREA)
  • Quality & Reliability (AREA)
  • Tourism & Hospitality (AREA)
  • Educational Administration (AREA)
  • Technology Law (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Provided in the present application are a routing method and apparatus based on a micro-service, and a device and a storage medium. The method comprises: acquiring a processor utilization rate, a memory utilization rate, a queue depth and the number of connections of a node device n under a micro-service system m, wherein m and n are positive integers greater than or equal to 2, the queue depth represents a preset processing performance of the node device n processing a request, and the number of connections represents the number of external connections that is supported by a port of the node device n; determining system performance parameters of the node device n on the basis of the processor utilization rate, the memory utilization rate, the queue depth and the number of connections; predicting, on the basis of the system performance parameters and a counted time that is consumed by a service request, routing performance parameters of selected node devices under a plurality of micro-service systems when the plurality of micro-service systems are passed by during a routing process; and if a plurality of service requests are received, determining, on the basis of the routing performance parameters, routing paths corresponding to the plurality of service requests.

Description

一种基于微服务的路由方法、装置、设备及存储介质A microservice-based routing method, device, equipment, and storage medium

相关申请的交叉引用Cross References to Related Applications

本申请要求在2021年11月22日提交中国专利局、申请号为202111386475.5、申请名称为“一种基于微服务的路由方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application submitted to the China Patent Office on November 22, 2021, with the application number 202111386475.5 and the application name "A routing method, device, equipment and storage medium based on microservices", all of which The contents are incorporated by reference in this application.

技术领域technical field

本申请涉及金融科技(Fintech)的数据处理技术领域,涉及但不限于一种基于微服务的路由方法、装置、设备及存储介质。The present application relates to the technical field of data processing of financial technology (Fintech), involving but not limited to a routing method, device, device and storage medium based on microservices.

背景技术Background technique

随着计算机计算的发展,越来越多的技术应用在金融领域,传统金融业正在逐步向金融科技(Fintech)转变,但由于金融行业的安全性、实时性要求,也对技术提出了更高的要求。With the development of computer computing, more and more technologies are applied in the financial field, and the traditional financial industry is gradually transforming into Fintech. However, due to the security and real-time requirements of the financial industry, higher requirements are placed on technology. requirements.

金融科技领域下,针对行业内的消息中间件系统,由于处理的大部分是异步消息,所以系统关心的重点是消息在链路中的传输时间。系统间消息发送到下一个多节点的系统时,往往采用hash取模的随机算法,以达到负载均衡。同时为了防止随机发送到某一台机器的消息数过多,采取限制机器的最大队列深度,当达到最大的深度后,该节点将不再接收发送的消息,随机算法会将消息发送到除达到最大队列深度外的其他机器。In the field of financial technology, for the message middleware system in the industry, since most of the processing is asynchronous messages, the focus of the system is the transmission time of messages in the link. When messages between systems are sent to the next multi-node system, a random algorithm of hash modulo is often used to achieve load balancing. At the same time, in order to prevent too many messages randomly sent to a certain machine, the maximum queue depth of the machine is limited. When the maximum depth is reached, the node will no longer receive the sent messages, and the random algorithm will send the messages to all but reached Other machines beyond the maximum queue depth.

相关技术的微服务系统的路由方式只是做到随机调用,或者在随机的基础上找出相对调用少的节点增加调用,或者是对处理能力较低的节点减少调用。大部分是节点和节点之间,一个系统和相邻系统之间的局部调用调整。这种路由方式较为简单,无法精准实现动态路由。The routing method of the microservice system in the related art is only to make random calls, or to find out nodes with relatively few calls on a random basis to increase calls, or to reduce calls to nodes with low processing capabilities. Most are local call adjustments between nodes and between one system and adjacent systems. This routing method is relatively simple and cannot accurately implement dynamic routing.

发明内容Contents of the invention

本申请实施例提供一种基于微服务的路由方法、装置、设备及存储介质,以解决相关技术中的微服务系统的路由方式简单,无法实现动态调整路由路径的问题。Embodiments of the present application provide a microservice-based routing method, device, device, and storage medium to solve the problem that the routing method of the microservice system in the related art is simple and cannot dynamically adjust the routing path.

本申请实施例的技术方案是这样实现的:The technical scheme of the embodiment of the application is realized in this way:

本申请实施例提供一种基于微服务的路由方法,包括:The embodiment of this application provides a routing method based on microservices, including:

获取微服务系统m下的节点设备n的处理器使用率、内存使用率、队列深度和连接数, 其中,所述m和所述n为大于等于2的正整数,所述队列深度表征预设的所述节点设备n处理请求的处理性能,所述连接数表征所述节点设备n的端口所支持的对外连接数;Obtain the processor usage, memory usage, queue depth and number of connections of the node device n under the microservice system m, wherein, the m and the n are positive integers greater than or equal to 2, and the queue depth represents a preset The processing performance of the processing request of the node device n, the number of connections represents the number of external connections supported by the port of the node device n;

基于所述处理器使用率、内存使用率、队列深度和连接数,确定所述节点设备n的系统性能参数;Determine system performance parameters of the node device n based on the processor usage, memory usage, queue depth, and number of connections;

基于所述系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,所述多个微服务系统下的所选节点设备的路由性能参数;Predicting the routing performance parameters of the selected node devices under the multiple micro-service systems when the routing process passes through multiple micro-service systems based on the system performance parameters and the statistical time-consuming service requests;

若接收到多个服务请求,基于所述路由性能参数,确定所述多个服务请求对应的路由路径。If multiple service requests are received, based on the routing performance parameters, route paths corresponding to the multiple service requests are determined.

本申请实施例提供一种基于微服务的路由装置,包括:An embodiment of the present application provides a routing device based on microservices, including:

获取模块,用于获取微服务系统m下的节点设备n的处理器使用率、内存使用率、队列深度和连接数,其中,所述m和所述n为大于等于2的正整数,所述队列深度表征预设的所述节点设备n处理请求的处理性能,所述连接数表征所述节点设备n的端口所支持的对外连接数;The obtaining module is used to obtain the processor usage rate, memory usage rate, queue depth and connection number of the node device n under the microservice system m, wherein the m and the n are positive integers greater than or equal to 2, and the The queue depth represents the preset processing performance of the processing request of the node device n, and the number of connections represents the number of external connections supported by the port of the node device n;

处理模块,用于基于所述处理器使用率、内存使用率、队列深度和连接数,确定所述节点设备n的系统性能参数;A processing module, configured to determine system performance parameters of the node device n based on the processor usage, memory usage, queue depth, and number of connections;

所述处理模块,用于基于所述系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,所述多个微服务系统下的所选节点设备的路由性能参数;The processing module is configured to predict the routing performance parameters of the selected node devices under the multiple micro-service systems when the routing process passes through multiple micro-service systems based on the system performance parameters and the statistical service request time-consuming ;

所述处理模块,用于若接收到多个服务请求,基于所述路由性能参数,确定所述多个服务请求对应的路由路径。The processing module is configured to, if multiple service requests are received, determine routing paths corresponding to the multiple service requests based on the routing performance parameters.

本申请实施例提供一种基于微服务的路由设备,包括:An embodiment of the present application provides a routing device based on microservices, including:

存储器,用于存储可执行指令;处理器,用于执行存储器中存储的可执行指令时,实现上述的基于微服务的路由方法。The memory is used to store executable instructions; the processor is used to implement the above microservice-based routing method when executing the executable instructions stored in the memory.

本申请实施例提供一种存储介质,存储有可执行指令,用于引起处理器执行时,实现上述的方法。An embodiment of the present application provides a storage medium, which stores executable instructions, and is used to cause a processor to implement the above method when executed.

本申请实施例具有以下有益效果:The embodiment of the present application has the following beneficial effects:

通过获取微服务系统m下的节点设备n的处理器使用率、内存使用率、队列深度和连接数,其中,m和n为大于等于2的正整数,队列深度表征预设的节点设备n处理请求的处理性能,连接数表征节点设备n的端口所支持的对外连接数;基于处理器使用率、内存使用率、队列深度和连接数,确定节点设备n的系统性能参数;基于系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,多个微服务系统下的所选节点设备的路由性能参数;若接收到多个服务请求,基于路由性能参数,确定多个服务请求对应的路由路径; 也就是说,本申请实施例收集实际路由中影响性能的如下参数处理器使用率、内存使用率、队列深度、连接数和统计的服务请求耗时进行分析,实现对请求路径中各个微服务系统下的节点设备的相关信息的收集和分析,进而,在后续服务请求到来时,将分析结果投入路由调度,实现动态调整路由路径,优化整体服务调用时间。By obtaining the processor usage, memory usage, queue depth and connection number of node device n under the microservice system m, where m and n are positive integers greater than or equal to 2, the queue depth represents the preset node device n processing Request processing performance, the number of connections represents the number of external connections supported by the port of node device n; based on processor usage, memory usage, queue depth and number of connections, determine the system performance parameters of node device n; based on system performance parameters and Statistical service request time-consuming, predict routing performance parameters of selected node devices under multiple micro-service systems when passing through multiple micro-service systems in the routing process; if multiple service requests are received, based on routing performance parameters, determine how many The routing path corresponding to each service request; that is to say, the embodiment of the present application collects the following parameters affecting performance in the actual routing: processor usage rate, memory usage rate, queue depth, number of connections, and service request time-consuming statistics for analysis, to achieve Collect and analyze the relevant information of node devices under each micro-service system in the request path, and then, when subsequent service requests arrive, put the analysis results into routing scheduling, realize dynamic adjustment of routing paths, and optimize the overall service call time.

附图说明Description of drawings

图1是本申请实施例提供的服务器的一个可选的架构示意图;FIG. 1 is a schematic diagram of an optional architecture of a server provided in an embodiment of the present application;

图2是本申请实施例提供的基于微服务的路由方法的流程示意图一;FIG. 2 is a first schematic flow diagram of a microservice-based routing method provided by an embodiment of the present application;

图3是本申请实施例提供的基于微服务的路由方法的流程示意图二;FIG. 3 is a second schematic flow diagram of the microservice-based routing method provided by the embodiment of the present application;

图4是本申请实施例提供的基于微服务的路由方法的流程示意图三;FIG. 4 is a third schematic flow diagram of the microservice-based routing method provided by the embodiment of the present application;

图5是本申请实施例提供的微服务流程所经过的微服务系统的示意图;Fig. 5 is a schematic diagram of the microservice system through which the microservice process provided by the embodiment of the present application passes;

图6是本申请实施例提供的微服务架构下的微服务调节流程的示意图。FIG. 6 is a schematic diagram of a microservice adjustment process under the microservice architecture provided by the embodiment of the present application.

具体实施方式Detailed ways

为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述,所描述的实施例不应视为对本申请的限制,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of the application clearer, the application will be further described in detail below in conjunction with the accompanying drawings. All other embodiments obtained under the premise of creative labor belong to the scope of protection of this application.

在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。除非另有定义,本申请实施例所使用的所有的技术和科学术语与属于本申请实施例的技术领域的技术人员通常理解的含义相同。本申请实施例所使用的术语只是为了描述本申请实施例的目的,不是旨在限制本申请。In the following description, references to "some embodiments" describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or a different subset of all possible embodiments, and Can be combined with each other without conflict. Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meaning as commonly understood by those skilled in the technical field of the embodiments of the present application. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application, and are not intended to limit the present application.

下面说明本申请实施例提供的基于微服务的路由设备的示例性应用,本申请实施例提供的基于微服务的路由设备可以实施为笔记本电脑,平板电脑,台式计算机,移动设备(例如,移动电话,便携式音乐播放器,个人数字助理,专用消息设备,便携式游戏设备),智能机器人等任意具有屏幕显示功能的终端,也可以实施为服务器。下面,将说明基于微服务的路由设备实施为服务器时的示例性应用。The exemplary application of the microservice-based routing device provided by the embodiment of the present application is described below. The microservice-based routing device provided by the embodiment of the present application can be implemented as a notebook computer, a tablet computer, a desktop computer, a mobile device (for example, a mobile phone) , portable music player, personal digital assistant, dedicated message device, portable game device), intelligent robot and any terminal with screen display function can also be implemented as a server. Next, an exemplary application when the microservice-based routing device is implemented as a server will be described.

参见图1,图1是本申请实施例提供的服务器100的结构示意图,图1所示的服务器100包括:至少一个处理器110、至少一个网络接口120、用户接口130和存储器150。服务器100中的各个组件通过总线系统140耦合在一起。可理解,总线系统140用于实现这些组件之间的连接通信。总线系统140除包括数据总线之外,还包括电源总线、控制总线和状态信 号总线。但是为了清楚说明起见,在图1中将各种总线都标为总线系统140。Referring to FIG. 1, FIG. 1 is a schematic structural diagram of a server 100 provided by an embodiment of the present application. The server 100 shown in FIG. Various components in the server 100 are coupled together through the bus system 140 . It can be understood that the bus system 140 is used to realize connection and communication between these components. The bus system 140 includes not only a data bus, but also a power bus, a control bus and a status signal bus. However, for clarity of illustration, the various buses are labeled as bus system 140 in FIG.

处理器110可以是一种集成电路芯片,具有信号的处理能力,例如通用处理器、数字信号处理器(DSP,Digital Signal Processor),或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等,其中,通用处理器可以是微处理器或者任何常规的处理器等。Processor 110 can be a kind of integrated circuit chip, has signal processing capability, such as general-purpose processor, digital signal processor (DSP, Digital Signal Processor), or other programmable logic device, discrete gate or transistor logic device, discrete hardware Components, etc., wherein the general-purpose processor can be a microprocessor or any conventional processor, etc.

用户接口130包括使得能够呈现媒体内容的一个或多个输出装置131,包括一个或多个扬声器和/或一个或多个视觉显示屏。用户接口130还包括一个或多个输入装置132,包括有助于用户输入的用户接口部件,比如键盘、鼠标、麦克风、触屏显示屏、摄像头、其他输入按钮和控件。User interface 130 includes one or more output devices 131 that enable presentation of media content, including one or more speakers and/or one or more visual displays. The user interface 130 also includes one or more input devices 132, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

存储器150可以是可移除的,不可移除的或其组合。示例性地硬件设备包括固态存储器,硬盘驱动器,光盘驱动器等。存储器150可选地包括在物理位置上远离处理器110的一个或多个存储设备。存储器150包括易失性存储器或非易失性存储器,也可包括易失性和非易失性存储器两者。非易失性存储器可以是只读存储器(Read Only Memory,ROM),易失性存储器可以是随机存取存储器(Random Access Memory,RAM)。本申请实施例描述的存储器150旨在包括任意适合类型的存储器。在一些实施例中,存储器150能够存储数据以支持各种操作,这些数据的示例包括程序、模块和数据结构或者其子集或超集,下面示例性说明。Memory 150 may be removable, non-removable or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, and the like. Memory 150 optionally includes one or more storage devices located physically remote from processor 110 . Memory 150 includes volatile memory or nonvolatile memory, and may include both volatile and nonvolatile memory. The non-volatile memory can be read-only memory (Read Only Memory, ROM), and the volatile memory can be random access memory (Random Access Memory, RAM). The memory 150 described in the embodiment of the present application is intended to include any suitable type of memory. In some embodiments, the memory 150 is capable of storing data to support various operations, examples of which include programs, modules, and data structures, or subsets or supersets thereof, as exemplified below.

操作系统151,包括用于处理各种基本系统服务和执行硬件相关任务的系统程序,例如框架层、核心库层、驱动层等,用于实现各种基础业务以及处理基于硬件的任务;Operating system 151, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;

网络通信模块152,用于经由一个或多个(有线或无线)网络接口120到达其他计算设备,示例性地网络接口120包括:蓝牙、无线相容性认证(Wi-Fi)、和通用串行总线(Univ ersal Serial Bus,USB)等;Network communication module 152 for reaching other computing devices via one or more (wired or wireless) network interfaces 120, exemplary network interfaces 120 include: Bluetooth, Wireless Compatibility Authentication (Wi-Fi), and Universal Serial Bus (Universal Serial Bus, USB), etc.;

输入处理模块153,用于对一个或多个来自一个或多个输入装置132之一的一个或多个用户输入或互动进行检测以及翻译所检测的输入或互动。The input processing module 153 is configured to detect one or more user inputs or interactions from one or more of the input devices 132 and translate the detected inputs or interactions.

在一些实施例中,本申请实施例提供的装置可以采用软件方式实现,图1示出了存储在存储器150中的一种基于微服务的路由装置154,该基于微服务的路由装置154可以是服务器100中的基于微服务的路由装置,其可以是程序和插件等形式的软件,包括以下软件模块:获取模块1541、处理模块1542,这些模块是逻辑上的,因此根据所实现的功能可以进行任意的组合或进一步拆分。将在下文中说明各个模块的功能。In some embodiments, the device provided by the embodiment of the present application may be implemented in software. FIG. 1 shows a microservice-based routing device 154 stored in a memory 150. The microservice-based routing device 154 may be The microservice-based routing device in the server 100 can be software in the form of programs and plug-ins, and includes the following software modules: an acquisition module 1541 and a processing module 1542. These modules are logical, so they can be processed according to the functions implemented. Arbitrary combinations or further splits. The function of each module will be explained below.

在另一些实施例中,本申请实施例提供的装置可以采用硬件方式实现,作为示例,本申请实施例提供的装置可以是采用硬件译码处理器形式的处理器,其被编程以执行本申请实施例提供的基于微服务的路由方法,例如,硬件译码处理器形式的处理器可以采用一个或多个应用专用集成电路(Application Specific Integrated Circuit,ASIC)、DSP、可编程逻 辑器件(Programmable Logic Device,PLD)、复杂可编程逻辑器件(Complex Programmabl e Logic Device,CPLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或其他电子元件。In other embodiments, the device provided in the embodiment of the present application may be implemented in hardware. As an example, the device provided in the embodiment of the present application may be a processor in the form of a hardware decoding processor, which is programmed to execute the In the microservice-based routing method provided by the embodiment, for example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (Application Specific Integrated Circuit, ASIC), DSP, Programmable Logic Device (Programmable Logic Device, PLD), Complex Programmable Logic Device (Complex Programmable Logic Device, CPLD), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other electronic components.

下面将结合本申请实施例提供的服务器100的示例性应用和实施,说明本申请实施例提供的基于微服务的路由方法。参见图2,图2是本申请实施例提供的基于微服务的路由方法的一个可选的流程示意图,将结合图2示出的步骤进行说明,The microservice-based routing method provided by the embodiment of the present application will be described below in conjunction with the exemplary application and implementation of the server 100 provided in the embodiment of the present application. Referring to FIG. 2, FIG. 2 is an optional flow chart of the microservice-based routing method provided by the embodiment of the present application, which will be described in conjunction with the steps shown in FIG. 2.

步骤S201,获取微服务系统m下的节点设备n的处理器使用率、内存使用率、队列深度和连接数。Step S201, acquiring processor usage, memory usage, queue depth and connection number of node device n under the microservice system m.

其中,m和n为大于等于2的正整数,队列深度表征预设的节点设备n处理请求的处理性能,连接数表征节点设备n的端口所支持的对外连接数。Among them, m and n are positive integers greater than or equal to 2, the queue depth represents the processing performance of the preset node device n for processing requests, and the number of connections represents the number of external connections supported by the port of the node device n.

本申请实施例提供的节点设备可以实施为笔记本电脑,平板电脑,台式计算机,移动设备(例如,移动电话,便携式音乐播放器,个人数字助理,专用消息设备,便携式游戏设备),智能机器人等任意具有屏幕显示功能的终端,也可以实施为服务器。本申请实施例中以节点设备实施为服务器为例进行说明。The node device provided by the embodiment of the present application can be implemented as any A terminal with screen display function can also be implemented as a server. In the embodiment of the present application, the node device is implemented as a server as an example for description.

示例性的,队列深度体现的是节点设备n提供相应功能时的处理性能,不同的节点设备在提供同一功能时,一般存在处理性能的差异。本申请可以预先针对任一节点设备设置队列深度。在一些示例性的场景中,假设不同节点设备都具有存储功能,由于各自硬件条件等的影响,存储快慢和/或存储空间大小有所不同。进一步地,在实际应用的场景中,可以人工设置任一节点设备的队列深度;当然,也可以采用其他方式设置队列深度,例如,节点设备结合硬件条件等的影响,选择相匹配的队列深度。假设队列深度指的是节点设备n需要处理的消息,在节点设备n的队列深度比较大时,说明需要排队等待处理的时间更长;在节点设备n的队列深度比较小时,说明需要排队等待处理的时间相对较短。Exemplarily, the queue depth reflects the processing performance when the node device n provides a corresponding function, and when different node devices provide the same function, there are generally differences in processing performance. This application can pre-set the queue depth for any node device. In some exemplary scenarios, assuming that different node devices have storage functions, due to the influence of respective hardware conditions, the storage speed and/or the size of the storage space are different. Furthermore, in a practical application scenario, the queue depth of any node device can be manually set; of course, other methods can also be used to set the queue depth, for example, the node device selects a matching queue depth based on the influence of hardware conditions. Assuming that the queue depth refers to the messages that node device n needs to process, when the queue depth of node device n is relatively large, it means that it takes longer to wait in line for processing; when the queue depth of node device n is relatively small, it means that it needs to wait in line for processing relatively short time.

示例性的,针对连接数而言,比如一个客户端向节点设备如服务器发起http请求,需要先建立TCP连接,然后再向http服务发出数据包,连接请求会占用节点设备的端口,收到请求应答后根据包头的是否保持,确定是否关闭连接,端口数是有限的,所以连接数也是有限的。本申请在确定路由路径的过程中,充分收集了节点设备n的相关信息如处理器使用率、内存使用率、队列深度和连接数,以确保后续不同路径之间的路由性能排序更加准确全面。Exemplarily, for the number of connections, for example, if a client initiates an http request to a node device such as a server, it needs to establish a TCP connection first, and then send a data packet to the http service. The connection request will occupy the port of the node device, and the request is received After the response, determine whether to close the connection according to whether the header is maintained. The number of ports is limited, so the number of connections is also limited. In the process of determining the routing path, this application fully collects relevant information of the node device n such as processor usage, memory usage, queue depth, and number of connections, so as to ensure more accurate and comprehensive routing performance ranking among subsequent different paths.

本申请实施例中,在一个可实现的微服务架构中,服务器作为微服务架构中的配置中心,包括但不限于实现对配置和服务的显示及管理。示例性的,微服务架构包括作为配置中心的服务器、注册中心和多个微服务系统。注册中心涉及对启动整体系统后注册服务的管理。在 一些微服务系统的维护场景中,在系统运行之初可以采用随机算法,进而在维持系统运行的基础上,节点设备提供各类相关信息以供配置中心分析。In the embodiment of the present application, in a realizable microservice architecture, the server serves as the configuration center in the microservice architecture, including but not limited to realizing the display and management of configuration and services. Exemplarily, the microservice architecture includes a server serving as a configuration center, a registration center, and multiple microservice systems. The registration center involves the management of registration services after starting the overall system. In the maintenance scenarios of some microservice systems, random algorithms can be used at the beginning of system operation, and then on the basis of maintaining system operation, node devices provide various relevant information for analysis by the configuration center.

本申请涉及的服务请求包括但不限于实时联机事务处理过程(On-Line Transaction Processing,OLTP),也称为面向交易的处理过程中的服务请求。上述服务请求的特征是前台接收的用户数据可以立即传送到计算中心进行处理,并在很短的时间内给出处理结果。The service requests involved in this application include, but are not limited to, real-time online transaction processing (On-Line Transaction Processing, OLTP), also known as service requests in transaction-oriented processing. The feature of the above service request is that the user data received by the front desk can be immediately transmitted to the computing center for processing, and the processing result will be given in a very short time.

在一些实施例中,本申请提供的基于微服务的路由方法是一种智能路由方法,该方法针对现有的路由路径进行分析,分析结果供配置中心动态调整路径。这里,配置中心在收集实际路由中影响性能的相关参数的过程中,可以设置一个合理的周期,例如,针对包括多节点设备的微服务系统,基于网络通信中的心跳机制,采用心跳的方式,在一个心跳周期后,将所有节点设备的相关参数进行数据同步。智能路由算法可以以心跳周期为参考,根据一个心跳周期内的消息总数,和算法需要收集的最少消息数,确定以几个心跳周期为一个消息收集的周期最为合理,少于最小消息数、样本较少的周期可以剔除。每个周期收集现有请求的全部路由信息,等待下个周期再将分析的结果投入具体的路由调度。以此循环,以达到相对实时、动态调整路由的目的。In some embodiments, the microservice-based routing method provided by the present application is an intelligent routing method, which analyzes the existing routing paths, and the analysis results are used for the configuration center to dynamically adjust the paths. Here, the configuration center can set a reasonable cycle in the process of collecting relevant parameters that affect performance in actual routing. For example, for a microservice system including multi-node devices, based on the heartbeat mechanism in network communication, the heartbeat method is adopted. After a heartbeat cycle, the relevant parameters of all node devices are synchronized. The intelligent routing algorithm can take the heartbeat cycle as a reference, and according to the total number of messages in a heartbeat cycle, and the minimum number of messages that the algorithm needs to collect, it is most reasonable to use several heartbeat cycles as a message collection cycle, which is less than the minimum number of messages, samples Fewer cycles can be eliminated. Each cycle collects all routing information of existing requests, and waits for the next cycle before putting the analysis results into specific routing scheduling. This cycle is used to achieve the purpose of relatively real-time and dynamic routing adjustment.

步骤S202,基于处理器使用率、内存使用率、队列深度和连接数,确定节点设备n的系统性能参数。Step S202: Determine system performance parameters of node device n based on processor usage, memory usage, queue depth, and number of connections.

本申请实施例中,处理器使用率包括但不限于中央处理器(central processing unit,CPU)使用率。本申请确定的节点设备n的系统性能参数,作为预测路由过程中经过多个微服务系统时,选择多个微服务系统下的哪些节点设备以形成路径满足合理路径长度条件的路由的重要参考因素。In this embodiment of the present application, the processor usage rate includes, but is not limited to, a central processing unit (central processing unit, CPU) usage rate. The system performance parameters of the node device n determined in this application are used as an important reference factor to select which node devices under the multiple micro-service systems to form a route that satisfies the reasonable path length condition when the routing process passes through multiple micro-service systems .

结合步骤S201和步骤S202,示例性的,以一个心跳周期为一个消息收集的周期,获取微服务系统m下的节点设备n的处理器使用率、内存使用率、队列深度和连接数,进而基于处理器使用率、内存使用率、队列深度和连接数,确定节点设备n的系统性能参数;进一步地,以当一个心跳周期确定的系统性能参数作为参考因素,在后续集合统计的服务请求耗时,执行下一心跳周期的路由路径的预测,最终等待下个心跳周期到来时,再将分析的结果投入具体的路由调度。Combining steps S201 and S202, for example, a heartbeat period is used as a message collection period to obtain the processor usage, memory usage, queue depth and connection number of the node device n under the microservice system m, and then based on Processor usage, memory usage, queue depth, and number of connections determine the system performance parameters of node device n; further, taking the system performance parameters determined as a heartbeat cycle as a reference factor, the time-consuming service requests in subsequent collection statistics , execute the prediction of the routing path of the next heartbeat cycle, and finally wait for the arrival of the next heartbeat cycle, and then put the analysis results into specific routing scheduling.

步骤S203,基于系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,多个微服务系统下的所选节点设备的路由性能参数。Step S203, based on the system performance parameters and the statistical time-consuming service requests, predict the routing performance parameters of the selected node devices under the multiple micro-service systems when the routing process passes through multiple micro-service systems.

本申请实施例中,统计的服务请求耗时是指一个消息收集周期内,统计数列中占x%比重的数值,其中,x为正数。示例性的,x为95,当然,本申请实施例中x还可以取其他参数,例如98,对此本申请不作具体限定。In the embodiment of the present application, the statistical service request time consumption refers to the numerical value accounting for x% proportion in the statistical series within a message collection period, where x is a positive number. Exemplarily, x is 95. Of course, in the embodiment of the present application, x can also take other parameters, such as 98, which is not specifically limited in the present application.

示例性的,以统计数列中占95%比重的数值为例,假设有100个服务请求,按照响应时间从小到大排列,位置为95的值,即为95%比重的数值又称为P95值。假设该值为180ms,则说明对95%的用户的响应耗时在180ms之内,只有5%的用户的响应耗时大于180ms,据此,本申请可以确定更精确的服务响应耗时信息。As an example, take the value of 95% in the statistical series as an example, assuming that there are 100 service requests, arranged in ascending order of response time, and the value at position 95, that is, the value of 95% is also called the P95 value . Assuming that the value is 180ms, it means that the response time for 95% of the users is within 180ms, and only 5% of the users are longer than 180ms. Based on this, the application can determine more accurate service response time-consuming information.

本申请实施例中,配置中心可以收集每个微服务系统的所有节点设备的处理器使用率如CPU使用率、内存使用率、队列深度和连接数,并且在统计的服务请求耗时的基础上加上这些实际路由过程中的系统性能参数,以预估不同路由路径中所选节点设备在未来的请求传递时间。In the embodiment of this application, the configuration center can collect the processor usage rate of all node devices of each microservice system, such as CPU usage rate, memory usage rate, queue depth and number of connections, and based on the time-consuming statistics of service requests Add these system performance parameters in the actual routing process to estimate the future request delivery time of selected node devices in different routing paths.

需要说明的是,对统计的服务请求耗时、CPU使用率、内存使用率、队列深度和连接数等消息的收集,对于熔断和限流也是有一定的意义,当多个微服务系统下的所选节点设备的路由性能参数的计算结果超出合理的阈值,就可以将对应的节点设备暂时隔离,等待恢复后再重新计入可路由的路径。It should be noted that the collection of statistics such as service request time consumption, CPU usage, memory usage, queue depth, and number of connections is also meaningful for fusing and current limiting. When multiple microservice systems If the calculation result of the routing performance parameter of the selected node device exceeds a reasonable threshold, the corresponding node device can be temporarily isolated, and then re-included in the routable path after recovery.

步骤S204,若接收到多个服务请求,基于路由性能参数,确定多个服务请求对应的路由路径。Step S204, if multiple service requests are received, determine routing paths corresponding to the multiple service requests based on routing performance parameters.

本申请实施例中,在接收到多个服务请求的情况下,配置中心确定下个心跳周期到来,将分析的结果投入具体的路由调度,并基于路由性能参数,确定多个服务请求对应的路由路径,实现动态调整路由路径,优化整体服务调用时间的目的。In the embodiment of this application, when multiple service requests are received, the configuration center determines the arrival of the next heartbeat cycle, puts the analysis results into specific routing scheduling, and determines the routes corresponding to multiple service requests based on routing performance parameters Path, to achieve the purpose of dynamically adjusting the routing path and optimizing the overall service call time.

本申请提供的基于微服务的路由方法,通过获取微服务系统m下的节点设备n的处理器使用率、内存使用率、队列深度和连接数,其中,m和n为大于等于2的正整数,队列深度表征预设的节点设备n处理请求的处理性能,连接数表征节点设备n的端口所支持的对外连接数;基于处理器使用率、内存使用率、队列深度和连接数,确定节点设备n的系统性能参数;基于系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,多个微服务系统下的所选节点设备的路由性能参数;若接收到多个服务请求,基于路由性能参数,确定多个服务请求对应的路由路径;也就是说,本申请收集实际路由中影响性能的如下参数处理器使用率、内存使用率、队列深度、连接数和统计的服务请求耗时进行分析,实现对请求路径中各个微服务系统下的节点设备的相关信息的收集和分析,进而,在后续服务请求到来时,将分析结果投入路由调度,实现动态调整路由路径,优化整体服务调用时间。The microservice-based routing method provided by this application obtains the processor usage, memory usage, queue depth, and number of connections of node device n under the microservice system m, where m and n are positive integers greater than or equal to 2 , the queue depth represents the processing performance of the preset node device n processing requests, and the number of connections represents the number of external connections supported by the port of the node device n; based on the processor usage, memory usage, queue depth and the number of connections, determine the node device The system performance parameters of n; based on the system performance parameters and statistical service request time-consuming, predict the routing performance parameters of the selected node devices under the multiple micro-service systems when the routing process passes through multiple micro-service systems; if multiple micro-service systems are received A service request, based on routing performance parameters, determine the routing path corresponding to multiple service requests; that is, this application collects the following parameters that affect performance in the actual routing Processor usage rate, memory usage rate, queue depth, number of connections, and statistics time-consuming analysis of service requests, to realize the collection and analysis of relevant information of node devices under each micro-service system in the request path, and then, when subsequent service requests arrive, the analysis results are put into routing scheduling to realize dynamic adjustment of routing paths , optimize the overall service call time.

本申请其他实施例中,步骤S202基于处理器使用率、内存使用率、队列深度和连接数,确定节点设备n的系统性能参数,可以通过如图3所示的步骤实现:In other embodiments of the present application, step S202 determines the system performance parameters of the node device n based on the processor usage rate, memory usage rate, queue depth and number of connections, which can be implemented through the steps shown in Figure 3:

A11,分别为处理器使用率、内存使用率、队列深度和连接数配置权重参数;A11, configure weight parameters for processor usage, memory usage, queue depth and number of connections respectively;

A12,将处理器使用率、内存使用率、队列深度、连接数、各个权重参数、节点设备n 的阈值深度以及阈值连接数代入如下计算公式,计算节点设备n的系统性能参数。A12. Substitute processor usage, memory usage, queue depth, number of connections, each weight parameter, threshold depth of node device n, and threshold number of connections into the following calculation formula to calculate the system performance parameters of node device n.

这里,节点设备n的系统性能参数表征为PS:Here, the system performance parameter of node device n is characterized by PS:

Figure PCTCN2022097857-appb-000001
Figure PCTCN2022097857-appb-000001

其中,处理器使用率表征为pct cpu、pct cpu对应的权重参数为W cpu,内存使用率表征为pct 内存、pct 内存对应的权重参数为W 内存,队列深度对应的权重参数为W 队列深度,连接数对应的权重参数为W 连接数。这里,阈值深度又称为节点设备限定最大深度,阈值连接数又称为节点设备限定最大连接数。 Among them, the processor usage is characterized by pct cpu , the weight parameter corresponding to pct cpu is W cpu , the memory usage is represented by pct memory , the weight parameter corresponding to pct memory is W memory , and the weight parameter corresponding to the queue depth is W queue depth , The weight parameter corresponding to the number of connections is the number of W connections . Here, the threshold depth is also called the maximum depth limited by node devices, and the threshold number of connections is also called the maximum number of connections limited by node devices.

需要说明的是,每个微服务系统,由于功能性不同,所以对节点设备限定最大连接数和节点设备限定最大深度可能有不同的设定,对CPU和内存的要求也不一定完全相同,因此每个节点设备可以按上面的公式,根据节点设备的功能性要求,自定义的设置权重的分配比例,使结果更为精确。It should be noted that, due to the different functions of each microservice system, there may be different settings for the maximum number of connections and the maximum depth of node devices, and the requirements for CPU and memory may not be exactly the same, so Each node device can customize the distribution ratio of the weight according to the above formula and according to the functional requirements of the node device, so as to make the result more accurate.

本申请其他实施例中,步骤S203基于系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,多个微服务系统下的所选节点设备的路由性能参数,可以通过如图4所示的步骤实现:In other embodiments of the present application, in step S203, based on the system performance parameters and statistical service request time-consuming, the routing performance parameters of the selected node devices under the multiple micro-service systems can be predicted when the routing process passes through multiple micro-service systems. Through the steps shown in Figure 4:

B11,分别为多个微服务系统下的所选节点设备的系统性能参数之和、统计的服务请求耗时配置权重参数。B11, the weight parameters are respectively configured for the sum of the system performance parameters of the selected node devices under the multiple microservice systems and the statistical service request time consumption.

这里,所选节点设备包括多个微服务系统中每一微服务系统下所选择的每一个节点设备。Here, the selected node device includes each node device selected under each microservice system in the multiple microservice systems.

B12,将系统性能参数之和、统计的服务请求耗时以及各个权重参数代入如下计算公式,预测路由性能参数。B12. Substituting the sum of system performance parameters, statistical service request time consumption and each weight parameter into the following calculation formula to predict routing performance parameters.

这里,路由性能参数表征为R:Here, the routing performance parameter is represented by R:

R=W T×T+W ps×(PS 1+PS 2+PS 3+......PS i+......+PS N); R=W T ×T+W ps ×(PS 1 +PS 2 +PS 3 +...PS i +...+PS N );

其中,统计的服务请求耗时表征为T、对应的权重参数为W T,多个微服务系统的总数为N,任一微服务系统下所选节点设备的系统性能参数表征为PS i,系统性能参数之和对应的权重参数为W ps,i的取值范围为大于0且小于等于N的正整数。这里,在前述关于统计的服务请求耗时的解释的基础上,T包括但不限于T p95Among them, the statistical service request time consumption is represented by T, the corresponding weight parameter is W T , the total number of multiple microservice systems is N, and the system performance parameters of selected node devices under any microservice system are represented by PS i , the system The weight parameter corresponding to the sum of the performance parameters is W ps , and the value range of i is a positive integer greater than 0 and less than or equal to N. Here, on the basis of the foregoing explanation about the statistical service request time consumption, T includes but is not limited to T p95 .

需要说明的是,路由性能参数R的计算公式中,值得关注的还有P95平均请求耗时和系统性能参数之和的各自权重。这里,统计的服务请求耗时是现有请求耗时的总结,系统性能参数之和是对未来性能的预估,当每个周期系统性能参数之和值增长较缓时,可以适当 降低系统性能参数之和前的权重系数。待系统性能参数之和值较大或者增长较快时,说明系统性能参数之和很可能成为整体性能的瓶颈,此时,可以适时增大对应的权重。It should be noted that in the calculation formula of the routing performance parameter R, it is also worth paying attention to the respective weights of the P95 average request time consumption and the sum of the system performance parameters. Here, the statistical service request time consumption is a summary of the existing request time consumption, and the sum of system performance parameters is an estimate of future performance. When the sum of system performance parameters in each cycle increases slowly, the system performance can be appropriately reduced The weight factor before the sum of parameters. When the sum of system performance parameters is large or grows rapidly, it means that the sum of system performance parameters is likely to become the bottleneck of the overall performance. At this time, the corresponding weight can be increased in due course.

本申请实施例中,以统计的服务请求耗时T为T p95举例,路由性能参数R的计算公式中,权重变化曲线是类似指数曲线的,比如从T p95前面的权重系数来看,在初期平均请求时间较短,从请求时间角度很难看出该路径的性能,而本申请在设计一个系统时,往往会根据经验和程序的具体要求和实现,对请求时间有一个初步的预估,本申请考虑到两个比较关注的时间点。一个是本申请设置的可以接受的请求时长,在这个时长内响应,都算性能较好,超过这个时间,就需要稍微关注一下,是否可以优化;另一个时间点,是确认的超时时间,超过这个时间,默认请求超时。在这两个时间点之间的这段时间,请求时间反应性能的能力越来越强,所以前面的权重W T会快速上涨。在一些实施例中,示例性的,确认的超时时间是微服务系统根据所提供的服务类型确定的,例如不同服务类型的超时时间可以不同,通过不同的服务类型,对应不同的确认的超时时间,使得确认的超过时间自适应不同,从而实现不同服务类型的微服务系统权重也自适应动态变化;可以接受的请求时长是微服务系统和服务请求的发起方共同协商确定的。当然,确认的超时时间和可以接受的请求时长,还可以采用人工设置的方式,结合微服务系统提供的服务,人为地进行设置。综上所述,W T的增长曲线类似于指数函数,在到达可以接受的请求时间点前,基本是平直的横线,可能有少许的增长,但是速度很慢,对整体的结果影响不大;等到了这个时间点,就出现了拐点,W T增长加快,而且是单位时间的增长速度越来越大,直到超时时间,到达峰值。 In the embodiment of this application, taking the statistical service request time T as T p95 as an example, in the calculation formula of the routing performance parameter R, the weight change curve is similar to an exponential curve. For example, from the weight coefficient before T p95 , in the initial stage The average request time is short, and it is difficult to see the performance of this path from the perspective of request time. When designing a system, this application often has a preliminary estimate of the request time based on experience and the specific requirements and implementation of the program. The application takes into account two points of interest. One is the acceptable request duration set by this application. Responding within this duration is regarded as having better performance. If it exceeds this time, you need to pay a little attention to whether it can be optimized. The other time point is the confirmation timeout. At this time, the default request timeout. During the period between these two time points, the ability to request time response performance is getting stronger and stronger, so the previous weight W T will rise rapidly. In some embodiments, for example, the confirmation timeout period is determined by the microservice system according to the service type provided, for example, the timeout period of different service types can be different, and different service types correspond to different confirmation timeout periods , so that the overtime of the confirmation is adaptively different, so that the weight of the microservice system of different service types is also adaptively and dynamically changed; the acceptable request duration is determined through mutual negotiation between the microservice system and the initiator of the service request. Of course, the timeout period for confirmation and the acceptable request duration can also be manually set in combination with the services provided by the microservice system. To sum up, the growth curve of W T is similar to an exponential function. Before reaching an acceptable request time point, it is basically a straight horizontal line. There may be a little growth, but the speed is very slow, which has little effect on the overall result. Large; at this point in time, there is an inflection point, and the growth of W T is accelerating, and the growth rate per unit time is getting larger and larger, until the timeout reaches the peak value.

不只是W T,其他的权重系数也是类似指数曲线增长,本申请在压测的时候,往往就会对处理器使用率、内存使用率、队列深度、连接数等都有一个预期范围,例如CPU使用率,普通情况下,本申请认为只要不是长时间使用率超过50%,那么CPU使用率对性能的影响都很小,超过50%就要开始关注,同样是每增长一个单位,对性能的限制也越来越大。 Not only W T , other weight coefficients also grow similar to an exponential curve. When this application is stress testing, it often has an expected range for processor usage, memory usage, queue depth, number of connections, etc., such as CPU Utilization rate, under normal circumstances, this application believes that as long as the usage rate does not exceed 50% for a long time, the impact of CPU usage rate on performance is very small, and if it exceeds 50%, attention should be paid to it. Also, every increase of one unit will affect performance. Restrictions are also increasing.

也就是说,本申请路由性能参数R的计算公式中,W ps是一个变量,W ps随着系统性能参数之和的改变而改变,如系统性能参数之和增大较快,则增大W ps,系统性能参数之和增大较慢,则减小W ps,如此,结合系统性能参数之和灵活调整所选节点设备对应的请求路径的请求量,在系统性能参数之和越大的情况下,减少这个请求路径的请求量,在系统性能参数之和越小的情况下,增加这个请求路径的请求量,确保实现整体性能最优。 That is to say, in the calculation formula of the routing performance parameter R of this application, W ps is a variable, and W ps changes with the change of the sum of the system performance parameters. If the sum of the system performance parameters increases quickly, then increase W ps , the sum of system performance parameters increases slowly, then reduce W ps , so, combined with the sum of system performance parameters, flexibly adjust the request amount of the request path corresponding to the selected node device, when the sum of system performance parameters is larger Next, reduce the request volume of this request path. When the sum of system performance parameters is smaller, increase the request volume of this request path to ensure the optimal overall performance.

在一个可实现的基于微服务的智能路由场景中,参照图5所示,假设微服务整体流程分 为以下4个必经微服务系统,微服务系统A、微服务系统B、微服务系统C和微服务系统D,每一微服务系统有3个不同互联网协议地址(Internet Protocol Address,IP)的节点设备,则完成一次完整消息路由的路线共可以有

Figure PCTCN2022097857-appb-000002
种,基于本申请提供的方法,可以在81条路线中动态找到性能最佳的路由路线。 In a realizable microservice-based intelligent routing scenario, as shown in Figure 5, it is assumed that the overall microservice process is divided into the following four necessary microservice systems, microservice system A, microservice system B, and microservice system C And microservice system D, each microservice system has 3 node devices with different Internet Protocol Address (IP), then there can be a total of routes for completing a complete message routing
Figure PCTCN2022097857-appb-000002
Based on the method provided by this application, the routing route with the best performance can be dynamically found among 81 routes.

首先,是确认单个微服务系统中性能影响因素即处理器使用率、内存使用率、队列深度和连接数的各自权重,可以根据微服务系统实际需要设定。First of all, it is to confirm the respective weights of the performance influencing factors in a single microservice system, that is, processor usage, memory usage, queue depth, and number of connections, which can be set according to the actual needs of the microservice system.

其次,仍旧按照一个系统中有3个IP节点设备节点计算,参照图5所示,A系统有a1、a2、a3共3个节点设备,A系统各节点设备的性能影响因素有如下四个:CPU使用率、内存使用率、队列深度和连接数,包含这个4个因子的系统性能参数计算公式如下:Secondly, the calculation is still based on the fact that there are 3 IP node devices in a system. Referring to Figure 5, system A has a total of 3 node devices a1, a2, and a3. The performance influencing factors of each node device in system A are as follows: CPU usage, memory usage, queue depth, and number of connections, the calculation formula of system performance parameters including these four factors is as follows:

Figure PCTCN2022097857-appb-000003
Figure PCTCN2022097857-appb-000003

由上述公式可知,计算出来的PS值越小,则节点设备的性能越佳。每个节点设备,由于功能性不同,所以对最大连接数和最大队列深度可能有不同的设定,对CPU和内存的要求也不一定完全相同,因此每个系统可以按上面的公式,根据系统的功能性要求,自定义的设置权重的分配比例,使结果更为精确。It can be seen from the above formula that the smaller the calculated PS value is, the better the performance of the node device is. Each node device, due to its different functionality, may have different settings for the maximum number of connections and maximum queue depth, and the requirements for CPU and memory may not be exactly the same, so each system can use the above formula, according to the system According to the functional requirements, the distribution ratio of the custom setting weight makes the result more accurate.

然后,依次计算全部12个节点的所有PS值,整体的路由性能计算公式是结合了P95平均请求耗时和路由中经过的所有系统下的各节点设备的PS之和计算的,公式如下:Then, calculate all the PS values of all 12 nodes in turn. The overall routing performance calculation formula is calculated by combining the P95 average request time consumption and the sum of PS of each node device under all systems passing through the route. The formula is as follows:

R=W T×T p95+W ps×(PS A+PS B+PS C+PS D); R=W T ×T p95 +W ps ×(PS A +PS B +PS C +PS D );

其中,PS A表征A系统下所选节点设备的系统性能参数,PS B表征B系统下所选节点设备的系统性能参数,PS C表征C系统下所选节点设备的系统性能参数,PS D表征D系统下所选节点设备的系统性能参数。 Among them, PS A represents the system performance parameters of the selected node devices in system A, PS B represents the system performance parameters of selected node devices in system B, PS C represents the system performance parameters of selected node devices in system C, and PS D represents System performance parameters of the selected node devices under the D system.

最后,上述公式的各个参数都确定后,就可以由配置中心计算上述81种路径的R值。Finally, after all the parameters of the above formula are determined, the configuration center can calculate the R values of the above 81 paths.

本申请其他实施例中,在一个实现负载均衡的场景中,步骤S204若接收到多个服务请求,基于路由性能参数,确定多个服务请求对应的路由路径,可以通过如下步骤实现:In other embodiments of the present application, in a scenario where load balancing is implemented, if multiple service requests are received in step S204, based on routing performance parameters, the routing path corresponding to multiple service requests can be determined, which can be achieved through the following steps:

C11,为多个微服务系统下,不同路径对应的所选节点设备的路由性能参数,设置请求数量权重参数;C11, set the request quantity weight parameter for the routing performance parameters of the selected node devices corresponding to different paths under multiple microservice systems;

C12,若接收到多个服务请求,基于请求数量权重参数和多个服务请求的请求数量,确定多个服务请求对应的路由路径。C12. If multiple service requests are received, determine routing paths corresponding to the multiple service requests based on the request quantity weight parameter and the request quantity of the multiple service requests.

基于前述的可实现的基于微服务的智能路由场景,在得到各个路径对应的R值的情况下,还可以按由小到大进行排序,进而配置中心可以按照提前预设好的请求数量权重,在服务请 求到来时,合理分配请求数量。Based on the aforementioned achievable smart routing scenarios based on microservices, in the case of obtaining the R value corresponding to each path, it can also be sorted from small to large, and then the configuration center can weight the number of requests preset in advance. When service requests come, allocate the number of requests reasonably.

例如,A1-B1-C1-D1的路径R值最小,系统可设置请求数量权重为0.4,A2-B2-C2-D2路径R值排名第二设置请求数量权重为0.3,A3-B3-C3-D3路径R值排名第三可以设置请求数量权重为0.2,A4-B4-C4-D4路径R值排名第四设置请求数量权重为0.1。进一步地,在服务请求发起时就可以按照权重相应分配请求路由。For example, the path R value of A1-B1-C1-D1 is the smallest, the system can set the weight of the number of requests to 0.4, the path R value of A2-B2-C2-D2 ranks second, set the weight of the number of requests to 0.3, and the weight of A3-B3-C3- If the R value of the D3 path ranks third, the weight of the number of requests can be set to 0.2, and the R value of the path A4-B4-C4-D4 ranks fourth, and the weight of the number of requests can be set to 0.1. Furthermore, when a service request is initiated, the request route can be allocated according to the weight.

示例性的,当配置中心收到1000条服务请求时,基于前述设置的请求数量权重参数和多个服务请求的请求数量1000,确定A1-B1-C1-D1共路由400笔,A2-B2-C2-D2共路由300笔,A3-B3-C3-D3共路由200笔,A4-B4-C4-D4共路由100笔。等下个周期再按照这个周期计算出的R值,重新分配新的排名前四位的请求路由权重,实时基于前一周期的相关参数,动态调整下一周期的请求路由路径。当然,还可以选择排名前五位的路径,本申请对此不做具体地限定。Exemplarily, when the configuration center receives 1000 service requests, based on the previously set request quantity weight parameter and the request quantity of multiple service requests of 1000, it is determined that A1-B1-C1-D1 has a total of 400 routes, A2-B2- C2-D2 has a total of 300 routes, A3-B3-C3-D3 has a total of 200 routes, and A4-B4-C4-D4 has a total of 100 routes. Wait for the next cycle and redistribute the new top four request routing weights according to the R value calculated in this cycle, and dynamically adjust the request routing path for the next cycle in real time based on the relevant parameters of the previous cycle. Of course, the top five paths may also be selected, which is not specifically limited in this application.

需要说明的是,在实际分配时,除了R值特别大已经超出合理值范围的不合理路径,应该被隔离之外,请求调用量比较大的情况下,应该尽量在有所侧重的同时,相对分散,以达到负载均衡的目的。本申请中关于A系统下节点设备的表示,在A系统下有3个节点设备时,用a1、a2、a3表征各个节点设备,A系统下有4个节点设备时,用上述的A1、A2、A3、A4表征各个节点设备,不同的指代标识只是便于描述。It should be noted that in the actual allocation, except for the unreasonable paths whose R value is too large and exceeds the reasonable value range, they should be isolated. Distributed to achieve the purpose of load balancing. Regarding the representation of node devices under A system in this application, when there are 3 node devices under A system, use a1, a2, and a3 to represent each node device; when there are 4 node devices under A system, use the above-mentioned A1, A2 , A3, and A4 represent each node device, and the different designations are only for convenience of description.

由上述实施例可知,本申请提供的基于微服务的智能路由方法,可以做到按照系统实际的部署情况智能且动态的提供请求路径。根据服务的请求数量,各系统可能被调用的几率,及时去修改对应的权重,下个周期就能应用到路径的收集和计算中,十分方便快捷。It can be seen from the above embodiments that the microservice-based intelligent routing method provided by the present application can intelligently and dynamically provide request paths according to the actual deployment of the system. According to the number of service requests and the probability that each system may be called, modify the corresponding weight in time, and it can be applied to the collection and calculation of the path in the next cycle, which is very convenient and fast.

本申请其他实施例中,在一个实现负载均衡且时效性要求较高的场景中,步骤S204若接收到多个服务请求,基于路由性能参数,确定多个服务请求对应的路由路径,可以通过如下步骤实现:In other embodiments of the present application, in a scenario that implements load balancing and requires high timeliness, if multiple service requests are received in step S204, based on routing performance parameters, the routing path corresponding to multiple service requests can be determined through the following Steps to achieve:

D11,若接收到多个服务请求,确定不同路径对应的所选节点设备所属互联网数据中心标识;这里,互联网数据中心标识用于确定各路径中所选的节点设备是否属于同一互联网数据中心(Internet Data Center,IDC)如同一机房。D11, if multiple service requests are received, determine the ID of the Internet data center to which the selected node devices corresponding to different paths belong; here, the ID of the Internet data center is used to determine whether the node devices selected in each path belong to the same Internet data center (Internet Data Center, IDC) is like a computer room.

D12,从不同路径对应的所选节点设备的路由性能参数中,筛选出至少一个目标路径对应的所选节点设备的目标路由性能参数,其中,目标路径对应的所选节点设备中至少两个设备具有同一互联网数据中心标识;D12, from the routing performance parameters of the selected node devices corresponding to different paths, select the target routing performance parameters of the selected node devices corresponding to at least one target path, wherein at least two of the selected node devices corresponding to the target path have the same Internet data center logo;

也就是说,该实施例中,在步骤S203基于系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,多个微服务系统下的所选节点设备的路由性能参数的情况下,基于节点设备是否部署在同一个IDC这一条件,筛选出至少一个目标路径对应的所选 节点设备的目标路由性能参数,即所选的路由路径中的所选节点设备中至少两个设备具有同一互联网数据中心标识,如此,以节省路由时间。That is to say, in this embodiment, in step S203, based on system performance parameters and statistical service request time consumption, the routing performance of selected node devices under multiple microservice systems is predicted when the routing process passes through multiple microservice systems In the case of parameters, based on the condition of whether the node devices are deployed in the same IDC, filter out the target routing performance parameters of the selected node devices corresponding to at least one target path, that is, at least one of the selected node devices in the selected routing path Both devices have the same Internet data center identity, so to save routing time.

D13,基于目标路由性能参数,确定多个服务请求对应的路由路径。D13. Determine routing paths corresponding to multiple service requests based on the target routing performance parameters.

由上述实施例可知,在微服务系统间调用时可以判断节点设备是否部署在同一个IDC。也就是说,配置中心在确定路由路径的过程中,可以优先选取同IDC内部署的节点设备,再根据本申请的基于微服务的智能路由方法选取服务。It can be seen from the above embodiments that it can be determined whether the node devices are deployed in the same IDC when calling between microservice systems. That is to say, in the process of determining the routing path, the configuration center can preferentially select node devices deployed in the IDC, and then select services according to the intelligent routing method based on microservices of this application.

在本申请其他实施例中,如果CPU和内存等配置足够高,配置中心评估后认为在系统运行之初,可以暂时不用考虑这个因素;当然,配置中心在系统运行之初,也可以先去掉同一个IDC这个影响因子,等待系统运行一端时间后内存开始成为限制性能的一个方面,再加入同一个IDC这一因素作为更高优先级的参考因素,并结合筛选出的路径的路由性能参数,共同进行实时路由路径的调整。In other embodiments of the present application, if the CPU and memory configurations are high enough, the configuration center evaluates that this factor may not be considered at the beginning of the system operation; of course, the configuration center may also remove the same The impact factor of an IDC, after waiting for the system to run for a period of time, the memory begins to become an aspect that limits performance, and then add the same IDC factor as a higher priority reference factor, combined with the routing performance parameters of the selected path, together Perform real-time routing path adjustments.

这里,针对本申请的微服务架构,结合图6所示,对微服务调节流程进行说明,微服务架构包括作为配置中心的服务器、注册中心和多个微服务系统。注册中心包含所有提供给服务的系统注册的服务,各个系统提供的服务可以不完全相同;配置中心可以从注册中心读取注册的全部服务。针对不同的微服务系统,其提供的服务可能需要调用下游微服务系统。例如,微服务系统A提供的服务可能需要调用下游微服务系统B、微服务系统C、微服务系统D;微服务系统B提供的服务可能需要调用下游微服务系统C、微服务系统D;微服务系统C提供的服务可能需要调用下游微服务系统D。本申请在确定路由路径的过程中,配置中心充分收集了各个微服务系统下所有节点设备的相关信息如处理器使用率、内存使用率、队列深度和连接数,以确保后续不同路径之间的路由性能排序更加准确全面。进一步地,配置中心基于节点设备反馈的相关信息和统计的服务请求耗时,统计计算路由路径排序,并且反馈给下游系统路由路径。需要说明的是,本申请各个微服务系统与配置中心之间,配置中心每个周期收集现有请求的全部路由信息,等待下个周期再将分析的结果投入具体的路由调度。以此循环,以达到相对实时、动态调整路由的目的。例如,参照图6所示,在微服务系统A接收配置中心反馈的路由路径后,执行路由过程,并且微服务系统A将实际的路由记录一并反馈给配置中心,如此,配置中心可以得到真实的微服务系统的路由情况作为下一次分析的参考。Here, for the microservice architecture of the present application, the microservice adjustment process is described in conjunction with the diagram shown in FIG. 6 . The microservice architecture includes a server as a configuration center, a registration center, and multiple microservice systems. The registration center contains all the services registered by the system provided to the service, and the services provided by each system may not be exactly the same; the configuration center can read all registered services from the registration center. For different microservice systems, the services they provide may need to call downstream microservice systems. For example, the service provided by microservice system A may need to call downstream microservice system B, microservice system C, and microservice system D; the service provided by microservice system B may need to call downstream microservice system C and microservice system D; The service provided by service system C may need to call the downstream microservice system D. In the process of determining the routing path in this application, the configuration center has fully collected the relevant information of all node devices under each microservice system, such as processor usage, memory usage, queue depth, and number of connections, to ensure the subsequent routing between different paths. Routing performance sorting is more accurate and comprehensive. Furthermore, based on the relevant information fed back by the node device and the statistical service request time-consuming, the configuration center statistically calculates the ranking of routing paths, and feeds back the routing paths to the downstream system. It should be noted that, between the various microservice systems and the configuration center in this application, the configuration center collects all routing information of existing requests every cycle, and waits for the next cycle to put the analysis results into specific routing scheduling. This cycle is used to achieve the purpose of relatively real-time and dynamic routing adjustment. For example, as shown in Figure 6, after microservice system A receives the routing path fed back by the configuration center, it executes the routing process, and microservice system A feeds back the actual routing records to the configuration center, so that the configuration center can get the real The routing situation of the microservice system is used as a reference for the next analysis.

本申请其他实施例中,在一个实现针对服务请求的属性进行智能路由的场景中,步骤S204若接收到多个服务请求,基于路由性能参数,确定多个服务请求对应的路由路径,可以通过如下步骤E11至步骤E12或者,步骤E11、步骤E13至步骤E15实现:In other embodiments of the present application, in a scenario where intelligent routing is performed on attributes of service requests, if multiple service requests are received in step S204, based on routing performance parameters, the routing paths corresponding to multiple service requests can be determined through the following Step E11 to step E12 or, step E11, step E13 to step E15 realize:

E11,若接收到多个服务请求,获取多个服务请求的时效信息和/或请求数量;这里,时效信息用于指示服务请求对时效性的要求。例如,同步服务请求和异步服务请求具有不同的 时效信息,而且同步服务请求的时效信息相比异步服务请求的时效信息,对时效性的要求更高。E11, if multiple service requests are received, acquire the timeliness information and/or request quantity of the multiple service requests; here, the timeliness information is used to indicate the timeliness requirements of the service requests. For example, synchronous service requests and asynchronous service requests have different timeliness information, and the timeliness information of synchronous service requests has higher requirements on timeliness than the timeliness information of asynchronous service requests.

E12,若多个服务请求中存在部分服务请求的时效信息符合时效条件,和/或多个服务请求的请求数量大于阈值数量,基于路由性能参数,确定部分服务请求对应的路由路径。E12, if the timeliness information of some service requests in the multiple service requests meets the timeliness condition, and/or the number of requests for multiple service requests is greater than the threshold number, based on the routing performance parameters, determine the routing path corresponding to the part of the service requests.

也就是说,本申请对于时效性要求较高的服务请求,基于本申请提供的基于微服务的智能路由方法,基于路由性能参数,确定部分服务请求即时效性要求较高的请求对应的路由路径;和/或请求量达到阈值数量的场景,基于路由性能参数,确定部分服务请求即所有服务请求中的一部分请求对应的路由路径,从而及时确定适合当前微服务架构的路由方案。这里,针对服务请求的属性如请求量进行智能路由的场景中,对于请求量达到阈值数量的场景,触发本申请提供的智能路径的确定方案,对于请求量未达到阈值数量的场景,可以仍旧采用随机路由的方案,如此,可以减少计算量,提高服务请求的整体处理效率。That is to say, for service requests with high timeliness requirements, based on the microservice-based intelligent routing method provided by this application, and based on routing performance parameters, the routing paths corresponding to some service requests with high timeliness requirements are determined. ; and/or in the scenario where the amount of requests reaches the threshold number, based on the routing performance parameters, determine the routing path corresponding to some service requests, that is, a part of all service requests, so as to timely determine a routing solution suitable for the current microservice architecture. Here, in the scenario of intelligent routing based on the attributes of service requests, such as the request volume, for the scenario where the request volume reaches the threshold number, trigger the smart path determination scheme provided by this application, and for the scenario where the request volume does not reach the threshold number, you can still use The random routing scheme, in this way, can reduce the amount of computation and improve the overall processing efficiency of service requests.

E13,针对多个服务请求中的剩余服务请求,对剩余服务请求中的每一请求的主键字段进行哈希计算得到哈希值;E13, for the remaining service requests in the multiple service requests, perform hash calculation on the primary key field of each request in the remaining service requests to obtain a hash value;

这里,在部分服务请求为时效性要求较高的请求时,剩余服务请求包括时效性要求较低的请求。在部分服务请求为所有服务请求中的一部分请求时,剩余服务请求包括所有服务请求中的剩余请求。需要说明的是,本申请针对剩余服务请求,采用随机算法,确定路由路径,从而减少计算量,提高所有服务请求的整体处理效率。Here, when some service requests are requests with higher timeliness requirements, the remaining service requests include requests with lower timeliness requirements. When the partial service request is a part of all service requests, the remaining service requests include the rest of all service requests. It should be noted that, for the remaining service requests, this application uses a random algorithm to determine the routing path, thereby reducing the amount of calculation and improving the overall processing efficiency of all service requests.

E14,通过哈希值对微服务系统m下的所有节点设备的数量进行取模运算,得到取模结果;E14, perform a modulo operation on the number of all node devices under the microservice system m through the hash value, and obtain a modulo result;

E15,基于取模结果,将每一请求发送至对应的节点设备。E15. Send each request to the corresponding node device based on the modulus result.

本申请实施例中,采用随机算法的过程中,随机算法包括哈希(hash)取模算法,即对hash结果取余数hash()mod n,通过对节点设备编号从0到n-1,按照自定义的hash()算法,对每个请求的hash()值按n取模,得到余数i,然后将请求分发到编号为i的节点设备。In the embodiment of the present application, in the process of adopting the random algorithm, the random algorithm includes a hash (hash) modulo algorithm, that is, the remainder hash() mod n is taken for the hash result, and the node equipment is numbered from 0 to n-1 according to The custom hash() algorithm moduloes the hash() value of each request by n to obtain the remainder i, and then distributes the request to the node device numbered i.

由上述实施例可知,对有时效性要求的服务请求来说,智能路由算法的作用相对更明显,最优路径和排序相对靠前的路径,可以明显减少请求到收到处理完成消息的时间。对于同步请求来说,本申请提供的基于微服务的智能路由方法,也可以在一定程度上反映服务的处理能力。It can be seen from the above embodiments that for service requests requiring timeliness, the role of the intelligent routing algorithm is relatively more obvious. The optimal path and the relatively high-ranked path can significantly reduce the time from the request to the receipt of the processing completion message. For synchronous requests, the intelligent routing method based on microservices provided by this application can also reflect the processing capabilities of services to a certain extent.

下面继续说明本申请实施例提供的基于微服务的路由装置154实施为软件模块的示例性结构,在一些实施例中,如图1所示,存储在存储器150的基于微服务的路由装置154中的软件模块可以是服务器100中的基于微服务的路由装置,包括:The following continues to describe the exemplary structure in which the microservice-based routing device 154 provided by the embodiment of the present application is implemented as a software module. In some embodiments, as shown in FIG. The software module may be a microservice-based routing device in the server 100, including:

获取模块1541,用于获取微服务系统m下的节点设备n的处理器使用率、内存使用率、 队列深度和连接数,其中,m和n为大于等于2的正整数,队列深度表征预设的节点设备n处理请求的处理性能,连接数表征节点设备n的端口所支持的对外连接数;The obtaining module 1541 is used to obtain the processor usage rate, memory usage rate, queue depth and connection number of the node device n under the microservice system m, where m and n are positive integers greater than or equal to 2, and the queue depth represents a preset The processing performance of the node device n processing the request, the number of connections represents the number of external connections supported by the port of the node device n;

处理模块1542,用于基于处理器使用率、内存使用率、队列深度和连接数,确定节点设备n的系统性能参数;A processing module 1542, configured to determine system performance parameters of node device n based on processor usage, memory usage, queue depth, and number of connections;

处理模块1542,用于基于系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,多个微服务系统下的所选节点设备的路由性能参数;The processing module 1542 is used to predict the routing performance parameters of the selected node devices under the multiple micro-service systems when the routing process passes through multiple micro-service systems based on system performance parameters and statistical service request time;

处理模块1542,用于若接收到多个服务请求,基于路由性能参数,确定多个服务请求对应的路由路径。The processing module 1542 is configured to determine routing paths corresponding to multiple service requests based on routing performance parameters if multiple service requests are received.

在一些实施例中,处理模块1542,用于分别为处理器使用率、内存使用率、队列深度和连接数配置权重参数;将处理器使用率、内存使用率、队列深度、连接数、各个权重参数、节点设备n的阈值深度以及阈值连接数代入如下计算公式,计算节点设备n的系统性能参数,节点设备n的系统性能参数表征为PS:In some embodiments, the processing module 1542 is configured to configure weight parameters for processor usage, memory usage, queue depth and connection number respectively; processor usage, memory usage, queue depth, connection number, each weight The parameters, the threshold depth of node device n, and the threshold number of connections are substituted into the following calculation formula to calculate the system performance parameters of node device n. The system performance parameters of node device n are represented by PS:

Figure PCTCN2022097857-appb-000004
Figure PCTCN2022097857-appb-000004

其中,处理器使用率表征为pct cpu、pct cpu对应的权重参数为W cpu,内存使用率表征为pct 内存、pct 内存对应的权重参数为W 内存,队列深度对应的权重参数为W 队列深度,连接数对应的权重参数为W 连接数Among them, the processor usage is characterized by pct cpu , the weight parameter corresponding to pct cpu is W cpu , the memory usage is represented by pct memory , the weight parameter corresponding to pct memory is W memory , and the weight parameter corresponding to the queue depth is W queue depth , The weight parameter corresponding to the number of connections is the number of W connections .

在一些实施例中,处理模块1542,用于分别为多个微服务系统下的所选节点设备的系统性能参数之和、统计的服务请求耗时配置权重参数;将系统性能参数之和、统计的服务请求耗时以及各个权重参数代入如下计算公式,预测路由性能参数,路由性能参数表征为R:In some embodiments, the processing module 1542 is configured to respectively configure the weight parameters for the sum of system performance parameters and statistical service request time consumption of selected node devices under multiple microservice systems; the sum of system performance parameters, statistical Substituting the service request time and each weight parameter into the following calculation formula to predict the routing performance parameters, the routing performance parameters are represented by R:

R=W T×T+W ps×(PS 1+PS 2+PS 3+......PS i+......+PS N); R=W T ×T+W ps ×(PS 1 +PS 2 +PS 3 +...PS i +...+PS N );

其中,统计的服务请求耗时表征为T、对应的权重参数为W T,多个微服务系统的总数为N,任一微服务系统下所选节点设备的系统性能参数表征为PS i,系统性能参数之和对应的权重参数为W ps,i的取值范围为大于0且小于等于N的正整数。 Among them, the statistical service request time consumption is represented by T, the corresponding weight parameter is W T , the total number of multiple microservice systems is N, and the system performance parameters of selected node devices under any microservice system are represented by PS i , the system The weight parameter corresponding to the sum of the performance parameters is W ps , and the value range of i is a positive integer greater than 0 and less than or equal to N.

在一些实施例中,处理模块1542,用于为多个微服务系统下,不同路径对应的所选节点设备的路由性能参数,设置请求数量权重参数;若接收到多个服务请求,基于请求数量权重参数和多个服务请求的请求数量,确定多个服务请求对应的路由路径。In some embodiments, the processing module 1542 is configured to set the request quantity weight parameter for the routing performance parameters of the selected node devices corresponding to different paths under multiple microservice systems; if multiple service requests are received, based on the request quantity The weight parameter and the number of requests for multiple service requests determine the routing paths corresponding to multiple service requests.

在一些实施例中,处理模块1542,用于若接收到多个服务请求,确定不同路径对应的所选节点设备所属互联网数据中心标识;从不同路径对应的所选节点设备的路由性能参数中,筛选出至少一个目标路径对应的所选节点设备的目标路由性能参数,其中,目标路径对应的 所选节点设备中至少两个设备具有同一互联网数据中心标识;基于目标路由性能参数,确定多个服务请求对应的路由路径。In some embodiments, the processing module 1542 is configured to, if multiple service requests are received, determine the identifier of the Internet data center to which the selected node devices corresponding to different paths belong; from the routing performance parameters of the selected node devices corresponding to different paths, Screen out the target routing performance parameters of the selected node devices corresponding to at least one target path, wherein at least two of the selected node devices corresponding to the target path have the same Internet data center identifier; based on the target routing performance parameters, determine multiple service The routing path corresponding to the request.

在一些实施例中,获取模块1541,用于若接收到多个服务请求,获取多个服务请求的时效信息和/或请求数量;处理模块1542,用于若多个服务请求中存在部分服务请求的时效信息符合时效条件,和/或多个服务请求的请求数量大于阈值数量,基于路由性能参数,确定部分服务请求对应的路由路径。In some embodiments, the obtaining module 1541 is configured to obtain the timeliness information and/or request quantity of multiple service requests if multiple service requests are received; the processing module 1542 is configured to obtain partial service requests among the multiple service requests The timeliness information of the timeliness meets the timeliness condition, and/or the number of requests for multiple service requests is greater than the threshold number, based on the routing performance parameters, determine the routing path corresponding to some service requests.

在一些实施例中,处理模块1542,用于针对多个服务请求中的剩余服务请求,对剩余服务请求中的每一请求的主键字段进行哈希计算得到哈希值;通过哈希值对微服务系统m下的所有节点设备的数量进行取模运算,得到取模结果;基于取模结果,将每一请求发送至对应的节点设备。In some embodiments, the processing module 1542 is configured to, for the remaining service requests among the plurality of service requests, perform hash calculation on the primary key field of each request in the remaining service requests to obtain a hash value; The number of all node devices under the service system m is subjected to a modulo calculation to obtain a modulo result; based on the modulo result, each request is sent to the corresponding node device.

本申请提供的微服务的路由装置,通过获取微服务系统m下的节点设备n的处理器使用率、内存使用率、队列深度和连接数,其中,m和n为大于等于2的正整数,队列深度表征预设的节点设备n处理请求的处理性能,连接数表征节点设备n的端口所支持的对外连接数;基于处理器使用率、内存使用率、队列深度和连接数,确定节点设备n的系统性能参数;基于系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,多个微服务系统下的所选节点设备的路由性能参数;若接收到多个服务请求,基于路由性能参数,确定多个服务请求对应的路由路径;也就是说,本申请收集实际路由中影响性能的如下参数处理器使用率、内存使用率、队列深度、连接数和统计的服务请求耗时进行分析,实现对请求路径中各个微服务系统下的节点设备的相关信息的收集和分析,进而,在后续服务请求到来时,将分析结果投入路由调度,实现动态调整路由路径,优化整体服务调用时间。The microservice routing device provided by the present application obtains the processor usage rate, memory usage rate, queue depth and connection number of the node device n under the microservice system m, wherein m and n are positive integers greater than or equal to 2, The queue depth represents the processing performance of the preset node device n processing requests, and the number of connections represents the number of external connections supported by the port of the node device n; based on the processor usage, memory usage, queue depth and the number of connections, the node device n is determined system performance parameters; based on system performance parameters and statistical service request time-consuming, predict the routing performance parameters of selected node devices under multiple micro-service systems when the routing process passes through multiple micro-service systems; if multiple Service requests, based on routing performance parameters, determine the routing paths corresponding to multiple service requests; that is, this application collects the following parameters that affect performance in actual routing Processor usage, memory usage, queue depth, number of connections, and statistics Time-consuming analysis of service requests enables the collection and analysis of relevant information about node devices under each micro-service system in the request path. Then, when subsequent service requests arrive, the analysis results are put into routing scheduling to realize dynamic adjustment of routing paths. Optimize the overall service call time.

需要说明的是,本申请实施例装置的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果,因此不做赘述。对于本装置实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。It should be noted that the description of the device in the embodiment of the present application is similar to the description of the above-mentioned method embodiment, and has similar beneficial effects to the method embodiment, so details are not repeated here. For the technical details not disclosed in the device embodiment of this application, please refer to the description of the method embodiment of this application for understanding.

本申请实施例提供一种存储有可执行指令的存储介质,其中存储有可执行指令,当可执行指令被处理器执行时,将引起处理器执行本申请实施例提供的方法,例如,如图2示出的方法。The embodiment of the present application provides a storage medium storing executable instructions, and the executable instruction is stored therein. When the executable instruction is executed by the processor, it will cause the processor to execute the method provided in the embodiment of the present application, for example, as shown in FIG. 2 shows the method.

本申请提供的存储介质,通过获取微服务系统m下的节点设备n的处理器使用率、内存使用率、队列深度和连接数,其中,m和n为大于等于2的正整数,队列深度表征预设的节点设备n处理请求的处理性能,连接数表征节点设备n的端口所支持的对外连接数;基于处理器使用率、内存使用率、队列深度和连接数,确定节点设备n的系统性能参数;基于系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,多个微服务系统 下的所选节点设备的路由性能参数;若接收到多个服务请求,基于路由性能参数,确定多个服务请求对应的路由路径;也就是说,本申请收集实际路由中影响性能的如下参数处理器使用率、内存使用率、队列深度、连接数和统计的服务请求耗时进行分析,实现对请求路径中各个微服务系统下的节点设备的相关信息的收集和分析,进而,在后续服务请求到来时,将分析结果投入路由调度,实现动态调整路由路径,优化整体服务调用时间。The storage medium provided by this application obtains the processor usage rate, memory usage rate, queue depth and connection number of the node device n under the microservice system m, where m and n are positive integers greater than or equal to 2, and the queue depth represents The preset processing performance of node device n processing requests, the number of connections represents the number of external connections supported by the port of node device n; based on processor usage, memory usage, queue depth and number of connections, determine the system performance of node device n Parameters; based on system performance parameters and statistical service request time-consuming, predict routing performance parameters of selected node devices under multiple micro-service systems when passing through multiple micro-service systems in the routing process; if multiple service requests are received, Based on routing performance parameters, determine the routing paths corresponding to multiple service requests; that is, this application collects the following parameters that affect performance in actual routing: processor usage, memory usage, queue depth, number of connections, and statistical service request consumption Real-time analysis to realize the collection and analysis of relevant information of node devices under each micro-service system in the request path, and then, when subsequent service requests arrive, put the analysis results into routing scheduling, realize dynamic adjustment of routing paths, and optimize overall services call time.

在一些实施例中,存储介质可以是计算机可读存储介质,例如,铁电存储器(FRAM,Ferromagnetic Random Access Memory)、只读存储器(ROM,Read Only Memory)、可编程只读存储器(PROM,Programmable Read Only Memory)、可擦除可编程只读存储器(EPROM,Erasable Programmable Read Only Memory)、带电可擦可编程只读存储器(EEPROM,Electrically Erasable Programmable Read Only Memory)、闪存、磁表面存储器、光盘、或光盘只读存储器(CD-ROM,Compact Disk-Read Only Memory)等存储器;也可以是包括上述存储器之一或任意组合的各种设备。In some embodiments, the storage medium can be a computer-readable storage medium, for example, a ferroelectric memory (FRAM, Ferromagnetic Random Access Memory), a read-only memory (ROM, Read Only Memory), a programmable read-only memory (PROM, Programmable Read Only Memory), Erasable Programmable Read Only Memory (EPROM, Erasable Programmable Read Only Memory), Electrically Erasable Programmable Read Only Memory (EEPROM, Electrically Erasable Programmable Read Only Memory), flash memory, magnetic surface memory, optical disc, Or memory such as CD-ROM (Compact Disk-Read Only Memory); It can also be various devices including one or any combination of the above-mentioned memories.

在一些实施例中,可执行指令可以采用程序、软件、软件模块、脚本或代码的形式,按任意形式的编程语言(包括编译或解释语言,或者声明性或过程性语言)来编写,并且其可按任意形式部署,包括被部署为独立的程序或者被部署为模块、组件、子例程或者适合在计算环境中使用的其它单元。In some embodiments, executable instructions may take the form of programs, software, software modules, scripts, or code written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages, and its Can be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

作为示例,可执行指令可以但不一定对应于文件系统中的文件,可以可被存储在保存其它程序或数据的文件的一部分,例如,存储在超文本标记语言(超文本标记语言,Hyper Text Markup Language)文档中的一个或多个脚本中,存储在专用于所讨论的程序的单个文件中,或者,存储在多个协同文件(例如,存储一个或多个模块、子程序或代码部分的文件)中。作为示例,可执行指令可被部署为在一个计算设备上执行,或者在位于一个地点的多个计算设备上执行,又或者,在分布在多个地点且通过通信网络互连的多个计算设备上执行。As an example, executable instructions may, but do not necessarily correspond to files in a file system, may be stored as part of a file that holds other programs or data, for example, in Hyper Text Markup Language (HTML, Hyper Text Markup Language) in one or more scripts in a document, in a single file dedicated to the program in question, or in multiple cooperating files (for example, a file that stores one or more modules, subroutines, or code sections )middle. As an example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or alternatively, on multiple computing devices distributed across multiple sites and interconnected by a communication network. to execute.

以上所述,仅为本申请的实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和范围之内所作的任何修改、等同替换和改进等,均包含在本申请的保护范围之内。The above descriptions are merely examples of the present application, and are not intended to limit the protection scope of the present application. Any modifications, equivalent replacements and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

工业实用性Industrial Applicability

本申请实施例所提供的基于微服务的路由方法、装置、设备及存储介质,通过获取微服务系统m下的节点设备n的处理器使用率、内存使用率、队列深度和连接数,其中,m和n为大于等于2的正整数,队列深度表征预设的节点设备n处理请求的处理性能,连接数表征节点设备n的端口所支持的对外连接数;基于处理器使用率、内存使用率、队列深度和连接数,确定节点设备n的系统性能参数;基于系统性能参数和统计的服务请求耗时,预测路由 过程中经过多个微服务系统时,多个微服务系统下的所选节点设备的路由性能参数;若接收到多个服务请求,基于路由性能参数,确定多个服务请求对应的路由路径;也就是说,本申请实施例收集实际路由中影响性能的如下参数处理器使用率、内存使用率、队列深度、连接数和统计的服务请求耗时进行分析,实现对请求路径中各个微服务系统下的节点设备的相关信息的收集和分析,进而,在后续服务请求到来时,将分析结果投入路由调度,实现动态调整路由路径,优化整体服务调用时间。The microservice-based routing method, device, device, and storage medium provided in the embodiments of the present application obtain the processor usage rate, memory usage rate, queue depth, and connection number of node device n under the microservice system m, wherein, m and n are positive integers greater than or equal to 2, the queue depth represents the processing performance of the preset node device n processing requests, and the number of connections represents the number of external connections supported by the port of the node device n; based on processor usage and memory usage , queue depth and number of connections to determine the system performance parameters of the node device n; based on the system performance parameters and statistical service request time-consuming, when the routing process passes through multiple micro-service systems, the selected nodes under multiple micro-service systems The routing performance parameters of the device; if multiple service requests are received, based on the routing performance parameters, determine the routing path corresponding to the multiple service requests; that is to say, the embodiment of the present application collects the following parameters that affect performance in actual routing Processor usage rate , memory usage, queue depth, number of connections, and statistical service request time-consuming analysis, to realize the collection and analysis of relevant information of node devices under each micro-service system in the request path, and then, when subsequent service requests arrive, Put the analysis results into routing scheduling, realize dynamic adjustment of routing paths, and optimize the overall service call time.

Claims (10)

一种基于微服务的路由方法,包括:A microservice-based routing approach that includes: 获取微服务系统m下的节点设备n的处理器使用率、内存使用率、队列深度和连接数,其中,所述m和所述n为大于等于2的正整数,所述队列深度表征预设的所述节点设备n处理请求的处理性能,所述连接数表征所述节点设备n的端口所支持的对外连接数;Obtain the processor usage, memory usage, queue depth and number of connections of the node device n under the microservice system m, wherein, the m and the n are positive integers greater than or equal to 2, and the queue depth represents a preset The processing performance of the processing request of the node device n, the number of connections represents the number of external connections supported by the port of the node device n; 基于所述处理器使用率、内存使用率、队列深度和连接数,确定所述节点设备n的系统性能参数;Determine system performance parameters of the node device n based on the processor usage, memory usage, queue depth, and number of connections; 基于所述系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,所述多个微服务系统下的所选节点设备的路由性能参数;Predicting the routing performance parameters of the selected node devices under the multiple micro-service systems when the routing process passes through multiple micro-service systems based on the system performance parameters and the statistical time-consuming service requests; 若接收到多个服务请求,基于所述路由性能参数,确定所述多个服务请求对应的路由路径。If multiple service requests are received, based on the routing performance parameters, route paths corresponding to the multiple service requests are determined. 根据权利要求1中所述的方法,其中,所述基于所述处理器使用率、内存使用率、队列深度和连接数,确定所述节点设备n的系统性能参数,包括:The method according to claim 1, wherein said determining the system performance parameters of said node device n based on said processor usage rate, memory usage rate, queue depth and number of connections comprises: 分别为所述处理器使用率、所述内存使用率、所述队列深度和所述连接数配置权重参数;Configuring weight parameters for the processor usage, the memory usage, the queue depth and the number of connections respectively; 将所述处理器使用率、所述内存使用率、所述队列深度、所述连接数、各个权重参数、所述节点设备n的阈值深度以及阈值连接数代入如下计算公式,计算所述节点设备n的系统性能参数,所述节点设备n的系统性能参数表征为PS:Substituting the processor usage rate, the memory usage rate, the queue depth, the number of connections, each weight parameter, the threshold depth of the node device n, and the threshold connection number into the following calculation formula to calculate the node device The system performance parameter of n, the system performance parameter of the node device n is characterized by PS:
Figure PCTCN2022097857-appb-100001
Figure PCTCN2022097857-appb-100001
其中,所述处理器使用率表征为pct cpu、所述pct cpu对应的权重参数为W cpu,所述内存使用率表征为pct 内存、所述pct 内存对应的权重参数为W 内存,所述队列深度对应的权重参数为W 队列深度,所述连接数对应的权重参数为W 连接数Wherein, the processor usage rate is characterized by pct cpu , the weight parameter corresponding to the pct cpu is W cpu , the memory usage rate is represented by pct memory , the weight parameter corresponding to the pct memory is W memory , and the queue The weight parameter corresponding to the depth is W queue depth , and the weight parameter corresponding to the connection number is W connection number .
根据权利要求1或2所述的方法,其中,所述基于所述系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,所述多个微服务系统下的所选节点设备的路由性能参数,包括:The method according to claim 1 or 2, wherein, when the service request time-consuming based on the system performance parameters and statistics is predicted, when passing through multiple micro-service systems during the routing process, the service requests under the multiple micro-service systems Routing performance parameters of selected node devices, including: 分别为所述多个微服务系统下的所选节点设备的系统性能参数之和、所述统计的服务请求耗时配置权重参数;Configuring weight parameters for the sum of the system performance parameters of the selected node devices under the plurality of microservice systems and the time-consuming statistics of service requests; 将所述系统性能参数之和、统计的服务请求耗时以及各个权重参数代入如下计算公式,预测所述路由性能参数,所述路由性能参数表征为R:Substituting the sum of the system performance parameters, the statistical service request time consumption and each weight parameter into the following calculation formula to predict the routing performance parameters, the routing performance parameters are represented as R: R=W T×T+W ps×(PS 1+PS 2+PS 3+......PS i+......+PS N); R=W T ×T+W ps ×(PS 1 +PS 2 +PS 3 +...PS i +...+PS N ); 其中,所述统计的服务请求耗时表征为T、所述对应的权重参数为W T,所述多个微服务系统的总数为N,任一微服务系统下所选节点设备的系统性能参数表征为PS i,所述系统性能参数之和对应的权重参数为W ps,i的取值范围为大于0且小于等于N的正整数。 Wherein, the statistical service request time consumption is represented by T, the corresponding weight parameter is W T , the total number of the multiple microservice systems is N, and the system performance parameters of the selected node devices under any microservice system Characterized as PS i , the weight parameter corresponding to the sum of the system performance parameters is W ps , and the value range of i is a positive integer greater than 0 and less than or equal to N. 根据权利要求1-3任一项中所述的方法,其中,所述若接收到多个服务请求,基于所述路由性能参数,确定所述多个服务请求对应的路由路径,包括:The method according to any one of claims 1-3, wherein, if multiple service requests are received, determining routing paths corresponding to the multiple service requests based on the routing performance parameters includes: 为所述多个微服务系统下,不同路径对应的所选节点设备的所述路由性能参数,设置请求数量权重参数;For the routing performance parameters of the selected node devices corresponding to different paths under the plurality of microservice systems, set the request quantity weight parameter; 若接收到所述多个服务请求,基于请求数量权重参数和所述多个服务请求的请求数量,确定所述多个服务请求对应的路由路径。If the multiple service requests are received, determine routing paths corresponding to the multiple service requests based on the request quantity weight parameter and the request quantity of the multiple service requests. 根据权利要求1-3任一项所述的方法,其中,所述若接收到多个服务请求,基于所述路由性能参数,确定所述多个服务请求对应的路由路径,包括:The method according to any one of claims 1-3, wherein, if multiple service requests are received, determining the routing paths corresponding to the multiple service requests based on the routing performance parameters includes: 若接收到多个服务请求,确定不同路径对应的所选节点设备所属互联网数据中心标识;If multiple service requests are received, determine the identification of the Internet data center to which the selected node equipment corresponding to different paths belongs; 从不同路径对应的所选节点设备的所述路由性能参数中,筛选出至少一个目标路径对应的所选节点设备的目标路由性能参数,其中,所述目标路径对应的所选节点设备中至少两个设备具有同一互联网数据中心标识;From the routing performance parameters of the selected node devices corresponding to different paths, select the target routing performance parameters of the selected node devices corresponding to at least one target path, wherein at least two of the selected node devices corresponding to the target path devices have the same Internet data center identifier; 基于所述目标路由性能参数,确定所述多个服务请求对应的路由路径。Based on the target routing performance parameters, routing paths corresponding to the multiple service requests are determined. 根据权利要求1-3任一项中所述的方法,其中,所述若接收到多个服务请求,基于所述路由性能参数,确定所述多个服务请求对应的路由路径,包括:The method according to any one of claims 1-3, wherein, if multiple service requests are received, determining routing paths corresponding to the multiple service requests based on the routing performance parameters includes: 若接收到所述多个服务请求,获取所述多个服务请求的时效信息和/或请求数量;If the multiple service requests are received, acquiring timeliness information and/or request quantity of the multiple service requests; 若所述多个服务请求中存在部分服务请求的时效信息符合时效条件,和/或所述多个服务请求的请求数量大于阈值数量,基于所述路由性能参数,确定所述部分服务请求对应的路由路径。If the timeliness information of some of the service requests in the multiple service requests meets the timeliness condition, and/or the number of requests for the multiple service requests is greater than the threshold number, based on the routing performance parameters, determine the timeliness corresponding to the part of the service requests routing path. 根据权利要求6所述的方法,其中,所述若接收到所述多个服务请求,获取所述多个服务请求的时效信息之后,所述方法还包括:The method according to claim 6, wherein, if the multiple service requests are received, after obtaining the timeliness information of the multiple service requests, the method further comprises: 针对所述多个服务请求中的剩余服务请求,对所述剩余服务请求中的每一请求的主键字段进行哈希计算得到哈希值;For the remaining service requests in the plurality of service requests, perform hash calculation on the primary key field of each request in the remaining service requests to obtain a hash value; 通过所述哈希值对微服务系统m下的所有节点设备的数量进行取模运算,得到取模结果;Carrying out a modulo operation on the quantity of all node devices under the microservice system m through the hash value to obtain a modulo result; 基于所述取模结果,将所述每一请求发送至对应的节点设备。Based on the modulus result, each request is sent to a corresponding node device. 一种基于微服务的路由装置,包括:A routing device based on microservices, comprising: 获取模块,用于获取微服务系统m下的节点设备n的处理器使用率、内存使用率、队列 深度和连接数,其中,所述m和所述n为大于等于2的正整数,所述队列深度表征预设的所述节点设备n处理请求的处理性能,所述连接数表征所述节点设备n的端口所支持的对外连接数;The obtaining module is used to obtain the processor usage rate, memory usage rate, queue depth and connection number of the node device n under the microservice system m, wherein the m and the n are positive integers greater than or equal to 2, and the The queue depth represents the preset processing performance of the processing request of the node device n, and the number of connections represents the number of external connections supported by the port of the node device n; 处理模块,用于基于所述处理器使用率、内存使用率、队列深度和连接数,确定所述节点设备n的系统性能参数;A processing module, configured to determine system performance parameters of the node device n based on the processor usage, memory usage, queue depth, and number of connections; 所述处理模块,用于基于所述系统性能参数和统计的服务请求耗时,预测路由过程中经过多个微服务系统时,所述多个微服务系统下的所选节点设备的路由性能参数;The processing module is configured to predict the routing performance parameters of the selected node devices under the multiple micro-service systems when the routing process passes through multiple micro-service systems based on the system performance parameters and the statistical service request time-consuming ; 所述处理模块,用于若接收到多个服务请求,基于所述路由性能参数,确定所述多个服务请求对应的路由路径。The processing module is configured to, if multiple service requests are received, determine routing paths corresponding to the multiple service requests based on the routing performance parameters. 一种基于微服务的路由设备,包括:A routing device based on microservices, including: 存储器,用于存储可执行指令;处理器,用于执行所述存储器中存储的可执行指令时,实现权利要求1至7任一项所述的方法。The memory is used to store executable instructions; the processor is used to implement the method according to any one of claims 1 to 7 when executing the executable instructions stored in the memory. 一种存储介质,存储有可执行指令,用于引起处理器执行时,实现权利要求1至7任一项所述的方法。A storage medium storing executable instructions for causing a processor to implement the method according to any one of claims 1 to 7.
PCT/CN2022/097857 2021-11-22 2022-06-09 Routing method and apparatus based on micro-service, and device and storage medium Ceased WO2023087679A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111386475.5A CN114118560B (en) 2021-11-22 2021-11-22 Routing method, device, equipment and storage medium based on micro-service
CN202111386475.5 2021-11-22

Publications (1)

Publication Number Publication Date
WO2023087679A1 true WO2023087679A1 (en) 2023-05-25

Family

ID=80439108

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/097857 Ceased WO2023087679A1 (en) 2021-11-22 2022-06-09 Routing method and apparatus based on micro-service, and device and storage medium

Country Status (2)

Country Link
CN (1) CN114118560B (en)
WO (1) WO2023087679A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116684493A (en) * 2023-06-13 2023-09-01 易保网络技术(上海)有限公司 Routing method, network device and computer readable medium
CN116915866A (en) * 2023-09-12 2023-10-20 云粒智慧科技有限公司 Gateway configuration method, gateway, micro-service and device

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114118560B (en) * 2021-11-22 2025-07-18 深圳前海微众银行股份有限公司 Routing method, device, equipment and storage medium based on micro-service

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180181390A1 (en) * 2016-12-22 2018-06-28 Juniper Networks, Inc. Automatic scaling of microservices applications
CN109716729A (en) * 2016-06-14 2019-05-03 希尔戴克斯网络股份有限公司 The dynamically auto zoom network security micro services framework based on load
US20210028991A1 (en) * 2019-07-24 2021-01-28 Cisco Technology, Inc. Ai-driven capacity forecasting and planning for microservices apps
CN112437147A (en) * 2020-11-19 2021-03-02 浙江大学滨海产业技术研究院 Micro-service load balancing optimal routing algorithm, device, equipment and medium
US20210081197A1 (en) * 2019-09-18 2021-03-18 International Business Machines Corporation Availability level-based service management
CN114118560A (en) * 2021-11-22 2022-03-01 深圳前海微众银行股份有限公司 Microservice-based routing method, device, device and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9794353B2 (en) * 2013-12-19 2017-10-17 Google Inc. Systems, methods, and computer program products for service processing
CN110324403A (en) * 2019-05-23 2019-10-11 平安科技(深圳)有限公司 Dynamic divides library method for routing, device, server and storage medium
CN110807050B (en) * 2019-09-25 2023-05-30 平安科技(深圳)有限公司 Performance analysis method, device, computer equipment and storage medium
CN112711479B (en) * 2019-10-25 2025-07-15 北京沃东天骏信息技术有限公司 Server cluster load balancing system, method, device and storage medium
CN113382080B (en) * 2021-06-25 2023-03-28 中关村智慧城市产业技术创新战略联盟 Micro-service management system and method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109716729A (en) * 2016-06-14 2019-05-03 希尔戴克斯网络股份有限公司 The dynamically auto zoom network security micro services framework based on load
US20180181390A1 (en) * 2016-12-22 2018-06-28 Juniper Networks, Inc. Automatic scaling of microservices applications
US20210028991A1 (en) * 2019-07-24 2021-01-28 Cisco Technology, Inc. Ai-driven capacity forecasting and planning for microservices apps
US20210081197A1 (en) * 2019-09-18 2021-03-18 International Business Machines Corporation Availability level-based service management
CN112437147A (en) * 2020-11-19 2021-03-02 浙江大学滨海产业技术研究院 Micro-service load balancing optimal routing algorithm, device, equipment and medium
CN114118560A (en) * 2021-11-22 2022-03-01 深圳前海微众银行股份有限公司 Microservice-based routing method, device, device and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116684493A (en) * 2023-06-13 2023-09-01 易保网络技术(上海)有限公司 Routing method, network device and computer readable medium
CN116915866A (en) * 2023-09-12 2023-10-20 云粒智慧科技有限公司 Gateway configuration method, gateway, micro-service and device
CN116915866B (en) * 2023-09-12 2023-11-21 云粒智慧科技有限公司 Gateway configuration method, gateway, micro-service and device

Also Published As

Publication number Publication date
CN114118560A (en) 2022-03-01
CN114118560B (en) 2025-07-18

Similar Documents

Publication Publication Date Title
CN109218355B (en) Load balancing engine, client, distributed computing system and load balancing method
CN108776934B (en) Distributed data calculation method and device, computer equipment and readable storage medium
CN111176792B (en) A resource scheduling method, device and related equipment
US11888756B2 (en) Software load balancer to maximize utilization
WO2023087679A1 (en) Routing method and apparatus based on micro-service, and device and storage medium
US9992273B2 (en) Intelligent load balancer selection in a multi-load balancer environment
US10033659B2 (en) Reputation-based mediation of virtual control planes
US9882773B2 (en) Virtual resource provider with virtual control planes
CN109831524B (en) Load balancing processing method and device
US9553774B2 (en) Cost tracking for virtual control planes
CN107295090A (en) A kind of method and apparatus of scheduling of resource
CN114916012B (en) Load flow distribution method and device
CN103763346A (en) Distributed resource scheduling method and device
CN102662764A (en) Dynamic cloud computing resource optimization allocation method based on semi-Markov decision process (SMDP)
CN108897626A (en) Resource scheduling method and server
CN118897730A (en) Load balancing method, device, equipment and storage medium based on computing cluster
US20200314019A1 (en) Managing bandwidth based on user behavior
CN114443241A (en) A task dynamic scheduling method, task delivery method and device thereof
CN113518119B (en) Service distribution method, device, equipment and storage medium of ABTest
CN114125066B (en) A method and device for processing a service request
CN115396319B (en) Data stream slicing method, device, equipment and storage medium
CN114237895B (en) Thread resource scheduling method, device, storage medium and electronic device
CN116909758B (en) Computing task processing methods, devices and electronic equipment
CN113778730B (en) Service degradation method and device for distributed system
CN117573288A (en) Parameter adjustment method and device for container cluster, storage medium and equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22894222

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02/09/2024)

122 Ep: pct application non-entry in european phase

Ref document number: 22894222

Country of ref document: EP

Kind code of ref document: A1