A method, apparatus, and device for asynchronous database log processing based on multi-buffered queues.
By adopting asynchronous log processing method of multi-buffer queues in the database, the thread blocking problem caused by a single queue is solved, and more efficient log processing and system stability are achieved.
Patent Information
- Application Number
- CN202411391416.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-10-08
AI Technical Summary
In the prior art, database log processing adopts a single queue asynchronous processing method, resulting in multiple producer and consumer threads having to access the queue synchronously, resulting in thread blockage and performance degradation.
The database asynchronous log processing method based on multi-buffer queue is adopted. The front-end thread writes the log data to a specific buffer queue through the front-end thread, and the back-end thread reads the log data from the target consumption queue and writes it to the storage medium. This method dynamically adjusts the number of buffered queues to avoid queue overload or overempty, and ensures that multiple threads independently access different queues.
It effectively avoids blocking and waiting time of threads when accessing queues, improves the overall log processing efficiency of the system, and enhances the stability and fault tolerance of the system.
Smart Images

Figure CN118897726B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database storage management, and more specifically to a database asynchronous log processing method, device and equipment based on multiple buffer queues. Background Art
[0002] In database operations, logging is of great significance to system stability, security, and troubleshooting. Logging often uses synchronous writing, which can have a significant impact on database performance and even cause business blockage when the log volume is large.
[0003] In the related art, in order to achieve asynchronous processing, the front end is responsible for the production process of logs, and the back end uses a queue to consume logs, thus realizing an asynchronous processing process. Since there is only one queue in the above processing method, multiple producer and consumer threads must access the single queue synchronously, resulting in threads blocking each other when accessing the queue, thereby reducing the overall performance of the system. Summary of the invention
[0004] In view of the above problems, the present invention provides a database asynchronous log processing method, device and equipment based on multiple buffer queues.
[0005] According to a first aspect of the present invention, a database asynchronous log processing method based on multiple buffer queues is provided, comprising: in response to the generation of log data, according to the thread identifier of the nth front-end thread among N front-end threads and the queue number of the determined buffer queue, determining from the buffer queue a target buffer queue for storing log data corresponding to the thread identifier of the nth front-end thread, and storing the log data corresponding to the thread identifier of the nth front-end thread in the target buffer queue; exchanging the target buffer queue that meets the first preset condition with the consumption queue after consumption, and determining the exchanged target buffer queue as the target consumption queue, the consumption queue after consumption being the queue after the log data stored in the consumption queue is read by the back-end thread; reading the log data from the target consumption queue by the back-end thread, and writing the log data to the target storage medium; wherein the determined queue number of the buffer queue is obtained by the following method: determining the initial number of the buffer queue; and when the buffer queue meets the second preset condition, dynamically adjusting the buffer queue according to the initial number to obtain the determined queue number of the buffer queue, wherein N≥1, 1≤n≤N, and the determined queue number of the buffer queue includes at least 2.
[0006] According to an embodiment of the present invention, based on the thread identifier of the nth front-end thread among N front-end threads and the determined queue number of the buffer queue, a target buffer queue for storing log data corresponding to the thread identifier of the nth front-end thread is determined from the buffer queue, including: determining the thread identifier of the nth front-end thread; calculating the thread identifier of the nth front-end thread and the determined queue number of the buffer queue to obtain a calculated value; based on the calculated value, determining the target buffer queue for storing log data corresponding to the thread identifier of the nth front-end thread from the buffer queues of the queue number, and there is a one-to-one correspondence between the calculated value and the target cache queue.
[0007] According to an embodiment of the present invention, satisfying the first preset condition includes: the target buffer queue satisfies a preset system refresh time threshold or the storage state of the target buffer queue satisfies a preset storage state.
[0008] According to an embodiment of the present invention, when the buffer queue meets the second preset condition, the buffer queue is dynamically adjusted according to the initial number to obtain the determined queue number of the buffer queue, including: using a global counter to determine the number of waiting queues of the buffer queue to be exchanged, wherein the buffer queue to be exchanged is a target buffer queue whose storage state is full and waiting to be exchanged with the consumption queue after consumption; using a timer to determine the waiting time of the buffer queue to be exchanged, wherein the waiting time of the buffer queue to be exchanged is re-determined as the number of waiting queues changes; when the number of waiting queues is greater than or equal to 1, and the waiting time is greater than or equal to the first preset time, the buffer queue is expanded and adjusted to obtain the determined queue number of the buffer queue.
[0009] According to an embodiment of the present invention, when the buffer queue satisfies a second preset condition, the buffer queue is dynamically adjusted based on the initial number to obtain a determined queue number of the buffer queue, and also includes: when the number of waiting queues is less than 1 and the waiting time is greater than or equal to the second preset time, the buffer queue is contracted and adjusted to obtain a determined queue number of the buffer queue.
[0010] According to an embodiment of the present invention, a backend thread is used to read log data from a target consumer queue and write the log data into a target storage medium, including: using a backend thread to read log data from a target consumer queue and converting the log data into a log string; using a function pointer to write the log string into the target storage medium.
[0011] The second aspect of the present invention provides a database asynchronous log processing device based on multiple buffer queues, including: a first determination module, which is used to respond to the generation of log data, and determine the target buffer queue for storing the log data corresponding to the thread identifier of the nth front-end thread from the buffer queues of the queue number according to the thread identifier of the nth front-end thread among N front-end threads and the queue number of the determined buffer queue, and store the log data corresponding to the thread identifier of the nth front-end thread in the target buffer queue; a second determination module, which is used to exchange the target buffer queue that meets the first preset condition with the consumption queue after consumption, and determine the exchanged target buffer queue as the target consumption queue, and the consumption queue after consumption is the queue after the log data stored in the consumption queue is read by the back-end thread; a writing module, which is used to read the log data from the target consumption queue by the back-end thread, and write the log data to the target storage medium; wherein the first determination module includes: a first determination submodule, which is used to determine the initial number of buffer queues; a first adjustment submodule, which is used to dynamically adjust the buffer queue according to the initial number when the buffer queue meets the second preset condition, so as to obtain the determined queue number of the buffer queue.
[0012] A third aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above method.
[0013] The fourth aspect of the present invention also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the above method.
[0014] The fifth aspect of the present invention also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0015] According to an embodiment of the present invention, the target buffer queue that meets the first preset condition is exchanged with the consumption queue after consumption, and the exchanged target buffer queue is determined as the target consumption queue; the backend thread is used to read the log data from the target consumption queue, and the log data is written into the target storage medium; wherein, when the buffer queue meets the second preset condition, the buffer queue is dynamically adjusted according to the initial number of the buffer queue to obtain the queue number of the determined buffer queue. Due to the use of the dynamic adjustment of the buffer queue and the technical means of exchanging the target buffer queue with the consumption queue after consumption, the problem of multiple producer and consumer threads accessing a single queue synchronously, resulting in the mutual blocking of threads when accessing the queue, is avoided, and multiple threads are accessed to different queues respectively without interfering with each other, so as to reduce the blocking and waiting time when the threads access the queue, thereby improving the technical effect of the overall log processing efficiency of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above contents and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:
[0017] Figure 1 A diagram schematically shows an application scenario of a database asynchronous log processing method and device based on multiple buffer queues according to an embodiment of the present invention;
[0018] Figure 2 A flowchart of a database asynchronous log processing method based on multiple buffer queues according to an embodiment of the present invention is schematically shown;
[0019] Figure 3 A schematic diagram of an operation of determining a target buffer queue according to an embodiment of the present invention is shown;
[0020] Figure 4 A schematic diagram of front-end thread operation according to an embodiment of the present invention is shown;
[0021] Figure 5 A schematic diagram schematically shows asynchronous processing of log data by a target buffer queue and a consumer queue according to an embodiment of the present invention;
[0022] Figure 6 A schematic diagram schematically shows asynchronous processing of log data after the target buffer queue and the consumer queue are exchanged according to an embodiment of the present invention;
[0023] Figure 7 Schematically shows a schematic diagram of backend thread operation according to an embodiment of the present invention;
[0024] Figure 8A schematic diagram schematically shows a method for processing database asynchronous logs based on multiple buffer queues according to an embodiment of the present invention;
[0025] Fig. 9 A schematic diagram of a structure of a database asynchronous log processing device based on multiple buffer queues according to an embodiment of the present invention is shown;
[0026] Fig.10 A block diagram of an electronic device suitable for implementing a database asynchronous log processing method based on multiple buffer queues according to an embodiment of the present invention is schematically shown. DETAILED DESCRIPTION
[0027] Below, embodiments of the present invention 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 invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. 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 concepts of the present invention.
[0028] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. 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.
[0029] 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.
[0030] 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.).
[0031] The present invention provides a database asynchronous log processing method, device and equipment based on multiple buffer queues. The method comprises: in response to the generation of log data, according to the thread identifier of the nth front-end thread among N front-end threads and the queue number of the determined buffer queues, determining a target buffer queue for storing log data corresponding to the thread identifier of the nth front-end thread from the buffer queues of the queue number, and storing the log data corresponding to the thread identifier of the nth front-end thread in the target buffer queue, wherein N≥1, 1≤n≤N, and the determined queue number of the buffer queues includes at least 2; exchanging the target buffer queue that meets the first preset condition with the consumption queue after consumption, and determining the exchanged target buffer queue as the target consumption queue, the consumption queue after consumption is the queue after the log data stored in the consumption queue is read by the back-end thread; reading the log data from the target consumption queue by the back-end thread, and writing the log data into the target storage medium; wherein the determined queue number of the buffer queue is obtained by the following method: determining the initial number of the buffer queue; and when the buffer queue meets the second preset condition, dynamically adjusting the buffer queue according to the initial number to obtain the determined queue number of the buffer queue.
[0032] In the technical solution of the present invention, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0033] Figure 1 The application scenario diagram of the database asynchronous log processing method and device based on multiple buffer queues according to an embodiment of the present invention is schematically shown.
[0034] 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.
[0035] 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).
[0036] 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.
[0037] 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.
[0038] It should be noted that the database asynchronous log processing method based on multiple buffer queues provided in the embodiment of the present invention can generally be executed by the server 105. Accordingly, the database asynchronous log processing device based on multiple buffer queues provided in the embodiment of the present invention can generally be set in the server 105. The database asynchronous log processing method based on multiple buffer queues provided in the embodiment of the present invention 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 asynchronous log processing device based on multiple buffer queues provided in the embodiment of the present invention 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.
[0039] 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.
[0040] The following will be based on Figure 1 The scene described by Figure 2~Figure 8 The database asynchronous log processing method based on multiple buffer queues of the disclosed embodiment is described in detail.
[0041] Figure 2 The flowchart of the database asynchronous log processing method based on multiple buffer queues according to an embodiment of the present invention is schematically shown.
[0042] like Figure 2 As shown, the database asynchronous log processing method based on multiple buffer queues of this embodiment includes operations S210 to S230.
[0043] In operation S210, in response to the generation of log data, based on the thread identifier of the nth front-end thread among N front-end threads and the determined number of queues of the buffer queue, a target buffer queue for storing log data corresponding to the thread identifier of the nth front-end thread is determined from the buffer queue, and the log data corresponding to the thread identifier of the nth front-end thread is stored in the target buffer queue, wherein N≥1, 1≤n≤N, and the determined number of queues of the buffer queue includes at least 2.
[0044] According to an embodiment of the present invention, log data may be record information generated by software, operating system, application or other system components in a computer system, such as key information of the system during business operations, which may include operation time, operation type, operation results, etc.
[0045] According to an embodiment of the present invention, the front-end thread is used to write log data into a buffer queue, and N front-end threads can write log data into different buffer queues at the same time.
[0046] According to an embodiment of the present invention, the thread identifier of the front-end thread may be a unique identity ID of each front-end thread, and the identity ID is represented in the form of a numerical value.
[0047] According to an embodiment of the present invention, the buffer queue is used to store log data written by the front-end thread, wherein the buffer queue is an elastic buffer queue that can automatically adjust the number of queues according to the state of the system, and the queue number of the buffer queue determined above can be the queue number of the buffer queue after dynamic adjustment.
[0048] The determined queue quantity of the buffer queue is obtained by the following method: determining the initial quantity of the buffer queue; and dynamically adjusting the buffer queue according to the initial quantity when the buffer queue meets the second preset condition to obtain the determined queue quantity of the buffer queue.
[0049] According to an embodiment of the present invention, the initial number of the buffer queue may be the current number of queues of the buffer queue.
[0050] According to an embodiment of the present invention, the second preset condition may be a condition for adjusting the queue quantity of the buffer queue, that is, when the buffer queue meets the condition, the buffer queue is dynamically adjusted.
[0051] According to an embodiment of the present invention, by dynamically adjusting the buffer queue, the waste of buffer queue resources when there is less log data and the problem of tight buffer queue resources when there is more log data are avoided, thereby achieving the effect of improving the throughput and response speed of the system.
[0052] According to an embodiment of the present invention, the target buffer queue is a buffer queue determined based on the thread identifier of each front-end thread and the determined queue quantity of the buffer queue, and is used to store the log data corresponding to the front-end thread identifier.
[0053] According to an embodiment of the present invention, a target buffer queue for storing log data corresponding to the thread identifier of the nth front-end thread is determined from the buffer queues of the queue quantity. This can avoid the problem of competition among multiple front-end threads due to operations such as random allocation when multiple front-end threads access the buffer queue, thereby causing the front-end threads to be blocked.
[0054] According to an embodiment of the present invention, after determining the target buffer queue corresponding to the thread identifier of the front-end thread, the front-end thread writes the log data into the target buffer queue.
[0055] According to an embodiment of the present invention, even if a buffer queue or front-end thread fails, another buffer queue or front-end thread can still continue to work, thereby improving the stability and fault tolerance of the system. In addition, since the log data is dispersed into multiple buffer queues, the load of each buffer queue will also be reduced, further improving the stability of the system.
[0056] In operation S220, the target buffer queue that meets the first preset condition is exchanged with the consumption queue after consumption, and the exchanged target buffer queue is determined as the target consumption queue. The consumption queue after consumption is the queue after the log data stored in the consumption queue is read by the backend thread.
[0057] According to an embodiment of the present invention, the first preset condition may be an exchange condition between the target buffer queue and the post-consumption consumption queue, that is, when the target buffer queue meets the exchange condition, it is exchanged with the post-consumption consumption queue.
[0058] According to an embodiment of the present invention, the consumption queue is determined from the buffer queue and is used to establish a connection relationship with the backend thread so that the log data stored in the consumption queue is read by the backend thread.
[0059] According to an embodiment of the present invention, the consumption queue after consumption may be a consumption queue for which the backend thread has completed the log data reading operation, or may be a consumption queue for which the log data reading operation is in progress.
[0060] According to an embodiment of the present invention, the target buffer queue is exchanged with the post-consumption consumer queue, and the exchanged target buffer queue establishes a connection relationship with the backend thread as the target consumer queue, and the exchanged post-consumption consumer queue waits to establish a connection relationship with the new front-end thread.
[0061] According to an embodiment of the present invention, after a connection relationship is established between the target consumption queue and the backend thread, the backend thread reads log data from the target consumption queue.
[0062] According to an embodiment of the present invention, in a method based on a single queue in the related art, the front-end thread needs to send a request to the back-end thread to wake up the back-end thread to perform a data reading operation. However, with the method of the present invention, the front-end thread writes multiple log data into the target buffer queue. After the target buffer queue is exchanged with the consumption queue after consumption, the target buffer queue is used as the target consumption queue, and the back-end thread performs a read operation on the target consumption queue, thereby reducing the frequency of the back-end thread being awakened, so that the resource overhead of the server is reduced.
[0063] In operation S230 , the log data is read from the target consumption queue by using the backend thread, and the log data is written into the target storage medium.
[0064] According to an embodiment of the present invention, the target storage medium may include a disk, a third-party application program interface, a database, etc.
[0065] According to an embodiment of the present invention, the backend thread writes the read log data to at least one of a disk, a third-party application program interface, and a database.
[0066] According to an embodiment of the present invention, the target buffer queue that meets the first preset condition is exchanged with the consumption queue after consumption, and the exchanged target buffer queue is determined as the target consumption queue; the backend thread is used to read the log data from the target consumption queue, and the log data is written into the target storage medium; wherein, when the buffer queue meets the second preset condition, the buffer queue is dynamically adjusted according to the initial number of the buffer queue to obtain the queue number of the determined buffer queue. Due to the use of the dynamic adjustment of the buffer queue and the technical means of exchanging the target buffer queue with the consumption queue after consumption, the problem of multiple producer and consumer threads accessing a single queue synchronously, resulting in the mutual blocking of threads when accessing the queue, is avoided, and multiple threads are accessed to different queues respectively without interfering with each other, so as to reduce the blocking and waiting time when the threads access the queue, thereby improving the technical effect of the overall log processing efficiency of the system.
[0067] According to an embodiment of the present invention, based on the thread identifier of the nth front-end thread among N front-end threads and the determined queue number of the buffer queue, a target buffer queue for storing log data corresponding to the thread identifier of the nth front-end thread is determined from the buffer queue, including: determining the thread identifier of the nth front-end thread; calculating the thread identifier of the nth front-end thread and the determined queue number of the buffer queue to obtain a calculated value; based on the calculated value, determining the target buffer queue for storing log data corresponding to the thread identifier of the nth front-end thread from the buffer queues of the queue number, and there is a one-to-one correspondence between the calculated value and the target buffer queue.
[0068] According to an embodiment of the present invention, the thread identifier of the nth front-end thread and the number of queues of the determined buffer queue are calculated using the remainder method of the hash function. Specifically, the value corresponding to the thread identifier can be divided by the number of queues of the buffer queue, and the remainder obtained is used as the calculated value.
[0069] According to an embodiment of the present invention, there is a one-to-one correspondence between the calculated value and the target cache queue. According to the calculated value, a buffer queue corresponding to the calculated value is determined from multiple buffer queues and used as the target buffer queue.
[0070] Figure 3 The following is a schematic diagram of an operation of determining a target buffer queue according to an embodiment of the present invention.
[0071] like Figure 3 As shown, the value corresponding to the thread identifier of the front-end thread 1 is 7, and the number of queues in the buffer queue is 3. By calculating, that is, 7 divided by 3, 2 is obtained with a remainder of 1. According to the obtained remainder 1, the buffer queue with the buffer queue identifier of 1 is identified among the three buffer queues, and it is used as the target buffer queue, that is, the buffer queue 1 corresponding to the remainder 1 is used as the target buffer queue 1 corresponding to the front-end thread 1.
[0072] The value corresponding to the thread identifier of the front-end thread 2 is 5, which can be calculated, that is, 5 divided by 3 is 1 with a remainder of 2. According to the obtained remainder 2, the buffer queue with the buffer queue identifier of 2 is identified among the three buffer queues and used as the target buffer queue, that is, the buffer queue 2 corresponding to the remainder 2 is used as the target buffer queue 2 corresponding to the front-end thread 2.
[0073] The front-end thread 1 writes the log data to the target buffer queue 1, and the front-end thread 2 writes the log data to the target buffer queue 2. When the target buffer queue 1, the target buffer queue 2 or the target buffer queue 0 meets the first preset condition, it exchanges with the consumption queue 1, wherein the consumption queue 1 outputs the log data to the back-end thread, and then the back-end thread outputs it to the target storage medium.
[0074] According to an embodiment of the present invention, the front-end thread is also used to perform operations such as style formatting, data streaming, log file rolling, and refresh control on the generated log data.
[0075] Figure 4 A schematic diagram of front-end thread operation according to an embodiment of the present invention is schematically shown.
[0076] like Figure 4 As shown, the front-end thread obtains log data, performs content assembly and formatting operations on the obtained log data, and writes the processed log data into the target buffer queue determined by the above calculation method.
[0077] According to an embodiment of the present invention, asynchronous writing of log data is achieved by using thread identifiers, and the impact on the main business logic of the system is avoided based on a hash function, and blocking of the front-end thread is avoided. At the same time, even if one queue or thread fails, another queue or thread can still continue to work, thereby improving the stability and fault tolerance of the system.
[0078] According to an embodiment of the present invention, satisfying the first preset condition includes: the target buffer queue satisfies a preset system refresh time threshold or the storage state of the target buffer queue satisfies a preset storage state.
[0079] According to an embodiment of the present invention, satisfying the first preset condition may be stopping the writing of log data and exchanging the log data with the consumption queue after consumption when the duration of the target buffer queue reaches a preset system refresh time threshold.
[0080] According to an embodiment of the present invention, the preset storage state may be that the target buffer queue is in a full state. The first preset condition may also be satisfied that when the storage state of the target buffer queue is full, the target buffer queue cannot continue to write log data and needs to be exchanged with the consumption queue after consumption.
[0081] According to an embodiment of the present invention, for example, the preset system refresh time threshold is 30 minutes. When the target buffer queue starts to write log data, the target buffer queue is timed. If within 30 minutes, the storage state of the target buffer queue has reached the preset storage state, the target buffer queue is exchanged with the consumption queue after consumption; if the target buffer queue has not yet been full of log data, but 30 minutes has been reached, the writing of log data is stopped, and the target buffer queue is exchanged with the consumption queue after consumption.
[0082] Figure 5 The schematic diagram schematically shows asynchronous processing of log data by a target buffer queue and a consumer queue according to an embodiment of the present invention. Figure 6The schematic diagram schematically shows the asynchronous processing of log data after the target buffer queue and the consumer queue are exchanged according to an embodiment of the present invention.
[0083] like Figure 5 As shown, the front-end thread writes the log data to the target buffer queue, the back-end thread reads the log data from the consumer queue, and the back-end thread outputs the log data to the target storage medium. When the target buffer queue meets the first preset condition, such as Figure 6 As shown, after the target buffer queue is exchanged with the consumption queue after consumption, the consumption queue after consumption serves as the target buffer queue, establishes a connection relationship with the front-end thread, and writes the log data into the target buffer queue; the exchanged target buffer queue serves as the target consumption queue, establishes a connection relationship with the back-end thread, and the back-end thread reads the log data from the target consumption queue and writes the log data into the target storage medium.
[0084] According to an embodiment of the present invention, when the buffer queue meets the second preset condition, the buffer queue is dynamically adjusted according to the initial number to obtain the determined queue number of the buffer queue, including: using a global counter to determine the number of waiting queues of the buffer queue to be exchanged, wherein the buffer queue to be exchanged is a target buffer queue whose storage state is full and waiting to be exchanged with the consumption queue after consumption; using a timer to determine the waiting time of the buffer queue to be exchanged, wherein the waiting time of the buffer queue to be exchanged is re-determined as the number of waiting queues changes; when the number of waiting queues is greater than or equal to 1, and the waiting time is greater than or equal to the first preset time, the buffer queue is expanded and adjusted to obtain the determined queue number of the buffer queue.
[0085] According to an embodiment of the present invention, the global counter may be a tool for counting the number of waiting queues of the buffer queue to be exchanged, and the buffer queue to be exchanged may be the target buffer queue whose storage state is full and waiting to be exchanged with the consumption queue after consumption.
[0086] According to an embodiment of the present invention, when the target buffer queue is full of log data, that is, it needs to be exchanged with the consumption queue after consumption, if the backend thread corresponding to the consumption queue has not completed the reading operation of all log data, then the target buffer queue is determined as the buffer queue to be exchanged. At this time, the global counter is +1 to the current count value, that is, the count value corresponding to the global counter is consistent with the number of waiting queues of the buffer queue to be exchanged.
[0087] According to an embodiment of the present invention, the timer may be a tool for timing the buffer queue to be exchanged.
[0088] According to an embodiment of the present invention, when the count value corresponding to the global counter changes, that is, when a new buffer queue to be exchanged appears, or a buffer queue to be exchanged is exchanged with a consumed queue, the timer restarts timing.
[0089] According to an embodiment of the present invention, the first preset duration can be set according to actual conditions, and is preferably 5 minutes.
[0090] According to an embodiment of the present invention, the expansion adjustment may be to expand the number of queues of the buffer queue, wherein the number of expanded queues should not exceed a preset upper limit of the number of queues, and the preset upper limit of the number of queues may be set according to actual conditions, preferably to 5.
[0091] According to an embodiment of the present invention, for example, there are currently two buffer queues to be exchanged, that is, the number of waiting queues is greater than 1, and the two buffer queues to be exchanged have been waiting for exchange for 5 minutes. At this time, a new buffer queue is added to reduce the burden of the buffer queues with the current number of queues.
[0092] According to the embodiment of the present invention, by expanding the number of queues of the buffer queue, the problem of thread blocking caused by too few queues is avoided, and the throughput and response speed of the system are improved.
[0093] According to an embodiment of the present invention, when the buffer queue satisfies a second preset condition, the buffer queue is dynamically adjusted based on the initial number to obtain a determined queue number of the buffer queue, and also includes: when the number of waiting queues is less than 1 and the waiting time is greater than or equal to the second preset time, the buffer queue is contracted and adjusted to obtain a determined queue number of the buffer queue.
[0094] According to an embodiment of the present invention, the second preset duration can be set according to actual conditions, and is preferably 30 minutes.
[0095] According to an embodiment of the present invention, the shrinkage adjustment may be to reduce the number of queues in the buffer queue, wherein the number of queues in the buffer queue after reduction should not be less than a preset lower limit of the number of queues, and the preset lower limit of the number of queues may be set according to actual conditions.
[0096] According to an embodiment of the present invention, for example, if the global counter has remained in the 0 state (the number of waiting queues is less than 1) for more than 30 minutes, that is, there is currently no buffer queue to be exchanged, then the current system activity is small, the amount of log data is small, the buffer queue pressure is small, and one buffer queue is reduced.
[0097] According to the embodiment of the present invention, by shrinking the number of queues of the buffer queue, resource waste caused by too many queues and too little log data is avoided, thereby saving the resource cost of the system.
[0098] According to an embodiment of the present invention, a backend thread is used to read log data from a target consumer queue and write the log data into a target storage medium, including: using a backend thread to read log data from a target consumer queue and converting the log data into a log string; using a function pointer to write the log string into the target storage medium.
[0099] According to an embodiment of the present invention, the backend thread uses multithreading or asynchronous input / output (I / O) and other technologies to achieve asynchronous reading of log data to ensure that the backend thread will not be blocked during the reading process.
[0100] According to an embodiment of the present invention, the backend thread may perform operations such as preprocessing, compression or encryption on the read log data according to actual business requirements.
[0101] According to an embodiment of the present invention, the format of the read log data is converted to obtain the log data in the form of a character string, that is, a log character string.
[0102] According to an embodiment of the present invention, the target storage medium may include a disk, a third-party application program interface, a database, etc.
[0103] According to an embodiment of the present invention, the output logic of the log string is adjusted by using a function pointer, so that the log string is output to at least one of a disk, a third-party application program interface, and a database according to actual needs.
[0104] According to an embodiment of the present invention, the above function pointer can be expressed as , where vec is a log string corresponding to a buffer queue.
[0105] Figure 7 The diagram schematically shows a backend thread operation diagram according to an embodiment of the present invention.
[0106] like Figure 7 As shown, the backend thread reads log data from the consumer queue, converts the format of the read log data, and the converted log string is processed by a function pointer and can be assigned to the disk, third-party application program interface and database.
[0107] Figure 8 The schematic diagram schematically shows a database asynchronous log processing method based on multiple buffer queues according to an embodiment of the present invention.
[0108] Database asynchronous log processing method 800 based on multi-buffer queue Figure 8 As shown, operation S801 is performed to determine the initial number of buffer queues. Operation S802 is performed to determine whether the buffer queue meets the second preset condition. If not, operation S804 is performed to use the initial number of buffer queues as the queue number of the determined buffer queue. If satisfied, operation S803 is performed to dynamically adjust the buffer queue, and then operation S804 is performed to use the queue number of the adjusted buffer queue as the queue number of the determined buffer queue. In operation S805, the thread identifier of the front-end thread is determined. Operation S806 is performed to calculate the thread identifier of the front-end thread corresponding to the log data and the queue number of the determined buffer queue, and the target buffer queue is determined according to the calculation result. In operation S807, the front-end thread is connected to the above-mentioned target buffer queue, and the log data is written to the target buffer queue. Operation S808 is then performed to determine whether the current target buffer queue meets the first preset condition. If not, operation S807 is continued to write the log data. If satisfied, operation S809 is performed to exchange the target buffer queue with the consumption queue after consumption, and the target buffer queue is used as the target consumption queue. Operation S810 is executed to establish a connection relationship between the backend thread and the target consumption queue, and the backend thread is used to read log data from the target consumption queue. Operation S811 is then executed to write the read log data into the target storage medium.
[0109] According to an embodiment of the present invention, the database asynchronous log processing method based on multiple buffer queues of the present invention can realize the one-step writing of multiple log data compared to a single buffer queue, avoid the impact on the system business logic, and improve the system throughput and response speed. At the same time, the method also has the advantages of scalability, maintainability and security, and can meet various business needs and application scenarios.
[0110] Specifically, as shown in Table 1, in the synchronous state, the database asynchronous log processing method based on multiple buffer queues of the present invention is less time-consuming and more efficient than that of a single queue; in the asynchronous state, the performance of the database asynchronous log processing method based on multiple buffer queues of the present invention is significantly improved compared with that of a single queue, and its data processing capability is approximately twice that of a single queue.
[0111]
[0112] Based on the above-mentioned database asynchronous log processing method based on multiple buffer queues, the present invention also provides a database asynchronous log processing device based on multiple buffer queues. Fig. 9 The device is described in detail.
[0113] Fig. 9The structure block diagram of a database asynchronous log processing device based on multiple buffer queues according to an embodiment of the present invention is schematically shown.
[0114] like Fig. 9 As shown, the database asynchronous log processing device 900 based on multiple buffer queues of this embodiment includes a first determination module 910 , a second determination module 920 and a writing module 930 .
[0115] The first determination module 910 is used to respond to the generation of log data, determine the target buffer queue for storing the log data corresponding to the thread identifier of the nth front-end thread from the buffer queues of the queue number according to the thread identifier of the nth front-end thread among N front-end threads and the queue number of the determined buffer queues, and store the log data corresponding to the thread identifier of the nth front-end thread in the target buffer queue, wherein N≥1, 1≤n≤N, and the determined queue number of the buffer queues includes at least 2.
[0116] The second determination module 920 is used to exchange the target buffer queue that meets the first preset condition with the consumption queue after consumption, and determine the exchanged target buffer queue as the target consumption queue. The consumption queue after consumption is the queue after the log data stored in the consumption queue is read by the backend thread.
[0117] The writing module 930 is used to read the log data from the target consumption queue by using the backend thread, and write the log data into the target storage medium.
[0118] The first determination module 910 includes a first determination submodule 911 and a first adjustment submodule 912 .
[0119] The first determining submodule 911 is used to determine the initial number of buffer queues.
[0120] The first adjustment submodule 912 is used to dynamically adjust the buffer queue according to the initial number to obtain a determined queue number of the buffer queue when the buffer queue meets the second preset condition.
[0121] According to an embodiment of the present invention, the target buffer queue that meets the first preset condition is exchanged with the consumption queue after consumption, and the exchanged target buffer queue is determined as the target consumption queue; the backend thread is used to read the log data from the target consumption queue, and the log data is written into the target storage medium; wherein, when the buffer queue meets the second preset condition, the buffer queue is dynamically adjusted according to the initial number of the buffer queue to obtain the queue number of the determined buffer queue. Due to the use of the dynamic adjustment of the buffer queue and the technical means of exchanging the target buffer queue with the consumption queue after consumption, the problem of multiple producer and consumer threads accessing a single queue synchronously, resulting in the mutual blocking of threads when accessing the queue, is avoided, and multiple threads are accessed to different queues respectively without interfering with each other, so as to reduce the blocking and waiting time when the threads access the queue, thereby improving the technical effect of the overall log processing efficiency of the system.
[0122] According to an embodiment of the present invention, any multiple modules of the first determination module 910, the second determination module 920 and the writing module 930 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. Optionally, at least one of the first determination module 910, the second determination module 920 and the writing module 930 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. Or at least one of the first determination module 910, the second determination module 920 and the writing module 930 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.
[0123] According to an embodiment of the present invention, the first determination module 910 includes a second determination submodule, a calculation submodule and a third determination submodule.
[0124] The second determining submodule is used to determine the thread identifier of the nth front-end thread.
[0125] The calculation submodule is used to calculate the thread identifier of the nth front-end thread and the queue quantity of the determined buffer queue to obtain a calculated value.
[0126] The third determination submodule is used to determine a target buffer queue for storing log data corresponding to the thread identifier of the nth front-end thread from the buffer queues of the queue quantity according to the calculated value, and there is a one-to-one correspondence between the calculated value and the target cache queue.
[0127] According to an embodiment of the present invention, the first adjustment submodule includes a first determining unit, a second determining unit and a first adjusting unit.
[0128] The first determining unit is used to determine the number of waiting queues of the buffer queue to be exchanged by using a global counter, wherein the buffer queue to be exchanged is a target buffer queue whose storage state is full and waiting to be exchanged with a consumption queue after consumption.
[0129] The second determining unit is used to determine the waiting time of the buffer queue to be exchanged by using a timer, wherein the waiting time of the buffer queue to be exchanged is re-determined as the number of waiting queues changes.
[0130] The first adjustment unit is used to expand and adjust the buffer queue to obtain the determined queue number of the buffer queue when the number of waiting queues is greater than or equal to 1 and the waiting time is greater than or equal to a first preset time.
[0131] According to an embodiment of the present invention, the first adjustment submodule further includes a second adjustment unit.
[0132] The second adjustment unit is used to shrink the buffer queue to obtain the determined queue number of the buffer queue when the number of waiting queues is less than 1 and the waiting time is greater than or equal to the second preset time.
[0133] According to an embodiment of the present invention, the writing module 930 includes a conversion submodule and a writing submodule.
[0134] The conversion submodule is used to use the backend thread to read log data from the target consumer queue and convert the log data into a log string.
[0135] The writing submodule is used to write the log string into the target storage medium using the function pointer.
[0136] Fig.10 A block diagram of an electronic device suitable for implementing a database asynchronous log processing method based on multiple buffer queues according to an embodiment of the present invention is schematically shown.
[0137] like Fig.10As shown, the electronic device 1000 according to an embodiment of the present invention includes a processor 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage part 1008 into a random access memory (RAM) 1003. The processor 1001 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 1001 may also include an onboard memory for caching purposes. The processor 1001 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 invention.
[0138] In RAM 1003, various programs and data required for the operation of electronic device 1000 are stored. Processor 1001, ROM 1002 and RAM 1003 are connected to each other via bus 1004. Processor 1001 performs various operations of the method flow according to the embodiment of the present invention by executing the program in ROM 1002 and / or RAM 1003. It should be noted that the program can also be stored in one or more memories other than ROM 1002 and RAM 1003. Processor 1001 can also perform various operations of the method flow according to the embodiment of the present invention by executing the program stored in one or more memories.
[0139] Optionally, the electronic device 1000 may further include an input / output (I / O) interface 1005, which is also connected to the bus 1004. The electronic device 1000 may further include one or more of the following components connected to the I / O interface 1005: an input portion 1006 including a keyboard, a mouse, etc.; an output portion 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 1008 including a hard disk, etc.; and a communication portion 1009 including a network interface card such as a LAN card, a modem, etc. The communication portion 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage portion 1008 as needed.
[0140] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; 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 invention is implemented.
[0141] Optionally, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, 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 invention, 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, optionally, the computer-readable storage medium may include the ROM 1002 and / or RAM 1003 described above and / or one or more memories other than ROM 1002 and RAM 1003.
[0142] The embodiment of the present invention also includes a computer program product, which includes a computer program, and the computer program includes a 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 database asynchronous log processing method based on multi-buffer queues provided by the embodiment of the present invention.
[0143] The computer program executes the above functions defined in the system / device of the embodiment of the present invention when the computer program is executed by the processor 1001. Optionally, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0144] 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 1009, and / or installed from the removable medium 1011. 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.
[0145] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1009, and / or installed from the removable medium 1011. When the computer program is executed by the processor 1001, the above functions defined in the system of the embodiment of the present invention are performed. Optionally, the system, device, apparatus, module, unit, etc. described above can be implemented by a computer program module.
[0146] Optionally, the program code for executing the computer program provided by the embodiment of the present invention 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, such as 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 (e.g., using an Internet service provider to connect through the Internet).
[0147] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. 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.
[0148] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present invention may be combined and / or combined in various ways, even if such combinations and / or combinations are not explicitly described in the present invention. In particular, the features described in the various embodiments and / or claims of the present invention may be combined and / or combined in various ways without departing from the spirit and teachings of the present invention. All of these combinations and / or combinations fall within the scope of the present invention.
[0149] The embodiments of the present invention are described above. However, these embodiments are only for the purpose of illustration, and are not intended to limit the scope of the present invention. Although each embodiment is described above, it does not mean that the measures in each embodiment cannot be used in combination. The scope of the present invention is defined by the attached claims and their equivalents. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.
Claims
1. A database asynchronous log processing method based on multiple buffer queues, characterized in that: The method comprises: In response to the generation of log data, according to the thread identifier of the nth front-end thread among the N front-end threads and the number of queues of the determined buffer queues, a target buffer queue for storing the log data corresponding to the thread identifier of the nth front-end thread is determined from the buffer queues, and the log data corresponding to the thread identifier of the nth front-end thread is stored in the target buffer queue, wherein N≥1, 1≤n≤N, and the number of queues of the determined buffer queues includes at least 2; The target buffer queue that meets the first preset condition is exchanged with the consumption queue after consumption, and the exchanged target buffer queue is determined as the target consumption queue, and the consumption queue after consumption is a queue after the log data stored in the consumption queue is read by a backend thread; Using the backend thread to read the log data from the target consumption queue, and writing the log data into a target storage medium; The determined number of queues of the buffer queue is obtained by the following method: Determining an initial number of the buffer queue; In the case where the buffer queue meets the second preset condition, dynamically adjusting the buffer queue according to the initial number to obtain the queue number of the determined buffer queue; Wherein, when the buffer queue satisfies the second preset condition, dynamically adjusting the buffer queue according to the initial number to obtain the determined queue number of the buffer queue includes: Using a global counter, determining the number of waiting queues of the buffer queue to be exchanged, wherein the buffer queue to be exchanged is the target buffer queue whose storage state is full and waiting to be exchanged with the consumption queue after consumption; Determine the waiting time of the buffer queue to be exchanged by using a timer, wherein the waiting time of the buffer queue to be exchanged is re-determined as the number of the waiting queues changes; When the number of waiting queues is greater than or equal to 1 and the waiting time is greater than or equal to the first preset time, the buffer queue is extended and adjusted to obtain the number of queues of the determined buffer queue; When the number of waiting queues is less than 1 and the waiting time is greater than or equal to a second preset time, the buffer queue is contracted and adjusted to obtain the determined number of queues of the buffer queue.
2. The method according to claim 1, characterized in that The step of determining, from the buffer queue, a target buffer queue for storing the log data corresponding to the thread identifier of the nth front-end thread among the N front-end threads and the determined queue quantity of the buffer queue comprises: Determine the thread ID of the nth front-end thread; Calculating the thread identifier of the nth front-end thread and the number of queues of the determined buffer queue to obtain a calculated value; According to the calculated value, a target buffer queue for storing the log data corresponding to the thread identifier of the nth front-end thread is determined from the buffer queues of the queue quantity, and there is a one-to-one correspondence between the calculated value and the target buffer queue.
3. The method according to claim 1, characterized in that The first preset condition is met, including: The target buffer queue meets a preset system refresh time threshold or the storage state of the target buffer queue meets a preset storage state.
4. The method according to claim 1, characterized in that The using the backend thread to read the log data from the target consumption queue and writing the log data into a target storage medium includes: Using the backend thread to read the log data from the target consumption queue, and converting the log data into a log string; The log string is written into the target storage medium using a function pointer.
5. A database asynchronous log processing device based on multiple buffer queues, characterized in that: The device comprises: A first determination module, for responding to the generation of log data, determining a target buffer queue for storing the log data corresponding to the thread identifier of the nth front-end thread among the N front-end threads and the number of queues of the determined buffer queues from the buffer queues of the number of queues, and storing the log data corresponding to the thread identifier of the nth front-end thread in the target buffer queue, wherein N≥1, 1≤n≤N, and the number of queues of the determined buffer queues includes at least 2; A second determination module is used to exchange the target buffer queue that meets the first preset condition with the consumption queue after consumption, and determine the exchanged target buffer queue as the target consumption queue, and the consumption queue after consumption is a queue after the log data stored in the consumption queue is read by a backend thread; A writing module, used for reading the log data from the target consumption queue by using the backend thread, and writing the log data into a target storage medium; Wherein, the first determination module includes: A first determining submodule, used to determine the initial number of the buffer queue; A first adjustment submodule, configured to dynamically adjust the buffer queue according to the initial number to obtain the determined queue number of the buffer queue when the buffer queue meets the second preset condition, wherein the dynamically adjusting the buffer queue according to the initial number to obtain the determined queue number of the buffer queue when the buffer queue meets the second preset condition includes: Using a global counter, determining the number of waiting queues of the buffer queue to be exchanged, wherein the buffer queue to be exchanged is the target buffer queue whose storage state is full and waiting to be exchanged with the consumption queue after consumption; Determine the waiting time of the buffer queue to be exchanged by using a timer, wherein the waiting time of the buffer queue to be exchanged is re-determined as the number of the waiting queues changes; When the number of waiting queues is greater than or equal to 1 and the waiting time is greater than or equal to the first preset time, the buffer queue is extended and adjusted to obtain the number of queues of the determined buffer queue; When the number of waiting queues is less than 1 and the waiting time is greater than or equal to a second preset time, the buffer queue is contracted and adjusted to obtain the determined number of queues of the buffer queue.
6. 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 4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Insurance policy data processing method, device and equipment
CN110765167A
Message processing method and device, electronic equipment and readable storage medium
CN111585867A