Microservice scheduling control method, device, computer equipment and storage medium

By obtaining the heartbeat information of the target business server, determining its actual idle road and updating status, solving the problem that the registered center cannot accurately update the server status, and improves the reliability and stability of the system.

CN114979274BActive Publication Date: 2025-01-28SHENZHEN ZHUIYI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210379295.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-12
Publication Date
2025-01-28
Estimated Expiration
2042-04-12

AI Technical Summary

Technical Problem

When the registry cannot accurately update the server status, multiple clients access the same server at the same time, resulting in their network protocol being unavailable.

Method used

Provide a control method for microservices scheduling. By obtaining the heartbeat information of the target business server, determine its actual idle number, and update the server status in a timely manner.

Benefits of technology

Make sure the server status is accurately updated, avoid clients from accessing unused servers at the same time, and improve the reliability and stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114979274B_ABST
    Figure CN114979274B_ABST
Patent Text Reader

Abstract

The present application relates to a control method, device, computer equipment, storage medium and computer program product for microservice scheduling. The method includes: obtaining first reporting information that a target business server calls a first interface to send a heartbeat at a preset time interval; obtaining a valid session identifier corresponding to the server identifier of the target business server from a first server information set, and obtaining a first number of valid session identifiers; determining the actual number of idle paths of the target business server based on the first number of idle paths and the first number of valid session identifiers, and storing the actual number of idle paths of the target business server in a second server information set, wherein the second server information set is used to store the corresponding relationship between the business server and the number of idle paths. This method can timely and accurately update the status of the business server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of control technology, and in particular to a control method, apparatus, computer equipment, storage medium and computer program product for microservice scheduling. Background Art

[0002] With the development of communication technology, servers with fixed routes will register available lines in the registration center. When the registration service cannot accurately update the status of the server, multiple clients will query the available lines of the available servers at the same time, and when multiple clients access the available servers based on the available lines, the Internet Protocol (IP) for interconnecting the networks of the queried servers will be unavailable. Summary of the invention

[0003] Based on this, it is necessary to provide a control method, device, computer equipment, computer-readable storage medium and computer program product for microservice scheduling in response to the above technical problems.

[0004] In a first aspect, the present application provides a control method for microservice scheduling. The method comprises:

[0005] Acquire first reporting information of the target service server calling the first interface to send a heartbeat at a preset time interval, wherein the first reporting information includes a server identifier and a first idle path number;

[0006] Acquire a valid session identifier corresponding to the server identifier of the target service server from the first server information set, and obtain a first number of the valid session identifiers; the first server information set includes a correspondence between the service server identifier and the session identifier; the session identifier is used to represent a client pre-connected to the service server;

[0007] According to the first idle number of paths and the first number of valid session identifiers, the actual idle number of paths of the target business server is determined, and the actual idle number of paths of the target business server is stored in a second server information set, which is used to store the correspondence between business servers and idle numbers.

[0008] In one embodiment, obtaining the first idle path number of the target service server includes:

[0009] Obtain the total number of routes and the first number of used routes reported by the target service server;

[0010] A first idle number of ways is obtained according to the total number of ways and the first used number of ways.

[0011] In one embodiment, the method further comprises:

[0012] Receive a business service request sent by a client by calling a second interface, wherein the business service request carries a first session identifier;

[0013] randomly selecting a service server identifier from the service server identifiers whose idle paths are greater than 1 in the second server information set as a pre-connected service server identifier according to the service service request, and returning the pre-connected service server identifier to the client;

[0014] The correspondence between the pre-connected service server identifier and the first session identifier is stored in the first server information set.

[0015] In one of the embodiments, the pre-connected service server is identified as the target service server; and the method further includes:

[0016] Acquire second reporting information sent by the target service server by calling the third interface, where the second reporting information includes a server identifier, a second idle path number, and a first session identifier; the second reporting information is sent by the target service server after receiving the first session identifier sent by the client;

[0017] deleting the first session identifier from the first server information set, and then acquiring a valid session identifier corresponding to the server identifier of the target service server from the first server information set from which the first session identifier is deleted, to obtain a second number of the valid session identifiers;

[0018] The actual number of idle paths of the target service server is determined according to the second number of idle paths and the second number of valid session identifiers, and the actual number of idle paths of the target service server is stored in the second server information set.

[0019] In one embodiment, obtaining the first idle path number of the target service server includes:

[0020] Obtain the total number of paths sent by the target service server and the second number of used paths; the second number of used paths is the first number of used paths plus 1;

[0021] A second idle number of ways is obtained according to the total number of ways and the second used number of ways.

[0022] In one of the embodiments, the acquiring, from the first server information set, a valid session identifier corresponding to the server identifier of the target service server includes:

[0023] Acquire a candidate session identifier corresponding to the server identifier of the target service server from the first server information set;

[0024] A candidate session identifier within a validity period is determined from the candidate session identifiers as a valid session identifier.

[0025] In a second aspect, the present application also provides a control device for microservice scheduling. The device includes:

[0026] A first acquisition module is used to acquire first reporting information sent by the target service server by calling the first interface at a preset time interval to send a heartbeat, wherein the first reporting information includes a server identifier and a first idle path number;

[0027] A session determination module, configured to obtain a valid session identifier corresponding to the server identifier of the target service server from a first server information set, and obtain a first number of the valid session identifiers; the first server information set includes a correspondence between a service server identifier and a session identifier; the session identifier is used to represent a client pre-connected to the service server;

[0028] A path calculation module is used to determine the actual number of idle paths of the target business server based on the first number of idle paths and the first number of valid session identifiers, and store the actual number of idle paths of the target business server in a second server information set, wherein the second server information set is used to store the correspondence between business servers and idle paths.

[0029] In one of the embodiments, the first acquisition module is further used to acquire the total number of paths and the first number of used paths reported by the target service server; the path calculation module is further used to obtain the first number of idle paths according to the total number of paths and the first number of used paths.

[0030] In one embodiment, the control of the above-mentioned microservice scheduling also includes a receiving module, an identification selection module and a storage module. The receiving module is used to receive a business service request sent by the client calling the second interface, and the business service request carries a first session identification; the identification selection module is used to randomly select a business server identification from the business server identifications with a number of idle paths greater than 1 in the second server information set according to the business service request as a pre-connected business server identification, and return the pre-connected business server identification to the client; the storage module is used to store the correspondence between the pre-connected business server identification and the first session identification in the first server information set.

[0031] In one of the embodiments, the control of the above-mentioned microservice scheduling also includes a deletion module. The first acquisition module is also used to obtain the second reporting information sent by the target business server calling the third interface, the second reporting information including the server identifier, the second idle path number and the first session identifier; the second reporting information is sent by the target business server after receiving the first session identifier sent by the client; the deletion module is used to delete the first session identifier in the first server information set, and then obtain the valid session identifier corresponding to the server identifier of the target business server from the first server information set in which the first session identifier is deleted, and obtain the second number of the valid session identifiers; the storage module is also used to determine the actual number of idle paths of the target business server according to the second idle path number and the second number of valid session identifiers, and store the actual number of idle paths of the target business server in the second server information set.

[0032] In one embodiment, the first acquisition module is further used to obtain the total number of paths and the second number of used paths sent by the target service server; the second number of used paths is the first number of used paths plus 1; the path calculation module is further used to obtain the second number of free paths based on the total number of paths and the second number of used paths.

[0033] In one of the embodiments, the session determination module is further configured to obtain a candidate session identifier corresponding to the server identifier of the target service server from the first server information set; and determine a candidate session identifier within a validity period from the candidate session identifiers as a valid session identifier.

[0034] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0035] Acquire first reporting information of the target service server calling the first interface to send a heartbeat at a preset time interval, wherein the first reporting information includes a server identifier and a first idle path number;

[0036] Acquire a valid session identifier corresponding to the server identifier of the target service server from the first server information set, and obtain a first number of the valid session identifiers; the first server information set includes a correspondence between the service server identifier and the session identifier; the session identifier is used to represent a client pre-connected to the service server;

[0037] According to the first idle number of paths and the first number of valid session identifiers, the actual idle number of paths of the target business server is determined, and the actual idle number of paths of the target business server is stored in a second server information set, which is used to store the correspondence between business servers and idle numbers.

[0038] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0039] Acquire first reporting information of the target service server calling the first interface to send a heartbeat at a preset time interval, wherein the first reporting information includes a server identifier and a first idle path number;

[0040] Acquire a valid session identifier corresponding to the server identifier of the target service server from the first server information set, and obtain a first number of the valid session identifiers; the first server information set includes a correspondence between the service server identifier and the session identifier; the session identifier is used to represent a client pre-connected to the service server;

[0041] According to the first idle number of paths and the first number of valid session identifiers, the actual idle number of paths of the target business server is determined, and the actual idle number of paths of the target business server is stored in a second server information set, which is used to store the correspondence between business servers and idle numbers.

[0042] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0043] Acquire first reporting information of the target service server calling the first interface to send a heartbeat at a preset time interval, wherein the first reporting information includes a server identifier and a first idle path number;

[0044] Acquire a valid session identifier corresponding to the server identifier of the target service server from the first server information set, and obtain a first number of the valid session identifiers; the first server information set includes a correspondence between the service server identifier and the session identifier; the session identifier is used to represent a client pre-connected to the service server;

[0045] According to the first idle number of paths and the first number of valid session identifiers, the actual idle number of paths of the target business server is determined, and the actual idle number of paths of the target business server is stored in a second server information set, which is used to store the correspondence between business servers and idle numbers.

[0046] The control method, device, computer equipment, storage medium and computer program product of the microservice scheduling obtain the first reporting information sent by the target business server by calling the first interface at a preset time interval for heartbeat transmission, wherein the first reporting information includes a server identifier and a first idle path number; obtain the valid session identifier corresponding to the server identifier of the target business server from the first server information set to obtain the first number of the valid session identifiers; the first server information set includes the corresponding relationship between the business server identifier and the session identifier; the session identifier is used to characterize the client pre-connected to the business server; according to the first idle path number and the first number of the valid session identifiers, determine the actual number of idle paths of the target business server, and store the actual number of idle paths of the target business server in the second server information set, and the second server information set is used to store the corresponding relationship between the business server and the idle paths. By obtaining the first idle path number and the first number of the valid session identifiers sent by the target business server, determining the actual number of idle paths of the target business server according to the first idle path number and the first number of the valid session identifiers, and storing the actual number of idle paths of the target business server in the second server information set, the state of the business server can be updated timely and accurately. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 An application environment diagram of a control method for microservice scheduling in one embodiment;

[0048] Figure 2 A schematic diagram of a flow chart of a control method for microservice scheduling in one embodiment;

[0049] Figure 3 A flowchart of the control steps of microservice scheduling in one embodiment;

[0050] Figure 4 A schematic diagram of a flow chart of a control method for microservice scheduling in one embodiment;

[0051] Figure 5 A schematic diagram of the report interface flow in the control of microservice scheduling in one embodiment;

[0052] Figure 6 A schematic diagram of the getserv interface flow in the control of microservice scheduling in one embodiment;

[0053] Figure 7 A flow chart of the reportafterconnected interface in the control of microservice scheduling in one embodiment;

[0054] Figure 8 It is a structural block diagram of a control device for microservice scheduling in one embodiment;

