Service instruction processing method and device
A keep-alive mechanism for load balancers and distributed databases addresses link detection failures, ensuring active connection management and improving transaction success rates.
Patent Information
- Application Number
- CN202411222731.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-12-06
AI Technical Summary
Existing systems fail to detect link disconnections between load balancers and distributed databases, leading to connection status uncertainties and business operation failures due to perceived availability of disconnected links.
Implement a keep-alive mechanism to maintain and re-establish links between load balancers and distributed databases based on preset time thresholds, ensuring active connection management and timely detection of link status changes.
Prevents business operation failures by maintaining active connections and promptly re-establishing links, enhancing transaction success rates and customer experience.
Smart Images

Figure CN119088566A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine learning, and in particular to a method and device for processing business instructions. Background Art
[0002] With the rapid development of network technology, it has brought great convenience to people's daily life. Now, most things can be done online without leaving home. This phenomenon is mainly supported by various IT systems. With the evolution of Internet models, the development of new businesses is changing day by day, which has accelerated the iteration speed of traditional IT systems and brought great iteration pressure to traditional systems. In addition to changes in development methods, there are also changes in operation and maintenance methods.
[0003] The existing system has the following problems:
[0004] When the existing system application starts the service, in order to establish a link with the distributed database, two methods are often used: one is to use the load balancing LB method, and the other is to use the database middleware method; the system developed in C language often uses the method of using a long connection with the database server, that is, the link connection is maintained from the start to the termination of the service application, but in the LB method, the LB often detects the link activity and link idleness. When the session idle timeout exceeds the threshold, it will actively disconnect the link and release the connection. The client cannot detect the connection status between the LB and the database server side, resulting in the client being in a connected state while the actual link is partially disconnected. At this time, the application service will mistakenly believe that the connection is available, and when sending a database operation transaction, a connection failure error will occur;
[0005] With regard to the current technology, the current distributed database and application system are coordinated and connected through a load balancer. Once the link between the load balancer and the distributed database is broken, the application system cannot perceive it and cannot know the actual connection status, which may easily lead to the problem that the business operations issued by the application system cannot be executed. No effective solution has been proposed yet.
[0006] Therefore, it is necessary to improve the related technology to overcome the above-mentioned defects in the related technology. Summary of the invention
[0007] The embodiments of the present invention provide a method and device for processing business instructions, so as to at least solve the problem that personnel who are not familiar with R&D technology in related technologies cannot build models.
[0008] According to an embodiment of the present invention, a method for processing business instructions is provided, comprising: upon receiving a business instruction issued by an application system, determining a first link establishment duration between a load balancer and a distributed database, wherein the first link establishment duration is used to indicate a time interval from the last time the load balancer and the distributed database established a link; upon receiving the first link establishment duration being greater than a first preset value, initiating a keep-alive instruction to the distributed database, wherein the keep-alive instruction is used to instruct the load balancer to maintain a link with the distributed database; upon receiving feedback information issued by the distributed database based on the keep-alive instruction, forwarding the business instruction to the distributed database for processing, and obtaining a processing result of the business instruction.
[0009] In an exemplary embodiment, when the link establishment time is greater than a preset value, a keep-alive instruction is initiated to the distributed database, including: when the first link establishment time is greater than a preset value, a first instruction is initiated to the distributed database, wherein the first instruction is used to instruct the load balancer to cut off the link with the distributed database; after initiating the first instruction to the distributed database, a second instruction is initiated to the distributed database, wherein the second instruction is used to instruct the load balancer to establish a link with the distributed database; wherein the keep-alive instruction includes the first instruction and the second instruction.
[0010] In an exemplary embodiment, a second link establishment duration between the load balancer and the distributed database is determined, wherein the second link establishment duration is used to indicate the time from the time when the processing result of the business instruction is obtained to the time when the load balancer and the distributed database are most recently connected; when the second link establishment duration is greater than a second preset value, the keep-alive instruction is initiated again to the distributed database.
[0011] In an exemplary embodiment, after forwarding the business instruction to the distributed database for processing and obtaining the processing result of the business instruction, the method further includes: forwarding the processing result to the application system; and determining that the business instruction has been completed upon receiving reception feedback issued by the application system based on the processing result.
[0012] In an exemplary embodiment, after determining that the business instruction has been completed, the method further includes: if no business instruction issued by the application system is received within a preset time period, determining whether any business instruction is forwarded to the distributed database within the preset time period; if no business instruction is forwarded to the distributed database within the preset time period, initiating a first instruction to the distributed database, wherein the first instruction is used to instruct the load balancer to cut off the link with the distributed database.
[0013] In an exemplary embodiment, before determining that the business instruction has been completed, the method also includes: determining a feedback type corresponding to the received feedback; when the feedback type is a first feedback type, determining that there is an abnormality in the processing result, and re-forwarding the business instruction to the distributed database; when the feedback type is a second feedback type, determining that there is no abnormality in the processing result, and determining that the business instruction is executed normally.
[0014] In an exemplary embodiment, after forwarding the business instruction to the distributed database for processing and obtaining the processing result of the business instruction, the method further includes: determining a completion time for completing the business instruction, wherein the completion time is used to indicate the time interval between a first moment of receiving the business instruction issued by the application system and a second moment of obtaining the processing result of the business instruction; comparing the completion time with a preset expected time to obtain a difference value between the completion time and the preset expected time; and determining whether the completion time meets the expected time based on the difference value.
[0015] According to another embodiment of the present invention, a device for processing business instructions is provided, including: a determination module, used to determine a first link establishment duration between a load balancer and a distributed database when a business instruction issued by an application system is received, wherein the first link establishment duration is used to indicate the time distance from the load balancer to the distributed database to which a link was most recently established; a link module, used to initiate a keep-alive instruction to the distributed database when the first link establishment duration is greater than a first preset value, wherein the keep-alive instruction is used to instruct the load balancer to maintain a link with the distributed database; and a processing module, used to forward the business instruction to the distributed database for processing when feedback information issued by the distributed database based on the keep-alive instruction is received, so as to obtain a processing result of the business instruction.
[0016] According to yet another embodiment of the present invention, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.
[0017] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0018] Through the present invention, when receiving a business instruction issued by an application system, the first link establishment time between the load balancer and the distributed database is determined, wherein the first link establishment time is used to indicate the time from the last link establishment between the load balancer and the distributed database; when the first link establishment time is greater than a first preset value, a keep-alive instruction is initiated to the distributed database, wherein the keep-alive instruction is used to instruct the load balancer to maintain the link with the distributed database; when receiving feedback information issued by the distributed database based on the keep-alive instruction, the business instruction is forwarded to the distributed database for processing to obtain the processing result of the business instruction. That is, when receiving a business operation issued by an application system, the link establishment time with the distributed database is determined, and when the link establishment time is greater than a preset value, a keep-alive instruction is initiated to the distributed database to ensure that the distributed database and the load balance are in a connected state. The present invention solves the problem that the current distributed database and the application system are coordinated and connected through a load balancer, and once a link is broken between the load balancer and the distributed database, the application system cannot perceive it and cannot know the actual connection state, which easily leads to the inability to execute the business operation issued by the application system. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0020] Figure 1 It is a hardware structure block diagram of a computer terminal for executing a method for processing a service instruction according to an embodiment of the present invention;
[0021] Figure 2 is a flow chart of a method for processing a service instruction according to an embodiment of the present invention;
[0022] Figure 3 is a schematic diagram of connection between a distributed database and an application system according to an embodiment of the present invention;
[0023] Figure 4 is a schematic diagram of link failure according to an embodiment of the present invention;
[0024] Figure 5 is a flowchart of an optional transaction instruction processing according to an embodiment of the present application;
[0025] Figure 6 It is a structural block diagram of a device for processing service instructions according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0028] Example 1
[0029] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a computer terminal for executing a method for processing a service instruction according to an embodiment of the present invention. Figure 1 As shown, the computer terminal 10 may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0030] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for processing business instructions in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0031] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0032] In this embodiment, a method for processing a service instruction running on the above-mentioned computer terminal is provided. Figure 2 is a flow chart of a method for processing a service instruction according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0033] Step S202, upon receiving a business instruction from the application system, determining a first link establishment duration between the load balancer and the distributed database, wherein the first link establishment duration is used to indicate the time since the load balancer and the distributed database were last linked;
[0034] Step S204: In the case where the first link establishment time is greater than a first preset value, initiating a keep-alive instruction to the distributed database, wherein the keep-alive instruction is used to instruct the load balancer to maintain a connection with the distributed database;
[0035] Step S206: upon receiving feedback information sent by the distributed database based on the keep-alive instruction, forward the service instruction to the distributed database for processing to obtain a processing result of the service instruction.
[0036] Through the above steps, when receiving the business instruction issued by the application system, the first link establishment time between the load balancer and the distributed database is determined, wherein the first link establishment time is used to indicate the time from the last link establishment between the load balancer and the distributed database; when the first link establishment time is greater than the first preset value, a keep-alive instruction is initiated to the distributed database, wherein the keep-alive instruction is used to instruct the load balancer to maintain the link with the distributed database; when receiving the feedback information issued by the distributed database based on the keep-alive instruction, the business instruction is forwarded to the distributed database for processing to obtain the processing result of the business instruction. That is to say, when receiving the business operation issued by the application system, the link establishment time with the distributed database is determined, and when the link establishment time is greater than the preset value, a keep-alive instruction is initiated to the distributed database to ensure that the distributed database and the load balance are in a connected state. The current distributed database and the application system are coordinated and connected through a load balancer.
[0037] As an optional implementation, Figure 3 As shown, Figure 3 This is a schematic diagram of the connection between the distributed database and the application system according to an embodiment of the present invention. The existing application system establishes a connection with the distributed database through LB (load balancing) when the service is started. The connection established between the application service and the LB is a long connection, that is, after the connection is successfully established, it will remain connected until the service is stopped. Once the link between the load balancing and the distributed database is broken, the application system cannot perceive it and cannot know the actual connection status, which may easily lead to the problem that the business operations issued by the application system cannot be executed. Figure 4 As shown, Figure 4 This is a schematic diagram of link failure according to an embodiment of the present invention. For example, the business operation issued by the application system is a transaction operation. After the transaction starts, the distributed database processes the business. Once a virtual link or a broken link occurs, the application system can only prompt that the transaction failed, resulting in the early termination of the transaction.
[0038] That is to say, when the application system service uses a distributed database, it changes from the traditional direct connection to an indirect connection through various means, which causes one or several of the multiple connection links to be interrupted during the indirect connection process. The application side cannot perceive it in time, resulting in the failure of transactions with the database, causing business failure and affecting customer experience.
[0039] Through step S204, when the first link establishment time is greater than the first preset value, a keep-alive instruction is initiated to the distributed database, wherein the keep-alive instruction is used to instruct the load balancer to maintain a connection with the distributed database, thereby actively initiating a keep-alive instruction, thereby avoiding establishing a long link with the LB. If the link is interrupted due to network reasons, the application side will not automatically detect the actual link status, or a virtual link will appear, and it will be unable to actively reconnect, resulting in a failure of the service to access the database and a transaction failure; a low transaction failure rate will lead to a low service success rate, affecting the customer service experience.
[0040] In an exemplary embodiment, when the link establishment time is greater than a preset value, a keep-alive instruction is initiated to the distributed database, including: when the first link establishment time is greater than a preset value, a first instruction is initiated to the distributed database, wherein the first instruction is used to instruct the load balancer to cut off the link with the distributed database; after initiating the first instruction to the distributed database, a second instruction is initiated to the distributed database, wherein the second instruction is used to instruct the load balancer to establish a link with the distributed database; wherein the keep-alive instruction includes the first instruction and the second instruction.
[0041] That is, the keep-alive instruction includes a first instruction and a second instruction, wherein the first instruction is used to cut off the link between the load balancer and the distributed database, and the second instruction is used to re-establish the link between the load balancer and the distributed database. By issuing the keep-alive instruction, the link is actively cut off first and then the connection is re-established, thereby ensuring that the load balancer and the distributed database remain in a linked state, avoiding the problem of operation failure caused by the application side (equivalent to the application system) being unable to perceive the link state between the load balancer and the distributed database.
[0042] In addition, it should be noted that since the load balancer often performs link detection and link idleness detection, it will actively disconnect the link when the session idle timeout exceeds the threshold. Therefore, the first preset value can be set to be lower than the load balancer and the distributed database session idle timeout.
[0043] That is to say, the start time of chain building is recorded when the chain is built. When the business instruction starts, it is determined whether the current time from the last chain building time exceeds the set timeout. If so, it will actively disconnect from the distributed database, and then actively re-build the chain and update the start time of chain building. Before the transaction ends, it is determined whether the current time from the last chain building time exceeds the set timeout. If so, it will actively disconnect from the distributed database. In order to avoid increasing the database burden due to a large number of chain building at the same time, different timeouts are set for different services.
[0044] In an exemplary embodiment, a second link establishment duration between the load balancer and the distributed database is determined, wherein the second link establishment duration is used to indicate the time from the time when the processing result of the business instruction is obtained to the time when the load balancer and the distributed database are most recently connected; when the second link establishment duration is greater than a second preset value, the keep-alive instruction is initiated again to the distributed database.
[0045] That is to say, after the business processing is completed, it is determined again whether the time since the last link establishment exceeds the set timeout period. If it times out, the link is disconnected.
[0046] In an exemplary embodiment, after forwarding the business instruction to the distributed database for processing and obtaining the processing result of the business instruction, the method further includes: forwarding the processing result to the application system; and determining that the business instruction has been completed upon receiving reception feedback issued by the application system based on the processing result.
[0047] That is, after the processing result is sent to the application system, the application system will issue a feedback instruction to indicate that the processing result has been received. After it is determined that the application system has received the processing result, it means that the business instruction has been completed.
[0048] In an exemplary embodiment, after determining that the business instruction has been completed, the method further includes: if no business instruction issued by the application system is received within a preset time period, determining whether any business instruction is forwarded to the distributed database within the preset time period; if no business instruction is forwarded to the distributed database within the preset time period, initiating a first instruction to the distributed database, wherein the first instruction is used to instruct the load balancer to cut off the link with the distributed database.
[0049] That is to say, if no business instructions are received from the application system for a long time, in order to save resources, a disconnection instruction can be actively sent to the distributed database, thereby achieving the purpose of saving resources.
[0050] In an exemplary embodiment, before determining that the business instruction has been completed, the method also includes: determining a feedback type corresponding to the received feedback; when the feedback type is a first feedback type, determining that there is an abnormality in the processing result, and re-forwarding the business instruction to the distributed database; when the feedback type is a second feedback type, determining that there is no abnormality in the processing result, and determining that the business instruction is executed normally.
[0051] It should be noted that, in actual applications, there are cases where the business instruction is sent abnormally. In order to avoid the business instruction being unable to be executed normally due to the abnormal sending, the problem reported by the received feedback can be determined first. If the received feedback indicates that the processing result is abnormal, then the business instruction is re-forwarded to the distributed database to solve the problem of the abnormal sending. If the received feedback indicates that the processing result is not abnormal, it is determined that the business instruction is executed normally.
[0052] In an exemplary embodiment, after forwarding the business instruction to the distributed database for processing and obtaining the processing result of the business instruction, the method further includes: determining a completion time for completing the business instruction, wherein the completion time is used to indicate the time interval between a first moment of receiving the business instruction issued by the application system and a second moment of obtaining the processing result of the business instruction; comparing the completion time with a preset expected time to obtain a difference value between the completion time and the preset expected time; and determining whether the completion time meets the expected time based on the difference value.
[0053] That is to say, by determining the completion time of the business instruction and comparing it with the preset expected time, the processing time of the business instruction can be monitored in real time, and the situation that the processing time exceeds expectations can be discovered in time. By monitoring and evaluating the processing time, the situation of low processing efficiency can be discovered in time, so that corresponding measures can be taken to improve the processing efficiency, ensure that the business instruction is processed and responded to in time, and improve efficiency.
[0054] Figure 5 is a flow chart of an optional transaction instruction processing according to an embodiment of the present application, such as Figure 5 As shown, there are the following steps, wherein the transaction instruction is equivalent to the business instruction in the above steps.
[0055] In the case of receiving a transaction instruction issued by the application system, determining a first link establishment duration between the load balancer and the distributed database, wherein the first link establishment duration is used to indicate the time since the load balancer and the distributed database were last linked;
[0056] In a case where the first link establishment time is greater than a first preset value, initiating a keep-alive instruction to the distributed database, wherein the keep-alive instruction is used to instruct the load balancer to maintain a link with the distributed database;
[0057] When feedback information issued by the distributed database based on the keep-alive instruction is received, the transaction instruction is forwarded to the distributed database for processing to obtain a processing result of the transaction instruction.
[0058] In short, after the transaction starts, it is determined whether the time since the last chain establishment exceeds the set timeout period; if it times out, the chain is actively disconnected and reconnected, and the start time of chain establishment is updated; then business processing is carried out; after the business processing is completed, it is determined whether the time since the last chain establishment exceeds the set timeout period. If it times out, the connection is disconnected; the transaction ends.
[0059] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0060] In the present embodiment, a processing device for a service instruction is also provided, and the device is used to implement the above-mentioned embodiment and preferred implementation mode, and the descriptions that have been made are not repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.
[0061] Figure 6 is a structural block diagram of a device for processing a service instruction according to an embodiment of the present invention. Figure 6 As shown, the device includes: a determination module 62 , a linking module 64 and a processing module 66 .
[0062] A determination module 62, configured to determine a first link establishment duration between the load balancer and the distributed database upon receiving a business instruction from the application system, wherein the first link establishment duration is used to indicate a time duration from the last link establishment between the load balancer and the distributed database;
[0063] A link module 64, configured to initiate a keep-alive instruction to the distributed database when the first link establishment time is greater than a first preset value, wherein the keep-alive instruction is used to instruct the load balancer to maintain a link with the distributed database;
[0064] The processing module 66 is used to forward the business instruction to the distributed database for processing when receiving feedback information issued by the distributed database based on the keep-alive instruction, so as to obtain a processing result of the business instruction.
[0065] Through the above device, in the case of receiving a business instruction issued by the application system, the first link establishment time between the load balancer and the distributed database is determined, wherein the first link establishment time is used to indicate the time from the last link establishment between the load balancer and the distributed database; in the case of the first link establishment time being greater than the first preset value, a keep-alive instruction is initiated to the distributed database, wherein the keep-alive instruction is used to instruct the load balancer to maintain the link with the distributed database; in the case of receiving feedback information issued by the distributed database based on the keep-alive instruction, the business instruction is forwarded to the distributed database for processing to obtain the processing result of the business instruction. That is, in the case of receiving a business operation issued by the application system, the link establishment time with the distributed database is determined, and in the case of the link establishment time being greater than the preset value, a keep-alive instruction is initiated to the distributed database to ensure that the distributed database and the load balance are in a connected state. The problem that the current distributed database and the application system are coordinated and connected through the load balancer, once the link between the load balancer and the distributed database is broken, the application system cannot perceive it and cannot know the actual connection state, which easily leads to the inability to execute the business operation issued by the application system.
[0066] In an exemplary embodiment, the link module 64 is also used to initiate a first instruction to the distributed database when the first link establishment duration is greater than a preset value, wherein the first instruction is used to instruct the load balancer to cut off the link with the distributed database; after initiating the first instruction to the distributed database, initiate a second instruction to the distributed database, wherein the second instruction is used to instruct the load balancer to establish a link with the distributed database; wherein the keep-alive instruction includes the first instruction and the second instruction.
[0067] In an exemplary embodiment, the processing module 66 is also used to determine a second link establishment duration between the load balancer and the distributed database, wherein the second link establishment duration is used to indicate the time from the time when the processing result of the business instruction is obtained to the time when the load balancer and the distributed database are most recently connected; when the second link establishment duration is greater than a second preset value, the keep-alive instruction is initiated to the distributed database again.
[0068] In an exemplary embodiment, the processing module 66 is further configured to forward the processing result to the application system; and determine that the service instruction has been completed upon receiving a reception feedback issued by the application system based on the processing result.
[0069] In an exemplary embodiment, the processing module 66 is also used to determine whether any business instructions are forwarded to the distributed database within a preset time period if no business instructions are received from the application system within the preset time period; and to initiate a first instruction to the distributed database if no business instructions are forwarded to the distributed database within the preset time period, wherein the first instruction is used to instruct the load balancer to cut off the link with the distributed database.
[0070] In an exemplary embodiment, the processing module 66 is also used to determine the feedback type corresponding to the received feedback; when the feedback type is the first feedback type, it is determined that there is an abnormality in the processing result, and the business instruction is re-forwarded to the distributed database; when the feedback type is the second feedback type, it is determined that there is no abnormality in the processing result, and it is determined that the business instruction is executed normally.
[0071] In an exemplary embodiment, the processing module 66 is also used to determine the completion time of completing the business instruction, wherein the completion time is used to indicate the time interval between the first moment of receiving the business instruction issued by the application system and the second moment of obtaining the processing result of the business instruction; the completion time is compared with the preset expected time to obtain the difference value between the completion time and the preset expected time; and whether the completion time meets the expected time is determined based on the difference value.
[0072] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0073] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0074] S1, upon receiving a business instruction from an application system, determining a first link establishment duration between a load balancer and a distributed database, wherein the first link establishment duration is used to indicate a time interval from the last link establishment between the load balancer and the distributed database;
[0075] S2, when the first link establishment time is greater than a first preset value, initiating a keep-alive instruction to the distributed database, wherein the keep-alive instruction is used to instruct the load balancer to maintain a link with the distributed database;
[0076] S3: When receiving feedback information sent by the distributed database based on the keep-alive instruction, forward the service instruction to the distributed database for processing to obtain a processing result of the service instruction.
[0077] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0078] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0079] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0080] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0081] S1, upon receiving a business instruction from an application system, determining a first link establishment duration between a load balancer and a distributed database, wherein the first link establishment duration is used to indicate a time interval from the last link establishment between the load balancer and the distributed database;
[0082] S2, when the first link establishment time is greater than a first preset value, initiating a keep-alive instruction to the distributed database, wherein the keep-alive instruction is used to instruct the load balancer to maintain a link with the distributed database;
[0083] S3: When receiving feedback information sent by the distributed database based on the keep-alive instruction, forward the service instruction to the distributed database for processing to obtain a processing result of the service instruction.
[0084] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0085] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0086] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0087] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for processing a business instruction, characterized in that: include: In the case of receiving a business instruction issued by the application system, determining a first link establishment duration between the load balancer and the distributed database, wherein the first link establishment duration is used to indicate the time since the load balancer and the distributed database were last linked; In a case where the first link establishment time is greater than a first preset value, initiating a keep-alive instruction to the distributed database, wherein the keep-alive instruction is used to instruct the load balancer to maintain a link with the distributed database; When feedback information issued by the distributed database based on the keep-alive instruction is received, the service instruction is forwarded to the distributed database for processing to obtain a processing result of the service instruction.
2. The method according to claim 1, characterized in that When the link establishment time is longer than a preset value, initiating a keep-alive instruction to the distributed database includes: In the case where the first link establishment time is longer than a preset value, initiating a first instruction to the distributed database, wherein the first instruction is used to instruct the load balancer to cut off the link with the distributed database; After initiating a first instruction to the distributed database, initiating a second instruction to the distributed database, wherein the second instruction is used to instruct the load balancer to establish a link with the distributed database; The keep-alive instruction includes the first instruction and the second instruction.
3. The method according to claim 1, characterized in that After forwarding the business instruction to the distributed database for processing and obtaining the processing result of the business instruction, the method further includes: Determine a second link establishment duration between the load balancer and the distributed database, wherein the second link establishment duration is used to indicate the time from the last link establishment between the load balancer and the distributed database after the processing result of the business instruction is obtained; When the second link establishment time is greater than a second preset value, the keep-alive instruction is again initiated to the distributed database.
4. The method according to claim 1, characterized in that After forwarding the business instruction to the distributed database for processing and obtaining the processing result of the business instruction, the method further includes: forwarding the processing result to the application system; When receiving a reception feedback sent by the application system based on the processing result, it is determined that the service instruction has been completed.
5. The method according to claim 4, characterized in that After determining that the service instruction has been completed, the method further includes: In the case where no service instruction is received from the application system within a preset time period, determining whether any service instruction is forwarded to the distributed database within the preset time period; In the case where no service instruction is forwarded to the distributed database within a preset time period, a first instruction is initiated to the distributed database, wherein the first instruction is used to instruct the load balancer to cut off the link with the distributed database.
6. The method according to claim 4, characterized in that Before determining that the service instruction has been completed, the method further includes: Determining a feedback type corresponding to the received feedback; In a case where the feedback type is the first feedback type, determining that the processing result is abnormal, and re-forwarding the business instruction to the distributed database; When the feedback type is the second feedback type, it is determined that there is no abnormality in the processing result, and it is determined that the business instruction is executed normally.
7. The method according to claim 1, characterized in that After forwarding the business instruction to the distributed database for processing and obtaining the processing result of the business instruction, the method further includes: Determine a completion time of completing the business instruction, wherein the completion time is used to indicate a time interval between a first moment of receiving the business instruction issued by the application system and a second moment of obtaining a processing result of the business instruction; Compare the completion time with the preset expected time to obtain a difference between the completion time and the preset expected time; It is determined whether the completion time meets the expected time according to the difference value.
8. A device for processing a business instruction, characterized in that: include: A determination module, configured to determine a first link establishment duration between the load balancer and the distributed database upon receiving a business instruction from the application system, wherein the first link establishment duration is used to indicate a time duration from the last link establishment between the load balancer and the distributed database; a link module, configured to initiate a keep-alive instruction to the distributed database when the first link establishment time is greater than a first preset value, wherein the keep-alive instruction is used to instruct the load balancer to maintain a link with the distributed database; The processing module is used to forward the business instruction to the distributed database for processing when receiving feedback information issued by the distributed database based on the keep-alive instruction, so as to obtain the processing result of the business instruction.
9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 7.
