Request processing method, device, electronic device and storage medium

By constructing a grid-based request processing network and employing a master-slave mechanism and distributed storage, the problem of scalability difficulties in stateful applications in cloud-native environments is solved, achieving high scalability and performance improvement.

CN115883653BActive Publication Date: 2024-11-05BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211492758.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-25
Publication Date
2024-11-05
Estimated Expiration
2042-11-25

AI Technical Summary

Technical Problem

The scalability of stateful applications in cloud-native environments is a challenge, and existing technologies struggle to achieve highly scalable handling of stateful application requests.

Method used

A grid-based request processing network is constructed, employing a master-slave mechanism and a distributed storage mechanism. Multiple stateful application replicas are pre-created, and requests to be processed are forwarded to target nodes storing historical state data through the master node. This, combined with the master-slave mechanism and distributed storage mechanism, forms a highly scalable architecture.

Benefits of technology

It achieves high scalability for stateful application requests, and can improve overall request processing capacity and performance by adding replicas or resources, supporting linearly growing system processing capacity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115883653B_ABST
    Figure CN115883653B_ABST
Patent Text Reader

Abstract

The present disclosure provides a request processing method, device, electronic device and storage medium, which relate to the fields of artificial intelligence technology such as distributed storage, Internet of Things, cloud computing, and cloud native. The method includes: receiving a pending request initiated by a user; in response to the current node being the master node in the request processing network, determining a target node storing the historical status data of the pending request, the master node and slave node constituting the request processing network are both served by different copies of a stateful application, the historical status data of different requests are stored in different nodes in a dispersed manner, and the copy of the node is run in the memory in the form of carrying the historical status data; forwarding the pending request to the target node, and controlling the target node to generate response information corresponding to the pending request according to the stored historical status information. The method can conveniently improve the overall request processing capability and performance by adding more stateful application replicas or increasing the amount of resources allocated to each replica.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of information processing technology, specifically to the field of artificial intelligence technology such as distributed storage, Internet of Things, cloud computing, and cloud native, and in particular to a request processing method, device, electronic device, computer-readable storage medium, and computer program product. Background Art

[0002] In cloud native, the state of an application refers to its condition at a specific time, i.e. it may be stateful. Determining whether an application is stateful or stateless generally depends on how the interaction state is recorded and how that information is stored.

[0003] Stateless, stateless applications can generally be understood as isolated. There is no way to know about its historical transactions. Each request or transaction processed by the application starts from scratch. Generally speaking, stateless applications can only provide one service and use content delivery networks or web pages to handle these short-term requests.

[0004] Stateful, stateful applications generally have periodic and dependent transactions. For example, online banking or email, these operations are performed in the context of previous transactions, and historical transactions are very likely to affect current transactions. A common phenomenon is that stateful applications use the same application server every time they process user requests (that is, the same application copy is used instead of other copies). When a transaction is interrupted, the stateful application will record its context locally for the next recovery.

[0005] Scalability has always been one of the important design indicators of the computing processing capabilities of application systems. High scalability represents elasticity, which means that during the application iteration process, the system processing capabilities can be linearly increased by adding hardware or servers.

[0006] How to solve the problem of difficult expansion of stateful applications in cloud native is an urgent problem to be solved by technical personnel in this field. Summary of the invention

[0007] The embodiments of the present disclosure provide a request processing method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product.

[0008] In the first aspect, an embodiment of the present disclosure proposes a request processing method, including: receiving a pending request initiated by a user; in response to the current node being a master node in a request processing network, determining a target node storing historical status data of the pending request; wherein the master node and slave nodes constituting the request processing network are both acted as by different copies of a stateful application, and the historical status data of different requests are stored in different nodes in a dispersed manner, and the copies of the nodes act as running in the memory in the form of carrying the historical status data, and the actual storage nodes with different historical status data are recorded in the master node; forwarding the pending request to the target node, and controlling the target node to generate response information corresponding to the pending request based on the stored historical status information.

[0009] In the second aspect, an embodiment of the present disclosure proposes a request processing device, comprising: a pending request receiving unit, configured to receive a pending request initiated by a user; a target node determination unit, configured to determine a target node storing historical status data of the pending request in response to the current node being a master node in the request processing network; wherein the master node and slave node constituting the request processing network are both acted as different copies of a stateful application, and the historical status data of different requests are stored in different nodes in a dispersed manner, and the copies of the nodes act as running in the memory in the form of carrying historical status data, and the master node records the actual storage nodes of different historical status data; the pending request processing unit, configured to forward the pending request to the target node, and control the target node to generate response information corresponding to the pending request based on the stored historical status information.

[0010] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can implement the request processing method described in the first aspect when executing.

[0011] In a fourth aspect, an embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, which are used to enable a computer to implement the request processing method described in the first aspect when executed.

[0012] In a fifth aspect, an embodiment of the present disclosure provides a computer program product comprising a computer program, which, when executed by a processor, can implement the steps of the request processing method described in the first aspect.