[0055] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0057] The control method for microservice scheduling provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the target business server 102 communicates with the service registration center 104 through the network. The data storage system can store the data that the service registration center 104 needs to process. The data storage system can be integrated on the service registration center 104, or it can be placed on the cloud or other network servers. The service registration center 104 obtains the first reporting information that the target business server 102 calls the first interface to send a heartbeat according to a preset time interval, and the first reporting information includes a server identifier and a first idle number of paths; obtains a valid session identifier corresponding to the server identifier of the target business server 102 from the first server information set, and obtains the first number of the valid session identifiers; the first server information set includes a corresponding relationship between the business server identifier and the session identifier; the session identifier is used to characterize the client pre-connected to the business server; according to the first idle number of paths and the first number of the valid session identifiers, the actual idle number of paths of the target business server 102 is determined, and the actual idle number of paths of the target business server 102 is stored in the second server information set, and the second server information set is used to store the corresponding relationship between the business server and the idle number of paths. The service registration center 104 can be implemented by an independent server or a server cluster composed of multiple servers.

[0058] In one embodiment, Figure 2 As shown, a control method for microservice scheduling is provided, which is applied to Figure 1 Taking the service registration center 104 in the example as an example, the following steps are included:

[0059] Step 202: obtaining first reporting information of the target service server calling the first interface to send heartbeats at a preset time interval, wherein the first reporting information includes a server identifier and a first idle path number.

[0060] Among them, the target business server is any server registered in the service registration center 104. The first interface refers to an interface that can realize the reporting of the server identification and the first idle number of paths. Heartbeat sending is to launch a custom structure on time, which includes the server identification and the first idle number of paths. The server identification is used to uniquely characterize the server, which can be the server's Media Access Control Address (MAC address) or the server Internet Protocol Address (IP address). The number of paths is the number of channels that can realize the interaction between the business server and the client. The first idle number of paths is the remaining unused number of paths counted by the target business server.

[0061] Specifically, the service registration center obtains the unique identification code and the first idle path number of the server that the target service server calls the first interface to send a heartbeat at a preset time interval.

[0062] Step 204, obtain a valid session identifier corresponding to the server identifier of the target business server from the first server information set to obtain a first number of valid session identifiers; the first server information set includes a correspondence between the business server identifier and the session identifier; the session identifier is used to represent the client pre-connected to the business server.

[0063] Among them, the client pre-establishes a session with the business server, and there will be a corresponding session identifier. The session identifier can be used to represent the client pre-connected to the business server. The session identifier can be a universally unique identifier (Universally Unique Identifier, referred to as UUID). A valid session identifier refers to a session used to represent the interaction between the business server and the client within the validity period. The first server information set can be a pre-withheld server information remote dictionary service (RemoteDictionary Server, referred to as Redis) storage structure.

[0064] Specifically, in the service registration, the pre-connected client corresponding to the server identifier of the target service server is obtained from the first server information set, and the number of the pre-connected clients with the target service server is obtained.

[0065] Step 206, determining the actual number of idle paths of the target service server according to the first number of idle paths and the first number of valid session identifiers, and storing the actual number of idle paths of the target service server in a second server information set, wherein the second server information set is used to store the correspondence between the service server and the number of idle paths.

[0066] The actual number of idle channels refers to the number of channels available for connection in the total number of channels of each service server excluding the number of channels that have been occupied and the number of channels pre-connected to the client. The second server information set may be an active server information Redis storage structure.

[0067] Specifically, in the service registration, the number of channels on the target service server that can be used to interact with the client is equal to the number of channels that can be used to interact with the client on the target service server, that is, the actual number of channels, based on the first number of channels minus the number of channels pre-connected to the client by the target service server, i.e., the actual number of channels, and the actual number of channels is stored in the second server information set.

[0068] In the control method of the above microservice scheduling, the first reporting information of the target business server calling the first interface to send a heartbeat according to a preset time interval is obtained, and the first reporting information includes a server identifier and a first idle path number; a valid session identifier corresponding to the server identifier of the target business server is obtained from the first server information set to obtain a first number of valid session identifiers; the first server information set includes a correspondence between the business server identifier and the session identifier; the session identifier is used to characterize the client pre-connected to the business server; according to the first idle path number and the first number of valid session identifiers, the actual idle path number of the target business server is determined, and the actual idle path number of the target business server is stored in the second server information set, and the second server information set is used to store the correspondence between the business server and the idle path number. By obtaining the first idle path number and the first number of valid session identifiers sent by the target business server, determining the actual idle path number of the target business server according to the first idle path number and the first number of valid session identifiers, and storing the actual idle path number of the target business server in the second server information set, the status of the business server can be updated timely and accurately.

