Request processing method, request processing apparatus, computer readable medium, and device
By automating the updating of connection instances and status checks in memory, the problem of low server adjustment efficiency caused by changes in the number of units in container orchestration systems is solved. This achieves automated management of logical units and memory consistency, improving processing immediacy and efficiency.
Patent Information
- Application Number
- CN202210398890.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2042-04-15
AI Technical Summary
In container orchestration systems, when the number of units changes, existing technologies require manual adjustment of the number of units stored in the server to match the number of existing units in Kubernetes, which is inefficient and not timely enough.
A request processing method is provided that automatically obtains logical unit information, updates the connection instances in memory, performs status detection to determine the target logical unit in the working state, and allocates the request to the target logical unit, thereby achieving consistency between the connection instances in memory and the logical units.
It improves the automation and immediacy of consistency between in-memory connected instances and logical units, reduces the cost of manual adjustments, and ensures timely processing of requests.
Smart Images

Figure CN114706684B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and in particular, to a request processing method, a request processing apparatus, a computer readable medium and an electronic device. BACKGROUND
[0002] In a container orchestration system (Kubernetes, K8s), a plurality of units that can process requests are generally included, and based on the scalability of K8s, the number of units is uncertain. When the number of units changes, it means that there are newly online units or there are units that have been offline. Generally, when this situation occurs, manual configuration needs to be performed in the server, so that the number of units stored in the server is consistent with the existing number of units of K8s. However, this way is low in efficiency.
[0003] It should be noted that the information disclosed in the above background section is only used to strengthen the understanding of the background of the present disclosure, and therefore can include information that does not constitute prior art known to those of ordinary skill in the art. SUMMARY
[0004] The purpose of the embodiments of the present disclosure is to provide a request processing method, a request processing apparatus, a computer readable medium and an electronic device, which can provide the function of modifying the connection instances in the memory, realize automatic updating of the memory, and improve the consistency of the connection instances in the memory and the logical units in the working state, that is, the logical units corresponding to the connection instances stored in the memory are all in the working state. Compared with the existing manual modification of the memory, it is higher in automation, stronger in immediacy, and higher in efficiency.
[0005] The first aspect of the embodiments of the present disclosure provides a request processing method, comprising:
[0006] obtaining a plurality of logical unit information;
[0007] if the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instances in the memory, updating the current connection instances in the memory according to the plurality of logical unit information; wherein the updated memory stores the connection instances corresponding to the plurality of logical unit information respectively;
[0008] detecting the states of the logical units corresponding to each connection instance, and determining target logical units in the working state according to the state detection results;
[0009] allocating the to-be-processed request to the target logical units.
[0010] In an exemplary embodiment of the present disclosure, the above method further comprises:
[0011] If it is detected that the specific logical unit information is included in the plurality of logical unit information and the connection instance corresponding to the specific logical unit information is not stored in the memory, it is determined that the connection instance corresponding to the plurality of logical unit information is inconsistent with the current connection instance in the memory.
[0012] If it is detected that the specific connection instance is included in the memory and the specific connection instance does not correspond to the plurality of logical unit information, it is determined that the connection instance corresponding to the plurality of logical unit information is inconsistent with the current connection instance in the memory.
[0013] If it is detected that the current connection instance in the memory corresponds to the connection instance corresponding to at least one logical unit information, it is determined that the connection instance corresponding to the plurality of logical unit information is consistent with the current connection instance in the memory.
[0014] In an exemplary embodiment of the present disclosure, after it is determined that the connection instance corresponding to the plurality of logical unit information is consistent with the current connection instance in the memory, the above method further comprises:
[0015] detecting the state of the logical unit corresponding to each connection instance, and determining a target logical unit in an operating state according to the state detection result;
[0016] allocating the to-be-processed request to the target logical unit.
[0017] In an exemplary embodiment of the present disclosure, updating the current connection instance in the memory according to the plurality of logical unit information comprises:
[0018] If it is detected that the specific logical unit information is included in the plurality of logical unit information and the connection instance corresponding to the specific logical unit information is not stored in the memory, the connection instance corresponding to the specific logical unit information is added to the memory.
[0019] If it is detected that the specific connection instance is included in the memory and the specific connection instance does not correspond to the plurality of logical unit information, the specific connection instance is deleted.
[0020] In an exemplary embodiment of the present disclosure, detecting the state of the logical unit corresponding to each connection instance, and determining a target logical unit in an operating state according to the state detection result comprises:
[0021] sending a test request to the logical unit corresponding to each connection instance, and receiving a response result to the test request;
[0022] determining the logical unit corresponding to the response result as the target logical unit in an operating state; wherein the logical units other than the target logical unit in the logical units corresponding to each connection instance are in a non-operating state.
[0023] In an example embodiment of the present disclosure, if the number of target logical units is greater than 1, the pending request is distributed into the target logical units, including:
[0024] determining the distribution identifier corresponding to the pending request;
[0025] if the distribution identifier corresponds to a first logical unit in the target logical units, distributing the pending request into the first logical unit;
[0026] if the distribution identifier corresponds to a second logical unit and the second logical unit does not belong to the target logical units, determining a reference logical unit corresponding to the distribution identifier from the target logical units, and distributing the pending request into the reference logical unit.
[0027] In an example embodiment of the present disclosure, the plurality of logical unit information is obtained, including:
[0028] obtaining the plurality of logical unit information according to a preset time length.
[0029] In an example embodiment of the present disclosure, after updating the current connection instance in the memory according to the plurality of logical unit information, the method further includes:
[0030] updating a preset initialization file according to the connection instances corresponding to the plurality of logical unit information respectively; wherein the preset initialization file is used for initializing the memory.
[0031] In an example embodiment of the present disclosure, the method further includes:
[0032] when detecting a boot operation, synchronizing the latest connection instance stored in the preset initialization file to the memory.
[0033] According to a second aspect of the embodiments of the present disclosure, a request processing apparatus is provided, and the apparatus includes:
[0034] a logical unit information obtaining unit, configured to obtain a plurality of logical unit information;
[0035] a connection instance updating unit, configured to update the current connection instance in the memory according to the plurality of logical unit information if the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory; wherein the updated memory stores the connection instances corresponding to the plurality of logical unit information respectively;
[0036] a logical unit determining unit, configured to perform state detection on the logical units corresponding to each connection instance, and determine a target logical unit in a working state according to the state detection result;
[0037] a request distributing unit, configured to distribute a pending request into the target logical unit.
[0038] In an example embodiment of the present disclosure, the apparatus further includes:
[0039] The consistency determining unit is configured to determine that the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory if it is detected that the plurality of logical unit information includes the specific logical unit information and the connection instance corresponding to the specific logical unit information is not stored in the memory.
[0040] The consistency determining unit is further configured to determine that the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory if it is detected that the memory includes the specific connection instance and the specific connection instance does not correspond to any of the plurality of logical unit information.
[0041] The consistency determining unit is further configured to determine that the connection instances corresponding to the plurality of logical unit information are consistent with the current connection instance in the memory if it is detected that the current connection instance in the memory one-to-one corresponds to the connection instance corresponding to at least one of the logical unit information.
[0042] In an example embodiment of the present disclosure, the apparatus further includes:
[0043] The state detecting unit is configured to perform state detection on the logical units corresponding to each connection instance after determining that the connection instances corresponding to the plurality of logical unit information are consistent with the current connection instance in the memory, and determine the target logical unit in the working state according to the state detection result.
[0044] The request assigning unit is further configured to assign the to-be-processed request to the target logical unit.
[0045] In an example embodiment of the present disclosure, the connection instance updating unit updates the current connection instance in the memory according to the plurality of logical unit information, including:
[0046] If it is detected that the plurality of logical unit information includes the specific logical unit information and the connection instance corresponding to the specific logical unit information is not stored in the memory, the connection instance corresponding to the specific logical unit information is added to the memory.
[0047] If it is detected that the memory includes the specific connection instance and the specific connection instance does not correspond to any of the plurality of logical unit information, the specific connection instance is deleted.
[0048] In an example embodiment of the present disclosure, the logical unit determining unit performs state detection on the logical units corresponding to each connection instance, and determines the target logical unit in the working state according to the state detection result, including:
[0049] sending a test request to the logical units corresponding to each connection instance, and receiving a response result to the test request.
[0050] determining the logical unit corresponding to the response result as a target logical unit in a working state; wherein, other logical units corresponding to the connection instance except the target logical unit are in a non-working state.
[0051] In an example embodiment of the present disclosure, if the number of target logical units is greater than 1, the request distribution unit distributes the to-be-processed request to the target logical units, including:
[0052] determining the distribution identifier corresponding to the to-be-processed request;
[0053] if the distribution identifier corresponds to a first logical unit in the target logical units, distributing the to-be-processed request to the first logical unit;
[0054] if the distribution identifier corresponds to a second logical unit and the second logical unit does not belong to the target logical units, determining a reference logical unit corresponding to the distribution identifier from the target logical units, and distributing the to-be-processed request to the reference logical unit.
[0055] In an example embodiment of the present disclosure, the logical unit information acquisition unit acquires a plurality of logical unit information, including:
[0056] acquiring the plurality of logical unit information according to a preset time length.
[0057] In an example embodiment of the present disclosure, the above device further includes:
[0058] a file updating unit, configured to update a preset initialization file according to the connection instance corresponding to each of the plurality of logical unit information after the connection instance updating unit updates the current connection instance in the memory according to the plurality of logical unit information; wherein, the preset initialization file is used to initialize the memory.
[0059] In an example embodiment of the present disclosure, the above device further includes:
[0060] an initialization unit, configured to synchronize the latest connection instance stored in the preset initialization file to the memory when a boot operation is detected.
[0061] According to a third aspect of the embodiments of the present disclosure, a computer readable medium is provided, which stores a computer program. The program is executed by a processor to implement the request processing method of the first aspect in the above embodiments.
[0062] According to a fourth aspect of the embodiments of the present disclosure, an electronic device is provided, including: one or more processors; a storage device configured to store one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the request processing method of the first aspect in the above embodiments.
[0063] According to a fifth aspect of the present application, a computer program product or computer program is provided, which comprises computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method provided in the various optional implementation manners described above.
[0064] The technical solutions provided by the embodiments of the present disclosure can include the following beneficial effects:
[0065] In the technical solutions provided by some embodiments of the present disclosure, specifically including: obtaining a plurality of logical unit information; if the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory, updating the current connection instance in the memory according to the plurality of logical unit information; wherein the plurality of logical unit information in the updated memory respectively correspond to the connection instances stored in the memory; performing state detection on the logical units corresponding to each connection instance, and determining a target logical unit in a working state according to the state detection result; and distributing a to-be-processed request to the target logical unit. By implementing the embodiments of the present disclosure, on the one hand, the function of modifying the connection instance in the memory can be provided, the automatic updating of the memory is realized, and the consistency between the connection instance in the memory and the logical unit in a working state is improved, that is, the logical units corresponding to the connection instances stored in the memory are all in a working state. Compared with the existing manual modification of the memory, the degree of automation is higher, the timeliness is stronger, and the efficiency is also higher. On the other hand, whether the logical unit is online or not can be determined by sending a test request, and through the two-layer consistency determination of the updating of the memory and the state detection, the high consistency between the online logical unit and the connection instance in the memory can be guaranteed, manual adjustment of the connection instance in the memory to maintain the consistency with the online logical unit can be avoided, the labor cost can be reduced, and the automatic maintenance of the consistency can be realized.
[0066] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0067] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0068] Figure 1A schematic diagram of an exemplary system architecture in which a request processing method and a request processing apparatus according to embodiments of the present disclosure can be applied is shown schematically;
[0069] Figure 2 A structural schematic diagram of a computer system of an electronic device suitable for implementing embodiments of the present disclosure is shown schematically;
[0070] Figure 3 A flowchart of a request processing method according to an embodiment of the present disclosure is shown schematically;
[0071] Figure 4 An application architecture diagram of a request processing method according to an embodiment of the present disclosure is shown schematically;
[0072] Figure 5 A flowchart of a request processing method according to an embodiment of the present disclosure is shown schematically;
[0073] Figure 6 A structural block diagram of a request processing apparatus in an embodiment of the present disclosure is shown schematically. DETAILED DESCRIPTION
[0074] Example implementations will now be described more fully with reference to the accompanying drawings. Example implementations can be implemented in any
[0075] In addition, the accompanying drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the present disclosure and serve to explain the principles of the present disclosure. Features, elements, and / or properties that are
[0076] Figure 1A schematic diagram of a system architecture showing an exemplary application environment of a request processing method and a request processing apparatus to which embodiments of the present disclosure can be applied is shown.
[0077] As shown in Figure 1 , the system architecture 100 can include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is a medium to provide a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links, or fiber optic cables, etc. The terminal devices 101, 102, 103 can be various electronic devices with display screens, including but not limited to desktop computers, portable computers, smart phones, and tablet computers, etc. It should be understood that Figure 1 The number of terminal devices, networks, and servers in may be illustrative only. Depending on the implementation needs, there can be any number of terminal devices, networks, and servers. For example, the server 105 can be a server cluster composed of multiple servers, etc. The server 105 is configured to perform: obtaining a plurality of logical unit information; if the connection instances corresponding to the plurality of logical unit information are inconsistent with a current connection instance in a memory, updating the current connection instance in the memory according to the plurality of logical unit information; wherein the updated memory stores the connection instances corresponding to the plurality of logical unit information respectively; performing state detection on the logical units corresponding to each connection instance, and determining a target logical unit in a working state according to the state detection result; and distributing a to-be-processed request to the target logical unit.
[0078] Figure 2 A structural schematic diagram of a computer system of an electronic device suitable for implementing embodiments of the present disclosure is shown.
[0079] It should be noted that Figure 2 The computer system 200 of the electronic device shown is only an example, and should not impose any limitation on the functions and use range of embodiments of the present disclosure.
[0080] As shown in Figure 2 , the computer system 200 includes a central processing unit (CPU) 201, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 202 or programs loaded from a storage portion 208 into a random access memory (RAM) 203. Various programs and data required for system operation are also stored in the (RAM) 203. The (CPU) 201, the (ROM) 202, and the (RAM) 203 are connected to each other through a bus 204. An input / output (I / O) interface 205 is also connected to the bus 204.
[0081] The following components are connected to the (I / O) interface 205: an input part 206 including a keyboard, a mouse, etc.; an output part 207 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage part 208 including a hard disk, etc.; and a communication part 209 including a network interface card such as a LAN card, a modem, etc. The communication part 209 performs communication processing via a network such as the Internet. A drive 210 is also connected to the (I / O) interface 205 as necessary. A removable medium 211 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 210 as necessary, so that a computer program read out therefrom is installed in the storage part 208 as necessary.
[0082] In particular, according to embodiments of the present disclosure, the processes described below with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for executing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication part 209, and / or installed from the removable medium 211. When the computer program is executed by the central processing unit (CPU) 201, various functions defined in the methods and apparatuses of the present application are executed.
[0083] It should be noted that the computer-readable medium shown in the disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination thereof. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, 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 thereof. In the disclosure, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the disclosure, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or apparatus. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination thereof.
[0084] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a part of code containing one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order than that shown in the drawings. For example, two blocks that are shown in succession can actually be executed substantially in parallel, and they can also be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams or flowcharts, and the combination of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0085] The units described in the embodiments of the present disclosure can be implemented in the form of software, or can be implemented in the form of hardware, and the described units can also be arranged in a processor. In some cases, the names of these units do not constitute a limitation on the units themselves.
[0086] As another aspect, the present application also provides a computer readable medium, which can be included in the electronic device described in the above embodiments, or can exist independently without being assembled into the electronic device. The computer readable medium carries one or more programs, which, when executed by the electronic device, enable the electronic device to implement the method described in the above embodiments. For example, the electronic device can implement the steps shown in Figure 3 and the like.
[0087] The present example embodiment provides a request processing method, which can include the following steps S310 to S340, as shown in Figure 3
[0088] Step S310: Obtain a plurality of logical unit information.
[0089] Step S320: If the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory, update the current connection instance in the memory according to the plurality of logical unit information; wherein the plurality of logical unit information respectively corresponding to the connection instances stored in the updated memory.
[0090] Step S330: Perform state detection on the logical units corresponding to each connection instance, and determine the target logical unit in the working state according to the state detection result.
[0091] Step S340: Distribute the to-be-processed request to the target logical unit.
[0092] The implementation Figure 3 The request processing method shown in the present example embodiment can provide the function of modifying the connection instances in the memory, realize automatic updating of the memory, and improve the consistency between the connection instances in the memory and the logical units in the working state, i.e., the logical units corresponding to the connection instances stored in the memory are all in the working state. Compared with the existing manual modification of the memory, the present example embodiment has higher automation, stronger immediacy, and higher efficiency. In addition, the logical units can be determined to be online or offline by sending test requests, and the high consistency between the online logical units and the connection instances in the memory can be ensured through the two-layer consistency determination of the updating of the memory and the state detection, which can reduce the labor cost and realize automatic maintenance of the consistency.
[0093] Next, the above steps of the present example embodiment are described in more detail.
[0094] In step S310, a plurality of logical unit information is acquired.
[0095] Specifically, the logical unit information can be used to represent the corresponding logical unit, for example, the logical unit information can be an address, an ID, an identifier, etc., and the present embodiment is not limited thereto. Different logical units correspond to different logical unit information, and the logical unit information can also be used as a unique representation of the logical unit, for example. It needs to be further explained that the logical unit can be a Pod in a container orchestration system (Kubernetes, K8s), which contains one or more containers, and also includes resources such as storage, network, etc. shared by various containers, and supports various container environments (such as Docker). In addition, optionally, the logical unit can also be other types of management elements in the container orchestration system (Kubernetes, K8s), and the present embodiment is not limited thereto. The way to acquire the plurality of logical unit information can be: acquiring the plurality of logical unit information from a preset platform; wherein the preset platform can be a platform pre-accessed to an nginx server, which can be understood as a multi-functional architecture component of an HTTP WEB server, a reverse proxy server, a mail proxy server and a general TCP / UDP proxy server, and the nginx server can also provide cache service functions. The nginx server can be used to perform, for example Figure 3 The steps and their embodiments shown in the above, Figure 5 The units shown in the above can also be disposed in the nginx server. In addition, optionally, in addition to being executed through the nginx server, the present application can also be executed through other types of servers, Figure 5 The units shown in the above can also be deployed in other servers, and the present embodiment is not limited thereto.
[0096] As an optional embodiment, acquiring the plurality of logical unit information includes: acquiring the plurality of logical unit information according to a preset time length.
[0097] Specifically, the preset time length can be a time length pre-set by a user, such as 10 ms. The plurality of logical unit information acquired according to the preset time length can be information of all logical units currently in a working state.
[0098] It can be seen that by implementing this optional embodiment, the plurality of logical unit information can be acquired based on the preset time length to realize polling type information acquisition, which can be beneficial to timely updating the connection instances of the logical units in the memory to ensure the consistency between the connection instances stored in the memory and the shiftable logical units.
[0099] In step S320, if the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory, the current connection instance in the memory is updated according to the plurality of logical unit information; wherein the connection instances corresponding to the plurality of logical unit information are stored in the updated memory.
[0100] Specifically, the memory can be an extended memory in the nginx server or other forms of memory, which is not limited in the present application. The connection instance can be used to connect the corresponding logical unit. For example, there are logical unit A, logical unit B and logical unit C, logical unit A corresponds to connection instance A, logical unit B corresponds to connection instance B, and logical unit C corresponds to connection instance C, and the connection instance can be represented as upstream-peer.
[0101] As an optional embodiment, the above method further comprises: if it is detected that the plurality of logical unit information includes a specific logical unit information and the connection instance corresponding to the specific logical unit information is not stored in the memory, it is determined that the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory; if it is detected that the memory includes a specific connection instance and the specific connection instance does not correspond to any of the plurality of logical unit information, it is determined that the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory; if it is detected that the current connection instance in the memory corresponds to the connection instance corresponding to at least one of the logical unit information, it is determined that the connection instances corresponding to the plurality of logical unit information are consistent with the current connection instance in the memory.
[0102] Specifically, the number of specific logical unit information can be one or more. If it is detected that the plurality of logical unit information includes a specific logical unit information and the connection instance corresponding to the specific logical unit information is not stored in the memory, it indicates that the logical unit corresponding to the specific logical unit information is a newly added logical unit. The number of specific connection instances can also be one or more. If it is detected that the memory includes a specific connection instance and the specific connection instance does not correspond to any of the plurality of logical unit information, it indicates that the logical unit corresponding to the specific connection instance has been offline, so the logical unit information of the logical unit is not included in the plurality of logical unit information obtained.
[0103] It can be seen that by implementing the optional embodiment, the determination condition for the consistency of the connection instances corresponding to the plurality of logical unit information and the current connection instance in the memory can be provided, which can realize accurate determination for multiple situations and improve the consistency determination accuracy.
[0104] As an optional embodiment, after determining that the connection instances corresponding to the plurality of logical unit information are consistent with the current connection instance in the memory, the method further comprises: performing state detection on the logical units corresponding to each connection instance, and determining a target logical unit in a working state according to the state detection result; and distributing the to-be-processed request to the target logical unit.
[0105] Optionally, the manner of performing state detection on the logical units corresponding to each connection instance and determining a target logical unit in a working state according to the state detection result can be: obtaining a state identifier of the logical unit corresponding to each connection instance, and generating a corresponding state detection result according to the state identifier, wherein the state detection result is used to indicate that the logical unit is in a working state or used to indicate that the logical unit is in a non-working state, and the state detection result can also be used to indicate other states, which are not limited in the embodiments of the present application.
[0106] It can be seen that, by implementing the optional embodiment, the to-be-processed request can be directly distributed to the target logical unit in a working state after determining that the connection instances corresponding to the plurality of logical unit information are consistent with the current connection instance in the memory, which can realize high consistency between the connection instance in the memory and the logical unit in a working state, avoid distributing the to-be-processed request to the offline logical unit to cause the request to be not processed for a long time, and also reduce the labor cost and ensure normal request distribution through automatic consistency detection.
[0107] As an optional embodiment, updating the current connection instance in the memory according to the plurality of logical unit information comprises: if it is detected that the plurality of logical unit information includes specific logical unit information and the connection instance corresponding to the specific logical unit information is not stored in the memory, adding the connection instance corresponding to the specific logical unit information to the memory; and if it is detected that the memory includes a specific connection instance and the specific connection instance does not correspond to the plurality of logical unit information, deleting the specific connection instance.
[0108] Specifically, adding the connection instance corresponding to the specific logical unit information to the memory comprises: obtaining the connection instance corresponding to the specific logical unit information, and adding the connection instance corresponding to the specific logical unit information to the memory.
[0109] It can be seen that, by implementing the optional embodiment, the function of modifying the connection instance in the memory can be provided, automatic updating of the memory is realized, and the consistency between the connection instance in the memory and the logical unit in a working state is improved, that is, the logical units corresponding to the connection instances stored in the memory are all in a working state, which is more automatic and more timely compared with the existing manual modification of the memory.
[0110] As an optional embodiment, after updating the current connection instance in the memory according to the plurality of logical unit information, the method further comprises: updating a preset initialization file according to the connection instance corresponding to the plurality of logical unit information respectively; wherein the preset initialization file is used for initializing the memory.
[0111] Specifically, updating the preset initialization file according to the connection instance corresponding to the plurality of logical unit information respectively comprises: obtaining the connection instance corresponding to the plurality of logical unit information stored in the memory according to a unit time length (for example, 15 ms), and updating the connection instance to the preset initialization file.
[0112] It can be seen that by implementing the optional embodiment, the connection instance stored in the memory can be synchronized to the preset initialization file in a polling manner in a timely manner, the disaster recovery mode of loading from a local file after reading an exception can be implemented, and the problem that the network cannot be shunted according to the last configuration during a network failure can be avoided.
[0113] As an optional embodiment, the method further comprises: when a start-up operation is detected, synchronizing the latest connection instance stored in the preset initialization file to the memory.
[0114] Specifically, the latest connection instance stored in the preset initialization file can be the connection instance in the memory at the time when the power is off.
[0115] It can be seen that by implementing the optional embodiment, the connection instance stored in the memory at the last time before the power is off can be saved through the preset initialization file, so that the storage state of the memory can be ensured to be recovered to the state before the last time when the power is off in a timely manner after the power is on, so as to further ensure the consistency of the connection instance in the memory and the online logical unit.
[0116] In step S330, the logical unit corresponding to each connection instance is detected, and the target logical unit in a working state is determined according to the state detection result.
[0117] Specifically, the number of target logical units can be one or more.
[0118] As an optional embodiment, detecting the logical unit corresponding to each connection instance and determining the target logical unit in a working state according to the state detection result comprises: sending a test request to the logical unit corresponding to each connection instance, and receiving a response result to the test request; determining the logical unit corresponding to the response result as the target logical unit in a working state; wherein the logical unit other than the target logical unit in the logical unit corresponding to each connection instance is in a non-working state.
[0119] Specifically, sending the test request to the logical unit corresponding to each connection instance is specifically represented as: sending the test request to the corresponding connection instance according to the logical unit corresponding to each connection instance.
[0120] It can be seen that by implementing the optional embodiment, whether the logical unit is still online can be determined through the manner of sending the test request, and the high consistency of the online logical unit and the connection instance in the memory can be guaranteed through the two-layer consistency determination of the update and the state detection of the memory, manual adjustment of the connection instance in the memory to maintain consistency with the online logical unit can be avoided, the labor cost can be reduced, and automatic maintenance of consistency can be realized.
[0121] In step S340, the to-be-processed request is allocated to the target logical unit.
[0122] Specifically, the number of to-be-processed requests can be one or more, and different to-be-processed requests can correspond to different identifiers (such as IP), and different identifiers can be used to point to different logical units.
[0123] As an optional embodiment, if the number of target logical units is greater than 1, allocating the to-be-processed request to the target logical unit includes: determining an allocation identifier corresponding to the to-be-processed request; if the allocation identifier corresponds to a first logical unit in the target logical unit, allocating the to-be-processed request to the first logical unit; and if the allocation identifier corresponds to a second logical unit and the second logical unit does not belong to the target logical unit, determining a reference logical unit corresponding to the allocation identifier from the target logical unit, and allocating the to-be-processed request to the reference logical unit.
[0124] Specifically, the allocation identifier can be represented in the form of a string, a number, etc., and the embodiments of the present application are not limited. The first logical unit can be any logical unit in the target logical unit. In addition, the manner of determining the reference logical unit corresponding to the allocation identifier from the target logical unit can be: generating a hash value corresponding to the allocation identifier according to a preset hash algorithm, and determining the reference logical unit from the target logical unit according to the hash value. The preset hash algorithm can be a consistent jump hash algorithm, an MD4 hash algorithm, an MD5 hash algorithm, an SHA-1 hash algorithm, etc., and the embodiments of the present application are not limited.
[0125] It can be seen that by implementing the optional embodiment, the to-be-processed request can be allocated to the target logical unit in the working state through the allocation identifier of the to-be-processed request, and when the logical unit pointed to by the allocation identifier is not in the working state, the to-be-processed request can be allocated to the target logical unit, avoiding the situation that the request cannot be processed in time.
[0126] Please refer to Figure 4 , Figure 4This illustration schematically depicts an application architecture diagram of a request processing method according to an embodiment of the present disclosure. (See diagram for example.) Figure 4 As shown, the application architecture diagram may include logical units Pod411, Pod412, ..., Pod413, Pod414; memory 420 including connection instances 422, ..., Pod423, Pod424; management module 430; detection module 440; traffic splitting module 450; preset initialization file 460; and initialization module 470. Figure 4 The Pod411, Pod412, ..., Pod413 and Pod414 shown are merely illustrative examples, and this application does not limit the number of Pods.
[0127] Specifically, the management module 430 can obtain the logical unit information corresponding to logical units Pod411, Pod412, ..., Pod413, and Pod414 according to a preset time interval. However, since logical unit Pod411 has been offline ( Figure 4 The connection line between management module 430 and logical unit Pod411 is crossed out (represented by an X), therefore, management module 430 cannot obtain the logical unit information corresponding to logical unit Pod411. Thus, management module 430 obtains the logical unit information corresponding to logical units Pod412, ..., Pod413, and Pod414 respectively; among them, logical unit Pod414 can be a newly added logical unit (…). Figure 4 (The line connecting the management module 430 and the logic unit Pod411 is shown as a dashed line).
[0128] Furthermore, the management module 430 can detect whether the connection instances corresponding to logical units Pod412, ..., Pod413, and Pod414 are consistent with the connection instances stored in memory 420. If memory 420 includes the connection instance corresponding to logical unit Pod411, it indicates that the connection instances corresponding to logical units Pod412, ..., Pod413, and Pod414 are inconsistent with the connection instances stored in memory 420. Therefore, the connection instance corresponding to logical unit Pod411 is deleted. Since logical unit Pod414 is a newly added logical unit, if memory 420 does not include the connection instance corresponding to logical unit Pod414, then a connection instance 424 corresponding to logical unit Pod414 is added to memory 420. The updated connection instances 422, ..., 423, and 424 stored in memory 420 can correspond one-to-one with logical units Pod412, ..., Pod413, and Pod414.
[0129] The initialization module 470 can poll the memory 420 according to a preset time length, and update the preset initialization file according to the polling result, in which Figure 4 The updated preset initialization file can store the connection instance 422, …, the connection instance 423, and the connection instance 424. The preset initialization file 460 can be represented as upstream.bak. When the boot operation is detected, the initialization module 470 can synchronize the latest connection instance stored in the preset initialization file to the memory 420.
[0130] Further, the detection module 440 can send a test request to the logical unit Pod 412 through the connection instance 422, if a response result of the logical unit Pod 412 to the test request is received, the logical unit Pod 412 is determined as a target logical unit in a working state, if the response result of the logical unit Pod 412 to the test request is not received, the logical unit Pod 412 is marked as a logical unit in a non-working state. In addition, the detection module 440 can send a test request to the logical unit Pod 413 through the connection instance 423, if a response result of the logical unit Pod 413 to the test request is received, the logical unit Pod 413 is determined as a target logical unit in a working state, if the response result of the logical unit Pod 413 to the test request is not received, the logical unit Pod 413 is marked as a logical unit in a non-working state. In addition, the detection module 440 can send a test request to the logical unit Pod 414 through the connection instance 424, if a response result of the logical unit Pod 414 to the test request is received, the logical unit Pod 414 is determined as a target logical unit in a working state, if the response result of the logical unit Pod 414 to the test request is not received, the logical unit Pod 414 is marked as a logical unit in a non-working state. That is, the target logical unit can be one or more, which is not limited by the embodiments of the present application.
[0131] Furthermore, when the traffic distribution module 450 receives one or more pending requests, it can determine the allocation identifier (e.g., IP) corresponding to each pending request. Based on the allocation identifier, the pending request can be distributed to the corresponding logical unit. If the allocation identifier corresponds to the first logical unit in the target logical unit (e.g., logical unit Pod412, ..., logical unit Pod413 or logical unit Pod414), the pending request is distributed to the first logical unit. If the allocation identifier corresponds to the second logical unit (e.g., logical unit Pod411) and the second logical unit does not belong to the target logical unit, a reference logical unit corresponding to the allocation identifier is determined from the target logical units (e.g., logical units Pod412, ..., logical units Pod413, logical unit Pod414), and the pending request is distributed to the reference logical unit to achieve traffic distribution processing of the pending requests.
[0132] It is evident that implementation Figure 4 The architecture diagram shown provides the ability to modify connection instances in memory, enabling automatic memory updates and improving the consistency between connection instances in memory and the logical units in a working state. That is, the logical units corresponding to the connection instances stored in memory are all in a working state. Compared to existing methods that rely on manual memory modifications, this approach offers higher automation, greater immediacy, and higher efficiency. Furthermore, it can determine whether a logical unit is still online by sending test requests. Through two layers of consistency checks—memory updates and status checks—it ensures a high degree of consistency between online logical units and connection instances in memory, avoiding the need for manual adjustments to connection instances in memory to maintain consistency with online logical units. This reduces labor costs and achieves automated consistency maintenance.
[0133] Please see Figure 5 , Figure 5 A flowchart illustrating a request processing method according to an embodiment of the present disclosure is shown schematically. Figure 5 As shown, the request processing method may include the following steps:
[0134] Step S500: Obtain information from multiple logical units according to a preset duration.
[0135] Step S510: If it is detected that the specific logical unit information is included in the plurality of logical unit information and the connection instance corresponding to the specific logical unit information is not stored in the memory, it is determined that the connection instance corresponding to the plurality of logical unit information is inconsistent with the current connection instance in the memory; if it is detected that the specific connection instance is included in the memory and the specific connection instance does not correspond to the plurality of logical unit information, it is determined that the connection instance corresponding to the plurality of logical unit information is inconsistent with the current connection instance in the memory; if it is detected that the current connection instance in the memory corresponds to the connection instance corresponding to at least one logical unit information, it is determined that the connection instance corresponding to the plurality of logical unit information is consistent with the current connection instance in the memory. If it is determined that the connection instance corresponding to the plurality of logical unit information is consistent with the current connection instance in the memory, step S520 is executed. If the connection instance corresponding to the plurality of logical unit information is inconsistent with the current connection instance in the memory, step S530 is executed.
[0136] Step S520: The state of the logical unit corresponding to each connection instance is detected, and the target logical unit in the working state is determined according to the state detection result, and the to-be-processed request is distributed to the target logical unit.
[0137] Step S530: If it is detected that the specific logical unit information is included in the plurality of logical unit information and the connection instance corresponding to the specific logical unit information is not stored in the memory, the connection instance corresponding to the specific logical unit information is added to the memory, and if it is detected that the specific connection instance is included in the memory and the specific connection instance does not correspond to the plurality of logical unit information, the specific connection instance is deleted, so as to update the memory; wherein the connection instance corresponding to the plurality of logical unit information is stored in the updated memory. Then, step S540 is executed.
[0138] Step S540: The preset initialization file is updated according to the connection instance corresponding to the plurality of logical unit information; wherein the preset initialization file is used to initialize the memory.
[0139] Step S550: A test request is sent to the logical unit corresponding to each connection instance, and a response result to the test request is received.
[0140] Step S560: The logical unit corresponding to the response result is determined as the target logical unit in the working state; wherein the logical unit other than the target logical unit in the logical unit corresponding to each connection instance is in the non-working state.
[0141] Step S570: The distribution identifier corresponding to the to-be-processed request is determined.
[0142] Step S580: If the allocation identifier corresponds to the first logical unit in the target logical unit, then the request to be processed is allocated to the first logical unit; if the allocation identifier corresponds to the second logical unit and the second logical unit does not belong to the target logical unit, then the reference logical unit corresponding to the allocation identifier is determined from the target logical unit, and the request to be processed is allocated to the reference logical unit.
[0143] Step S590: When a power-on operation is detected, the latest connection instance stored in the preset initialization file is synchronized to memory.
[0144] Step S590 can be performed before or after any step, and this application embodiment does not limit it.
[0145] It should be noted that steps S500 to S590 are different from... Figure 3 For the specific implementation details of steps S500 to S590, please refer to the examples shown. Figure 3 The steps and their embodiments shown are not repeated here.
[0146] It is evident that implementation Figure 5 The method described provides the ability to modify connection instances in memory, enabling automatic memory updates and improving the consistency between connection instances in memory and working logical units. Specifically, the logical units corresponding to connection instances stored in memory are all in a working state. Compared to existing methods that rely on manual memory modifications, this approach offers higher automation, greater immediacy, and higher efficiency. Furthermore, it allows for the determination of whether a logical unit is still online by sending test requests. Through this two-layer consistency check—memory updates and status checks—a high degree of consistency between online logical units and connection instances in memory can be guaranteed. This avoids the need for manual adjustments to connection instances in memory to maintain consistency with online logical units, reducing labor costs and achieving automated consistency maintenance.
[0147] Furthermore, in this exemplary embodiment, a request processing apparatus is also provided, with reference to... Figure 6 As shown, Figure 6 The schematic diagram illustrates a structural block of a request processing apparatus according to one embodiment of the present disclosure. The request processing apparatus 600 may include:
[0148] The logic unit information acquisition unit 601 is used to acquire information about multiple logic units;
[0149] The connection instance update unit 602 is used to update the current connection instance in memory based on the multiple logical unit information if the connection instances corresponding to multiple logical unit information are inconsistent with the current connection instance in memory; wherein, the updated memory stores the connection instances corresponding to the multiple logical unit information respectively;
[0150] The logic unit determination unit 603 is used to perform status detection on the logic units corresponding to each connection instance, and determine the target logic unit in the working state based on the status detection results.
[0151] The request allocation unit 604 is used to allocate the request to be processed to the target logical unit.
[0152] It is evident that implementation Figure 6 The device shown provides the ability to modify connection instances in memory, enabling automatic memory updates and improving the consistency between connection instances in memory and active logical units. Specifically, the logical units corresponding to the connection instances stored in memory are all in an active state. Compared to existing methods that rely on manual memory modifications, this approach offers higher automation, greater immediacy, and higher efficiency. Furthermore, it can determine whether a logical unit is still online by sending test requests. Through this two-layer consistency check—memory updates and status checks—a high degree of consistency between online logical units and connection instances in memory can be guaranteed. This avoids the need for manual adjustments to connection instances in memory to maintain consistency with online logical units, reducing labor costs and achieving automated consistency maintenance.
[0153] In one exemplary embodiment of this disclosure, the above-described apparatus further includes:
[0154] The consistency determination unit is used to determine that if multiple logical unit information includes specific logical unit information and the connection instance corresponding to the specific logical unit information is not stored in memory, the connection instance corresponding to the multiple logical unit information is inconsistent with the current connection instance in memory.
[0155] The consistency determination unit is also used to determine that the connection instances corresponding to the multiple logical unit information are inconsistent with the current connection instance in memory if it is detected that the memory contains a specific connection instance and the specific connection instance does not correspond to multiple logical unit information.
[0156] The consistency determination unit is also used to determine that if the current connection instance in memory corresponds one-to-one with the connection instance corresponding to at least one logical unit information, the connection instance corresponding to multiple logical unit information is consistent with the current connection instance in memory.
[0157] As can be seen, implementing this optional embodiment can provide a condition for determining the consistency between the connection instance corresponding to multiple logical unit information and the current connection instance in memory. This can enable accurate determination of various situations and improve the accuracy of consistency determination.
[0158] In one exemplary embodiment of this disclosure, the above-described apparatus further includes:
[0159] The state detection unit is configured to, after determining that the connection instances corresponding to the plurality of pieces of logical unit information are consistent with the current connection instance in the memory, perform state detection on the logical units corresponding to each connection instance, and determine a target logical unit in a working state according to a state detection result.
[0160] The request distribution unit 604 is further configured to distribute the to-be-processed request to the target logical unit.
[0161] It can be seen that, by implementing the optional embodiment, the to-be-processed request can be directly distributed to the target logical unit in the working state after determining that the connection instances corresponding to the plurality of pieces of logical unit information are consistent with the current connection instance in the memory, which can achieve high consistency between the connection instance in the memory and the logical unit in the working state, avoid the to-be-processed request being distributed to the offline logical unit to cause the request to be unprocessed for a long time, and reduce the labor cost and ensure normal request distribution through automatic consistency detection.
[0162] In an exemplary embodiment of the present disclosure, the connection instance updating unit 602 updates the current connection instance in the memory according to the plurality of pieces of logical unit information, including:
[0163] If it is detected that the plurality of pieces of logical unit information include a specific piece of logical unit information and the connection instance corresponding to the specific piece of logical unit information is not stored in the memory, the connection instance corresponding to the specific piece of logical unit information is added to the memory.
[0164] If it is detected that the memory includes a specific connection instance and the specific connection instance does not correspond to any of the plurality of pieces of logical unit information, the specific connection instance is deleted.
[0165] It can be seen that, by implementing the optional embodiment, the function of modifying the connection instance in the memory can be provided, automatic updating of the memory is achieved, and the consistency between the connection instance in the memory and the logical unit in the working state is improved, that is, the logical units corresponding to the connection instances stored in the memory are all in the working state. Compared with the existing manual modification of the memory, the automatic degree is higher and the timeliness is stronger.
[0166] In an exemplary embodiment of the present disclosure, the logical unit determination unit 603 performs state detection on the logical units corresponding to each connection instance, and determines a target logical unit in a working state according to a state detection result, including:
[0167] sending a test request to the logical unit corresponding to each connection instance, and receiving a response result to the test request;
[0168] The logical unit corresponding to the response result is determined as the target logical unit in the working state; and the logical units corresponding to the connection instances other than the target logical unit are in the non-working state.
[0169] It can be seen that, by implementing the optional embodiment, it can be determined whether the logical unit is online by sending a test request, and the high consistency between the online logical unit and the connection instances in the memory can be ensured by the two-layer consistency determination of the update and the state detection of the memory, so as to avoid manual adjustment of the connection instances in the memory to maintain the consistency with the online logical unit, reduce the labor cost, and realize automatic maintenance of the consistency.
[0170] In an example embodiment of the present disclosure, if the number of target logical units is greater than 1, the request distribution unit 604 distributes the to-be-processed request to the target logical units, including:
[0171] Determining the distribution identifier corresponding to the to-be-processed request;
[0172] If the distribution identifier corresponds to the first logical unit in the target logical units, the to-be-processed request is distributed to the first logical unit;
[0173] If the distribution identifier corresponds to the second logical unit and the second logical unit does not belong to the target logical units, the reference logical unit corresponding to the distribution identifier is determined from the target logical units, and the to-be-processed request is distributed to the reference logical unit.
[0174] It can be seen that, by implementing the optional embodiment, the to-be-processed request can be distributed to the target logical unit in the working state according to the distribution identifier of the to-be-processed request, and when the logical unit indicated by the distribution identifier is not in the working state, the to-be-processed request can be distributed to the target logical unit, so as to avoid the situation that the request cannot be processed in time.
[0175] In an example embodiment of the present disclosure, the logical unit information acquisition unit 601 acquires a plurality of logical unit information, including:
[0176] The plurality of logical unit information is acquired according to a preset time length.
[0177] It can be seen that, by implementing the optional embodiment, the plurality of logical unit information can be acquired based on the preset time length to realize polling type information acquisition, which can be beneficial to timely update the connection instances of the logical units in the memory, so as to ensure the consistency between the connection instances stored in the memory and the shiftable logical units.
[0178] In an example embodiment of the present disclosure, the above device further includes:
[0179] The file updating unit is configured to update the preset initialization file according to the connection instance corresponding to the plurality of pieces of logical unit information after the connection instance updating unit 602 updates the current connection instance in the memory according to the plurality of pieces of logical unit information; and the preset initialization file is used to initialize the memory.
[0180] It can be seen that, by implementing the optional embodiment, the connection instance stored in the memory can be timely synchronized into the preset initialization file in a polling manner, the disaster recovery mode of loading from the local file after reading the exception can be realized, and the shunting according to the last configuration when the network fails can be avoided.
[0181] In an exemplary embodiment of the present disclosure, the apparatus further includes:
[0182] The initialization unit is configured to synchronize the latest connection instance stored in the preset initialization file into the memory when detecting the power-on operation.
[0183] It can be seen that, by implementing the optional embodiment, the connection instance stored in the memory before the power-off can be saved through the preset initialization file, so that the storage state of the memory can be ensured to be timely restored to the state before the last power-off after the power-on, so as to further ensure the consistency of the connection instance in the memory and the online logical unit.
[0184] It should be noted that, although several modules or units of the device for action execution are mentioned in the foregoing detailed description, such a division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into several modules or units embodied.
[0185] Since the various functional modules of the request processing apparatus of the example embodiments of the present disclosure correspond to the steps of the example embodiments of the request processing method described above, for details not disclosed in the device embodiments of the present disclosure, please refer to the embodiments of the request processing method of the present disclosure described above.
[0186] Other embodiments of the present disclosure will be readily apparent to those skilled in the art upon considering the specification and practice of the disclosed application. The present application is intended to cover any variations, uses, or adaptations of the present disclosure that follow, in general, the principles of the present disclosure and include those that are known or customary practice in the art to which the present disclosure pertains. The specification and examples are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0187] It should be understood that the present disclosure is not limited to the precise construction that has been described above and shown in the accompanying drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the present disclosure. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A request processing method characterized by comprising: The method comprises the following steps: acquiring a plurality of logical unit information; if the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory, updating the current connection instance in the memory according to the plurality of logical unit information; wherein the plurality of logical unit information respectively correspond to the connection instances stored in the updated memory; detecting the state of the logical units corresponding to each connection instance, and determining a target logical unit in a working state according to the state detection result; allocating a to-be-processed request to the target logical unit. The method further comprises the following steps: if it is detected that the plurality of logical unit information includes specific logical unit information and the connection instance corresponding to the specific logical unit information is not stored in the memory, it is determined that the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory; if it is detected that the memory includes a specific connection instance and the specific connection instance does not correspond to any of the plurality of logical unit information, it is determined that the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory; if it is detected that the current connection instance in the memory corresponds to the connection instance corresponding to at least one logical unit information, it is determined that the connection instances corresponding to the plurality of logical unit information are consistent with the current connection instance in the memory.
2. The method of claim 1, wherein, After it is determined that the connection instances corresponding to the plurality of logical unit information are consistent with the current connection instance in the memory, the method further comprises the following steps: detecting the state of the logical units corresponding to each connection instance, and determining a target logical unit in a working state according to the state detection result; allocating a to-be-processed request to the target logical unit.
3. The method of claim 1, wherein, Updating the current connection instance in the memory according to the plurality of logical unit information comprises the following steps: if it is detected that the plurality of logical unit information includes specific logical unit information and the connection instance corresponding to the specific logical unit information is not stored in the memory, the connection instance corresponding to the specific logical unit information is added to the memory; if it is detected that the memory includes a specific connection instance and the specific connection instance does not correspond to any of the plurality of logical unit information, the specific connection instance is deleted.
4. The method of claim 1, wherein, Detecting the state of the logical units corresponding to each connection instance, and determining a target logical unit in a working state according to the state detection result comprises the following steps: sending a test request to the logical units corresponding to each connection instance, and receiving a response result corresponding to the test request; determining the logical unit corresponding to the response result as the target logical unit in the working state; wherein the logical units other than the target logical unit among the logical units corresponding to each connection instance are in a non-working state.
5. The method of claim 1, wherein, If the number of target logical units is greater than 1, allocating a to-be-processed request to the target logical units comprises the following steps: determining an allocation identifier corresponding to the to-be-processed request; if the allocation identifier corresponds to a first logical unit among the target logical units, allocating the to-be-processed request to the first logical unit. If the distribution identifier corresponds to a second logical unit and the second logical unit does not belong to the target logical unit, a reference logical unit corresponding to the distribution identifier is determined from the target logical unit, and the to-be-processed request is distributed to the reference logical unit.
6. The method of claim 1, wherein, Obtaining a plurality of logical unit information, comprising: Obtaining the plurality of logical unit information according to a preset time length.
7. The method of claim 1, wherein, After updating the current connection instance in the memory according to the plurality of logical unit information, the method further comprises: Updating a preset initialization file according to the connection instances corresponding to the plurality of logical unit information respectively; wherein the preset initialization file is used to initialize the memory.
8. The method of claim 7, wherein, The method further comprises: When a boot operation is detected, synchronizing the latest connection instance stored in the preset initialization file to the memory.
9. A request processing apparatus characterized by comprising: Comprising: A logical unit information obtaining unit is configured to obtain a plurality of logical unit information; A connection instance updating unit is configured to update the current connection instance in the memory according to the plurality of logical unit information if the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory; wherein the connection instances corresponding to the plurality of logical unit information are stored in the updated memory. A logical unit determining unit is configured to perform state detection on the logical units corresponding to each connection instance, and determine a target logical unit in a working state according to the state detection result. A request distribution unit is configured to distribute a to-be-processed request to the target logical unit. The apparatus further comprises: A consistency determining unit is configured to determine that the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory if it is detected that the plurality of logical unit information includes specific logical unit information and the connection instance corresponding to the specific logical unit information is not stored in the memory. The consistency determining unit is further configured to determine that the connection instances corresponding to the plurality of logical unit information are inconsistent with the current connection instance in the memory if it is detected that the memory includes specific connection instances and the specific connection instances do not correspond to the plurality of logical unit information. The consistency determining unit is further configured to determine that the connection instances corresponding to the plurality of logical unit information are consistent with the current connection instance in the memory if it is detected that the current connection instance in the memory corresponds to the connection instances corresponding to at least one logical unit information one by one.
10. A computer readable medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the request processing method of any one of claims 1-8.
11. An electronic device, comprising: Comprising: One or more processors; A storage device is configured to store one or more programs, when the one or more programs are executed by the one or more processors, so that the one or more processors implement the request processing method of any one of claims 1-8.
Citation Information
Patent Citations
Upgrade method, device and system for application instance
CN108683516A
Configuration modification method and device for container application, computer equipment and storage medium
CN110262873A