[0013] The present disclosure provides a request processing solution, which pre-creates multiple copies of the stateful application for a stateful application that needs to store historical status data for responding to received pending requests, and uses these copies as nodes to build a grid-like request processing network, supplemented by a master-slave mechanism and a distributed storage mechanism, to form a highly scalable architecture for processing stateful application requests. For incoming pending requests, they can be forwarded to a target node that stores the historical status data of the pending requests through a master node, so that the target node can be used to complete the response to the pending request. While having basic request processing, the architecture can also improve the overall request processing capability and performance by adding more stateful application copies or increasing the amount of resources allocated to each copy.

[0014] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0016] Figure 1 is an exemplary system architecture in which the present disclosure may be applied;

[0017] Figure 2 A flowchart of a request processing method provided by an embodiment of the present disclosure;

[0018] Figure 3 A flowchart of a method for constructing a request processing network provided by an embodiment of the present disclosure;

[0019] Figure 4 Flowcharts of two different capacity expansion methods provided in embodiments of the present disclosure;

[0020] Figure 5a A schematic diagram of different applications included in the device management platform provided in an embodiment of the present disclosure;

[0021] Figure 5b A comparative schematic diagram of adjusting the storage location of data under a method of adding replicas to expand capacity provided by an embodiment of the present disclosure;

[0022] Figure 6 A structural block diagram of a request processing device provided in an embodiment of the present disclosure;

[0023] Figure 7 A schematic diagram of the structure of an electronic device suitable for executing a request processing method provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0024] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description. It should be noted that the embodiments in the present disclosure and the features in the embodiments may be combined with each other without conflict.

[0025] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0026] Figure 1 An exemplary system architecture 100 is shown to which embodiments of the request processing method, apparatus, electronic device, and computer-readable storage medium of the present disclosure can be applied.

[0027] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a request processing network 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the request processing network 105, and the network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The request processing network 105 is obtained by a plurality of request processing node components, each of which is acted as a copy of a stateful application, and each copy stores historical state data for responding to part of the requests to be processed.

[0028] The user can use the terminal devices 101, 102, 103 to interact with any node in the request processing network 105 through the network 104 to receive or send messages, etc. The terminal devices 101, 102, 103 and each node constituting the request processing network 105 can be installed with various applications for realizing information communication between the two, such as request sending applications, request processing applications, network messaging applications, etc.

[0029] The terminal devices 101, 102, 103 and the nodes constituting the request processing network 105 can be hardware or software. When the terminal devices 101, 102, 103 are hardware, they can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers, etc.; when the terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above, which can be implemented as multiple software or software modules, or as a single software or software module, which is not specifically limited here. When the nodes constituting the request processing network 105 are hardware, they can be implemented as a distributed server cluster composed of multiple servers, or as a single server; when the nodes are software or software running products, they can be implemented as multiple software or software modules, or as a single software or software module, which is not specifically limited here.

[0030] Each node constituting the request processing network 105 can provide various services through various built-in applications. Taking a request processing application that can process incoming pending requests as an example, each node constituting the request processing network 105 can achieve the following effects when running the request processing application: first, receiving pending requests incoming from users through terminal devices 101, 102, and 103 through network 104; then, when the current node is the master node in the request processing network 105, determining a target node that stores historical status data of the pending request, where the master node records actual storage nodes with different historical status data; next, forwarding the pending request to the target node, and controlling the target node to generate response information corresponding to the pending request based on the stored historical status information.

[0031] The request processing method provided in the subsequent embodiments of the present disclosure is generally executed by a request processing network 105 that stores historical status data for responding to requests to be processed, which is equivalent to being executed by the nodes constituting the request processing network 105. Accordingly, the request processing device is generally also arranged in each node constituting the request processing network 105.

[0032] It should be understood that Figure 1 The number of terminal devices, networks and nodes in the embodiment is only for illustration. Any number of terminal devices, networks and nodes may be provided according to the implementation requirements.

[0033] Please refer to Figure 2 , Figure 2 A flowchart of a request processing method provided by an embodiment of the present disclosure, wherein process 200 includes the following steps:

[0034] Step 201: receiving a pending request initiated by a user;