[0069] In one embodiment, obtaining a first idle number of paths of a target service server includes: obtaining a total number of paths and a first used number of paths reported by the target service server; and obtaining a first idle number of paths according to the total number of paths and the first used number of paths.

[0070] The total number of paths refers to the total number of channels through which each business server interacts with the client, and the first number of used paths refers to the number of channels through which the business server has been connected to the client.

[0071] Specifically, the service registration obtains the number of channels through which each target business server interacts with the client and the number of channels through which the target business server is already connected to the client, and subtracts the number of channels through which each target business server interacts with the client from the number of channels through which the target business server is already connected to the client to obtain the first idle channel number of the target business server.

[0072] In this embodiment, the first idle number of paths can be accurately determined according to the total number of paths of the target service server and the first used number of paths, and the calculation is convenient.

[0073] In one embodiment, the control method for microservice scheduling includes the following steps:

[0074] Step 302: Receive a business service request sent by the client by calling the second interface, where the business service request carries a first session identifier.

[0075] The second interface is suitable for implementing the interaction between the client and the service registration center. The first session identifier is used to characterize the session of the client interaction that has been pre-connected with the service server. The service request includes the first session identifier and the name of the service server that can be used for the client to pre-connect.

[0076] Specifically, the service registration line receives the session identifier of the service server for connecting to the client and the name of the service server for connecting to the client, which are sent by the client calling the second interface.

[0077] Step 304: randomly select a service server identifier from the service server identifiers with idle paths greater than 1 in the second server information set as the pre-connected service server identifier according to the service service request, and return the pre-connected service server identifier to the client.

[0078] Specifically, the service registration bank queries the business server identifiers with idle paths greater than 1 from the second service information set according to the business service request, randomly selects a business server identifier from the queried business server identifiers with idle paths greater than 1 as the pre-connected business server identifier, and returns the pre-connected business server identifier to the client.

[0079] Step 306: Store the correspondence between the pre-connected service server identifier and the first session identifier in the first server information set.

[0080] Specifically, in the service registration process, the correspondence between the pre-connected service server identifier and the first session identifier is stored in the first server information set.

[0081] In this embodiment, by calling the second interface, the client can establish a pre-connection with the business server, and randomly select a business server from the business servers storing the idle paths to respond to the client, and store the correspondence between the pre-connected business server identifier and the first session identifier in the first server information set, so as to facilitate the subsequent correction of the idle paths of the business server and ensure the accuracy of the idle paths of the business server.

[0082] In one embodiment, the pre-connected service server is identified as the target service server, and the control method for microservice scheduling further includes the following steps:

[0083] Step 402, obtaining second reporting information sent by the target service server by calling the third interface, the second reporting information including the server identifier, the second idle path number and the first session identifier; the second reporting information is sent by the target service server after receiving the first session identifier sent by the client.

[0084] The third interface is used to report the idle number of the service server to the service registration bank after the service server receives the connection request initiated by the client. The second idle number of paths refers to the number of paths managed by the target service server pre-connected with the client.

[0085] Specifically, the service registration obtains the server identifier sent by the target service server calling the third interface, the number of routes managed by the target server pre-connected with the client, and the session identifier of the target service server used for the client to connect.

[0086] Step 404: delete the first session identifier from the first server information set, and then obtain a valid session identifier corresponding to the server identifier of the target service server from the first server information set from which the first session identifier is deleted, to obtain a second number of valid session identifiers.

[0087] Specifically, during service registration, the session identifier of the target business server used for connecting to the client is deleted from the first server information set, and then the valid session identifier and the number of valid session identifiers corresponding to the server identifier of the target business server are calculated according to a preset time from the first server information set in which the first session identifier is deleted.

[0088] Step 406: determine the actual number of idle paths of the target service server according to the second number of idle paths and the second number of valid session identifiers, and store the actual number of idle paths of the target service server in the second server information set.

[0089] Specifically, in the service registration, the actual number of idle paths of the target service server is obtained by subtracting the second number of valid session identifiers from the second number of idle paths, and the actual number of idle paths of the target service server is stored in the second server information set.

[0090] In this embodiment, the number of idle paths of the actual target service server can be calculated timely and accurately by calling the third interface.

[0091] In one embodiment, obtaining the first idle number of the target service server includes: obtaining the total number of paths and the second used number of paths sent by the target service server; the second used number of paths is the first used number of paths plus 1; and obtaining the second idle number of paths according to the total number of paths and the second used number of paths.

[0092] Specifically, the service registration obtains the total number of paths and the second number of used paths sent by the target service server; the second number of used paths is the first number of used paths plus 1; and the second number of free paths is obtained by subtracting the second number of used paths from the total number of paths.

[0093] In this embodiment, the total number of paths and the second number of used paths can accurately calculate the number of paths that are actually available except for the number of paths through which the service server and the client are pre-connected.

[0094] In one embodiment, obtaining a valid session identifier corresponding to a server identifier of a target business server from a first server information set includes: obtaining a candidate session identifier corresponding to a server identifier of a target business server from the first server information set; and determining, from the candidate session identifiers, a candidate session identifier within a validity period as a valid session identifier.

[0095] Specifically, the registration service obtains a candidate session identifier corresponding to the server identifier of the target service server from the first server information set, and determines a candidate session identifier within a validity period from the candidate session identifiers as a valid session identifier according to a preset time in the first service server information set.

[0096] In this embodiment, by calculating the valid session identifier, access can be performed within the valid period, which can improve the work efficiency of the service registration process.

[0097] The embodiment of the present application provides a control method for microservice scheduling. The following describes the process of controlling microservice scheduling in conjunction with a detailed embodiment: wherein the first interface is a report interface, the second interface is a getserv interface, the third interface is a reportafterconnected interface, and the first server information set is a pre-withheld server information redis storage structure, including:

[0098] [Set server name:ip:port:sessionId 1]expiret:3s-------infor1;

[0099] [Sadd server name:ip:port[sessionId]…]-------infor2;

[0100] The second server information set is the redis storage structure of active server information, including:

[0101] [Set service name:ip:port free:number of routes] expire:10s-------infor3;

[0102] [Sadd server name [ip:port]]-------infor4;

[0103] like Figure 5 As shown in the figure, the process of the report interface includes:

[0104] (1) In the service registration, the bank obtains the idle path information of the target service server and the identity document (ID) of the target service server reported by the target service server through the report interface heartbeat every 5 seconds;

[0105] (2) In the service registration, the bank obtains the sessionID of the target business server from the preset validity period of 3 seconds of infor1 in the withholding server information redis storage structure and infor2 in the withholding server information redis storage structure, and uses Redis-schedule to calculate the number of valid sessionIDs (valid session identifiers) within 3 seconds;

[0106] (3) In the service registration, the bank uses Redis-schedule to execute the idle number of the target service server minus the number of valid sessionIDs to obtain the number of available paths for the actual target service server;

[0107] (4) Redis-schedule stores the actual number of available routes of the target business server in the free infor3 of the active server information redis storage structure.

[0108] like Figure 6 As shown in the figure, the process of the getserv interface includes:

[0109] (1) The service registration bank receives an idle service server resource request sent by the client by calling the getserv interface; wherein the idle service server resource request includes the name and session ID of the service server;

[0110] (2) Under Redis-schedule update, delete the expired business server [ip:port] and query all business servers [ip:port] with free value greater than 1 from the active server information redis storage structure;

[0111] (3) In the service registration, a service server [ip:port] is randomly selected from all service servers [ip:port] with a free value greater than 1 and updated to infor3 of the active server information redis storage structure;

