Database guarantee method and device, equipment, medium and program product
Through multi-level circuit breaking strategies, the resource usage of session-level databases is managed, and the problem of database resource surge under high concurrency is solved, the availability of systems and services is improved, and service interruption caused by master-shop switching is avoided.
Patent Information
- Application Number
- CN202411838078.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-03-28
AI Technical Summary
In the case of high concurrent connections, session-level databases can easily cause operational resources to surge, resulting in unavailability of services, and existing master-slip handover switching and fuse measures will reduce system availability.
By regularly obtaining the resource usage total data and detailed data of the session-level database, based on the multi-level circuit breaking strategy, when the resource usage total data exceeds the preset threshold, the circuit breaking strategy is executed step by step until the resource usage total data is less than the threshold.
It effectively improves the availability of systems and services, avoids service interruptions caused by master-stop switching, and ensures the normal operation of the database system and the overall stability of the application system.
Smart Images

Figure CN119719087A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of distributed technology, and in particular to a database assurance method, apparatus, device, medium and program product. Background Art
[0002] With the development of Internet finance and the transformation of distributed application architecture, in reality, when faced with extremely high-concurrency business scenarios, instantaneous business traffic will bring pressure that far exceeds the actual capacity of the application and database system. The database field will face great technical challenges in ensuring the overall stability and availability of the application system.
[0003] Among all types of databases, there is a type of database based on session-level cache. This type of database is different from the traditional database instance-level cache. In the case of high concurrent connections, it is easy to cause a serious problem of database running resources being overwhelmed and external services being affected.
[0004] For session-level databases, the resource usage of the entire session database is usually observed. When the resource threshold is reached, the fuse measure of active-standby switching will be triggered to ensure the availability of the database.
[0005] However, during the circuit breaker process, the session-level database will be unable to provide corresponding services, reducing system availability. Summary of the invention
[0006] In view of the above problems, the present disclosure provides a database assurance method, apparatus, device, medium and program product for improving system and service availability.
[0007] According to a first aspect of the present disclosure, a database protection method is provided, the method comprising: regularly acquiring total resource usage data and detailed resource usage data of a session-level database, wherein the detailed resource usage data corresponds one-to-one to N sessions, and N is a positive integer; and in a case where the total resource usage data exceeds a preset fuse threshold, executing a multi-level fuse strategy based on the detailed resource usage data, until the total resource usage data is less than the preset fuse threshold, then terminating the multi-level fuse strategy.
[0008] According to an embodiment of the present disclosure, the periodic acquisition of total resource usage data and detailed resource usage data of a session-level database includes: the total resource usage data and detailed resource usage data of the session-level database regularly counted by a preset intelligent agent.
[0009] According to an embodiment of the present disclosure, the multi-level fuse strategy includes fuse strategies of L different fuse levels, and the different fuse levels correspond one to one to a fuse level trigger interval, L is a positive integer, and the multi-level fuse strategy is executed based on the resource usage detail data until the total resource usage data is less than the preset fuse threshold, and then the multi-level fuse strategy is terminated, including: when the total resource usage data is in any of the fuse level trigger intervals, continuously executing the corresponding fuse strategy; and when the total resource usage data is less than the preset fuse threshold, terminating the multi-level fuse strategy.
[0010] According to an embodiment of the present disclosure, the execution of a multi-level fuse strategy based on the total resource usage data also includes: when the total resource usage data is in any of the fuse level trigger intervals, executing a corresponding fuse strategy based on the resource usage detail data; when the total resource usage data is in other fuse level trigger intervals, switching to a corresponding fuse strategy; and when the total resource usage data is less than the preset fuse threshold, ending the multi-level fuse strategy.
[0011] According to an embodiment of the present disclosure, the fuse strategy includes a first-level fuse strategy, and the multi-level fuse strategy is executed based on the resource usage detail data, including: for the first-level fuse strategy, based on the resource usage detail data, extracting idle sessions; and killing the idle sessions.
[0012] According to an embodiment of the present disclosure, the circuit breaker strategy also includes a secondary circuit breaker strategy, and the multi-level circuit breaker strategy is executed based on the resource usage detail data, including: for the secondary circuit breaker strategy, based on the resource usage detail data, extracting the session ranking according to memory usage; and killing the session according to the session ranking.
[0013] A second aspect of the present disclosure provides a database protection device, including: a receiving module, used to periodically obtain total resource usage data and resource usage detail data of a session-level database, wherein the resource usage detail data corresponds one-to-one to N sessions, and N is a positive integer; and a multi-level fuse module, used to execute a multi-level fuse strategy based on the resource usage detail data when the total resource usage data exceeds a preset fuse threshold, until the total resource usage data is less than the preset fuse threshold, and then terminate the multi-level fuse strategy.
[0014] According to an embodiment of the present disclosure, the receiving module is specifically used to collect the total resource usage data and the resource usage detail data of the session-level database regularly counted by a preset intelligent agent.
[0015] According to an embodiment of the present disclosure, the multi-level fuse strategy includes fuse strategies of L different fuse levels, and the different fuse levels correspond one to one with fuse level trigger intervals, L is a positive integer, and the multi-level fuse module is specifically used to continuously execute the corresponding fuse strategy when the total resource usage data is in any of the fuse level trigger intervals; and to end the multi-level fuse strategy when the total resource usage data is less than the preset fuse threshold.
[0016] According to an embodiment of the present disclosure, the multi-level fuse module is also specifically used to, when the total resource usage data is in any of the fuse level trigger intervals, execute a corresponding fuse strategy based on the resource usage detail data; when the total resource usage data is in other fuse level trigger intervals, switch to the corresponding fuse strategy; and when the total resource usage data is less than the preset fuse threshold, end the multi-level fuse strategy.
[0017] According to an embodiment of the present disclosure, the multi-level fuse module includes: a first-level fuse unit, used for extracting idle sessions for the first-level fuse strategy based on the resource usage detail data; and killing the idle sessions.
[0018] According to an embodiment of the present disclosure, the multi-level fuse module also includes: a secondary fuse unit, which is used to extract session rankings according to memory usage for the secondary fuse strategy based on the resource usage detail data; and to kill the sessions according to the session rankings.
[0019] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0020] The fourth aspect of the present disclosure further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the above computer program or instructions are executed by a processor.
[0021] The fifth aspect of the present disclosure further provides a computer program product, including a computer program or instructions, which implement the steps of the above method when the above computer program or instructions are executed by a processor.
[0022] In the embodiment of the present disclosure, in order to solve the problem that the solution of primary and standby fusing of application layer sessions will reduce the stability and availability of the overall application, the embodiment of the present disclosure uses the total resource usage data as an indicator to trigger multi-level fusing, and implements the multi-level fusing strategy for each session in the session database through the resource usage detail data, fusing some sessions and sacrificing a small number of sessions to ensure the stability of the overall operation. When the application system encounters instantaneous peak concurrency pressure, it can effectively guarantee the normal operation of the database system and ensure the overall stability and availability of the application system. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0024] Figure 1 The application scenario diagram of the database assurance method according to the embodiment of the present disclosure is schematically shown;
[0025] Figure 2 A flowchart of a database security method according to an embodiment of the present disclosure is schematically shown;
[0026] Figure 3 A full flow chart of a database security method according to an embodiment of the present disclosure is schematically shown;
[0027] Figure 4 A schematic block diagram schematically shows a database session management mechanism of a session-level cache type according to an embodiment of the present disclosure;
[0028] Figure 5 A schematic block diagram schematically shows a session performance indicator acquisition mechanism according to an embodiment of the present disclosure;
[0029] Figure 6 A schematic diagram of a database security device according to an embodiment of the present disclosure is shown; and
[0030] Figure 7 A block diagram of an electronic device suitable for implementing a database assurance method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0031] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0032] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0033] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0034] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0035] Before the embodiments of the present disclosure are disclosed in detail, the key technical terms involved in the embodiments of the present disclosure are explained one by one, as follows:
[0036] Session: A sequence of communications between two or more participants. A session can occur between a user and a server, between two servers, or between any entities that require continuous interaction. In a database connection, database operations need to remain connected in a session in order to perform transaction processing.
[0037] In the prior art, all session sets in the monitoring session database are usually monitored as a whole. After obtaining the overall indicators, it is determined whether they reach the threshold. When the resource threshold is reached, the fuse measure of active-standby switching is taken to ensure database availability.
[0038] The existing technology still has the following shortcomings: first, the active-standby switch triggered by the circuit breaker will directly lead to the interruption of in-transit transactions; second, during the active-standby switch triggered by the circuit breaker, the database cannot provide external services, directly affecting the system availability.
[0039] In order to solve the technical problems existing in the prior art, an embodiment of the present invention provides a database protection method, which regularly obtains the total resource usage data and the resource usage detail data of the session-level database, wherein the resource usage detail data corresponds one-to-one to N sessions, and N is a positive integer; and when the total resource usage data exceeds a preset fuse threshold, a multi-level fuse strategy is executed based on the resource usage detail data, until the total resource usage data is less than the preset fuse threshold, and the multi-level fuse strategy is terminated.
[0040] In the embodiment of the present disclosure, in order to solve the problem that the solution of primary and standby fusing of application layer sessions will reduce the stability and availability of the overall application, the embodiment of the present disclosure uses the total resource usage data as an indicator to trigger multi-level fusing, and implements the multi-level fusing strategy for each session in the session database through the resource usage detail data, fusing some sessions and sacrificing a small number of sessions to ensure the stability of the overall operation. When the application system encounters instantaneous peak concurrency pressure, it can effectively guarantee the normal operation of the database system and ensure the overall stability and availability of the application system.
[0041] Figure 1 The application scenario diagram of the database assurance method according to the embodiment of the present disclosure is schematically shown.
[0042] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0043] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0044] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0045] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0046] It should be noted that the database security method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the database security device provided in the embodiment of the present disclosure can generally be set in the server 105. The database security method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the database security device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0047] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0048] The following will be based on Figure 1 The scene described by Figure 2~Figure 5 The database protection method of the disclosed embodiment is described in detail.
[0049] Figure 2 The flowchart of the database protection method according to the embodiment of the present disclosure is schematically shown.
[0050] Figure 4 A schematic block diagram schematically illustrates a database session management mechanism of a session-level cache type according to an embodiment of the present disclosure.
[0051] Figure 5 A schematic block diagram schematically shows a session performance indicator acquisition mechanism according to an embodiment of the present disclosure.
[0052] like Figure 2 As shown, the database protection method of this embodiment includes operations S210 to S220, and the database protection method can be executed by the server 105.
[0053] In operation S210, total resource usage data and resource usage detail data of a session-level database are periodically acquired, wherein the resource usage detail data corresponds to N sessions one by one, and N is a positive integer.
[0054] In a typical scenario, combined with Figure 4 As shown, when the user is processing business, the connection with the session database is maintained through the middleware connection pool, wherein the session will cache the business-related data packets, and at the same time, the session will remain in existence and occupy certain resources of the session database, and the user can reuse the connections established in the past to occupy the business resources in the database through the session. Among them, the total resource usage data is the total resource data occupied by sessions 1 to N in the session database, and the total resource usage includes the number of database connections occupied by sessions 1 to N and the memory capacity occupied by sessions 1 to N; wherein, the detailed resource usage data is the resource data occupied by each session in sessions 1 to N in the session database, and the detailed resource usage includes the number of database connections occupied by each session in sessions 1 to N and the memory capacity occupied by each session in sessions 1 to N.
[0055] In the embodiment of the present disclosure, the total resource usage data and the detailed resource usage data regularly sent from the remote distributed node as the session database node are received as indicator data. It should be noted that the total resource usage data and the detailed resource usage data are continuously updated and can be used to monitor whether the subsequent multi-level fuse is effective, so as to close the fuse switch.
[0056] It should be emphasized that the commonly used session monitoring in the industry only monitors the resources occupied by the overall session. The mainstream ordinary session database does not provide detailed data on the resource usage of each session. The ordinary database is configured to only obtain the resource usage data of multiple sessions as a whole. In the ordinary database, only the space opened up for the overall session is monitored. The embodiment of the present disclosure monitors a special session database, which can provide various detailed indicators of the session.
[0057] According to an embodiment of the present disclosure, the periodic acquisition of total resource usage data and detailed resource usage data of a session-level database includes: the total resource usage data and detailed resource usage data of the session-level database regularly counted by a preset intelligent agent.
[0058] Specifically, the database protection solution of the embodiment of the present disclosure is configured in each distributed node (ie, each distributed node is configured as a plurality of session databases).
[0059] Combination Figure 5As shown, an agent (intelligent agent) is pre-set in the database node, and the agent executes the pre-set logic, which includes the logic of data collection and data processing. For example, an Agent Jar file that adapts to the fuse mechanism of the database is developed. The Agent Jar file cannot run alone and needs to be deployed on the database node server. The application uses this Jar file and configures the relevant fuse policy, directly logs in to the current local console of the database node to check and kill the session, release memory, and realize the ability to fuse the database service.
[0060] In operation S220, when the total resource usage data exceeds the preset fuse threshold, a multi-level fuse strategy is executed based on the resource usage detail data until the total resource usage data is less than the preset fuse threshold, and the multi-level fuse strategy is terminated.
[0061] The multi-level fuse strategy includes L fuse strategies with different fuse levels, each of the different fuse levels has a fuse level trigger interval corresponding to the other, and L is a positive integer.
[0062] Specifically, for example, when the number of connections and / or the value of memory usage in the total resource usage data exceeds the preset fuse threshold (such as memory usage exceeding 80%), a multi-level fuse strategy is enabled, wherein the multi-level fuse strategy is executed based on the detailed data of each session, and some of the N sessions are processed, and the multi-level fuse strategy includes L fuse strategies of different fuse levels, and the corresponding strategy is selected for multi-level fuse according to the load of the session database. Furthermore, after the multi-level fuse strategy is executed, when the total load (i.e., the total resource usage data) is lower than the preset fuse threshold (for example, the memory usage is lower than 80%), the fuse is closed.
[0063] It can be understood that the multi-stage fuse strategy in the embodiment of the present disclosure can be regarded as a lightweight partial fuse strategy, which avoids the fuse of the master-slave switching in the prior art by sacrificing the database resources of some sessions.
[0064] According to an embodiment of the present disclosure, the multi-level fuse strategy is executed based on the resource usage detail data until the total resource usage data is less than the preset fuse threshold, and the multi-level fuse strategy is terminated, including: when the total resource usage data is in any of the fuse level trigger intervals, continuously executing the corresponding fuse strategy; and when the total resource usage data is less than the preset fuse threshold, terminating the multi-level fuse strategy.
[0065] Specifically, the multi-level fuse strategy can be to continuously execute one of L fuse strategies until the total load is lower than the preset fuse threshold. For example, the multi-level fuse strategy includes fuse strategy 1 and fuse strategy 2. Fuse strategy 1 is triggered when the load (i.e., total resource usage data) is between 80% and 90%, and fuse strategy 2 is triggered when the load is between 90% and 100%. When the load is between 90% and 100%, fuse strategy 2 is continuously executed until the total resource usage data is lower than 80%, and the load is shut down.
[0066] According to an embodiment of the present disclosure, the execution of a multi-level fuse strategy based on the total resource usage data also includes: when the total resource usage data is in any of the fuse level trigger intervals, executing a corresponding fuse strategy based on the resource usage detail data; when the total resource usage data is in other fuse level trigger intervals, switching to a corresponding fuse strategy; and when the total resource usage data is less than the preset fuse threshold, ending the multi-level fuse strategy.
[0067] Specifically, the multi-stage fusing strategy may also be to initially execute one of the L fusing strategies, and when the load condition changes (increases or decreases) but is not lower than a preset fusing threshold, the fusing strategy is switched in time.
[0068] Continuing with the above example, when circuit breaker strategy 2 is triggered first, after circuit breaker strategy 2 is continuously executed, it is observed that the latest load is 85%, and then circuit breaker strategy 1 is executed. Or, for another example, when circuit breaker strategy 1 is triggered first, after circuit breaker strategy 1 is continuously executed, it is observed that the latest load is 95%, and then circuit breaker strategy 2 is switched to be executed.
[0069] According to an embodiment of the present disclosure, the fuse strategy includes a first-level fuse strategy, and the multi-level fuse strategy is executed based on the resource usage detail data, including: for the first-level fuse strategy, based on the resource usage detail data, extracting idle sessions; and killing the idle sessions.
[0070] Specifically, statistics are performed based on the resource usage details, and data packets received / sent by the session within a certain period of time are counted. When there is no or too small a received / sent data packet, it is determined to be an idle session, and these idle sessions occupying resources are checked and killed.
[0071] According to an embodiment of the present disclosure, the circuit breaker strategy also includes a secondary circuit breaker strategy, and the multi-level circuit breaker strategy is executed based on the resource usage detail data, including: for the secondary circuit breaker strategy, based on the resource usage detail data, extracting the session ranking according to memory usage; and killing the session according to the session ranking.
[0072] Specifically, statistics are performed based on the resource usage detail data to count the memory usage of the current session, and the sessions are ranked from high to low according to the memory usage to obtain a session ranking, and N sessions are checked and killed according to the session ranking (from high to low).
[0073] It is understandable that the second-level circuit breaker strategy has a stronger detection and killing intensity than the first-level circuit breaker strategy. In the first-level circuit breaker strategy, only idle and temporarily useless sessions are detected and killed, while in the second-level circuit breaker strategy, the sessions in use that occupy a large amount of memory space are also detected and killed to free up space in the database.
[0074] In the embodiment of the present disclosure, in order to solve the problem that the solution of primary and standby fusing of application layer sessions will reduce the stability and availability of the overall application, the embodiment of the present disclosure uses the total resource usage data as an indicator to trigger multi-level fusing, and implements the multi-level fusing strategy for each session in the session database through the resource usage detail data, fusing some sessions and sacrificing a small number of sessions to ensure the stability of the overall operation. When the application system encounters instantaneous peak concurrency pressure, it can effectively guarantee the normal operation of the database system and ensure the overall stability and availability of the application system.
[0075] Figure 3 The full flow chart of a database protection method according to an embodiment of the present disclosure is schematically shown.
[0076] like Figure 3 As shown, the database protection method of this embodiment includes operations S310 to S390.
[0077] In operation S310, it is determined whether the fuse initialization flag is turned on. If it is turned off, operation S320 is executed; if it is turned on, operation S340 is executed.
[0078] In operation S320, a configuration file with a specified file name in a specified directory is loaded and saved in a memory mapping table, and a resource fuse strategy is configured in the configuration file, with the number of database connections and memory capacity as fuse resources. In the database, the fuse strategy is as follows: In terms of the fuse strategy, it is divided into a two-level fuse mechanism, which is implemented through memory usage calculation and capacity monitoring, as follows, to effectively control and reduce the impact of the fuse on the business and ensure the availability of the application system. Level 1 fuse strategy: When the agent monitors and analyzes that the database memory reaches 80%, the level 1 fuse mechanism is triggered to start, and agnet checks and kills the idle sessions in the session list that have been executed and not automatically recycled. If the memory drops below 80%, the fuse strategy is closed; when the memory continues to grow to 90%, the level 1 disaster recovery mechanism is closed and the level 2 cache mechanism is started. Level 2 fuse strategy: When the agent monitors and analyzes that the database memory reaches 90%, the level 2 fuse mechanism is started, and the session that occupies the largest memory is sorted by calculation and judgment, and the session is checked and killed until the memory occupancy is below 80%. After the memory resources return to normal, the fuse mechanism is automatically closed.
[0079] In operation S330, a new scheduled task is started to load the configuration file regularly because the database restart needs to load the configuration file regularly to realize the function of dynamically updating the fuse policy. Then the fuse initialization flag is turned on.
[0080] In operation S340, the number of connections and memory capacity of the application are obtained as an evaluation, and the configuration file memory mapping table is checked to see whether a fuse policy is configured and which fuse logic is configured through monitoring. If yes, operation S350 is executed, otherwise operation S360 is executed.
[0081] In operation S350, the fuse switch is judged to be triggered, and if it is in the open state, a fuse exception is directly thrown and operation S360 is executed.
[0082] In operation S360, the start time and the number of session requests are recorded.
[0083] In operation S370, a command for cleaning up sessions in the database is automatically executed.
[0084] In operation S380, the number of sessions and the number of cleared sessions are counted, the memory usage is counted, and the fuse switch state is updated according to the memory usage and the fuse policy threshold.
[0085] In operation S390, the response result of the database fuse is finally returned to the client.
[0086] The embodiments of the present disclosure can be used for database system-level circuit breaking of the session-level cache type, solving the problems of business stability and availability of the application system. The circuit breaking mechanism is transparent to the application side, and the application does not need to make additional investments in the research and development of the application-side circuit breaking module, thereby reducing the cost of application transformation. The application only needs to focus on its own business logic and configuration strategy, while the database side focuses on the optimization of the circuit breaking tool and its own external service capabilities, as well as the use and optimization of database resources, with a clearer division of labor.
[0087] Based on the above database protection method, the present disclosure also provides a database protection device. Figure 6 The device is described in detail.
[0088] Figure 6 The structure block diagram of the database protection device according to the embodiment of the present disclosure is schematically shown.
[0089] like Figure 6 As shown, the database protection device 600 of this embodiment includes a receiving module 610 and a multi-stage fuse module 620 .
[0090] The receiving module 610 is used to periodically obtain the total resource usage data and resource usage detail data of the session-level database, wherein the resource usage detail data corresponds to N sessions one by one, and N is a positive integer. In one embodiment, the receiving module 610 can be used to perform the operation S210 described above, which will not be repeated here.
[0091] The multi-stage fuse module 620 is used to execute a multi-stage fuse strategy based on the resource usage detail data when the total resource usage data exceeds a preset fuse threshold, until the total resource usage data is less than the preset fuse threshold, and then terminate the multi-stage fuse strategy. In one embodiment, the multi-stage fuse module 620 can be used to execute the operation S220 described above, which will not be repeated here.
[0092] In the embodiment of the present disclosure, in order to solve the problem that the solution of primary and standby fusing of application layer sessions will reduce the stability and availability of the overall application, the embodiment of the present disclosure uses the total resource usage data as an indicator to trigger multi-level fusing, and implements the multi-level fusing strategy for each session in the session database through the resource usage detail data, fusing some sessions and sacrificing a small number of sessions to ensure the stability of the overall operation. When the application system encounters instantaneous peak concurrency pressure, it can effectively guarantee the normal operation of the database system and ensure the overall stability and availability of the application system.
[0093] According to an embodiment of the present disclosure, the receiving module is specifically used to collect the total resource usage data and the resource usage detail data of the session-level database regularly counted by a preset intelligent agent.
[0094] According to an embodiment of the present disclosure, the multi-level fuse strategy includes fuse strategies of L different fuse levels, and the different fuse levels correspond one to one with fuse level trigger intervals, L is a positive integer, and the multi-level fuse module is specifically used to continuously execute the corresponding fuse strategy when the total resource usage data is in any of the fuse level trigger intervals; and to end the multi-level fuse strategy when the total resource usage data is less than the preset fuse threshold.
[0095] According to an embodiment of the present disclosure, the multi-level fuse module is also specifically used to, when the total resource usage data is in any of the fuse level trigger intervals, execute a corresponding fuse strategy based on the resource usage detail data; when the total resource usage data is in other fuse level trigger intervals, switch to the corresponding fuse strategy; and when the total resource usage data is less than the preset fuse threshold, end the multi-level fuse strategy.
[0096] According to an embodiment of the present disclosure, the multi-level fuse module includes: a first-level fuse unit, used for extracting idle sessions for the first-level fuse strategy based on the resource usage detail data; and killing the idle sessions.
[0097] According to an embodiment of the present disclosure, the multi-level fuse module also includes: a secondary fuse unit, which is used to extract session rankings according to memory usage for the secondary fuse strategy based on the resource usage detail data; and to kill the sessions according to the session rankings.
[0098] According to an embodiment of the present disclosure, any multiple modules in the receiving module 610 and the multi-stage fuse module 620 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the receiving module 610 and the multi-stage fuse module 620 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, at least one of the receiving module 610 and the multi-stage fuse module 620 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.
[0099] Figure 7A block diagram of an electronic device suitable for implementing a database assurance method according to an embodiment of the present disclosure is schematically shown.
[0100] like Figure 7 As shown, the electronic device 700 according to an embodiment of the present disclosure includes a processor 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 to a random access memory (RAM) 703. The processor 701 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 701 may also include an onboard memory for caching purposes. The processor 701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0101] In RAM 703, various programs and data required for the operation of electronic device 700 are stored. Processor 701, ROM 702 and RAM 703 are connected to each other via bus 704. Processor 701 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 702 and / or RAM 703. It should be noted that the program can also be stored in one or more memories other than ROM 702 and RAM 703. Processor 701 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0102] According to an embodiment of the present disclosure, the electronic device 700 may further include an input / output (I / O) interface 705, which is also connected to the bus 704. The electronic device 700 may further include one or more of the following components connected to the input / output (I / O) interface 705: an input portion 706 including a keyboard, a mouse, etc.; an output portion 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 708 including a hard disk, etc.; and a communication portion 709 including a network interface card such as a LAN card, a modem, etc. The communication portion 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the input / output (I / O) interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage portion 708 as needed.
[0103] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0104] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 702 and / or RAM 703 described above and / or one or more memories other than ROM 702 and RAM 703.
[0105] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the method provided by the embodiment of the present disclosure.
[0106] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 701. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0107] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 709, and / or installed from the removable medium 711. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0108] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the processor 701, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0109] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0110] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0111] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0112] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A database security method, characterized in that: The method comprises: Regularly acquiring total resource usage data and detailed resource usage data of a session-level database, wherein the detailed resource usage data corresponds to N sessions one by one, where N is a positive integer; and When the total resource usage data exceeds the preset fuse threshold, a multi-level fuse strategy is executed based on the resource usage detail data until the total resource usage data is less than the preset fuse threshold, at which time the multi-level fuse strategy is terminated.
2. The method according to claim 1, characterized in that The periodic acquisition of total resource usage data and detailed resource usage data of the session-level database includes: The total resource usage data and the resource usage detail data of the session-level database are regularly counted based on the preset intelligent agent.
3. The method according to claim 2, characterized in that in, The multi-level fusing strategy includes fusing strategies of L different fusing levels, and the different fusing levels have a one-to-one correspondence with a fusing level triggering interval, where L is a positive integer. The executing of the multi-level fuse strategy based on the resource usage detail data until the total resource usage data is less than the preset fuse threshold, and then terminating the multi-level fuse strategy, includes: When the total resource usage data is within any of the fuse level triggering intervals, continuously executing the corresponding fuse strategy; and When the total resource usage data is less than the preset fuse threshold, the multi-level fuse strategy is terminated.
4. The method according to claim 3, characterized in that: The determining and executing of a multi-level fuse strategy based on the total resource usage data also includes: When the total resource usage data is within any of the fuse level triggering intervals, executing a corresponding fuse strategy based on the resource usage detail data; When the total resource usage data is within the other fuse level triggering intervals, switching to a corresponding fuse strategy; and When the total resource usage data is less than the preset fuse threshold, the multi-level fuse strategy is terminated.
5. The method according to any one of claims 2 to 4, characterized in that: The circuit breaker strategy includes a first-level circuit breaker strategy. The executing a multi-level fuse strategy based on the resource usage detail data includes: For the first-level fuse strategy, extracting idle sessions based on the resource usage detail data; and Kill the idle session.
6. The method according to claim 5, characterized in that The fuse strategy also includes a secondary fuse strategy. The executing a multi-level fuse strategy based on the resource usage detail data includes: For the secondary fuse strategy, based on the resource usage detail data, extracting session rankings according to memory usage; and According to the ranking of the sessions, the sessions are checked and killed.
7. A database security device, characterized in that: The device comprises: a receiving module, configured to periodically obtain total resource usage data and resource usage detail data from a session-level database, wherein the resource usage detail data corresponds to N sessions one by one, where N is a positive integer; and A multi-level fuse module is used to execute a multi-level fuse strategy based on the resource usage detail data when the total resource usage data exceeds the preset fuse threshold, and terminate the multi-level fuse strategy when the total resource usage data is less than the preset fuse threshold.
8. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.