[0035] This step is intended to be performed by the execution body of the request processing method (such as Figure 1 The nodes constituting the request processing network 105 shown in FIG. 10A receive requests from users (e.g., via Figure 1 A pending request initiated by the terminal device 101, 102 or 103 shown.

[0036] Among them, the pending request is a request (such as a deposit inquiry request) initiated by a user to a stateful application (such as a banking application), that is, the stateful application is expected to make a correct response to the request based on the pre-stored historical status data of the pending request, that is, the purpose of the user initiating the request is to obtain the response.

[0037] The concept of stateful applications exists to distinguish them from stateless applications. The stateless in stateless applications usually means that when any Web request end makes a request, the request itself contains all the information (authentication information, etc.) required by the responding end to respond to the request; while the stateful in stateful applications usually means that the request from the Web request end must be submitted to the server that stores its relevant state information (such as historical session information), otherwise these requests may not be understood, which means that in this mode, the server cannot freely schedule user requests.

[0038] Simply put, the difference lies in whether the state information is saved by the requester or the responder. If it is saved by the requester, it is stateless, and if it is saved by the responder, it is stateful. That is, stateless applications do not care who the responder is, whether it is necessary to synchronize information between responders, and the response service can be deleted at any time without affecting others. It has high fault tolerance, and will not lose data if the load balancing of distributed services fails. There is no memory consumption, and it can be directly deployed and used online; while stateful applications need to synchronize data in a timely manner, and there may be problems such as data synchronization failure and loss of data, and consumption of memory resources to save data.

[0039] Step 202: In response to the current node being a master node in the request processing network, determining a target node storing historical status data of the request to be processed;

[0040] On the basis of step 201, this step aims to determine the target node storing the historical status data of the request to be processed by the master node when the execution subject is the master node in the request processing network. The master node and slave nodes constituting the request processing network are both different copies of the stateful application, and the historical status data of different requests are dispersedly stored in different nodes. At the same time, each copy acting as a node runs in the memory in the form of carrying the historical status data, rather than storing it in the hard disk of persistent storage, to improve the response speed.

[0041] When the historical status data of different requests are scattered and stored in different nodes, in order to enable the master node to determine which node stores the historical status data of the request to be processed, the actual storage nodes of different historical status data are recorded in the master node in advance. This information can be expressed as a correspondence table between the historical status information of different requests and different nodes, so as to determine the target node by looking up the table, and the target node can be the master node itself (that is, the master node also stores the historical status data of some requests like the slave node), or it can be a slave node that is not the master node.

[0042] Furthermore, under the master-slave mechanism, the stateful application replica acting as the master node can store the same amount of historical state data as the stateful application replica acting as the slave node, so as to unify the amount of data stored in each node for easy management; it can also store slightly less historical state data than the stateful application replica acting as the slave node, so that the master node can store some data that does not need to be stored by the slave node (such as the above-mentioned correspondence table). Furthermore, in order to facilitate the clarification of whether the node itself is a master node or a slave node, it can also be determined by adding a master node mark or a slave node mark. Of course, it can also be used to determine whether it is a master node. The method that can be used to determine whether it is a master node can also be used. No specific limitation is made here.

[0043] Step 203: forward the request to be processed to the target node, and control the target node to generate response information corresponding to the request to be processed according to the stored historical status information.

[0044] On the basis of step 202, this step aims at forwarding the pending request to the target node by the above-mentioned execution subject, and controlling the target node to generate response information corresponding to the pending request according to the stored historical status information of the pending request.

[0045] Different from the branch where step 202 and step 203 are located, if the above-mentioned execution subject is a slave node in the request processing network, then since the slave node does not record the relevant information of which node the historical status data of different requests are stored in, it is also necessary to forward the pending request to the master node so that the master node can process it through the process of steps 202 and 203 according to the received pending request.

[0046] After the target node generates the response information of the pending request, the target node returns the response information to the user who initiated the pending request, so that the user receives the response information and completes the processing of the request.

[0047] The request processing method provided by the embodiment of the present disclosure is aimed at a stateful application that needs to store historical status data for responding to received pending requests. It pre-creates multiple copies of the stateful application, and uses these copies as nodes to build a grid-shaped request processing network, supplemented by a master-slave mechanism and a distributed storage mechanism, to form a highly scalable architecture for processing stateful application requests. For incoming pending requests, they can be forwarded to a target node that stores the historical status data of the pending requests through a master node, so that the target node can be used to complete the response to the pending request. While having basic request processing, the architecture can also improve the overall request processing capability and performance by adding more stateful application copies or increasing the amount of resources allocated to each copy.

[0048] To deepen the understanding of how to construct the request processing network, this embodiment also uses the perspective of any stateful application replica acting as a node to Figure 3 A flowchart of a method for constructing a request processing network is shown, wherein the process 300 includes the following steps:

[0049] Step 301: Obtain the assigned unique identity information;

[0050] This step is intended to enable any stateful application replica acting as a node to obtain the assigned unique identity information after the replica is created, so as to distinguish it from other stateful application replicas.

[0051] Specifically, the unique identity information may be a unique identity number, a unique name, a unique copy serial number, etc., which is not specifically limited here and can be selected according to the actual application scenario.

[0052] Step 302: Obtain the assigned unique domain name;

[0053] On the basis of step 301, this step aims at obtaining the unique domain name that is further allocated by the above-mentioned execution subject. The unique domain name is generated based on the unique identity information that was previously allocated, that is, the unique domain name can be reflected in the uniqueness of the domain name by including the unique identity information, or other domain name generation methods can be used, as long as the generated domain name can be guaranteed to be unique, for example, an information processing algorithm that generates a character string that will not be repeated can be used.

[0054] Step 303: Discover other domain names that are similar to the unique domain name, and determine other stateful application replicas corresponding to the other domain names;

[0055] On the basis of step 302, this step aims to enable the above-mentioned execution subject to discover other domain names similar to the unique domain name based on the similarity of the domain names, so as to further determine other stateful application copies corresponding to the other domain names, that is, the other domain names have similarities with the unique domain name in domain name content.

[0056] Specifically, when the unique domain name contains complete unique identity information, the other domain name may be a domain name that differs from the unique domain name only in the identity information content recorded in the identity information record field (i.e., a field dedicated to recording the identity information constituting the domain name) that is also contained in the same domain name, that is, the other information contained in the other domain name is consistent with the current unique domain name, and only the identity information part representing different stateful application copies is different.

[0057] Step 304: Determine the node types that the current stateful application replica and other stateful application replicas are selected as based on a preset master-slave node selection mechanism;

[0058] On the basis of step 303, this step aims to determine the node types selected as the current stateful application replica and the other stateful application replicas by the above-mentioned execution subject based on the preset master-slave node selection mechanism. That is, under the master-slave selection mechanism of one master and multiple slaves, the selection situation can be divided into two categories according to the node type selected as the current stateful application replica:

[0059] In one case, when the current stateful application replica is selected as the master node, all other stateful application replicas will be selected as slave nodes. In the other case, the current stateful application replica is selected as a slave node, one of the other stateful application replicas is selected as the master node, and the remaining stateful application replicas are also selected as slave nodes.

[0060] Step 305: Based on the node type, jointly construct a request processing network with other nodes.

[0061] On the basis of step 304, this step aims to enable the above-mentioned execution subject to jointly construct the request processing network with other nodes based on the node type, that is, when the current stateful application copy as the above-mentioned execution subject is selected as the master node, it will actively conduct self-organizing networking with each slave node to complete the construction of the request processing network; when the current stateful application copy as the above-mentioned execution subject is selected as the slave node, it will conduct self-organizing networking with the master node and other slave nodes according to the self-organizing network request initiated by the received master node, thereby completing the construction of the request processing network.

[0062] Specifically, the master-slave node selection mechanism may include: a serial number rotation mechanism based on a unique replica serial number (for example, a rotation mechanism that gradually rotates from a small serial number to a large serial number), a voting mechanism based on the election initiation time (that is, the earlier a node initiates the election to become the master node, the more likely it is to be voted as the master node), a selection mechanism based on the replica creation time (for example, the longer the replica creation time, the higher the probability of being selected as the new master node, or the shorter the replica creation time, the higher the probability of being selected as the new master node), etc.

[0063] This embodiment provides a node self-organizing network solution based on similar domain names through steps 301 to 304, in order to determine the object of the self-organizing network by discovering stateful application copies with similar domain names, and complete the self-organizing network of the request processing network.

[0064] On the basis of any of the above embodiments, in order to reflect the effect that the architecture of the constructed request processing network is easy to expand, Figure 4 A schematic diagram showing two different expansion methods:

[0065] Method 1: When the current node is the master node in the request processing network and receives the first capacity expansion instruction, a new stateful application copy can be determined according to the first capacity expansion instruction, and then the new stateful application copy can be added to the request processing network as a new slave node, and the actual storage node of the historical state data of different requests can be re-determined. That is, the first capacity expansion instruction indicates the creation of a new stateful application copy, which is equivalent to increasing the number of nodes built for the request processing network. In order to make each node responsible for processing part of the requests, it is necessary to redistribute the historical state data that only exists in the original node among all current nodes. Specifically, when transferring historical state data, it can be based on the principle of minimum transfer to save unnecessary data reading and writing operations and shorten adjustment time.

[0066] Method 2: When the current node is the master node in the request processing network and receives the second capacity expansion instruction, the new resource allocation amount of each stateful application replica can be determined according to the second capacity expansion instruction, and then the actual resource allocation amount of the node served by the stateful application replica is increased to the new resource allocation amount. That is, the second capacity expansion instruction instructs to increase the resource allocation amount (such as computing performance, maximum memory usage, maximum bandwidth, etc.) of each existing node to increase the maximum request processing capacity of each node.

[0067] To deepen understanding, this disclosure also provides a specific implementation solution in combination with the device management scenario in the IoT scenario:

[0068] The device management platform described in this embodiment is a very large platform. It is mainly used to manage a large number of devices in the IoT scenario. It includes business functions such as device information, resources, and data semantic definitions. In addition, it also includes two-way communication between all devices and the cloud, such as device reporting data and the cloud sending data to control devices. In order to realize such a large-scale platform, the microservices approach is used to divide its applications. For the convenience of explanation, the simplified application structure is as follows: Figure 5a As shown:

[0069] The device / request access application is a stateless application. All requests are unrelated and the corresponding operations are executed directly. Its main functions are: permission authentication, on the one hand, to authenticate which devices can access and which cannot, on the other hand, to authenticate which Baidu cloud accounts can access the platform and which cannot; request distribution, to distribute requests to other applications according to the interface to complete the actual function implementation.

[0070] The device resource management application is a stateless application that models the application of physical devices. It mainly divides devices into three sections: instance / product / device. Instances divide the resources used by devices, products summarize the general characteristics of devices, and devices are the unique IDs of each physical device. Its main functions are: device external resource management. The Internet of Things service provides many applications. External resources are all resources that are not developed / maintained by the device management platform. Some devices may use the Internet of Things core suite to report data, and related resources need to be enabled; device internal resource management. The various applications on the device management platform also need to communicate. Generally, internal resources generally include caches, message queues, and registries. In order to facilitate the device to monopolize a certain resource, these internal resources also need to be managed by the platform.

[0071] The IoT core suite application is a stateless application. The device management platform will embed some functions of the core suite, which are independent of the device management platform. Its main functions are: scenario linkage service, embedding of scenario linkage service, metadata of storage service, etc.; rule engine service, embedding of rule engine service, metadata of storage service, etc.

[0072] Device runtime application scheduling is a stateless application. The device resource management application divides the resources used by the device according to the instance. The resources here are the device runtime applications, and scheduling refers to the manual changes to the device runtime applications that are already running. Its main functions are: runtime application management, storing metadata of runtime applications and parameters deployed on the Kubernetes platform, etc.; runtime application operation and maintenance, providing interfaces for direct operations on runtime applications. For example, Kubernetes sometimes fails to deploy applications due to insufficient physical resources. You can call the interface to query the cause and solve related problems. Or provide runtime application upgrade behavior, such as iterative upgrades of device management platform functions.

[0073] The only stateful application is the device management runtime application. Its main functions are: application discovery, discovering other copies of the application to determine how many nodes there are to form a grid network to complete data storage partitioning and fault tolerance; data docking, receiving data reported by the device and sending data to the device. There are two ways to do this: one is long link mode and the other is message subscription. Local computing, realizing the orderliness of data for all devices and read your write. At some times, data will arrive out of order due to network delay. Local computing aggregates data, reorders it according to the sequence number, and provides the reordered data to other functions for subsequent processing. Read your write means that users can retrieve the device shadow at any time - the time and attribute value of the device's last data report. At the same time, each time the device data arrives, differential calculation will be performed to generate data differential information and push it to the subscribed application or device. Device retrieval, realizing the current instance, the device connected to the runtime application may be retrieved according to a certain label, a certain category or a certain keyword.

[0074] The first four applications introduced above are all stateless applications, and high scalability indicators can be achieved by horizontally increasing application copies; however, the high scalability of stateful application device management runtime applications is not so simple. At the same time, since the runtime application needs to handle the data reporting / downloading of devices under all instances, its peak transaction processing volume per second is difficult to estimate. If externalized state is used, it is too dependent on the network. When the transaction processing volume increases, it will cause network bandwidth congestion and reduce the performance of the runtime application. Therefore, this embodiment proposes a more general high scalability architecture suitable for stateful applications on cloud native:

[0075] Step 1: Define the device management runtime application on the cloud native as a StatefulSet resource. This step allows the application to have a unique name and replica number when deployed;

[0076] Step 2: Define a Headless Service resource for the device management runtime application. This resource is a special Service resource on the Kubernetes (an open source, containerized application for managing multiple hosts in a cloud platform) platform. No actual ClusterIP (the IP address of the Service, which is a virtual IP address that cannot be pinged from the external network and is only accessible within the Kubernetes cluster) is allocated. This step allows the application to have its own DNS (Domain Name System, translated here as domain name), and its format is generally:

[0077] <staefuleset-number> . <service-name> . <namespace>.svc.cluster.local;

[0078] The statefulset-number is the unique replica number generated in step 1.

[0079] Step 3: Add a ServiceAccount resource for the device management runtime application. This resource is an account permission resource on the Kubernetes platform. The application can access some Kubernetes APIs (Application Programming Interface) through this account.

[0080] Step 4: Implement the application discovery function in the device management runtime application to self-organize all runtime application copies to form a grid network. The specific steps are as follows:

[0081] a) When the application starts, inject the DNS general format into the application as an environment variable;

[0082] b) When the application starts, access the Kubernetes API to obtain the total number of replicas configured in the StatefulSet resource, and obtain the number of the current application replica in the StatefulSet by the host name to determine the total number of nodes in the self-organizing network;

[0083] c) Partitioning the device state (local computing function part) is performed based on the total number of nodes obtained in the previous step and the node number. In this embodiment, Hazelcast (a highly scalable data distribution and cluster platform that can be used to implement distributed data storage and data caching) is used to process the storage of device states. The data partitioning strategy is set to Hash remainder, that is, Hash calculation is performed on each device, and the result is modulo the number of valid nodes to finally determine on which node the device data should be calculated;

[0084] d) Access the Kubernetes API to obtain the currently alive (valid) application node. If there are no other alive nodes, the current node becomes the master node in the grid network and registers the node join / delete listener event, which is the application replica lifecycle callback event of the Kubernetes platform. If there are other alive nodes, the master node in the grid network performs data repartitioning operations, notifies other nodes to repartition and transmit data;

[0085] e) When the application is closed, the master node in the grid network will notify the remaining application replica nodes to repartition, and the current node will migrate all its own device data (i.e. status);

[0086] Step 5: When the device management runtime is applied, all devices in the instance are grouped according to the total number of nodes. The grouping strategy is still the same as the partitioning strategy, which includes device subscription, publishing, and linking, etc.

[0087] Step 6: Through step 4, the device management runtime application is already able to self-organize the network and share each other's status (record each other).

[0088] Next, you need to distribute the device request / link. The device / request access application has already implemented this function. The specific steps are as follows:

[0089] a) When a request from a device comes into the device / request access application, the application will access the master node of the device management runtime application in the grid network to determine the runtime application to which the request should go;

[0090] b) dispatch the request to the application;

[0091] c) Return the response to the request.

[0092] Step 7: If the master node in the grid network is about to shut down, its next sequence number sequence becomes the master node. If there is no next node, the cycle starts from the head node.

[0093] Through the above six steps, a general high-scalability architecture for cloud-native stateful applications has been completed.

[0094] The device management runtime application still involves some network consumption, but it only occurs when the node is online or offline. For example, the device management runtime application runs with two copies, but the traffic increases sharply, so it has to be horizontally expanded to run with three or more copies. At this time, a full state data repartition will be performed to synchronize the data. The StatefulSet resource limits each application copy to be started one by one, not all at once, which solves the torrent problem and reduces the peak network resource consumption to consumption per startup, which plays a role in peak reduction.

[0095] Hazelcast stores copies of state data. In fact, stateful applications still maintain their own states. Only when the stateful application disappears will these copies be migrated to other nodes. That is, the process of externalizing state data occurs when the application starts / stops, not every request. Therefore, this "sticky session" mechanism allows all devices of the instance to be spread across all nodes, and the actual request processing / connection / subscription, etc., still occurs on the corresponding application node.