[0112] (4) In the service registration process, the sessionID of the selected business server [ip:port] is added to infor1 and infor2 in the withholding server information redis storage structure.

[0113] like Figure 7 As shown in the figure, the process of the reportafterconnected interface includes:

[0114] (1) After the target service server and the client are connected, the target service server needs to call the reportafterconnected interface to report to the service registration center;

[0115] (2) The service registration center obtains the name, [ip:port], idle number and sessionID of the target business server;

[0116] (3) Redis-schedule deletes the sessionID of the target business server connected to the client in infor2 in the redis storage structure of the withheld server information;

[0117] (4) Redis-schedule calculates the number of sessionIDs of infor2 in the withholding server information redis storage structure according to the validity period of 3 seconds in infor1 in the withholding server information redis storage structure;

[0118] (5) The total number of idle paths of the target service server minus the number of idle paths already in use minus 1, and the number of paths of the actual idle server is obtained;

[0119] (6) Redis-schedule then stores the number of actual idle servers in infor1 in the active server information redis storage structure.

[0120] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0121] Based on the same inventive concept, the embodiment of the present application also provides a control device for microservice scheduling for implementing the control method for microservice scheduling involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more microservice scheduling control devices provided below can refer to the limitations of the microservice scheduling control method above, and will not be repeated here.

[0122] In one embodiment, Figure 8 As shown, a control device for microservice scheduling is provided, including: a first acquisition module 810, a session determination module 820 and a path number calculation module 830, wherein:

[0123] A first acquisition module 810 is used to acquire first reporting information sent by the target service server by calling the first interface at a preset time interval to send a heartbeat, wherein the first reporting information includes a server identifier and a first idle path number;

[0124] The session determination module 820 is used to obtain a valid session identifier corresponding to the server identifier of the target service server from the first server information set, and obtain a first number of valid session identifiers; the first server information set includes a correspondence between the service server identifier and the session identifier; the session identifier is used to represent the client pre-connected to the service server;

[0125] The path calculation module 830 is used to determine the actual idle paths of the target business server based on the first idle paths and the first number of valid session identifiers, and store the actual idle paths of the target business server in the second server information set, which is used to store the correspondence between the business server and the idle paths.

[0126] In one embodiment, the first acquisition module 810 is further used to acquire the total number of paths and the first number of used paths reported by the target service server; the path calculation module 830 is further used to obtain the first number of idle paths according to the total number of paths and the first number of used paths.

[0127] In one embodiment, the control of the above-mentioned microservice scheduling also includes a receiving module, an identification selection module and a storage module. The receiving module is used to receive a business service request sent by the client calling the second interface, and the business service request carries a first session identification; the identification selection module is used to randomly select a business server identification from the business server identifications with a number of idle paths greater than 1 in the second server information set according to the business service request as a pre-connected business server identification, and return the pre-connected business server identification to the client; the storage module is used to store the correspondence between the pre-connected business server identification and the first session identification in the first server information set.

[0128] In one embodiment, the control of the above-mentioned microservice scheduling also includes a deletion module. The first acquisition module 710 is also used to obtain the second reporting information sent by the target business server calling the third interface, the second reporting information including the server identifier, the second idle path number and the first session identifier; the second reporting information is sent by the target business server after receiving the first session identifier sent by the client; the deletion module is used to delete the first session identifier in the first server information set, and then obtain the valid session identifier corresponding to the server identifier of the target business server from the first server information set in which the first session identifier is deleted, and obtain the second number of valid session identifiers; the storage module is also used to determine the actual number of idle paths of the target business server based on the second idle path number and the second number of valid session identifiers, and store the actual number of idle paths of the target business server in the second server information set.

[0129] In one embodiment, the first acquisition module 810 is also used to obtain the total number of paths and the second number of used paths sent by the target service server; the second number of used paths is the first number of used paths plus 1; the path calculation module is also used to obtain the second number of free paths based on the total number of paths and the second number of used paths.

