Service execution method, device and equipment and readable storage medium
By forwarding business requests between the client and the distributed business execution cluster through an intermediate device, the burden caused by the client communicating directly with multiple clusters is eliminated, ensuring that the same business task is completed by the same cluster, thus achieving atomicity and high efficiency and stability of business execution.
Patent Information
- Application Number
- CN202411068684.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-08-05
AI Technical Summary
In existing technologies, a complete business process may require the sequential execution of multiple sub-business processes, and the execution of these sub-business processes is atomic. Directly allowing the client to communicate with multiple distributed business execution clusters would place a huge burden on the client and affect the normal operation of the business.
Intermediate devices are used to communicate with clients and multiple distributed business execution clusters. The intermediate devices determine the target cluster and forward business execution requests. The correspondence between target identifiers and clusters is stored to ensure that multiple tasks of the same business are completed by the same target cluster, reducing the configuration complexity of the client.
It achieves atomicity and consistency in business execution, reduces client configuration complexity and business execution costs, and improves business execution efficiency and stability.
Smart Images

Figure CN119030987A_ABST
Abstract
Description
Technical Field
[0001] The present specification relates to the field of computer technology, and in particular to a service execution method, device, equipment and readable storage medium. Background Art
[0002] With the rapid development of computer technology and the explosive growth of data, in big data processing scenarios, distributed business execution clusters can now be used to meet the needs of large-scale data processing and improve processing capabilities and concurrent query capabilities.
[0003] In the prior art, users can send business execution requests to the distributed business execution cluster through the client. The master node in the cluster generates the corresponding data processing task and decomposes it into multiple subtasks. The master node distributes each subtask to multiple working nodes in the cluster for parallel execution, thereby improving business execution efficiency.
[0004] However, as the number of data sources increases and the requirements for response speed increase, it is difficult for only one distributed business execution cluster to support a large number of businesses with computing resources. To this end, multiple distributed business execution clusters can be used to jointly process a large number of high-concurrency businesses from users to ensure business execution efficiency and stability.
[0005] However, in actual applications, a complete service may need to execute multiple sub-services in sequence, and the execution of these multiple sub-services is usually atomic, that is, the execution of multiple sub-services contained in a service cannot be separated. In this case, if the client is allowed to communicate directly with multiple distributed service execution clusters, the client needs to configure complex service execution logic and session management mechanism to ensure that multiple sub-services of the same service can be correctly forwarded to the same distributed service execution cluster. Once the service volume increases, it will bring a heavy burden to the client and even affect the normal operation of the service.
[0006] Based on this, this specification provides a service execution method. Summary of the invention
[0007] This specification provides a service execution method, device, equipment and readable storage medium to partially solve the above-mentioned problems existing in the prior art.
[0008] This manual adopts the following technical solutions:
[0009] This specification provides a service execution method, which is applied to an intermediate device, wherein the intermediate device is respectively connected to a client and multiple distributed service execution clusters for communication, and the method includes:
[0010] In response to a first service execution request sent by the client, determine a target cluster from each distributed service execution cluster, and forward the first service execution request to the target cluster, so that the target cluster generates and returns a target identifier in response to the first service execution request, and executes a first to-be-executed task corresponding to the first service execution request;
[0011] receiving a target identifier sent by the target cluster, storing a corresponding relationship between the target identifier and the target cluster, and sending the target identifier to the client;
[0012] In response to the second service execution request sent by the client, according to the target identifier carried in the second service execution request, searching for the target cluster corresponding to the target identifier from the stored correspondence relationship, and forwarding the second service execution request to the target cluster, so that the target cluster executes the second to-be-executed task corresponding to the second service execution request;
[0013] The first task to be executed and the second task to be executed belong to the same target business.
[0014] Optionally, determining the target cluster from each distributed service execution cluster specifically includes:
[0015] Obtain the load corresponding to each distributed business execution cluster;
[0016] According to the loads corresponding to the distributed service execution clusters, a distributed service execution cluster with the smallest load is determined as the target cluster.
[0017] Optionally, obtaining the loads corresponding to the distributed service execution clusters includes:
[0018] predetermining a load acquisition cycle;
[0019] When the load acquisition cycle is reached, a load query request is generated, and the load query request is sent to each master node of each distributed service execution cluster respectively;
[0020] Receive the loads corresponding to each distributed business execution cluster returned by each master node of each distributed business execution cluster, wherein the load of the distributed business execution cluster includes the load of the master node in the distributed business execution cluster and the load of multiple working nodes in the distributed business execution cluster.
[0021] Optionally, after sending the target identifier to the client and before responding to the second service execution request sent by the client, the method further includes:
[0022] Iterative execution: receiving the current result query address sent by the target cluster, sending the current result query address to the client, and receiving the current result query request sent by the client, wherein the current result query request is generated by the client according to the current result query address and the target identifier; according to the target identifier carried in the current result query request, searching for the target cluster corresponding to the target identifier from the stored corresponding relationship, forwarding the current result query request to the target cluster, receiving the current task execution result and the next result query address returned by the target cluster, wherein the current task execution result is obtained by the target cluster according to the current result query address query; sending the current task execution result and the next result query address to the client until the next result query address is an empty address.
[0023] Optionally, the data sources corresponding to the multiple distributed service execution clusters are different from each other;
[0024] The step of determining a target cluster from each distributed service execution cluster in response to the first service execution request sent by the client specifically includes:
[0025] Pre-acquire the identifiers of the data sources corresponding to each distributed business execution cluster;
[0026] In response to a first service execution request sent by the client, determining a designated identifier carried by the first service execution request, wherein the designated identifier is used to indicate a data source used to execute a first to-be-executed task corresponding to the first service execution request;
[0027] A distributed service execution cluster whose corresponding data source identifier is the same as the designated identifier among the distributed service execution clusters is used as a target cluster.
[0028] Optionally, the multiple distributed service execution clusters correspond to multiple data sources respectively, wherein at least two of the multiple distributed service execution clusters correspond to the same data source;
[0029] The step of determining a target cluster from each distributed service execution cluster in response to the first service execution request sent by the client specifically includes:
[0030] Pre-acquire the identifiers of the data sources corresponding to the distributed service execution clusters, divide several distributed service execution clusters with the same identifiers of the corresponding data sources into the same cluster group to obtain each cluster group, and determine the identifiers of the data sources corresponding to each cluster group according to the identifiers of the data sources corresponding to the several distributed service execution clusters respectively included in each cluster group;
[0031] Pre-acquire the loads corresponding to the distributed service execution clusters respectively;
[0032] In response to a first service execution request sent by the client, determining a designated identifier carried by the first service execution request, wherein the designated identifier is used to indicate a data source used to execute a first to-be-executed task corresponding to the first service execution request;
[0033] Determining, from the cluster groups, a target cluster group corresponding to the designated identifier and identifiers of data sources corresponding to the cluster groups;
[0034] According to the loads corresponding to the several distributed service execution clusters included in the target cluster group, a distributed service execution cluster with the smallest load in the target clusters is determined as the target cluster.
[0035] Optionally, the method further comprises:
[0036] Obtaining the real-time load corresponding to each of the distributed service execution clusters;
[0037] If the real-time loads corresponding to the distributed business execution clusters are all greater than the load threshold, a new distributed business execution cluster is determined, and a communication connection is established between the intermediate device and the new distributed business execution cluster; the new distributed business execution cluster is a distributed business execution cluster that has not executed any tasks.
[0038] This specification provides a service execution device, which is applied to an intermediate device, and the intermediate device is respectively connected to a client and multiple distributed service execution clusters for communication, and the device includes:
[0039] a target cluster determination module, configured to determine a target cluster from each distributed service execution cluster in response to a first service execution request sent by the client, and forward the first service execution request to the target cluster, so that the target cluster generates and returns a target identifier in response to the first service execution request, and executes a first to-be-executed task corresponding to the first service execution request;
[0040] a forwarding module, configured to receive a target identifier sent by the target cluster, store a corresponding relationship between the target identifier and the target cluster, and send the target identifier to the client;
[0041] A search module is used to respond to a second business execution request sent by the client, search for a target cluster corresponding to the target identifier from the stored correspondence relationship according to the target identifier carried in the second business execution request, and forward the second business execution request to the target cluster, so that the target cluster executes the second task to be executed corresponding to the second business execution request; wherein the first task to be executed and the second task to be executed belong to the same target business.
[0042] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned service execution method is implemented.
[0043] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned service execution method when executing the program.
[0044] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:
[0045] In the service execution method provided in this specification, the intermediate device determines the target cluster in response to the first service execution request sent by the client, and forwards the first service execution request to the target cluster so that it executes the corresponding first task to be executed, receives the target identifier returned by the target cluster, stores the corresponding relationship between the target identifier and the target cluster, sends the target identifier to the client, responds to the second service execution request sent by the client, determines the target cluster according to the target identifier carried by the second service execution request, and forwards the second service execution request to the target cluster so that it executes the corresponding second task to be executed, wherein the first task to be executed and the second task to be executed belong to the same target service. It can be seen that by storing the corresponding relationship between the identifier of the target cluster and the target identifier, multiple service execution requests belonging to the same service can be forwarded to the same target cluster, so that multiple tasks in the same service are completed by the same target cluster, ensuring the atomicity and consistency of service execution, and the intermediate device enables the client to communicate directly with each distributed service execution cluster without directly communicating with each distributed service execution cluster, reducing the configuration complexity of the client and the service execution cost, thereby improving the service execution efficiency and stability. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The exemplary embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification.
[0047] In the figure:
[0048] Figure 1This is a schematic diagram of the architecture of a business execution system in this specification;
[0049] Figure 2 A schematic diagram of an interactive process of a service execution method in this specification;
[0050] Figure 3 A schematic diagram of an interactive process of a service execution method in this specification;
[0051] Figure 4 A schematic diagram of a service execution device provided in this specification;
[0052] Figure 5 The corresponding Figure 2 Schematic diagram of electronic equipment. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0054] In addition, it should be noted that all actions of acquiring signals, information or data in this manual are performed in compliance with the relevant local data protection laws and policies and with the authorization given by the owner of the corresponding device.
[0055] It should be noted that, in the absence of conflict, the features in the following embodiments and implementations may be combined with each other.
[0056] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.
[0057] Figure 1The diagram shows the architecture of a business execution system provided in this specification, which includes a client, an intermediate device and multiple distributed business execution clusters. Among them, the client is used to generate a business execution request or a result query request in response to the user's operation, and communicate directly with the intermediate device. The client can be a mobile terminal or a fixed terminal of various types such as a smart phone, a tablet computer, a laptop computer, a desktop computer, etc. The intermediate device can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services, which is used to forward the request sent by the client to the distributed business execution cluster and forward the information or data returned by the distributed business execution cluster to the client. The intermediate device is connected to the client in communication, and is also connected to each distributed business execution cluster in communication. The communication connection method can be any existing type of method, such as wireless communication links such as Bluetooth, Wi-Fi, near field communication, and cellular mobile communication networks, or it can be through a wired communication link, which is not limited in this specification.
[0058] Based on the interaction between the client, intermediate equipment and distributed business execution cluster in the business execution system provided in this specification, it is possible to forward multiple business execution requests belonging to the same business to the same target cluster, so that multiple tasks in the same business are completed by the same target cluster, ensuring the atomicity and consistency of business execution. In addition, the intermediate equipment enables the client to communicate directly with each distributed business execution cluster without the need, reducing the client's configuration complexity and business execution cost, thereby improving business execution efficiency and stability.
[0059] Figure 2 This is a schematic diagram of an interactive process of a business execution method provided in this specification. The business execution method can be based on Figure 1 The service execution system shown is implemented, and the parties interacting during the execution of the method are the client, the intermediate device and multiple distributed service execution clusters included in the service execution system.
[0060] S100: The client sends a first service execution request to the intermediate device.
[0061] The client can generate a first service execution request in response to the user's input. For example, if the service that the user needs to execute is a database query service, the user's input can be a corresponding SQL query statement, and the client can generate the first service execution request based on the SQL query statement. Of course, other types of statements such as adding, deleting, and modifying the database can also be used.
[0062] In addition, according to actual business scenarios and user needs, the first business execution request may also carry task requirements for other types of data processing tasks, which is not limited in this specification.
[0063] It should be noted that in the present specification, the first business execution request and the second business execution request are both used to request the distributed business execution cluster to execute the corresponding tasks to be executed. There is no functional difference between the two. The distinction between "first" and "second" is made because in the business scenarios to which the business execution method provided in this specification is applicable, a business that the user needs to execute contains multiple sub-businesses, and the first business execution request actually corresponds to the first sub-business that the user requests to execute in the business, and the second business execution request corresponds to a non-first sub-business that the user requests to execute in the business.
[0064] S102: The intermediate device determines a target cluster from each distributed service execution cluster in response to the first service execution request sent by the client.
[0065] In this specification, the middleware acts as an intermediary for communication between the client and each distributed business execution cluster. It can assume multiple functions, such as acting as a security boundary to provide security policies such as identity authentication, authorization, and encrypted communication for the client and the distributed business execution cluster. For example, only legitimate business execution requests and result query requests can reach the distributed business execution cluster to protect data security. The middleware can also provide protocol conversion services when the communication protocols used by the client and the distributed business execution clusters are inconsistent. The client does not have to directly process various protocols, thereby simplifying the development and maintenance of the client. In addition, the middleware can also record all requests, information, and traffic entering and leaving the middleware, and perform detailed monitoring and troubleshooting to improve business execution efficiency and ensure security and compliance during business execution.
[0066] In addition to the above functions, in the service execution method provided in this specification, the most important function of the intermediate device is to forward or route the first service execution request sent by the client (that is, the request corresponding to the first sub-service to be executed among multiple sub-services contained in a service) to the distributed service execution cluster that is most suitable for executing the first task to be executed corresponding to the first service execution request.
[0067] For example, in the case where the target business to which the first business execution request belongs requires a specific data source to be executed, the first business execution request can carry the identifier of the data source required to execute the corresponding first task to be executed. Based on the identifier of the data source, the intermediate device can search for a distributed business execution cluster connected to the data source as the target cluster, and forward the first business execution request to the corresponding target cluster so as to execute the corresponding task based on the specific data source.
[0068] For another example, the intermediate device may also select a distributed service execution cluster with a shorter response time as a target cluster according to the load conditions corresponding to each distributed service execution cluster, thereby improving the speed and efficiency of service execution.
[0069] Alternatively, in a cross-regional business scenario, each distributed business execution cluster is deployed in different regions. The intermediate device can select a cluster with lower communication overhead and lower network latency based on the client's geographical location according to the principle of minimum communication overhead.
[0070] Of course, the target cluster can also be selected based on other reasons, such as the cluster has specific functions required by the target business, the cluster conforms to the business logic required by the target business, the cluster has the best historical execution efficiency, etc. The intermediate device can select one or more existing selection methods according to the actual business scenario to determine the distributed business execution cluster that is most suitable for executing the first task to be executed corresponding to the first business execution request. This specification does not limit the type and number of specific selection methods.
[0071] S104: Forward the first service execution request to the target cluster.
[0072] After determining the target cluster, the intermediate device can forward the first service execution request to the master node of the target cluster, so that the master node responds to the first service execution request, analyzes the first to-be-executed task to be executed, splits it and assigns it to multiple working nodes for execution.
[0073] S106: The target cluster generates a target identifier in response to the first service execution request, and executes a first to-be-executed task corresponding to the first service execution request.
[0074] In this specification, a distributed business execution cluster is usually composed of a master node and multiple working nodes, wherein the master node is used to communicate with the intermediate device to receive or send information. The master node can also monitor the operating status of each working node, each working node maintains a connection, and regularly reports the status of the working node. After determining the task to be executed, the master node will split the task to be executed according to the number and status of the working nodes, and assign each subtask obtained by the split to each working node. The working node will be connected to the data source through a connector and will be responsible for executing the subtasks issued by the master node based on the data source. After that, the task execution results obtained by the working node executing the subtask will be returned to the master node, and the master node will summarize the task execution results returned by each working node for query.
[0075] Thus, the master node in the target cluster will respond to the first business execution request and execute the above process. At the same time, the master node will also generate a target identifier (such as QueryId) to correspond to the first task to be executed corresponding to the first business execution request, and return the target identifier to the client through the intermediate device. The client can obtain the task execution result corresponding to the first task to be executed based on the target identifier. Of course, the target identifier generated by the master node of the target cluster can also correspond to the target business corresponding to the first business execution request. In this way, the target identifier is returned to the client through the intermediate device. The client can generate a second business execution request based on the target identifier when requesting to execute other tasks included in the target business next time, so that the intermediate device can route the second business execution request belonging to the same target business as the first business execution request to the same target cluster to ensure the atomicity of the target business execution.
[0076] In addition, the master node of the target cluster can also determine the task result query address of the first task to be executed, and return the task result query address to the client through the intermediate device, so that the client can generate a result query request based on the result query address and obtain the task execution result from the master node of the target cluster through the intermediate device.
[0077] S108: Return the target identifier to the intermediate device.
[0078] S110: The intermediate device receives the target identifier sent by the target cluster, and stores the corresponding relationship between the target identifier and the target cluster.
[0079] In order to ensure that the middleware will forward the service execution request and result query request belonging to the same target service to the same target cluster, the middleware will record the correspondence between the target identifier and the target cluster and store it in the form of a key value. In this way, the middleware only needs to parse whether there is a target identifier in the request sent by the client, and based on the target identifier query, it can determine which distributed service execution cluster to forward the request to.
[0080] For example, the queryid returned by the target cluster cluster2 is "aaaaa", and the queryid returned by the target cluster cluster3 is "bbbbb". Then the intermediate device can use the queryid as the key and the identifier of the target cluster as the value to store the correspondence between the target identifier and the target cluster. An optional implementation is as follows:
[0081] K V aaaaa cluster2 bbbbb cluster3
[0082] When the intermediate device receives another request carrying the target identifier "aaaaa", it will query the target cluster cluster2 based on the target identifier "aaaaa" instead of cluster cluster3, so the intermediate device will forward the request to the target cluster cluster2 instead of cluster cluster3.
[0083] In addition, in this specification, since the intermediate device will process highly concurrent business requests at the same time, many correspondences between target identifiers and target clusters will actually be stored. In order to reduce storage pressure and improve business execution efficiency, the correspondence between the target identifier and the target cluster can be deleted periodically, that is, the correspondence between the target identifier and the target cluster is only stored in the intermediate device for a certain period of time, which can be determined based on the specific business scenario, and this specification does not limit this.
[0084] S112: Send the target identifier to the client.
[0085] S114: The client sends a second service execution request to the intermediate device.
[0086] As mentioned above, the second business execution request is similar to the first business execution request in that both are used to request the execution of a task to be executed, and the second task to be executed corresponding to the second business execution request belongs to the same target business as the first task to be executed corresponding to the first business execution request. Since in the business scenarios to which this specification is applicable, multiple tasks belonging to the same target business need to be executed by the same cluster, when the client generates the second business execution request, in addition to generating the task requirement of the second task to be executed based on the user input, it also needs to be combined with the target identifier so that the intermediate device forwards the second business execution request to the target cluster that has received the first business execution request.
[0087] In addition, this specification does not limit whether the second task to be executed corresponding to the second service execution request and the first task to be executed corresponding to the first service execution request have the same task type, which can be the same or different.
[0088] S116: The intermediate device responds to the second service execution request sent by the client and searches for a target cluster corresponding to the target identifier from the stored corresponding relationship according to the target identifier carried in the second service execution request.
[0089] Specifically, after receiving the second business execution request sent by the client, the intermediate device will use the target identifier carried in the second business execution request as the key to search for the corresponding value from the stored key-value pairs (the correspondence between each target identifier and the target cluster), that is, search for the target cluster corresponding to the target identifier, thereby determining to forward the second business execution request to the target cluster corresponding to the target identifier, so as to achieve the effect of having each to-be-executed task under the same target business be executed by the same distributed business execution cluster.
[0090] S118: Forward the second service execution request to the target cluster.
[0091] S120: The target cluster executes the second to-be-executed task corresponding to the second service execution request, wherein the first to-be-executed task and the second to-be-executed task belong to the same target service.
[0092] In the service execution method provided in this specification, the intermediate device determines the target cluster in response to the first service execution request sent by the client, and forwards the first service execution request to the target cluster so that it executes the corresponding first task to be executed, receives the target identifier returned by the target cluster, stores the corresponding relationship between the target identifier and the target cluster, sends the target identifier to the client, responds to the second service execution request sent by the client, determines the target cluster according to the target identifier carried by the second service execution request, and forwards the second service execution request to the target cluster so that it executes the corresponding second task to be executed, wherein the first task to be executed and the second task to be executed belong to the same target service. It can be seen that by storing the corresponding relationship between the identifier of the target cluster and the target identifier, multiple service execution requests belonging to the same service can be forwarded to the same target cluster, so that multiple tasks in the same service are completed by the same target cluster, ensuring the atomicity and consistency of service execution, and the intermediate device enables the client to communicate directly with each distributed service execution cluster without directly communicating with each distributed service execution cluster, reducing the configuration complexity of the client and the service execution cost, thereby improving the service execution efficiency and stability.
[0093] In one or more embodiments of this specification, Figure 2 When the intermediate device determines the target cluster in step S102, a load balancing solution can be provided. According to the current load, response time and other indicators of each distributed service execution cluster, the first service execution request of the client is allocated to the cluster that is most suitable for processing the request, effectively avoiding overload of a certain cluster and improving the service processing capability and stability of the overall system. The specific implementation can be based on the following implementation methods:
[0094] Step 1: Obtain the load corresponding to each distributed business execution cluster.
[0095] Specifically, in order to determine, the intermediate device can send a load query request to each distributed business execution cluster respectively, and each distributed business execution cluster can return its own load to the intermediate device in response to the load query request. The load of the distributed business execution cluster can be represented by the proportion of hardware resources occupied by the main node in the cluster, such as CPU utilization, memory usage, etc., or it can be identified by the length of the task queue at the main node, or it can be represented by the number of tasks processed by the cluster per unit time. Of course, it can also be determined by any existing type of load indicator, and this manual does not limit this.
[0096] Step 2: According to the loads corresponding to the distributed service execution clusters, determine the distributed service execution cluster with the smallest load as the target cluster.
[0097] In short, the load corresponding to the distributed business execution cluster can characterize the computing resource usage of the cluster, as well as the pressure and stability of task execution, and thus indicate the cluster's ability to further undertake task execution. The heavier the load corresponding to the distributed business execution cluster, the lower the cluster's ability to further undertake task execution. Conversely, the lighter the load corresponding to the distributed business execution cluster, the higher the cluster's ability to further undertake task execution.
[0098] Based on this, in this specification, based on the principle of load balancing, tasks are forwarded to the distributed service cluster with the smallest load, so that, specifically, according to the load corresponding to each distributed service execution cluster,
[0099] Among them, in the above-mentioned first step, the intermediate device pre-acquires the load corresponding to each distributed business execution cluster. The intermediate device can make the acquisition of the load of each cluster a scheduled task, and obtain the real-time load of each cluster at intervals to monitor the business execution pressure of each cluster, thereby improving the accuracy of business allocation and further improving the effect of load balancing.
[0100] Specific:
[0101] First, the load acquisition period is predetermined.
[0102] In this specification, the load acquisition period is a time indicator used to indicate how often the load of each distributed service execution cluster is acquired. The load acquisition period can be a fixed value set manually based on the actual business scenario and prior experience, or it can be a flexibly adjusted variable value. This specification does not limit the specific duration of the load acquisition period.
[0103] Secondly, when the load acquisition cycle is reached, a load query request is generated, and the load query request is sent to each master node of each distributed service execution cluster.
[0104] Specifically, obtaining the load of each distributed business execution cluster is used as a scheduled task. Whenever a load acquisition cycle is reached, the intermediate device generates a load query request, which is used to query the load of the distributed business execution cluster that receives the load query request.
[0105] Afterwards, receive the loads corresponding to each distributed business execution cluster returned by each master node of each distributed business execution cluster, wherein the load of the distributed business execution cluster includes the load of the master node in the distributed business execution cluster and the load of multiple working nodes in the distributed business execution cluster.
[0106] The intermediate device will store the loads returned by the master node of each distributed service execution cluster in the intermediate device's own cache, and mark each load with the identifier of the distributed service execution cluster. In other words, the loads of each distributed service execution cluster stored by the intermediate device will be updated each time the real-time loads returned by the master node of each distributed service execution cluster are received. In each load acquisition cycle, if the intermediate device receives the first service execution request sent by the client, the intermediate device determines the target cluster based on the loads of each distributed service execution cluster currently stored by the intermediate device.
[0107] For example, the load acquisition cycle is T, and at time t, the intermediate device generates a load query request to query the load corresponding to each distributed service execution cluster. Then, the next time the intermediate device generates a load query request is actually at time t+T. If the intermediate device receives the first service execution request sent by the client during the period from time t to time t+T, the target cluster can be determined based on the loads of each distributed service execution cluster obtained by the load query request sent at time t.
[0108] In addition, in this specification, the load of the distributed business execution cluster can not only represent the load of the master node in the cluster, but also the load of each working node in the cluster, so as to fully and objectively reflect the task processing capacity of the cluster. In this specification, the load of the master node is generally determined according to the number and size of tasks to be executed in the queue of the master node, and the load of the working node is generally determined according to the number and size of tasks assigned to the working node for execution.
[0109] Of course, during the period from time t to time t+T, the load of each distributed business execution cluster will change. Therefore, in one or more embodiments of the present specification, in order to improve accuracy, the intermediate device may generate a load query request in response to the first business execution request sent by the client, and send the load query request to each distributed business execution cluster respectively to obtain the current load of each distributed business execution cluster when the intermediate device receives the first business execution request.
[0110] In one or more embodiments of the present specification, the target business executed by the user through the client may include multiple tasks to be executed. Figure 2 After the intermediate device sends the service execution request (which can be the first service execution request or the second service execution request) to the target cluster, the task to be executed corresponding to the service execution request can be queued at the master node of the target cluster for execution. After that, when it is the turn of the task to be executed corresponding to the service execution request, the master node in the target cluster can perform task allocation based on the task to be executed corresponding to the service execution request, so that each working node in the target cluster can execute the allocated task in parallel. The master node will receive the task execution results from different working nodes at different times. Based on this situation, the master node will temporarily store the received task execution results in the cache of the master node itself, and determine the result query address. The cache corresponding to each result query address stores at least part of the task execution results corresponding to the task to be executed. The result query address is sent to the client through the intermediate device. The client can send a result query request based on the result query address to obtain the task execution result. In practice, due to the different computing capabilities of different working nodes, the speed at which different working nodes execute tasks is different. The above process may need to be repeated many times before the client can obtain all the task execution results corresponding to the task to be executed. Based on the above process, this specification provides an optional embodiment of loop execution result query, so that the client can obtain all task execution results corresponding to the task to be executed by multiple request result query, such as Figure 3 The specific interaction process is as follows:
[0111] S200: The target cluster sends the current result query address to the intermediate device.
[0112] Specifically, the current result query address can be the storage address assigned by the master node of the target cluster to the task execution result. After each working node in the target cluster completes the execution of the assigned task, it will return the corresponding task execution result to the master node. The master node can then store the received task execution result in the cache corresponding to the current result query address.
[0113] Thus, the target cluster sends the current result query address to the client through the intermediate device, and the client can determine where at least part of the task execution results that it needs to obtain are stored based on the current result query address.
[0114] S202: The intermediate device forwards the received current result query address to the client.
[0115] S204: The client receives the current result query address, and generates a current result query request according to the current result query address and the target identifier.
[0116] In the current result query request, the current result query address is used to indicate that at least part of the task execution results are stored in a specific location in the cache of the master node, and the target identifier is used to instruct the intermediate device to forward the current result query request to the target cluster that executes the first task to be executed or the second task to be executed included in the target business.
[0117] S206: The client sends a current result query request to the intermediate device.
[0118] In this specification, the timing for the client to execute the task result query may be before sending the second service execution request or after sending the second service execution request.
[0119] S208: The intermediate device receives the current result query request sent by the client, and queries the target cluster corresponding to the target identifier from the stored corresponding relationship according to the target identifier carried in the current result query request.
[0120] In this step, the intermediate device searches for the corresponding target cluster based on the target identifier, which is similar to the aforementioned step S116 and will not be described in detail here.
[0121] S210: Forward the current result query request to the target cluster.
[0122] S212: The target cluster obtains the current task execution result according to the current result query address carried in the current result query request, and determines the next result query address.
[0123] The next result query address is used to indicate the address where the task execution result requested by the client next time is stored.
[0124] S214: Return the current task execution result and the next result query address to the intermediate device.
[0125] S216: The intermediate device forwards the current task execution result and the next result query address to the client, and returns to step S204 until the next result query address is an empty address.
[0126] Generally, since each worker node in a distributed business execution cluster executes the assigned tasks at different speeds, each worker node also feeds back the task execution results to the master node at different times. Therefore, the task execution results stored in the storage address indicated by the result query address returned by the target cluster each time are at least part of the task execution results of all the task execution results corresponding to the task to be executed. Therefore, for a task to be executed (such as a SQL statement) included in the target business requested to be executed by the client, the client needs to send multiple result query requests to obtain the complete task execution results. Therefore, the above Figure 3The solution shown needs to be repeated for multiple times to achieve the effect that the client can obtain the complete task execution results. The stopping condition of the loop iteration is that the next result query address returned by the target cluster is an empty address, that is, all the task execution results corresponding to the pending tasks requested by the client have been returned.
[0127] Above Figure 3 The solution shown can be used to query the task execution result of the first task to be executed corresponding to the first business execution request, and can also be used to query the task execution result of the second task to be executed corresponding to the second business execution request. The query process of the two is similar, and both can refer to the above Figure 3 The scheme shown will not be repeated in this manual.
[0128] based on Figure 3 In the scheme shown, the task execution of the target cluster and the task result query initiated by the client can be performed asynchronously. That is, after the target cluster obtains the execution result of the task to be executed, it stores it in the cache corresponding to a certain address and executes other tasks to be executed. There is no need to send the task execution result to the intermediate device before executing other tasks, nor is it necessary to wait until the client queries the task execution result before executing other tasks. This realizes the asynchrony of task execution result query and task execution, and improves the efficiency of business execution.
[0129] In one or more embodiments of the present specification, the data sources connected to different distributed business execution clusters may be the same, different, or partially the same and partially different. In this case, the intermediate device may record the identifiers of the data sources corresponding to each distributed business execution cluster and synchronize them with the client. In this way, the user can generate a first business execution request carrying the identifier of the corresponding data source according to the data source required for the business to be executed, so that the intermediate device can determine the target cluster based on the identifier of the data source carried in the first business execution request. Specifically, it can be divided into the following three situations:
[0130] The first case: multiple distributed service execution clusters in communication with the intermediate device all correspond to the same data source. In this case, the intermediate device can select a target cluster based on the load balancing principle and the loads corresponding to each distributed service execution cluster.
[0131] The second situation: the data sources corresponding to the multiple distributed service execution clusters connected to the middleware are different. In this case, the middleware can use the following scheme to determine the target cluster:
[0132] Step 1: Obtain in advance the identifiers of the data sources corresponding to each distributed business execution cluster.
[0133] Similar to the correspondence between the target identifier and the target cluster stored in the intermediate device, the intermediate device can also store the correspondence between each distributed business execution cluster and the identifier of the data source connected to each distributed business execution cluster in the form of a key-value pair. In this way, using the identifier of the data source connected to the distributed business execution cluster as the key and the identifier of the distributed business execution cluster as the value, the distributed business execution cluster that can be connected to the data source can be found according to the identifier of the data source.
[0134] Step 2: In response to the first service execution request sent by the client, determine a designated identifier carried by the first service execution request, wherein the designated identifier is used to indicate a data source used to execute a first to-be-executed task corresponding to the first service execution request.
[0135] In actual applications, users can execute corresponding target services based on specific data sources according to specific business scenarios and their own business needs. In this case, the data sources corresponding to each distributed business execution cluster are different from each other, which requires the intermediate device to forward the business execution request corresponding to the target business to the distributed business execution cluster corresponding to the specific data source according to the identifier of the data source required by the target business.
[0136] Therefore, the client can use the identifier of the data source required to execute the target service to which the first service execution request belongs as the designated identifier, and put the designated identifier into the first service execution request. In this way, when the intermediate device receives the first service execution request, it will parse the first service execution request to obtain the designated identifier.
[0137] Step 3: taking the distributed service execution cluster whose corresponding data source identifier is the same as the designated identifier among the distributed service execution clusters as the target cluster.
[0138] Furthermore, the intermediate device determines whether there is an identifier of a data source identical to the specified identifier among the identifiers of the data sources corresponding to each distributed business execution cluster obtained in the first step based on the instruction identifier. If so, the data source identical to the specified identifier is used as the data source required to execute the target business to which the first business execution request belongs. Then, the distributed business execution cluster corresponding to the found data source is determined based on the identifier of the data source, and the distributed business execution cluster is the target cluster determined in this step.
[0139] The third situation: multiple distributed service execution clusters that are communicatively connected to the intermediate device correspond to multiple data sources respectively, wherein at least two of the multiple distributed service execution clusters correspond to the same data source.
[0140] The first step: pre-acquire the identifiers of the data sources corresponding to each distributed business execution cluster, divide several distributed business execution clusters with the same identifier of the corresponding data source into the same cluster group to obtain each cluster group, and determine the identifiers of the data sources corresponding to each cluster group according to the identifiers of the data sources corresponding to the several distributed business execution clusters respectively contained in each cluster group.
[0141] Specifically, in this case, although each distributed business execution cluster is connected to a data source, there may be two or more distributed business execution clusters corresponding to the same data source. Based on this, one or more distributed business execution clusters corresponding to the same data source can be classified into a cluster group. When determining the data source used by the target business to which the first business execution request sent by the execution client belongs, the corresponding cluster group can be determined according to the identifier of the data source. In this way, forwarding the first business execution request to any distributed business execution cluster in the cluster group can realize the execution of the first task to be executed corresponding to the first business execution request according to the required data source.
[0142] Based on this, in this specification. According to the identifier of the data source corresponding to each distributed business execution cluster, after dividing several distributed business execution clusters corresponding to the same data source into the same cluster group, multiple cluster groups can actually be obtained. For each cluster group, the identifier of the data source corresponding to each distributed business execution cluster contained in the cluster group is the same. Therefore, the identifier of the data source corresponding to each distributed business execution cluster contained in the cluster group can be used as the identifier of the data source corresponding to the cluster group.
[0143] Similarly, the identifier of the cluster group and the identifier of the data source corresponding to the cluster group can be stored in the form of a key-value pair in the intermediate device. Of course, in order to facilitate the management of each distributed service execution cluster contained in each cluster group, the corresponding relationship between the identifier of the cluster group and the identifier of each distributed service execution cluster contained in the cluster group can also be stored.
[0144] Step 2: Pre-acquire the loads corresponding to each of the distributed service execution clusters.
[0145] This step is the same as the aforementioned method of obtaining the load of each distributed business execution cluster, and will not be repeated here.
[0146] Step 3: In response to the first service execution request sent by the client, determine a designated identifier carried by the first service execution request, wherein the designated identifier is used to indicate a data source used to execute a first to-be-executed task corresponding to the first service execution request.
[0147] This step is similar to the second step in the second case above and will not be described again here.
[0148] Step 4: According to the designated identifier and the identifiers of the data sources corresponding to the cluster groups, determine the target cluster group corresponding to the designated identifier from the cluster groups.
[0149] Specifically, the identifier of the cluster group corresponding to the specified identifier is searched from the key-value pair storing the identifier of the cluster group and the identifier of the data source corresponding to the cluster group with the specified identifier, and the target cluster group is determined according to the identifier of the found cluster group.
[0150] Step 5: According to the loads corresponding to the several distributed service execution clusters included in the target cluster group, determine the distributed service execution cluster with the smallest load in the target cluster as the target cluster.
[0151] Afterwards, based on the load balancing principle, a distributed service execution cluster with the smallest load is determined from among the distributed service execution clusters included in the target cluster group as the target cluster.
[0152] In an optional embodiment of the present specification, the intermediate device can not only communicate with multiple distributed business execution clusters, but can actually communicate with multiple clients, thereby providing distributed business execution cluster docking support for multiple different clients. However, in actual application scenarios, as the number of clients increases and business execution requirements increase, the intermediate device will receive an increasing number of business execution requests, resulting in a high load on each distributed business execution cluster. At this time, the intermediate device can introduce a new distributed business execution cluster to share the load of other distributed business execution clusters. The specific implementation method can be as follows:
[0153] First, the real-time loads corresponding to the distributed service execution clusters are obtained.
[0154] Afterwards, if the real-time loads corresponding to each distributed business execution cluster are greater than the load threshold, a new distributed business execution cluster is determined, and a communication connection is established between the intermediate device and the new distributed business execution cluster; the new distributed business execution cluster is a distributed business execution cluster that has not executed any tasks.
[0155] The load threshold may be a fixed value predetermined based on actual scenarios and prior experience, or may be updated during the execution of a service, which is not limited in this specification.
[0156] When the real-time load is greater than the load threshold, it means that the distributed business execution cluster has too low capacity to further undertake business execution, and no more tasks should be assigned to the distributed business execution cluster. If this situation exists in all distributed business execution clusters that are connected to the intermediate device, then all distributed business execution clusters that are currently connected to the intermediate device cannot add any more tasks. Therefore, it is necessary to introduce a new distributed business execution cluster that has not executed any tasks.
[0157] Of course, the timing for introducing a new distributed business execution cluster can be when the load of the current distributed business execution clusters is too high, or when there are unavailable clusters in the current distributed business execution clusters. At this time, the intermediate device can disconnect the communication connection with the unavailable cluster and establish a communication connection with the new distributed business execution cluster, thereby improving the high availability and fault tolerance of the overall system.
[0158] The above is a service execution method provided by one or more embodiments of this specification. Based on the same idea, this specification also provides a corresponding service execution device, such as Figure 4 shown.
[0159] Figure 4 A schematic diagram of a service execution device provided in this specification specifically includes:
[0160] A target cluster determination module 300 is used to determine a target cluster from each distributed business execution cluster in response to a first business execution request sent by the client, and forward the first business execution request to the target cluster, so that the target cluster generates and returns a target identifier in response to the first business execution request, and executes a first to-be-executed task corresponding to the first business execution request;
[0161] The forwarding module 302 is configured to receive a target identifier sent by the target cluster, store a corresponding relationship between the target identifier and the target cluster, and send the target identifier to the client;
[0162] The search module 304 is used to respond to the second business execution request sent by the client, search for the target cluster corresponding to the target identifier from the stored corresponding relationship according to the target identifier carried in the second business execution request, and forward the second business execution request to the target cluster, so that the target cluster executes the second task to be executed corresponding to the second business execution request; wherein, the first task to be executed and the second task to be executed belong to the same target business.
[0163] Optionally, the target cluster determination module 300 is specifically used to obtain the loads corresponding to each distributed service execution cluster; and determine the distributed service execution cluster with the smallest load as the target cluster according to the loads corresponding to each distributed service execution cluster.
[0164] Optionally, the target cluster determination module 300 is specifically used to predetermine a load acquisition cycle; when the load acquisition cycle is reached, generate a load query request, and send the load query request to each master node of each distributed business execution cluster respectively; receive the loads corresponding to each distributed business execution cluster respectively returned by each master node of each distributed business execution cluster, wherein the load of the distributed business execution cluster includes the load of the master node in the distributed business execution cluster and the load of multiple working nodes in the distributed business execution cluster.
[0165] Optionally, the device further comprises:
[0166] The query module 306 is specifically used for iterative execution: receiving the current result query address sent by the target cluster, sending the current result query address to the client, and receiving the current result query request sent by the client, wherein the current result query request is generated by the client according to the current result query address and the target identifier; according to the target identifier carried in the current result query request, searching for the target cluster corresponding to the target identifier from the stored corresponding relationship, forwarding the current result query request to the target cluster, receiving the current task execution result and the next result query address returned by the target cluster, wherein the current task execution result is obtained by the target cluster according to the current result query address query; sending the current task execution result and the next result query address to the client until the next result query address is an empty address.
[0167] Optionally, the data sources corresponding to the multiple distributed service execution clusters are different from each other;
[0168] Optionally, the target cluster determination module 300 is specifically used to pre-acquire the identifiers of the data sources corresponding to each distributed business execution cluster; in response to a first business execution request sent by the client, determine a designated identifier carried by the first business execution request, wherein the designated identifier is used to indicate the data source used to execute the first task to be executed corresponding to the first business execution request; and take the distributed business execution cluster whose corresponding data source identifier is the same as the designated identifier among the distributed business execution clusters as the target cluster.
[0169] Optionally, the multiple distributed service execution clusters correspond to multiple data sources respectively, wherein at least two of the multiple distributed service execution clusters correspond to the same data source;
[0170] Optionally, the target cluster determination module 300 is specifically used to pre-acquire the identifiers of the data sources corresponding to each distributed business execution cluster, divide several distributed business execution clusters with the same identifier of the corresponding data source into the same cluster group to obtain each cluster group, and determine the identifiers of the data sources corresponding to each cluster group according to the identifiers of the data sources corresponding to the several distributed business execution clusters respectively contained in the cluster groups; pre-acquire the loads corresponding to each distributed business execution cluster; determine the designated identifier carried by the first business execution request in response to the first business execution request sent by the client, wherein the designated identifier is used to indicate the data source used to execute the first task to be executed corresponding to the first business execution request; determine the target cluster group corresponding to the designated identifier from the cluster groups according to the designated identifier and the identifiers of the data sources corresponding to the cluster groups; and determine the distributed business execution cluster with the smallest load in the target cluster as the target cluster according to the loads corresponding to the several distributed business execution clusters contained in the target cluster group.
[0171] Optionally, the device further comprises:
[0172] The extension module 308 is specifically used to obtain the real-time load corresponding to each distributed business execution cluster; if the real-time load corresponding to each distributed business execution cluster is greater than the load threshold, a new distributed business execution cluster is determined, and a communication connection is established between the intermediate device and the new distributed business execution cluster; the new distributed business execution cluster is a distributed business execution cluster that has not executed any tasks.
[0173] This specification also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 2 The business execution method shown.
[0174] This manual also provides Figure 5 The schematic structure diagram of the electronic device shown in FIG. Figure 5 As mentioned above, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 2Of course, in addition to the software implementation, this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0175] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0176] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0177] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0178] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0179] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0180] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0181] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0182] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0183] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0184] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0185] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0186] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0187] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0188] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0189] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0190] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.
Claims
1. A service execution method, characterized in that: The method is applied to an intermediate device, the intermediate device is respectively connected to a client and a plurality of distributed service execution clusters for communication, and the method comprises: In response to a first service execution request sent by the client, determine a target cluster from each distributed service execution cluster, and forward the first service execution request to the target cluster, so that the target cluster generates and returns a target identifier in response to the first service execution request, and executes a first to-be-executed task corresponding to the first service execution request; receiving a target identifier sent by the target cluster, storing a corresponding relationship between the target identifier and the target cluster, and sending the target identifier to the client; In response to the second service execution request sent by the client, according to the target identifier carried in the second service execution request, searching for the target cluster corresponding to the target identifier from the stored correspondence relationship, and forwarding the second service execution request to the target cluster, so that the target cluster executes the second to-be-executed task corresponding to the second service execution request; The first task to be executed and the second task to be executed belong to the same target business.
2. The method according to claim 1, characterized in that Determining the target cluster from each distributed service execution cluster specifically includes: Obtain the load corresponding to each distributed business execution cluster; According to the loads corresponding to the distributed service execution clusters, a distributed service execution cluster with the smallest load is determined as the target cluster.
3. The method according to claim 2, characterized in that The obtaining of the loads corresponding to the distributed service execution clusters specifically includes: predetermining a load acquisition cycle; When the load acquisition cycle is reached, a load query request is generated, and the load query request is sent to each master node of each distributed service execution cluster respectively; Receive the loads corresponding to each distributed business execution cluster returned by each master node of each distributed business execution cluster, wherein the load of the distributed business execution cluster includes the load of the master node in the distributed business execution cluster and the load of multiple working nodes in the distributed business execution cluster.
4. The method according to claim 1, characterized in that After sending the target identifier to the client and before responding to the second service execution request sent by the client, the method further includes: Iterative execution: receiving the current result query address sent by the target cluster, sending the current result query address to the client, and receiving the current result query request sent by the client, wherein the current result query request is generated by the client according to the current result query address and the target identifier; according to the target identifier carried in the current result query request, searching for the target cluster corresponding to the target identifier from the stored corresponding relationship, forwarding the current result query request to the target cluster, receiving the current task execution result and the next result query address returned by the target cluster, wherein the current task execution result is obtained by the target cluster according to the current result query address query; sending the current task execution result and the next result query address to the client until the next result query address is an empty address.
5. The method according to claim 1, characterized in that The data sources corresponding to the multiple distributed service execution clusters are different from each other; The step of determining a target cluster from each distributed service execution cluster in response to the first service execution request sent by the client specifically includes: Pre-acquire the identifiers of the data sources corresponding to each distributed business execution cluster; In response to a first service execution request sent by the client, determining a designated identifier carried by the first service execution request, wherein the designated identifier is used to indicate a data source used to execute a first to-be-executed task corresponding to the first service execution request; A distributed service execution cluster whose corresponding data source identifier is the same as the designated identifier among the distributed service execution clusters is used as a target cluster.
6. The method according to claim 1, characterized in that The multiple distributed service execution clusters correspond to multiple data sources respectively, wherein at least two of the multiple distributed service execution clusters correspond to the same data source; The step of determining a target cluster from each distributed service execution cluster in response to the first service execution request sent by the client specifically includes: Pre-acquire the identifiers of the data sources corresponding to the distributed service execution clusters, divide several distributed service execution clusters with the same identifiers of the corresponding data sources into the same cluster group to obtain each cluster group, and determine the identifiers of the data sources corresponding to each cluster group according to the identifiers of the data sources corresponding to the several distributed service execution clusters respectively included in each cluster group; Pre-acquire the loads corresponding to the distributed service execution clusters respectively; In response to a first service execution request sent by the client, determining a designated identifier carried by the first service execution request, wherein the designated identifier is used to indicate a data source used to execute a first to-be-executed task corresponding to the first service execution request; Determining, from the cluster groups, a target cluster group corresponding to the designated identifier and identifiers of data sources corresponding to the cluster groups; According to the loads corresponding to the several distributed service execution clusters included in the target cluster group, a distributed service execution cluster with the smallest load in the target clusters is determined as the target cluster.
7. The method according to claim 1, characterized in that The method further comprises: Obtaining the real-time load corresponding to each of the distributed service execution clusters; If the real-time loads corresponding to the distributed business execution clusters are all greater than the load threshold, a new distributed business execution cluster is determined, and a communication connection is established between the intermediate device and the new distributed business execution cluster; the new distributed business execution cluster is a distributed business execution cluster that has not executed any tasks.
8. A service execution device, characterized in that: The device is applied to an intermediate device, and the intermediate device is respectively connected to a client and a plurality of distributed service execution clusters for communication, and the device includes: a target cluster determination module, configured to determine a target cluster from each distributed service execution cluster in response to a first service execution request sent by the client, and forward the first service execution request to the target cluster, so that the target cluster generates and returns a target identifier in response to the first service execution request, and executes a first to-be-executed task corresponding to the first service execution request; a forwarding module, configured to receive a target identifier sent by the target cluster, store a corresponding relationship between the target identifier and the target cluster, and send the target identifier to the client; A search module is used to respond to a second business execution request sent by the client, search for a target cluster corresponding to the target identifier from the stored correspondence relationship according to the target identifier carried in the second business execution request, and forward the second business execution request to the target cluster, so that the target cluster executes the second task to be executed corresponding to the second business execution request; wherein the first task to be executed and the second task to be executed belong to the same target business.
9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Distributed service establishment method and device
CN108282514A
Data processing method, device and system
CN113079200A
Data processing method, data processing device, electronic equipment and storage medium
CN113360558A
Data processing method and device and electronic equipment
CN113364818A
Task scheduling method and system, computing device, storage medium and program product
CN114296891A