[0096] The master node in the grid network has only one more state than other nodes. Each node has a state flag to record whether it is a master node and the application copy number of the master node. The benefit of this is that no matter which node the device / application requesting access asks the master node, any node can give a reply, that is, forward the query and return it.

[0097] Figure 5b The figure shows the changes of a stateful application in stable operation during horizontal expansion. As shown in the left half, there are two copies of the device management runtime application in stable operation, which are numbered 0 and 1 respectively. In the application copy No. 0, it stores the status and related data of devices A, B, C, and D. In the application copy No. 1, it stores the status and related data of devices E, F, G, and H. Among them, the application copy No. 0 is the master node in the grid network. After horizontal expansion, as shown in the right half of the figure, the application copy No. 2 is added to the grid network. At this time, the data is repartitioned and part of the data is transferred to the new node. It is worth mentioning that not all data will be moved. For example, devices A and C in the copy No. 0 are still left, and only device E is migrated. This non-all data movement also reduces performance occupancy and network consumption to a certain extent.

[0098] When the total number of devices is fixed, horizontal expansion can reduce the number of devices that each stateful application copy needs to process, greatly enhancing the performance of the application. When the transaction volume of a single device increases, only vertical expansion is required to match the performance by adding a small amount of hardware resources (CPU, network, memory, etc.).

[0099] In summary, compared to current technologies, this architecture is more scalable and can be easily expanded to achieve linear growth in performance.

[0100] Further references Figure 6 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a request processing device, which is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0101] like Figure 6 As shown, the request processing device 600 of this embodiment may include: a pending request receiving unit 601, a target node determining unit 602, and a pending request processing unit 603. The pending request receiving unit 601 is configured to receive a pending request initiated by a user; the target node determining unit 602 is configured to determine the target node storing the historical state data of the pending request in response to the current node being the master node in the request processing network; the master node and the slave node constituting the request processing network are both served by different copies of a stateful application, the historical state data of different requests are dispersedly stored in different nodes, the copies of the nodes are run in the memory in the form of carrying the historical state data, and the actual storage nodes of different historical state data are recorded in the master node; the pending request processing unit 603 is configured to forward the pending request to the target node, and control the target node to generate response information corresponding to the pending request according to the stored historical state information.

[0102] In this embodiment, in the request processing device 600, the specific processing of the pending request receiving unit 601, the target node determining unit 602, and the pending request processing unit 603 and the technical effects thereof can be referred to in Figure 2 The relevant descriptions of steps 201 - 203 in the corresponding embodiment are not repeated here.

[0103] In some optional implementations of this embodiment, the request processing device 600 may further include:

[0104] The pending request forwarding unit is configured to forward the pending request to the master node in response to the current node being a slave node in the request processing network.

[0105] In some optional implementations of this embodiment, the request processing device 600 may further include: a request processing network construction unit configured to pre-construct a request processing network, and the request processing network construction unit is further configured to:

[0106] Get the unique identity information assigned to you;

[0107] Obtaining a unique domain name that is assigned; wherein the unique domain name is generated based on unique identity information;

[0108] Discovering other domain names that are similar to the unique domain name and determining other stateful application replicas corresponding to the other domain names;

[0109] Determine, based on a preset master-slave node selection mechanism, the node types selected as the current stateful application replica and the other stateful application replicas respectively;

[0110] Based on the node type, it builds a request processing network together with other nodes.

[0111] In some optional implementations of this embodiment, in response to the unique domain name containing unique identity information, other domain names differ from the unique domain name only in the identity information content recorded in the identity information record fields that are also contained.

[0112] In some optional implementations of this embodiment, the master-slave node selection mechanism includes: a serial number rotation mechanism based on a unique replica serial number, a voting mechanism based on the election initiation time, and a selection mechanism based on the replica creation time.

[0113] In some optional implementations of this embodiment, the request processing device 600 may further include:

[0114] A newly created stateful application replica determining unit is configured to, in response to the current node being a master node in the request processing network and receiving a first capacity expansion instruction, determine a newly created stateful application replica according to the first capacity expansion instruction;

[0115] The new slave node joins the processing unit, which is configured to add the newly created stateful application replica as a new slave node to the request processing network and re-determine the actual storage node of the historical state data of different requests.

[0116] In some optional implementations of this embodiment, the request processing device 600 may further include:

[0117] A new resource allocation amount determining unit, configured to, in response to the current node being a master node in the request processing network and receiving a second capacity expansion instruction, determine a new resource allocation amount for the stateful application replica according to the second capacity expansion instruction;

[0118] The resource allocation amount increasing unit is configured to increase the actual resource allocation amount of the node served by the stateful application replica to the new resource allocation amount.

[0119] In some optional implementations of this embodiment, the request processing device 600 may further include:

[0120] The response information returning unit is configured to control the target node to return the response information to the user who initiated the request to be processed.

[0121] This embodiment exists as an apparatus embodiment corresponding to the above-mentioned method embodiment. The request processing apparatus provided by this embodiment pre-creates multiple copies of the stateful application for a stateful application that needs to store historical status data for responding to received pending requests, and uses these copies as nodes to build a grid-form request processing network, supplemented by a master-slave mechanism and a distributed storage mechanism, to form a highly scalable architecture for processing stateful application requests. For incoming pending requests, they can be forwarded to the target node that stores the historical status data of the pending requests through the master node, thereby completing the response to the pending request with the help of the target node. While having basic request processing, the architecture can also improve the overall request processing capability and performance by adding more stateful application copies or increasing the amount of resources allocated to each copy.

[0122] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can implement the request processing method described in any of the above embodiments when executing.

[0123] According to an embodiment of the present disclosure, the present disclosure further provides a readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to implement the request processing method described in any of the above embodiments when executed.

[0124] According to an embodiment of the present disclosure, the present disclosure further provides a computer program product, which, when executed by a processor, can implement the steps of the request processing method described in any of the above embodiments.

[0125] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0126] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0127] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0128] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as the request processing method. For example, in some embodiments, the request processing method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the request processing method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the request processing method in any other appropriate manner (e.g., by means of firmware).

[0129] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0130] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0131] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0132] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0133] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0134] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.

[0135] According to the technical solution of the embodiment of the present disclosure, for a stateful application that needs to store historical status data for responding to received pending requests, multiple copies of the stateful application are created in advance, and these copies are used as nodes to build a grid-like request processing network, assisted by a master-slave mechanism and a distributed storage mechanism, to form a highly scalable architecture for processing stateful application requests. For incoming pending requests, they can be forwarded to a target node that stores the historical status data of the pending requests through the master node, so that the target node can be used to complete the response to the pending request. While having basic request processing, the architecture can also improve the overall request processing capability and performance by adding more stateful application copies or increasing the amount of resources allocated to each copy.

[0136] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0137] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.< / namespace> < / service-name> < / staefuleset-number>

Claims

1. A request processing method, comprising: Receive pending requests initiated by users; In response to the current node being a master node in a request processing network, determining a target node storing the historical state data of the request to be processed; wherein the master node and the slave node constituting the request processing network are both served by different copies of a stateful application, the historical state data of different requests are dispersedly stored in different nodes, the copies of the nodes serving as the nodes run in the memory in the form of carrying the historical state data, and the actual storage nodes of different historical state data are recorded in the master node; The pending request is forwarded to the target node, and the target node is controlled to generate response information corresponding to the pending request according to the stored historical status information.

2. The method according to claim 1, further comprising: In response to the current node being a slave node in the request processing network, forwarding the request to be processed to the master node.

3. The method according to claim 1, wherein: The process of pre-building the request processing network includes: Obtain unique identity information assigned to a stateful application replica acting as a node; Obtaining a unique domain name assigned to a stateful application replica acting as a node; wherein the unique domain name is generated based on the unique identity information; Discovering other domain names that are similar to the unique domain name, and determining other stateful application replicas corresponding to the other domain names; Determine, based on a preset master-slave node selection mechanism, the node types selected as the current stateful application replica and the other stateful applications respectively; The request processing network is constructed based on the node type and other nodes.

4. The method according to claim 3, wherein: In response to the unique domain name containing the unique identity information, the other domain names differ from the unique domain name only in the identity information contents respectively recorded in the identity information record fields that are also contained therein.

5. The method according to claim 3, wherein: The master-slave node selection mechanism includes: a sequence number rotation mechanism based on a unique replica sequence number, a voting mechanism based on the campaign initiation time, and a selection mechanism based on the replica creation time.

6. The method according to claim 1, further comprising: In response to the current node being a master node in the request processing network and receiving a first capacity expansion instruction, determining to create a new stateful application replica according to the first capacity expansion instruction; The newly created stateful application replica is added to the request processing network as a new slave node, and the actual storage node of the historical state data of different requests is re-determined.

7. The method according to claim 1, further comprising: In response to the current node being a master node in the request processing network and receiving a second capacity expansion instruction, determining a new resource allocation amount for the stateful application replica according to the second capacity expansion instruction; The actual resource allocation of the node served by the stateful application replica is increased to the new resource allocation.

8. The method according to any one of claims 1 to 7, further comprising: The target node is controlled to return the response information to the user who initiated the request to be processed.

9. A request processing device, comprising: A pending request receiving unit, configured to receive a pending request initiated by a user; A target node determination unit is configured to determine a target node storing the historical state data of the request to be processed in response to the current node being a master node in the request processing network; wherein the master node and the slave node constituting the request processing network are both served by different copies of a stateful application, the historical state data of different requests are dispersedly stored in different nodes, the copies of the nodes are run in the memory in the form of carrying the historical state data, and the actual storage nodes of different historical state data are recorded in the master node; The pending request processing unit is configured to forward the pending request to the target node and control the target node to generate response information corresponding to the pending request according to the stored historical status information.

10. The apparatus according to claim 9, further comprising: The pending request forwarding unit is configured to forward the pending request to the master node in response to the current node being a slave node in the request processing network.

11. The apparatus according to claim 9, further comprising: A request processing network construction unit configured to pre-construct the request processing network, wherein the request processing network construction unit is further configured to: Obtain unique identity information assigned to a stateful application replica acting as a node; Obtaining a unique domain name assigned to a stateful application replica acting as a node; wherein the unique domain name is generated based on the unique identity information; Discovering other domain names that are similar to the unique domain name, and determining other stateful application replicas corresponding to the other domain names; Determine, based on a preset master-slave node selection mechanism, the node types selected as the current stateful application replica and the other stateful applications respectively; The request processing network is constructed based on the node type and other nodes.

12. The device according to claim 11, wherein In response to the unique domain name containing the unique identity information, the other domain names differ from the unique domain name only in the identity information contents respectively recorded in the identity information record fields that are also contained therein.

13. The device according to claim 11, wherein: The master-slave node selection mechanism includes: a sequence number rotation mechanism based on a unique replica sequence number, a voting mechanism based on the campaign initiation time, and a selection mechanism based on the replica creation time.

14. The apparatus according to claim 9, further comprising: A newly created stateful application replica determining unit is configured to, in response to the current node being a master node in the request processing network and receiving a first capacity expansion instruction, determine a newly created stateful application replica according to the first capacity expansion instruction; The new slave node adding processing unit is configured to add the newly created stateful application replica as a new slave node to the request processing network and re-determine the actual storage node of the historical state data of different requests.

15. The apparatus according to claim 9, further comprising: A new resource allocation amount determining unit, configured to, in response to the current node being a master node in the request processing network and receiving a second capacity expansion instruction, determine a new resource allocation amount for the stateful application replica according to the second capacity expansion instruction; The resource allocation amount increasing unit is configured to increase the actual resource allocation amount of the node served by the stateful application replica to the new resource allocation amount.

16. The device according to any one of claims 9 to 15, further comprising: The response information returning unit is configured to control the target node to return the response information to the user who initiated the request to be processed.

17. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the request processing method according to any one of claims 1 to 8.

18. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the request processing method according to any one of claims 1 to 8.

19. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the request processing method according to any one of claims 1 to 8 are implemented.