[0130] In one embodiment, the session determination module is further configured to obtain a candidate session identifier corresponding to the server identifier of the target service server from the first server information set; and determine a candidate session identifier within a validity period from the candidate session identifiers as a valid session identifier.

[0131] Each module in the control device for microservice scheduling can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0132] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store XX data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a control method for microservice scheduling is implemented.

[0133] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0134] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0135] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0136] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0137] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0138] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0139] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0140] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A control method for microservice scheduling, characterized in that: The method comprises: Acquire first reporting information of the target service server calling the first interface to send a heartbeat at a preset time interval, wherein the first reporting information includes a server identifier and a first idle line quantity; Acquire a valid session identifier corresponding to the server identifier of the target service server from the first server information set, and obtain a first number of the valid session identifiers; the first server information set includes a correspondence between the service server identifier and the session identifier; the session identifier is used to represent a client pre-connected to the service server; The actual number of idle lines of the target service server is determined according to the first number of idle lines and the first number of valid session identifiers, and the actual number of idle lines of the target service server is stored in a second server information set, where the second server information set is used to store the correspondence between service servers and the number of idle lines.

2. The method according to claim 1, characterized in that Obtain the number of the first idle lines of the target service server, including: Obtain the total number of lines and the first number of used lines reported by the target service server; A first idle line number is obtained according to the total line number and the first used line number.

3. The method according to claim 1, characterized in that The method further comprises: Receive a business service request sent by a client by calling a second interface, wherein the business service request carries a first session identifier; randomly selecting a service server identifier from the service server identifiers whose idle lines are greater than 1 in the second server information set as a pre-connected service server identifier according to the service service request, and returning the pre-connected service server identifier to the client; The correspondence between the pre-connected service server identifier and the first session identifier is stored in the first server information set.

4. The method according to claim 3, characterized in that The pre-connected service server is identified as the target service server, and the method further includes: Acquire second reporting information sent by the target service server by calling the third interface, where the second reporting information includes a server identifier, a second number of idle lines, and a first session identifier; the second reporting information is sent by the target service server after receiving the first session identifier sent by the client; deleting the first session identifier from the first server information set, and then acquiring a valid session identifier corresponding to the server identifier of the target service server from the first server information set from which the first session identifier is deleted, to obtain a second number of the valid session identifiers; The actual number of idle lines of the target service server is determined according to the second number of idle lines and the second number of valid session identifiers, and the actual number of idle lines of the target service server is stored in the second server information set.

5. The method according to claim 4, characterized in that Obtain the number of the first idle lines of the target service server, including: Obtain the total number of lines and the second number of used lines sent by the target service server; the second number of used lines is the first number of used lines plus 1; A second number of idle lines is obtained according to the total number of lines and the second number of used lines.

6. The method according to any one of claims 1 to 5, characterized in that The acquiring, from the first server information set, a valid session identifier corresponding to the server identifier of the target service server comprises: Acquire a candidate session identifier corresponding to the server identifier of the target service server from the first server information set; A candidate session identifier within a validity period is determined from the candidate session identifiers as a valid session identifier.

7. A control device for microservice scheduling, characterized in that: The device comprises: A first acquisition module, used to acquire first reporting information sent by the target service server by calling the first interface at a preset time interval to send a heartbeat, wherein the first reporting information includes a server identifier and a first idle line quantity; A session determination module, configured to obtain a valid session identifier corresponding to the server identifier of the target service server from a first server information set, and obtain a first number of the valid session identifiers; the first server information set includes a correspondence between a service server identifier and a session identifier; the session identifier is used to represent a client pre-connected to the service server; A route calculation module is used to determine the actual number of idle lines of the target business server according to the first number of idle lines and the first number of valid session identifiers, and store the actual number of idle lines of the target business server in a second server information set, wherein the second server information set is used to store the correspondence between the business server and the number of idle lines.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Micro service infrastructure unit

    CN107911430A

  • Internet of Things platform construction method based on micro-service architecture

    CN110149396A