CN112115020A - Database connection pool abnormity monitoring method and device and computer equipment - Google Patents

Database connection pool abnormity monitoring method and device and computer equipment Download PDF

Info

Publication number
CN112115020A
CN112115020A CN202010877368.1A CN202010877368A CN112115020A CN 112115020 A CN112115020 A CN 112115020A CN 202010877368 A CN202010877368 A CN 202010877368A CN 112115020 A CN112115020 A CN 112115020A
Authority
CN
China
Prior art keywords
connection
acquisition
database connection
database
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010877368.1A
Other languages
Chinese (zh)
Other versions
CN112115020B (en
Inventor
张鑫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Keynote Network Inc
Original Assignee
Beijing Keynote Network Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Keynote Network Inc filed Critical Beijing Keynote Network Inc
Priority to CN202010877368.1A priority Critical patent/CN112115020B/en
Publication of CN112115020A publication Critical patent/CN112115020A/en
Application granted granted Critical
Publication of CN112115020B publication Critical patent/CN112115020B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs

Abstract

The application relates to a method and a device for monitoring abnormity of a database connection pool and computer equipment, wherein the method comprises the following steps: recording the acquisition starting time when monitoring a database connection acquisition request; recording the acquisition ending time when the database connection acquisition success message is monitored; determining the connection time consumption of the database connection acquisition request according to the acquisition start time and the acquisition end time corresponding to the database connection acquisition request; determining average connection time and standard deviation of connection time according to the connection time of the multiple database connection acquisition requests; determining an acquisition connection abnormity threshold value of a database connection pool according to the average acquisition connection time consumption and the acquisition connection time consumption standard deviation; and monitoring the abnormity of the database connection pool according to the connection abnormity obtaining threshold and the connection obtaining time consumption of the database connection obtaining request. Through the application, the monitoring of the database connection pool is realized.

Description

Database connection pool abnormity monitoring method and device and computer equipment
Technical Field
The application relates to the technical field of computers, in particular to a database connection pool abnormity monitoring method and device and computer equipment.
Background
In JAVA-based applications, especially enterprise user-oriented applications, databases are one of its essential components. In order to solve the problem of performance loss caused by creation and destruction of database connection due to frequent database access, a database connection pool technology is introduced into an application system, and the basic idea of the database connection pool is to create a buffer layer for database connection. When the database connection pool is initialized, a certain number of database connections are created and are placed into the database connection pool, the number of the initially created database connections is determined by the set minimum connection number, and meanwhile, the maximum connection number of the database connection pool is set, so that excessive connection between an application system and a database is prevented from being created, and database resources are prevented from being consumed. When the application needs to use the database connection, one database connection is taken out from the database connection pool, and the database connection is put back to the database connection pool after the application is used, so that the frequent establishment of the database connection is avoided, the system resource overhead caused by closing is avoided, and meanwhile, each database connection can be efficiently and safely reused.
In the related art, the database connection is cached in the database connection pool, so that the system resource overhead can be reduced, but whether an abnormal condition exists in the database connection pool in the operation process cannot be known.
Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, the application provides a database connection pool abnormality monitoring method, a database connection pool abnormality monitoring device and computer equipment.
In a first aspect, the present application provides a method for monitoring an abnormality of a database connection pool, including: monitoring a database connection acquisition request, wherein the database connection acquisition request is configured to acquire database connections in a database connection pool; when a database connection acquisition request is monitored, recording acquisition start time corresponding to the database connection acquisition request; monitoring a database connection acquisition success message corresponding to the database connection acquisition request; when a database connection acquisition success message corresponding to the database connection acquisition request is monitored, recording acquisition ending time corresponding to the database connection acquisition request; determining the connection time consumption of the database connection acquisition request according to the acquisition start time and the acquisition end time corresponding to the database connection acquisition request; determining the average connection acquisition time and the standard deviation of the connection acquisition time of the database connection pool according to the connection acquisition time of the plurality of database connection acquisition requests; determining an acquired connection abnormity threshold value of the database connection pool according to the average acquired connection time consumption and the acquired connection time consumption standard deviation of the database connection pool; and monitoring the abnormity of the database connection pool according to the connection abnormity obtaining threshold and the connection obtaining time consumption of the database connection obtaining request.
In some embodiments, determining the connection obtaining anomaly threshold of the database connection pool according to the average connection obtaining time consumption and the standard deviation of the connection obtaining time consumption of the database connection pool includes: determining an acquisition connection anomaly threshold of the database connection pool according to the following modes: t ═ e (x) +3, where T is the acquisition connection anomaly threshold, and e (x) the average acquisition connection consumption time of the database connection pool is the standard deviation of the acquisition connection consumption time of the database connection pool.
In some embodiments, monitoring the abnormality of the database connection pool according to the connection abnormality acquisition threshold of the database connection pool and the connection time consumption of the database connection acquisition request includes: judging whether the connection acquisition time consumption of the database connection acquisition request is greater than an acquisition connection abnormity threshold value or not; and if the connection acquisition time consumption of the database connection acquisition request is greater than the connection acquisition abnormity threshold value, determining that the database connection pool is abnormal.
In some embodiments, determining an average connection acquisition time and a standard deviation of the connection acquisition time of the database connection pool according to the connection acquisition time of the plurality of database connection acquisition requests includes: determining average connection acquisition time and standard deviation of the connection acquisition time of a database connection pool according to the connection acquisition time of a plurality of database connection acquisition requests in a first time period; monitoring the abnormality of the database connection pool according to the connection abnormality threshold and the connection time consumption of the database connection acquisition request, comprising: and monitoring the abnormality of the database connection pool according to the connection abnormality threshold and the connection time consumption of the database connection acquisition request in the second time period.
In certain embodiments, further comprising: updating the acquisition connection abnormity threshold value of the database connection pool according to the acquisition connection time consumption of the plurality of database connection acquisition requests in the second time; wherein, according to the connection acquiring time consumption of the connection acquiring request and the connection acquiring threshold, monitoring the abnormality of the database connection pool, comprising: and monitoring the abnormity of the database connection pool according to the updated acquisition connection abnormity threshold and the acquisition connection time consumption of the database connection acquisition request in the third time period.
In some embodiments, determining an average connection acquisition time and a standard deviation of the connection acquisition time of the database connection pool according to the connection acquisition time of the plurality of database connection acquisition requests includes: determining average connection acquisition time and connection acquisition time standard deviation of a database connection pool according to the connection acquisition time of a plurality of database connection acquisition requests before the current database connection acquisition request; monitoring the abnormality of the database connection pool according to the connection abnormality threshold and the connection time consumption of the database connection acquisition request, comprising: and monitoring the abnormity of the database connection pool according to the connection abnormity obtaining threshold and the connection obtaining time consumption of the current database connection obtaining request.
In certain embodiments, further comprising: updating the connection abnormity obtaining threshold according to the connection obtaining time consumption of the current database connection obtaining request; and monitoring the abnormity of the database connection pool according to the updated acquisition connection abnormity threshold and the acquisition connection time consumption of the next database connection acquisition request.
In a second aspect, the present application provides a database connection pool anomaly monitoring device, including: the monitoring module is used for monitoring a database connection acquisition request, wherein the database connection acquisition request is configured to acquire database connection in a database connection pool; when a database connection acquisition request is monitored, recording acquisition start time corresponding to the database connection acquisition request; monitoring a database connection acquisition success message corresponding to the database connection acquisition request; when a database connection acquisition success message corresponding to the database connection acquisition request is monitored, recording acquisition ending time corresponding to the database connection acquisition request; determining the connection time consumption of the database connection acquisition request according to the acquisition start time and the acquisition end time corresponding to the database connection acquisition request; the threshold value determining module is used for determining the average connection acquisition time consumption and the standard deviation of the connection acquisition time consumption of the database connection pool according to the connection acquisition time consumption of the plurality of database connection acquisition requests; determining an acquired connection abnormity threshold value of the database connection pool according to the average acquired connection time consumption and the acquired connection time consumption standard deviation of the database connection pool; and the monitoring module is used for monitoring the abnormity of the database connection pool according to the connection abnormity obtaining threshold and the connection time consumption of the database connection obtaining request.
In a third aspect, the present application provides a computer device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor; the computer program, when executed by a processor, performs the steps of the database connection pool anomaly monitoring method.
In a fourth aspect, the present application provides a computer-readable storage medium, where a database connection pool abnormality monitoring program is stored on the computer-readable storage medium, and when executed by a processor, the database connection pool abnormality monitoring program implements the steps of the database connection pool abnormality monitoring method.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages: the method provided by the embodiment of the application realizes monitoring of the time consumed for acquiring the database connection from the database connection pool, so that the abnormal condition of the database connection pool can be accurately and quickly found.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
FIG. 1 is a flowchart of an embodiment of a database connection pool anomaly monitoring method provided in the present application;
fig. 2 is a flowchart of another implementation of a database connection pool anomaly monitoring method provided in an embodiment of the present application;
fig. 3 is a flowchart of another implementation of a database connection pool monitoring method according to an embodiment of the present disclosure;
fig. 4 is a block diagram illustrating a structure of an embodiment of a database connection pool abnormality monitoring apparatus according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram illustrating an embodiment of an application system according to an embodiment of the present disclosure; and
fig. 6 is a hardware schematic diagram of an implementation manner of a computer device according to an embodiment of the present application.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In the following description, suffixes such as "module", "component", or "unit" used to denote elements are used only for the convenience of description of the present application, and have no specific meaning by themselves. Thus, "module", "component" or "unit" may be used mixedly.
Fig. 1 is a flowchart of an embodiment of a database connection pool anomaly monitoring method provided in the present application, and as shown in fig. 1, the database connection pool anomaly monitoring method includes steps S102 to S116.
Step S102, a database connection obtaining request is monitored, wherein the database connection obtaining request is configured to obtain database connections in a database connection pool.
In the embodiment of the present application, the database connection pool is initialized by creating a certain number of database connections and placing the database connections in the database connection pool. In some embodiments, the number of database connections is determined according to the minimum number of connections and the maximum number of connections of the database connection pool, but the embodiments of the present application are not limited thereto.
And step S104, recording the acquisition starting time corresponding to the database connection acquisition request when the database connection acquisition request is monitored.
And step S106, monitoring a database connection acquisition success message corresponding to the database connection acquisition request.
Step S108, when the database connection acquisition success message corresponding to the database connection acquisition request is monitored, the acquisition ending time corresponding to the database connection acquisition request is recorded.
And step S110, determining the connection time consumption of the database connection acquisition request according to the acquisition start time and the acquisition end time corresponding to the database connection acquisition request.
In some embodiments, the acquisition connection elapsed time is the difference between the acquisition end time and the acquisition start time.
And step S112, determining the average connection acquisition time and the standard deviation of the connection acquisition time of the database connection pool according to the connection acquisition time of the plurality of database connection acquisition requests.
And step S114, determining an acquisition connection abnormity threshold value of the database connection pool according to the average acquisition connection time consumption and the acquisition connection time consumption standard difference of the database connection pool.
And step S116, monitoring the abnormity of the database connection pool according to the connection abnormity acquisition threshold and the connection acquisition time consumption of the database connection acquisition request.
By the database connection pool abnormity monitoring method, the time consumed for acquiring the database connection from the database connection pool is monitored, and therefore the abnormity condition of the database connection pool can be accurately and quickly found.
In some embodiments, in step S114, the connection exception threshold of the connection pool of the database is determined as follows:
T=E(x)+3*
wherein, T is an acquisition connection anomaly threshold, e (x) is an average acquisition connection time consumption of the database connection pool, and is an acquisition connection time consumption standard deviation of the database connection pool.
In some embodiments, in step S116, it is determined whether the connection acquiring time consumption of the database connection acquiring request is greater than the connection acquiring exception threshold; and if the connection acquisition time consumption of the database connection acquisition request is greater than the connection acquisition abnormity threshold value, determining that the database connection pool is abnormal. Optionally, if the connection acquiring time of the database connection acquiring request is less than or equal to the connection acquiring exception threshold, it is determined that no exception occurs in the database connection pool, but is not limited thereto.
In some embodiments, in step S116, an anomaly of the database connection pool is determined according to a size relationship between a connection acquiring time consumption of the database connection acquiring request and a connection acquiring anomaly threshold, optionally, the anomaly is divided into a plurality of levels (e.g., anomaly, medium anomaly, serious anomaly, etc.), and a degree of the anomaly is proportional to a difference between the connection acquiring time consumption and the connection acquiring anomaly threshold.
It should be understood that, in the embodiment of the present application, the foregoing anomaly monitoring policy is not limited, and any policy of acquiring connection time consumption according to a database connection acquisition request and acquiring connection anomaly threshold of a database connection may be conceived, which is not limited in the embodiment of the present application.
Fig. 2 is a flowchart of another implementation of a database connection pool abnormality monitoring method according to an embodiment of the present disclosure, and as shown in fig. 2, the method includes steps S202 to S206.
Step S202, according to the connection time consumption of the multiple database connection acquisition requests in the first time period, determining the average connection time consumption and the standard deviation of the connection time consumption of the database connection pool.
In this embodiment, according to the above steps S102 to S110, it may be determined that connection acquisition time of the multiple database connection acquisition requests in the first time period is consumed.
And step S204, determining an acquisition connection abnormity threshold of the database connection pool according to the average acquisition connection time consumption and the acquisition connection time consumption standard difference of the database connection pool.
In some embodiments, in step S204, the connection exception threshold of the connection pool of the database is determined as follows:
T=E(x)+3*
wherein, T is an acquisition connection anomaly threshold, e (x) is an average acquisition connection time consumption of the database connection pool, and is an acquisition connection time consumption standard deviation of the database connection pool.
Step S206, monitoring the abnormality of the database connection pool according to the connection abnormality threshold and the connection time consumption of the database connection acquisition request in the second time period.
In some embodiments, the first time period is a time period screened from historical data, and the second time period is a monitoring time period, thereby monitoring the abnormality of the database connection pool of the current time period according to the historical data.
In other embodiments, the first time period is a previous time period or a plurality of consecutive time periods of the second time period, and the length of each time period is the same or different. Therefore, the abnormality of the current end-time database connection pool is monitored according to the recent data.
In some embodiments, in step S206, in response to the single database connection obtaining request in the second time period, the abnormality of the database connection pool is monitored in real time according to the obtaining connection abnormality threshold and the obtaining connection time consumption of the single database connection obtaining request in the second time period. Optionally, in the second time period, once the connection acquiring time consumption of a single database connection acquiring request is greater than the connection acquiring abnormality threshold, it is determined that the database connection pool is abnormal. But is not limited thereto.
In other embodiments, in step S206, the abnormality of the database connection pool is monitored according to the connection acquiring time of the plurality of database connection acquiring requests in the second time period and the connection acquiring abnormality threshold determined in step S204. For example, counting the times that the connection acquiring time of the database connection acquiring request is greater than the connection acquiring abnormal threshold in the second time period, and determining that the database connection pool is abnormal when the times are greater than a preset value. But is not limited thereto.
In this embodiment, the connection acquisition time of the database connection acquisition request in the second time period may be determined according to the above steps S102 to S110.
In certain embodiments, further comprising: and updating the acquisition connection abnormity threshold of the database connection pool according to the acquisition connection time consumption of the plurality of database connection acquisition requests in the second time. And in a third time period, monitoring the abnormity of the database connection pool according to the updated acquisition connection abnormity threshold and the acquisition connection time consumption of the database connection acquisition request in the third time period.
Fig. 3 is a flowchart of a database connection pool monitoring method according to another implementation manner provided in an embodiment of the present application, and as shown in fig. 3, the method includes steps S302 to S306.
Step S302, according to the connection acquisition consumed time of a plurality of database connection acquisition requests before the current database connection acquisition request, determining the average connection acquisition consumed time and the standard deviation of the connection acquisition consumed time of the database connection pool.
In step S302, according to the above steps S102 to S110, it may take time to obtain connection of a plurality of database connection obtaining requests before the current database connection obtaining request.
And step S304, determining an acquisition connection abnormity threshold value of the database connection pool according to the average acquisition connection time consumption and the acquisition connection time consumption standard difference of the database connection pool.
Step S306, monitoring the abnormity of the database connection pool according to the connection abnormity obtaining threshold and the connection consuming time of the current database connection obtaining request.
In this embodiment, through steps S302 and S304, after receiving the database connection acquisition request, the acquisition connection abnormality threshold of the database connection pool is updated, and when receiving the database connection acquisition request next time, the abnormality of the database connection pool is monitored according to the acquisition connection abnormality threshold updated last time. Therefore, the method realizes updating the acquired connection abnormity threshold value of the database connection pool in an incremental manner in real time and monitoring the abnormity of the database connection pool in real time.
Fig. 4 is a block diagram of a structure of an embodiment of a database connection pool abnormality monitoring apparatus according to an embodiment of the present application, and as shown in fig. 4, a database connection pool abnormality monitoring apparatus 400 includes: a listening module 410, a threshold determination module 420, and a monitoring module 430.
Referring to fig. 4, a monitoring module 410, configured to monitor a database connection obtaining request, where the database connection obtaining request is configured to obtain a database connection in a database connection pool; when a database connection acquisition request is monitored, recording acquisition start time corresponding to the database connection acquisition request; monitoring a database connection acquisition success message corresponding to the database connection acquisition request; when a database connection acquisition success message corresponding to the database connection acquisition request is monitored, recording acquisition ending time corresponding to the database connection acquisition request; and determining the connection time consumption of the database connection acquisition request according to the acquisition start time and the acquisition end time corresponding to the database connection acquisition request.
Referring to fig. 4, the threshold determining module 420 is connected to the monitoring module 410, and configured to determine an average connection acquiring time and a standard deviation of the connection acquiring time of the database connection pool according to the connection acquiring time of the plurality of database connection acquiring requests; and determining the connection abnormity acquisition threshold of the database connection pool according to the average connection acquisition time consumption and the standard deviation of the connection acquisition time consumption of the database connection pool.
Referring to fig. 4, the monitoring module 430 is connected to the monitoring module 410 and the threshold determining module 420, and configured to monitor an abnormality of the database connection pool according to the connection acquiring time consumption of the connection acquiring request obtained by the threshold determining module 420 and the connection acquiring abnormal threshold determined by the threshold determining module 420 and the database connection acquiring request obtained by the monitoring module 410.
In some embodiments, the threshold determining module 420 is configured to determine an average connection acquisition time and a standard deviation of the connection acquisition time of the database connection pool according to the connection acquisition time of the multiple database connection acquisition requests in the first time period; and determining an acquisition connection abnormity threshold value of the database connection pool according to the average acquisition connection time consumption and the standard deviation of the acquisition connection time consumption obtained by determination. A monitoring module 430, configured to monitor an exception of the database connection pool according to the connection acquisition time consumed by the database connection acquisition request in the second time period and the connection acquisition exception threshold determined by the threshold determining module 420.
In some embodiments, the threshold determination module 420 is configured to determine an average connection acquiring time and a standard deviation of the connection acquiring time of the database connection pool according to connection acquiring time of a plurality of database connection acquiring requests before the current database connection acquiring request. A monitoring module 430, configured to monitor an exception of the database connection pool according to the connection acquisition time consumed by the current database connection acquisition request and the connection acquisition exception threshold determined by the threshold determining module 420.
Fig. 5 is a schematic structural diagram of an implementation manner of an application system according to an embodiment of the present application, and as shown in fig. 5, the application system 500 includes an application 510, a database connection pool 520, and a database connection pool monitoring device 530.
Referring to fig. 5, the application 510 creates a database connection pool 520, and creates a certain number of database connections when the database connection pool 520 is initialized, the number of database connections being determined according to a set minimum connection number and a set maximum connection number. When the database connection is needed, a database connection obtaining request is initiated, and the database connection is obtained from the quantity database connection pool. And after the database connection is used, the database connection is placed back to the database connection pool.
When a service holds or does not release a connection in the database connection pool for a long time, the time for other services to acquire a connection from the database connection pool will increase, resulting in an increase in service request time. Positioning is particularly difficult to address in such abnormal situations. In this embodiment of the present application, the database connection pool monitoring device 530 is configured to monitor time consumed for obtaining database connection from the database connection pool, so as to accurately and quickly find an abnormal condition of the database connection pool, and provide positioning for a problem of increased positioning service time.
Referring to fig. 5, the database connection pool monitoring device 530 is configured to determine an abnormal connection obtaining threshold, and monitor whether the current database connection pool is abnormal according to the time consumed for connecting the database and the abnormal connection obtaining threshold of the database. The time consumed for database connection is the time difference between the receiving of the database connection acquisition request and the successful acquisition of the database connection.
According to the theorem of majors and the theorem of central limit. If the time consumed for obtaining the database connection is more than the average number plus 3 times sigma, the current database connection pool can be judged to be in an abnormal condition. In some embodiments, the database connection pool monitoring device 530 is configured to determine an average connection acquisition time and a standard deviation of the connection acquisition time, and determine an acquisition connection exception threshold T ═ e (x) +3, where T is the acquisition connection exception threshold, and e (x) is the average connection acquisition time and the standard deviation of the connection acquisition time.
In some embodiments, the database connection pool monitoring device 530 is configured to compare the connection acquisition time of the database connection acquisition request with the connection acquisition exception threshold, and determine that the database connection pool is in an exception condition if the connection acquisition time of a single time is greater than the connection acquisition exception threshold; and if the connection acquisition time is longer than the connection acquisition abnormity threshold value, determining that the database connection pool is in a normal condition.
The database connection pool monitoring device 530 can refer to the foregoing description herein, and details thereof are not repeated in this embodiment of the application.
In some embodiments, the application 510 adjusts the number of database connections in the database connection pool after the database connection pool monitoring device 530 monitors that there is an abnormality in the database connection pool, but is not limited thereto.
The embodiment also provides a computer device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster composed of a plurality of servers) capable of executing programs, and the like. The computer device 20 of the present embodiment includes at least, but is not limited to: a memory 21, a processor 22, which may be communicatively coupled to each other via a system bus, as shown in FIG. 6. It is noted that fig. 6 only shows a computer device 20 with components 21-22, but it is to be understood that not all shown components are required to be implemented, and that more or fewer components may be implemented instead.
In the present embodiment, the memory 21 (i.e., a readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 21 may be an internal storage unit of the computer device 20, such as a hard disk or a memory of the computer device 20. In other embodiments, the memory 21 may also be an external storage device of the computer device 20, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the computer device 20. Of course, the memory 21 may also include both internal and external storage devices of the computer device 20. In this embodiment, the memory 21 is generally used for storing an operating system installed in the computer device 20 and various application software, such as program codes of the database connection pool abnormality monitoring method. Further, the memory 21 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 22 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 22 is typically used to control the overall operation of the computer device 20. In this embodiment, the processor 22 is configured to execute the program code stored in the memory 21 or process data, such as the program code of the database connection pool abnormality monitoring method, to implement the database connection pool abnormality monitoring method.
The present embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., on which a computer program is stored, which when executed by a processor implements corresponding functions. The computer-readable storage medium of this embodiment is used for storing a database connection pool abnormality monitoring program, and is executed by a processor to implement the steps of the database connection pool abnormality monitoring method.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A database connection pool abnormity monitoring method is characterized by comprising the following steps:
monitoring a database connection acquisition request, wherein the database connection acquisition request is configured to acquire database connections in a database connection pool;
when a database connection acquisition request is monitored, recording acquisition start time corresponding to the database connection acquisition request;
monitoring a database connection acquisition success message corresponding to the database connection acquisition request;
when a database connection acquisition success message corresponding to the database connection acquisition request is monitored, recording acquisition ending time corresponding to the database connection acquisition request;
determining the connection time consumption of the database connection acquisition request according to the acquisition start time and the acquisition end time corresponding to the database connection acquisition request;
determining the average connection acquisition time and the standard deviation of the connection acquisition time of the database connection pool according to the connection acquisition time of the plurality of database connection acquisition requests;
determining an acquired connection abnormity threshold value of the database connection pool according to the average acquired connection time consumption and the acquired connection time consumption standard deviation of the database connection pool;
and monitoring the abnormity of the database connection pool according to the connection abnormity acquisition threshold and the connection acquisition time consumption of the database connection acquisition request.
2. The method for monitoring the abnormality of the database connection pool according to claim 1, wherein determining the threshold value of the acquired connection abnormality of the database connection pool according to the standard deviation of the average acquired connection time and the acquired connection time of the database connection pool comprises: determining an acquisition connection anomaly threshold of the database connection pool according to the following modes: t ═ e (x) +3, where T is the acquisition connection anomaly threshold, and e (x) the average acquisition connection consumption time of the database connection pool is the standard deviation of the acquisition connection consumption time of the database connection pool.
3. The method for monitoring the abnormality of the database connection pool according to claim 1, wherein monitoring the abnormality of the database connection pool according to the connection acquisition abnormality threshold and the connection acquisition time of the database connection acquisition request includes:
judging whether the connection acquisition time consumption of the database connection acquisition request is greater than the connection acquisition abnormity threshold value or not;
and if the connection acquisition time consumption of the database connection acquisition request is greater than the connection acquisition abnormity threshold, determining that the database connection pool is abnormal.
4. The database connection pool abnormality monitoring method according to any one of claims 1 to 3,
determining the average connection acquisition time and the standard deviation of the connection acquisition time of the database connection pool according to the connection acquisition time of the plurality of database connection acquisition requests, wherein the method comprises the following steps: determining the average connection acquisition time and the standard deviation of the connection acquisition time of the database connection pool according to the connection acquisition time of a plurality of database connection acquisition requests in a first time period;
monitoring the abnormality of the database connection pool according to the connection abnormality obtaining threshold and the connection consuming time of the database connection obtaining request, and the method comprises the following steps: and monitoring the abnormity of the database connection pool according to the connection abnormity acquisition threshold and the connection acquisition time consumption of the database connection acquisition request in the second time period.
5. The database connection pool anomaly monitoring method according to claim 4, further comprising: updating the abnormal connection acquisition threshold of the database connection pool according to the connection acquisition time consumption of the plurality of database connection acquisition requests in the second time;
monitoring the abnormality of the database connection pool according to the connection abnormality obtaining threshold and the connection consuming time of the database connection obtaining request, wherein the monitoring comprises the following steps: and monitoring the abnormity of the database connection pool according to the updated acquisition connection abnormity threshold and the acquisition connection time consumption of the database connection acquisition request in the third time period.
6. The database connection pool abnormality monitoring method according to any one of claims 1 to 3,
determining the average connection acquisition time and the standard deviation of the connection acquisition time of the database connection pool according to the connection acquisition time of the plurality of database connection acquisition requests, wherein the method comprises the following steps: determining average connection acquisition time and connection acquisition time standard deviation of a database connection pool according to the connection acquisition time of a plurality of database connection acquisition requests before the current database connection acquisition request;
monitoring the abnormality of the database connection pool according to the connection abnormality obtaining threshold and the connection consuming time of the database connection obtaining request, and the method comprises the following steps: and monitoring the abnormity of the database connection pool according to the connection abnormity acquisition threshold and the connection acquisition time consumption of the current database connection acquisition request.
7. The database connection pool anomaly monitoring method according to claim 6, further comprising: updating the acquired connection abnormal threshold according to the acquired connection time consumption of the current database connection acquisition request; and monitoring the abnormity of the database connection pool according to the updated connection abnormity acquisition threshold and the connection acquisition time consumption of the next database connection acquisition request.
8. A database connection pool anomaly monitoring device, comprising:
the monitoring module is used for monitoring a database connection acquisition request, wherein the database connection acquisition request is configured to acquire database connection in a database connection pool; when a database connection acquisition request is monitored, recording acquisition start time corresponding to the database connection acquisition request; monitoring a database connection acquisition success message corresponding to the database connection acquisition request; when a database connection acquisition success message corresponding to the database connection acquisition request is monitored, recording acquisition ending time corresponding to the database connection acquisition request; determining the connection time consumption of the database connection acquisition request according to the acquisition start time and the acquisition end time corresponding to the database connection acquisition request;
the threshold value determining module is used for determining the average connection acquisition time and the standard deviation of the connection acquisition time of the database connection pool according to the connection acquisition time of the plurality of database connection acquisition requests; determining an acquired connection abnormity threshold value of the database connection pool according to the average acquired connection time consumption and the acquired connection time consumption standard deviation of the database connection pool;
and the monitoring module is used for monitoring the abnormity of the database connection pool according to the connection abnormity acquisition threshold and the connection acquisition time consumption of the database connection acquisition request.
9. A computer device, characterized in that the computer device comprises:
a memory, a processor, and a computer program stored on the memory and executable on the processor;
the computer program when executed by the processor implementing the steps of the database connection pool anomaly monitoring method according to any one of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a database connection pool abnormality monitoring program, which when executed by a processor, implements the steps of the database connection pool abnormality monitoring method according to any one of claims 1 to 7.
CN202010877368.1A 2020-08-27 2020-08-27 Database connection pool abnormity monitoring method and device and computer equipment Active CN112115020B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010877368.1A CN112115020B (en) 2020-08-27 2020-08-27 Database connection pool abnormity monitoring method and device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010877368.1A CN112115020B (en) 2020-08-27 2020-08-27 Database connection pool abnormity monitoring method and device and computer equipment

Publications (2)

Publication Number Publication Date
CN112115020A true CN112115020A (en) 2020-12-22
CN112115020B CN112115020B (en) 2021-03-26

Family

ID=73805524

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010877368.1A Active CN112115020B (en) 2020-08-27 2020-08-27 Database connection pool abnormity monitoring method and device and computer equipment

Country Status (1)

Country Link
CN (1) CN112115020B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104239365A (en) * 2013-06-24 2014-12-24 北京新媒传信科技有限公司 Database connection pool and method for acquiring links in database connection pool
CN108549592A (en) * 2018-03-19 2018-09-18 联动优势电子商务有限公司 A kind of monitoring method and monitoring device, application server of database connection pool
US20190361903A1 (en) * 2016-07-15 2019-11-28 Ebay Inc. Preemptive connection pool adjustments
CN110674197A (en) * 2019-10-09 2020-01-10 云南电网有限责任公司信息中心 Visual configuration and capture system for business operation
CN110704223A (en) * 2019-09-16 2020-01-17 苏宁云计算有限公司 Recovery system and method for single-node abnormity of database
CN111177203A (en) * 2019-12-18 2020-05-19 中国平安财产保险股份有限公司 Method, server and storage medium for dynamically adjusting size of database connection pool

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104239365A (en) * 2013-06-24 2014-12-24 北京新媒传信科技有限公司 Database connection pool and method for acquiring links in database connection pool
US20190361903A1 (en) * 2016-07-15 2019-11-28 Ebay Inc. Preemptive connection pool adjustments
CN108549592A (en) * 2018-03-19 2018-09-18 联动优势电子商务有限公司 A kind of monitoring method and monitoring device, application server of database connection pool
CN110704223A (en) * 2019-09-16 2020-01-17 苏宁云计算有限公司 Recovery system and method for single-node abnormity of database
CN110674197A (en) * 2019-10-09 2020-01-10 云南电网有限责任公司信息中心 Visual configuration and capture system for business operation
CN111177203A (en) * 2019-12-18 2020-05-19 中国平安财产保险股份有限公司 Method, server and storage medium for dynamically adjusting size of database connection pool

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
杨熙: "基于多池架构数据库连接池的研究与设计", 《中国优秀硕士学位论文全文数据库信息科技辑》 *

Also Published As

Publication number Publication date
CN112115020B (en) 2021-03-26

Similar Documents

Publication Publication Date Title
CN111447150A (en) Access request current limiting method, server and storage medium
CN108491301B (en) Electronic device, abnormality early warning method based on redis and storage medium
JP5768870B2 (en) PROGRAM DISTRIBUTION DEVICE, PROGRAM DISTRIBUTION METHOD, PROGRAM DISTRIBUTION SYSTEM, AND COMPUTER PROGRAM
CN110222535B (en) Processing device, method and storage medium for block chain configuration file
CN108446172B (en) Data calling method and device, computer equipment and storage medium
WO2004019161A2 (en) Method and apparatus for managing resources stored on a communication device
CN110333916B (en) Request message processing method, device, computer system and readable storage medium
CN109284193B (en) Distributed data processing method based on multithreading and server
CN111343267A (en) Configuration management method and system
CN113656098A (en) Configuration acquisition method and system
CN112115020B (en) Database connection pool abnormity monitoring method and device and computer equipment
CN110555009B (en) Processing method and device for Network File System (NFS) service
CN109257256B (en) Equipment monitoring method and device, computer equipment and storage medium
CN111580948A (en) Task scheduling method and device and computer equipment
CN115981826A (en) Task scheduling processing method and device, computer equipment and readable storage medium
CN115623063A (en) Message pushing method, device, equipment and storage medium for full-scale equipment
JP5884566B2 (en) Batch processing system, progress confirmation device, progress confirmation method, and program
CN112130936B (en) Data calling method, device, equipment and storage medium based on polling
CN106855824B (en) Task stopping method and device and electronic equipment
CN109254782B (en) Operating system installation method and device
US20050262244A1 (en) Indicating network resource availability methods, system and program product
CN112000390A (en) User information management method and device, electronic equipment and storage medium
CN110839085A (en) Instruction management method, instruction management device, electronic equipment and storage medium
CN116502235B (en) TMS remote management method and system
CN113132324B (en) Sample identification method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant