Branch library request management and control method, device and equipment and storage medium

By obtaining the database information in the multi-database system, determining the request sending time and performing request control, the problems of single point of failure and resource waste are solved, and efficient request processing and flexible flow control are achieved.

CN119621699APending Publication Date: 2025-03-14CHINA MERCHANTS BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411502129.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

Existing multi-segment systems are prone to single-point failure risk and resource waste when processing requested traffic, especially when hot resources appear, which may lead to denial of service and reduce system efficiency.

Method used

By obtaining the total database list and the database information of the current database, determine the first predecessor database and its latest request time, calculate the request sending time of the current database, and perform request control based on this to avoid relying on centralized gateways or queues.

Benefits of technology

It reduces the risk of single point of failure, improves request processing efficiency, reduces communication overhead, and implements flexible flow control, avoids excessive requests for hotspot resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621699A_ABST
    Figure CN119621699A_ABST
Patent Text Reader

Abstract

The invention discloses a sub-library request management and control method, device and equipment and a storage medium, and relates to the technical field of information transmission, and the sub-library request management and control method comprises the steps: obtaining a total sub-library list and sub-library information corresponding to a current sub-library; determining a first preorder sub-library corresponding to the current sub-library based on the total sub-library list and the sub-library information, and determining the latest request time of the first preorder sub-library; calculating request sending time corresponding to the current sub-library based on the recent request time; and performing request management and control on the current sub-library based on the request sending time. The request sending time is determined according to the total sub-library list and the sub-library information corresponding to the current sub-library, so that dependence on a centralized gateway or queue is avoided, dependence on a single control point is reduced, the risk of single-point failure is reduced, the request processing efficiency is improved, the communication overhead is reduced, flexible flow control is realized, and the user experience is improved. And therefore, excessive requests for the hotspot resources are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information transmission technology, and in particular to a sub-library request management method, device, equipment and storage medium. Background Art

[0002] The traditional multi-database system has significant advantages and is widely used. Its data is usually evenly distributed in each database of the system. However, since each database has its own independent instance, it is more difficult to control the flow of external requests. When a multi-database system processes a large amount of local data, it often encounters some hot resources. These hot resources will limit the request flow. If each database requests resources externally without restriction, it will often cause the hot resource to deny service, thereby dragging down the entire system and reducing the system's data processing efficiency.

[0003] At present, the control of external request traffic in a multi-database system mainly relies on two methods: one is to add an external request gateway and use the gateway to uniformly manage and control traffic. However, this method requires more physical resources, and in the case of multi-instance gateways, it cannot solve the problem of unified traffic control well. In the case of a single-instance gateway, there is a risk of single point failure. Once a problem occurs in the gateway, the external requests of the entire system will be affected. The second is to use a first-in-first-out queue, such as Kafka and other tools, to cache requests and control traffic through queues. Although this method can control traffic, it also requires a high resource investment, and when the request volume is much higher than the export traffic, a large amount of data needs to be cached, which not only affects system efficiency, but may also cause resource waste. Summary of the invention

[0004] The main purpose of this application is to provide a method, device, equipment and storage medium for sub-library request management, aiming to solve technical problems such as single-point timeliness risk and resource waste caused by sub-library request management through gateways or queues.

[0005] To achieve the above objectives, the present application proposes a method for managing and controlling sub-library requests, the method comprising:

[0006] Get the total sub-library list and the sub-library information corresponding to the current sub-library;

[0007] Based on the total sub-library list and the sub-library information, determine a first preceding sub-library corresponding to the current sub-library, and determine the most recent request time of the first preceding sub-library;

[0008] Based on the most recent request time, calculate the request sending time corresponding to the current sub-library;

[0009] Based on the request sending time, request management and control is performed on the current sub-library.

[0010] In one embodiment, determining the first preceding sub-library corresponding to the current sub-library based on the total sub-library list and the sub-library information includes:

[0011] Matching the sub-library information with the sub-library order in the total sub-library list to obtain a second preceding sub-library;

[0012] Determine whether the second preceding sub-database meets the sub-database active condition;

[0013] If so, the second preceding sub-library is used as the first preceding sub-library.

[0014] In one embodiment, the determining whether the second preceding sub-library meets the sub-library active condition includes:

[0015] Detecting whether there is a request to be sent in the second preceding sub-library;

[0016] If there is a request to be sent for the second preceding sub-database, determining that the second preceding sub-database meets the sub-database active condition;

[0017] If the detection fails, the detection duration is obtained, and based on the detection duration, it is determined whether the second preceding sub-library meets the sub-library active condition.

[0018] In one embodiment, after detecting whether there is a request to be sent in the second preceding sub-library, the method further includes:

[0019] If it is detected that the second preceding sub-database has no pending request to be sent, continue to detect whether the second preceding sub-database has new pending request to be sent;

[0020] If yes, then match the second preceding sub-library with the total sub-library list to obtain the first succeeding sub-library that meets the sub-library active condition;

[0021] The second preceding sub-library is used as the first preceding sub-library of the first succeeding sub-library.

[0022] In one embodiment, after determining whether the second preceding sub-library meets the sub-library active condition, the method further includes:

[0023] If not, determining a third preceding sub-library based on the second preceding sub-library and the sub-library order in the total sub-library list;

[0024] Determine whether the third preceding sub-database meets the sub-database active condition;

[0025] If not, based on the third preceding sub-library and the sub-library order in the total sub-library list, the first preceding sub-library that meets the sub-library active condition is queried to obtain.

[0026] In one embodiment, the calculating, based on the most recent request time, the request sending time corresponding to the current sub-library includes:

[0027] Get the number of requests per second;

[0028] Based on the number of requests per second, calculate the time interval of external requests;

[0029] The most recent request time and the external request time interval are calculated to obtain the request sending time corresponding to the current sub-library.

[0030] In one embodiment, the request control of the current sub-library based on the request sending time includes:

[0031] Send the pending request of the current sub-library according to the request sending time;

[0032] Detecting whether the request to be sent is successfully sent;

[0033] If not, a sending failure alarm is generated and pushed to the security administrator.

[0034] In addition, to achieve the above purpose, the present application also proposes a sub-library request control device, the sub-library request control device comprising:

[0035] The acquisition module is used to obtain the total sub-library list and the sub-library information corresponding to the current sub-library;

[0036] A determination module, configured to determine, based on the total sub-library list and the sub-library information, a first preceding sub-library corresponding to the current sub-library, and determine a most recent request time of the first preceding sub-library;

[0037] A calculation module, used for calculating the request sending time corresponding to the current sub-library based on the most recent request time;

[0038] The control module is used to perform request control on the current sub-library based on the request sending time.

[0039] In addition, to achieve the above-mentioned purpose, the present application also proposes a sub-library request management device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the sub-library request management method as described above.

[0040] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the sub-library request management method described above are implemented.

[0041] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the sub-library request management method as described above.

[0042] The present application provides a sub-library request management method, apparatus, equipment and storage medium. The sub-library request management method obtains a total sub-library list and sub-library information corresponding to the current sub-library, and then determines the first preceding sub-library corresponding to the current sub-library based on the total sub-library list and the sub-library information, and determines the most recent request time of the first preceding sub-library, and then calculates the request sending time corresponding to the current sub-library based on the most recent request time, and then performs request management on the current sub-library based on the request sending time, thereby avoiding dependence on a centralized gateway or queue, reducing dependence on a single control point, and thereby reducing the risk of single point failure, while improving request processing efficiency, reducing communication overhead, and realizing flexible traffic control, thereby avoiding excessive requests for hot resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] 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 present application.

[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0045] Figure 1 A flowchart of the first embodiment of the method for controlling application sub-database requests;

[0046] Figure 2 A flowchart of the second embodiment of the method for controlling database sub-repository requests in this application;

[0047] Figure 3 A flowchart of the third embodiment of the method for controlling application sub-database requests;

[0048] Figure 4 A brief example diagram of the process provided for the management and control method of database sub-repository requests in this application;

[0049] Figure 5 This is a schematic diagram of the module structure of the sub-library request control device according to an embodiment of the present application;

[0050] Figure 6 This is a schematic diagram of the device structure of the hardware operating environment involved in the sub-library request management and control method in the embodiment of the present application.

[0051] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0052] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0053] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0054] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a big data service platform, a sub-library request management and control system, etc. The following takes the sub-library request management and control system as an example to illustrate this embodiment and the following embodiments.

[0055] Based on this, the present application embodiment provides a sub-library request management method, referring to Figure 1 , Figure 1 A flowchart of the first embodiment of the method for managing and controlling database sub-repository requests in this application is provided.

[0056] In this embodiment, the sub-database request management method includes steps S11 to S14:

[0057] Step S11, obtaining the total sub-library list and the sub-library information corresponding to the current sub-library;

[0058] It should be noted that the total sub-library list refers to a list of all sub-libraries in the system. Each sub-library has its own role and position in the system, and the total sub-library list is an ordered collection of these sub-libraries. The total sub-library list can be sorted based on the startup order, weight, geographic location or other business logic of the sub-library, which is not limited here, but the total sub-library list stored in all sub-libraries should be clear and consistent, and can be set according to actual conditions.

[0059] It should be further explained that the current sub-library refers to the target sub-library that currently needs to be requested and managed, and the sub-library information refers to various data and parameters related to the sub-library, including but not limited to the sub-library's identification information, network address, request processing capability, current load, most recent request time, and sorting number in the total sub-library list, etc., which are not limited here.

[0060] Specifically, the total sub-library list and the sub-library information corresponding to the current sub-library may be obtained by reading a preset database or system log, etc., and no limitation is made here.

[0061] Step S12, based on the total sub-library list and the sub-library information, determining the first preceding sub-library corresponding to the current sub-library, and determining the most recent request time of the first preceding sub-library;

[0062] It should be noted that the first preceding sub-library refers to the first sub-library in the total sub-library list that is before the current sub-library and meets the sub-library active condition. In the total sub-library list, each sub-library has a sequence number, and the current sub-library will determine its preceding sub-library based on this sequence. The preceding sub-library is a key factor that the current sub-library needs to consider before sending a request, because its status (such as whether it is active, request processing capacity, etc.) will affect when the current sub-library can send a request.

[0063] It should be further explained that the most recent request time refers to the time point when the first preceding sub-library last sent a request to the outside. The most recent request time is a high-precision time point used to help the current sub-library determine its own request sending time to avoid conflicts with requests from the preceding sub-library and maintain the overall flow control of the system.

[0064] Specifically, the sub-library information is matched with the sub-library order in the total sub-library list to obtain the second preceding sub-library, and then it is determined whether the second preceding sub-library meets the sub-library active condition, and if so, the second preceding sub-library is used as the first preceding sub-library. Further, the most recent request time of the first preceding sub-library is determined, wherein the determination can be made by querying the sub-library information of the first preceding sub-library, which is not limited here.

[0065] Step S13, based on the most recent request time, calculating the request sending time corresponding to the current sub-library;

[0066] It should be noted that the request sending time refers to the time point when the request should be sent calculated based on the system set rules (such as TPS, Transactions Per Second, requests per second) and the most recent request time of the first preceding sub-library.

[0067] Specifically, the number of requests per second is obtained, and then based on the number of requests per second, the time interval for external requests is calculated, thereby calculating the most recent request time and the time interval for external requests to obtain the request sending time corresponding to the current sub-library.

[0068] Step S14: Based on the request sending time, request management and control is performed on the current sub-library.

[0069] Specifically, according to the request sending time, the pending request of the current sub-library is sent, and then it is detected whether the pending request is successfully sent. If not, a sending failure alarm is generated and pushed to the security administrator.

[0070] Understandably, if request control is performed by traditional methods, that is, in order to improve the availability and scalability of the system, multiple gateway instances will be deployed. However, even if there are multiple gateway instances, how to coordinate between them to achieve effective flow control is still a challenge. If there is no good synchronization and coordination mechanism between these gateway instances, it may lead to inconsistency in flow control. If only one gateway instance is used, then this gateway becomes a single point of failure for the system. If this gateway fails, the external requests of the entire system will be affected, because all requests must pass through this gateway. This single point of failure risk means that the stability and reliability of the system may be threatened. Therefore, each sub-database is locally judged whether a request needs to be sent and the time of sending, and each sub-database is allowed to send requests to the outside in turn at a predetermined frequency after eliminating the sub-databases that have completed all transactions and eliminating all abnormal sub-databases, so that the overall external request flow of the system is close to the predetermined value to prevent the above problems from occurring.

[0071] This embodiment obtains the total sub-library list and the sub-library information corresponding to the current sub-library, and then determines the first preceding sub-library corresponding to the current sub-library based on the total sub-library list and the sub-library information, and determines the most recent request time of the first preceding sub-library, and then calculates the request sending time corresponding to the current sub-library based on the most recent request time, and then performs request management on the current sub-library based on the request sending time, thereby avoiding dependence on a centralized gateway or queue, reducing dependence on a single control point, and thereby reducing the risk of single point failure, while improving request processing efficiency, reducing communication overhead, and achieving flexible traffic control, thereby avoiding excessive requests for hot resources.

[0072] Based on this, the present application embodiment provides a sub-library request management method, referring to Figure 2 , Figure 2 A flowchart of the second embodiment of the method for managing and controlling database sub-repository requests in this application is provided.

[0073] In a feasible implementation manner, determining the first preceding sub-library corresponding to the current sub-library based on the total sub-library list and the sub-library information includes:

[0074] Step S21, matching the sub-library information with the sub-library order in the total sub-library list to obtain a second preceding sub-library;

[0075] It should be noted that the sub-library order refers to the ordering of the sub-libraries in the total sub-library list according to a certain predetermined rule or strategy, in order to achieve orderly request processing and flow control in the system. The second preceding sub-library refers to the previous sub-library of the current sub-library in the total sub-library list. For example, if the sub-library number of the current sub-library is 3, then the second preceding sub-library is 2.

[0076] Specifically, the sub-library information is matched with the sub-library order in the total sub-library list to obtain a second preceding sub-library. In one embodiment, when the system starts, each sub-library will search the sub-library list for its position in the list to determine the information of the preceding sub-library, and then obtain the address of the preceding sub-library and other related calling information through the system service. If the system is a microservice architecture, then the address of the preceding sub-library and other related calling information can be obtained through the microservice.

[0077] Step S22, determining whether the second preceding sub-database meets the sub-database active condition;

[0078] It should be noted that the sub-library active condition refers to the condition or indicator used to determine whether a sub-library has subsequent requests to be sent, which can be set according to actual conditions and is not limited here.

[0079] Specifically, it is detected whether there are requests to be sent for the second preceding sub-library, and if so, it is determined that the second preceding sub-library meets the sub-library active condition. If the detection fails, the detection duration is obtained, and based on the detection duration, it is determined whether the second preceding sub-library meets the sub-library active condition.

[0080] Step S23: If yes, use the second preceding sub-library as the first preceding sub-library.

[0081] Specifically, if the second preceding sub-library meets the sub-library active condition, the second preceding sub-library is used as the first preceding sub-library.

[0082] This embodiment obtains the second preceding sub-library by matching the sub-library information with the sub-library order in the total sub-library list, and then determines whether the second preceding sub-library meets the sub-library active condition. If so, the second preceding sub-library is used as the first preceding sub-library, thereby realizing request management based on the actual active status of the sub-library, rather than performing request management by adding gateways or queues. This ensures that active sub-libraries get more request processing opportunities, while inactive sub-libraries reduce or suspend requests, while realizing decentralized algorithm design, thereby avoiding single point failure risks, etc., thereby improving resource utilization efficiency and improving system response speed.

[0083] In a feasible implementation manner, the determining whether the second preceding sub-library meets the sub-library active condition includes:

[0084] Step S31, detecting whether there is a request to be sent in the second preceding sub-library;

[0085] It should be noted that the pending requests refer to requests that have been prepared but not yet actually sent to the external system or service, indicating that the sub-database has active business processes and data processing needs.

[0086] Specifically, whether there is a request to be sent to the second preceding sub-database is detected by querying the request queue, monitoring system or log of the second preceding sub-database, and the detection method is not limited here.

[0087] Step S32: If there is a request to be sent for the second preceding sub-library, determine that the second preceding sub-library meets the sub-library active condition;

[0088] Step S33: If the detection fails, the detection duration is obtained, and based on the detection duration, it is determined whether the second preceding sub-library meets the sub-library active condition.

[0089] It should be noted that the detection duration refers to the time taken by the system to detect whether the second preceding sub-library is active.

[0090] Specifically, if the detection fails, the detection duration is obtained, and based on the detection duration, it is determined whether the second preceding sub-library meets the sub-library active condition, wherein if the second preceding sub-library times out without feedback, the second preceding sub-library is deemed inactive, that is, it does not meet the sub-library active condition. In addition, if the second preceding sub-library has return information, but the return information indicates that the preceding sub-library no longer has data that needs to be requested externally, the preceding sub-library is also deemed inactive.

[0091] This embodiment detects whether there are requests to be sent for the second preceding sub-library, and if so, determines that the second preceding sub-library meets the sub-library active condition. If the detection fails, the detection duration is obtained, and based on the detection duration, it is determined whether the second preceding sub-library meets the sub-library active condition, and then the active sub-library is identified in time to shorten the delay caused by the inactive sub-library responding to the system, thereby effectively enhancing the system's responsiveness and optimizing resource allocation. At the same time, the system can make reasonable decisions and improve the robustness of the system by judging its status through the detection duration even in the case of network delays or slow sub-library responses.

[0092] Based on this, the present application embodiment provides a sub-library request management method, referring to Figure 3 , Figure 3 This is a flowchart of the third embodiment of the method for managing and controlling database sub-repository requests in this application.

[0093] In a feasible implementation manner, after detecting whether the second preceding sub-library has a request to be sent, the method further includes:

[0094] Step S41: If it is detected that the second preceding sub-library has no request to be sent, then continue to detect whether the second preceding sub-library has any new request to be sent;

[0095] It should be noted that the newly added requests to be sent refer to the requests newly added to the sub-database processing queue after a certain time point, which may be from user operations, external system calls, batch processing tasks or other data generation sources, and are not limited here. The existence of the newly added requests to be sent indicates that the sub-database has new data processing requirements, and these requests need to be processed in a timely manner to keep the system running smoothly.

[0096] Specifically, if it is detected that there are no pending requests for the second preceding sub-library, the second preceding sub-library is continuously checked for new pending requests to be sent, so as to perform real-time monitoring of inactivated sub-libraries (i.e., inactive sub-libraries) to ensure timely response to request behaviors of inactivated sub-libraries.

[0097] Step S42: If yes, then match the second preceding sub-library with the total sub-library list to obtain the first succeeding sub-library that meets the sub-library active condition;

[0098] It should be noted that the first subsequent sub-library refers to the first sub-library that is ranked after the current sub-library in the total sub-library list and meets the sub-library active condition.

[0099] Specifically, since a sub-library will be identified as inactive (i.e., not meeting the sub-library active condition) by a subsequent sub-library when there is no external request data or when it is running abnormally, when the sub-library generates new external request data or runs normally again, the second previous sub-library is matched with the total sub-library list to obtain the first subsequent sub-library that meets the sub-library active condition. For example, it is determined whether the sub-library ranked one position after the second previous sub-library in the total sub-library list (i.e., the subsequent sub-library) meets the sub-library active condition. If the subsequent sub-library is inactive, the sub-library ranked two positions after the second previous sub-library is continued to be queried according to the total sub-library list until a subsequent sub-library that meets the sub-library active condition is found. If the last sub-library in the sub-library list has been found, the query is restarted from the first position in the total sub-library list until an active sub-library or the current sub-library itself is found. Regardless of whether other sub-libraries or the current sub-library itself are found, they will be identified as subsequent sub-libraries here.

[0100] Step S43: Use the second preceding sub-library as the first preceding sub-library of the first succeeding sub-library.

[0101] Specifically, after determining the first post-sequence sub-library, the second pre-sequence sub-library is used as the first pre-sequence sub-library of the first post-sequence sub-library. In one embodiment, there are 4 sub-libraries in the total sub-library list, and the sub-library serial numbers are 1, 2, 3, and 4. If the second pre-sequence sub-library is sub-library 3, and the current sub-library 3 is in an inactive state, when it is detected that sub-library 3 has a new request to be sent, the sub-library serial number of sub-library 3 is matched with the total sub-library list, and the first post-sequence sub-library obtained is sub-library 4.

[0102] Furthermore, if sub-library 4 does not meet the sub-library active condition, then according to the total sub-library list, it is necessary to query whether sub-library 1 meets the sub-library active condition. If sub-library 1 meets the sub-library active condition at this time, sub-library 1 is determined to be the first subsequent sub-library, and sub-library 3 is then used as the first preceding sub-library of sub-library 1. Therefore, when sub-library 1 is the current sub-library, according to the set algorithm logic, the request sending time of sub-library 1 will be determined by the most recent request time of sub-library 3, thereby ensuring that sub-library 3 is activated successfully and participates in the logic of request management, so as to more quickly identify the change of sub-library status and make corresponding adjustments more quickly.

[0103] This embodiment continuously detects whether there are new requests to be sent to the second preceding sub-library if it is detected that there are no requests to be sent to the second preceding sub-library, and if so, matches the second preceding sub-library with the total sub-library list to obtain the first subsequent sub-library that meets the sub-library active condition, thereby using the second preceding sub-library as the first preceding sub-library of the first subsequent sub-library, thereby providing a dynamic and continuous monitoring mechanism, thereby more quickly identifying changes in sub-library status and making corresponding adjustments more quickly, thereby ensuring that flow control and request scheduling in the multi-sub-library system can respond promptly according to changes in sub-library status, thereby enhancing the flexibility of the system.

[0104] In a feasible implementation manner, after determining whether the second preceding sub-database meets the sub-database active condition, the method further includes:

[0105] Step S51: if not, determine a third preceding sub-library based on the second preceding sub-library and the sub-library order in the total sub-library list;

[0106] It should be noted that the third preceding sub-library refers to the sub-library that is ranked two before the current sub-library in the total sub-library list. For example, if the sub-library sequence number of the current sub-library is 3, then the third preceding sub-library is 1.

[0107] Specifically, if the second preceding sub-library does not meet the preset active condition, the third preceding sub-library is obtained by querying according to the second preceding sub-library and the sorting of sub-libraries in the total sub-library list.

[0108] Step S52, determining whether the third preceding sub-library meets the sub-library active condition;

[0109] Specifically, it is detected whether there are requests to be sent for the third preceding sub-library, and if so, it is determined that the third preceding sub-library meets the sub-library active condition. If the detection fails, the detection duration is obtained, and based on the detection duration, it is determined whether the third preceding sub-library meets the sub-library active condition.

[0110] Step S53: If not, based on the third preceding sub-library and the sub-library order in the total sub-library list, query to obtain the first preceding sub-library that meets the sub-library active condition.

[0111] Specifically, if not, then according to the third preceding sub-library and the sorting of sub-libraries in the total sub-library list, query to obtain the first preceding sub-library that meets the sub-library active condition. For example, the current sub-library is sub-library 6, the second preceding sub-library is sub-library 5, and the third preceding sub-library is sub-library 4. If the query from sub-library 5 to sub-library 4 does not meet the sub-library active condition, it is necessary to keep querying forward according to the sorting until a sub-library that meets the sub-library active condition is found. If the query finds that sub-library 2 meets the sub-library active condition, then the first preceding sub-library is sub-library 2.

[0112] In addition, if the query is continued based on the total sub-library list until the current sub-library itself has not found a sub-library that meets the sub-library active conditions, then the current sub-library will determine whether it is at the first place in the sub-library list (that is, the first sub-library to send a request).

[0113] Specifically, if the current sub-library is at the first place in the sub-library list and there is data that needs to be requested externally, then arrange to send an external request immediately; if the current sub-library is not at the first place in the sub-library list, but the previous sub-libraries in the sub-library list are not active until an active sub-library is found after re-querying from the end of the list upwards, then the current sub-library can also be considered to be at the first place in the sub-library list, then when the current sub-library has data that needs to be requested externally, it should also arrange to send an external request immediately; if the current sub-library is not at the first place in the sub-library list, and the sub-library before the current sub-library in the sub-library list returns information indicating that the sub-library has not made a request, then the current sub-library should wait for a preset time before returning to execute the query based on the total sub-library list and the sub-library information, and determine the step of the first previous sub-library corresponding to the current sub-library. Among them, the preset time can be set according to the actual situation, and can be half of the external request time interval, which is not limited here.

[0114] In this embodiment, if not, the third preceding sub-library is determined based on the second preceding sub-library and the sub-library ranking in the total sub-library list, and then it is determined whether the third preceding sub-library meets the sub-library active condition. If not, the first preceding sub-library that meets the sub-library active condition is queried based on the third preceding sub-library and the sub-library ranking in the total sub-library list, and then the next qualifying active sub-library is dynamically searched in the total sub-library list, thereby improving the flexibility, efficiency and reliability of the multi-sub-library system in processing requests, thereby ensuring that the system can handle a large number of requests while maintaining efficient flow control.

[0115] In a feasible implementation manner, the calculating the request sending time corresponding to the current sub-library based on the most recent request time includes:

[0116] Step S61, obtaining the number of requests per second;

[0117] It should be noted that the number of requests per second refers to a target value preset during system design, which indicates the number of requests that the system can process within one second.

[0118] Specifically, the number of requests per second can be obtained through system configuration, and there is no restriction here.

[0119] Step S62, based on the number of requests per second, calculate the time interval for external requests;

[0120] It should be noted that the external request time interval refers to the time interval that should exist between two consecutive requests when the system processes external requests, so as to ensure that the system's external request volume does not exceed the system's designed throughput, thereby achieving precise flow control.

[0121] Specifically, the external request time interval can be calculated by the calculation formula of "external request time interval (unit: milliseconds) = 1000 milliseconds ÷ number of requests per second".

[0122] Step S63, calculating the most recent request time and the external request time interval to obtain the request sending time corresponding to the current sub-library.

[0123] Specifically, the most recent request time and the external request time interval are calculated to obtain the request sending time corresponding to the current sub-library. For example, the request sending time corresponding to the current sub-library is calculated by the calculation formula "request sending time = most recent request time + external request time interval". There is no limitation here and it can be set according to actual conditions.

[0124] This embodiment obtains the number of requests per second, and then calculates the external request time interval based on the number of requests per second, thereby calculating the most recent request time and the external request time interval to obtain the request sending time corresponding to the current sub-library, and then accurately calculates the request sending time of each sub-library, which can ensure that the system's external request volume meets the preset TPS, thereby achieving precise flow control, and by controlling the request sending time interval of each sub-library, avoiding excessive requests for hot resources, reducing service denial problems caused by resource contention, thereby effectively improving system stability, optimizing resource utilization, improving system response speed, and reducing communication overhead. In addition, when the system is expanded or reduced in capacity, the request sending time interval of each sub-library can be quickly recalculated to adapt to the new system configuration.

[0125] In a feasible implementation manner, the request control of the current sub-library based on the request sending time includes:

[0126] Step S71, sending the pending request of the current sub-library according to the request sending time;

[0127] Specifically, through system monitoring, when the system detects that the request sending time has arrived, the request sending mechanism is triggered, thereby sending the pending request of the current sub-library.

[0128] Step S72, detecting whether the request to be sent is successfully sent;

[0129] Step S73: if not, a sending failure alarm is generated and pushed to the security administrator.

[0130] It should be noted that the sending failure alarm refers to a warning message automatically generated by the system when the system attempts to send a request to be sent to an external system or service, but the request fails to be sent successfully due to some reason. The message includes the following: alarm time, alarm level, failed request details (such as the unique identifier of the failed request, the content summary or key information of the request, and the target address or service of the request), failure reason (such as network error, timeout, service denial, target server unreachable, etc.), source sub-library information (identification information of the sub-library sending the request, including the name of the sub-library, IP address or other relevant information) and scope of impact (the scope that the failed request may affect, such as the number of users, data volume or other services affected), etc.

[0131] Specifically, if not, a sending failure alarm is generated based on the sub-library serial number of the current sub-library and the sending failure flag and other information, and the sending failure alarm is pushed to the security administrator, where it can be pushed via SMS, APP notification, mini-program, and email, etc., without any restriction here.

[0132] This embodiment sends the pending request of the current sub-database according to the request sending time, and then detects whether the pending request is sent successfully. If not, a sending failure alarm is generated and pushed to the security administrator, thereby ensuring the accuracy and timeliness of request management, improving operation and maintenance efficiency, and reducing the risk of data loss.

[0133] For example, to help understand the implementation process of the sub-library request control method, please refer to Figure 4 , Figure 4 A simple flow chart showing the application's request management method for database sharding.

[0134] It should be noted that the examples in the figure are only used to understand the present application and do not constitute a limitation on the sub-library request management method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0135] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0136] This application also provides a sub-library request control device, please refer to Figure 5 , the sub-library request control device includes:

[0137] The acquisition module 51 is used to acquire the total sub-library list and the sub-library information corresponding to the current sub-library;

[0138] A determination module 52, configured to determine a first preceding sub-library corresponding to the current sub-library based on the total sub-library list and the sub-library information, and determine a most recent request time of the first preceding sub-library;

[0139] A calculation module 53, used to calculate the request sending time corresponding to the current sub-library based on the most recent request time;

[0140] The control module 54 is used to perform request control on the current sub-library based on the request sending time.

[0141] The sub-library request control device is also used for:

[0142] Matching the sub-library information with the sub-library order in the total sub-library list to obtain a second preceding sub-library;

[0143] Determine whether the second preceding sub-database meets the sub-database active condition;

[0144] If so, the second preceding sub-library is used as the first preceding sub-library.

[0145] The sub-library request control device is also used for:

[0146] Detecting whether there is a request to be sent in the second preceding sub-library;

[0147] If there is a request to be sent for the second preceding sub-database, determining that the second preceding sub-database meets the sub-database active condition;

[0148] If the detection fails, the detection duration is obtained, and based on the detection duration, it is determined whether the second preceding sub-library meets the sub-library active condition.

[0149] The sub-library request control device is also used for:

[0150] If it is detected that the second preceding sub-database has no pending request to be sent, continue to detect whether the second preceding sub-database has new pending request to be sent;

[0151] If yes, then match the second preceding sub-library with the total sub-library list to obtain the first succeeding sub-library that meets the sub-library active condition;

[0152] The second preceding sub-library is used as the first preceding sub-library of the first succeeding sub-library.

[0153] The sub-library request control device is also used for:

[0154] If not, determining a third preceding sub-library based on the second preceding sub-library and the sub-library order in the total sub-library list;

[0155] Determine whether the third preceding sub-database meets the sub-database active condition;

[0156] If not, based on the third preceding sub-library and the sub-library order in the total sub-library list, the first preceding sub-library that meets the sub-library active condition is queried to obtain.

[0157] The sub-library request control device is also used for:

[0158] Get the number of requests per second;

[0159] Based on the number of requests per second, calculate the time interval of external requests;

[0160] The most recent request time and the external request time interval are calculated to obtain the request sending time corresponding to the current sub-library.

[0161] The sub-library request control device is also used for:

[0162] Send the pending request of the current sub-library according to the request sending time;

[0163] Detecting whether the request to be sent is successfully sent;

[0164] If not, a sending failure alarm is generated and pushed to the security administrator.

[0165] The sub-library request control device provided by the present application adopts the sub-library request control method in the above embodiment, which can solve the technical problems in the background technology. Compared with the prior art, the beneficial effects of the sub-library request control device provided by the present application are the same as the beneficial effects of the sub-library request control method provided by the above embodiment, and the other technical features in the sub-library request control device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0166] The present application provides a sub-library request management device, which includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the sub-library request management method in the above-mentioned embodiment one.

[0167] Reference below Figure 6 , which shows a schematic diagram of the structure of a sub-library request control device suitable for implementing the embodiment of the present application. The sub-library request control device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The sub-library request management device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0168] like Figure 6As shown, the sub-library request control device may include a processing device 1001 (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the sub-library request control device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the sub-library request control device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a sub-library request control device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0169] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0170] The sub-library request control device provided by the present application adopts the sub-library request control method in the above embodiment, which can solve the technical problems in the background technology. Compared with the prior art, the beneficial effects of the sub-library request control device provided by the present application are the same as the beneficial effects of the sub-library request control method provided by the above embodiment, and the other technical features in the sub-library request control device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0171] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0172] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0173] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the sub-library request management and control method in the above-mentioned embodiment.

[0174] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0175] The above-mentioned computer-readable storage medium may be included in the sub-library request management and control device; or it may exist independently without being assembled into the sub-library request management and control device.

[0176] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the sub-library request control device, the sub-library request control device:

[0177] Get the total sub-library list and the sub-library information corresponding to the current sub-library;

[0178] Based on the total sub-library list and the sub-library information, determine a first preceding sub-library corresponding to the current sub-library, and determine the most recent request time of the first preceding sub-library;

[0179] Based on the most recent request time, calculate the request sending time corresponding to the current sub-library;

[0180] Based on the request sending time, request management and control is performed on the current sub-library.

[0181] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0182] 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 application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the 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 square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square 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 square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / 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.

[0183] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0184] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned sub-library request control method, and can solve the technical problems in the background technology. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the sub-library request control method provided in the above-mentioned embodiment, and will not be repeated here.

[0185] An embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned sub-library request management and control method.

[0186] The computer program product provided in this application can solve the technical problems in the background technology. Compared with the prior art, the beneficial effects of the computer program product provided in the embodiment of this application are the same as the beneficial effects of the sub-library request management method provided in the above embodiment, which will not be repeated here.

[0187] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A method for managing and controlling sub-database requests, characterized in that: include: Get the total sub-library list and the sub-library information corresponding to the current sub-library; Based on the total sub-library list and the sub-library information, determine a first preceding sub-library corresponding to the current sub-library, and determine the most recent request time of the first preceding sub-library; Based on the most recent request time, calculate the request sending time corresponding to the current sub-library; Based on the request sending time, request management and control is performed on the current sub-library.

2. The method for controlling sub-library requests according to claim 1, characterized in that: The determining, based on the total sub-library list and the sub-library information, a first preceding sub-library corresponding to the current sub-library includes: Matching the sub-library information with the sub-library order in the total sub-library list to obtain a second preceding sub-library; Determine whether the second preceding sub-database meets the sub-database active condition; If so, the second preceding sub-library is used as the first preceding sub-library.

3. The method for controlling sub-library requests according to claim 2, characterized in that: The determining whether the second preceding sub-database meets the sub-database active condition includes: Detecting whether there is a request to be sent in the second preceding sub-library; If there is a request to be sent for the second preceding sub-database, determining that the second preceding sub-database meets the sub-database active condition; If the detection fails, the detection duration is obtained, and based on the detection duration, it is determined whether the second preceding sub-library meets the sub-library active condition.

4. The method for controlling sub-library requests according to claim 3, characterized in that: After detecting whether the second preceding sub-library has a request to be sent, the method further includes: If it is detected that the second preceding sub-database has no pending request to be sent, continue to detect whether the second preceding sub-database has new pending request to be sent; If yes, then match the second preceding sub-library with the total sub-library list to obtain the first succeeding sub-library that meets the sub-library active condition; The second preceding sub-library is used as the first preceding sub-library of the first succeeding sub-library.

5. The method for controlling sub-library requests according to claim 2, characterized in that: After determining whether the second preceding sub-database meets the sub-database active condition, the method further includes: If not, determining a third preceding sub-library based on the second preceding sub-library and the sub-library order in the total sub-library list; Determine whether the third preceding sub-database meets the sub-database active condition; If not, based on the third preceding sub-library and the sub-library order in the total sub-library list, the first preceding sub-library that meets the sub-library active condition is queried to obtain.

6. The method for controlling sub-library requests according to claim 1, characterized in that: The calculating, based on the most recent request time, the request sending time corresponding to the current sub-library includes: Get the number of requests per second; Based on the number of requests per second, calculate the time interval of external requests; The most recent request time and the external request time interval are calculated to obtain the request sending time corresponding to the current sub-library.

7. The method for controlling sub-library requests according to claim 1, characterized in that: The request control of the current sub-database based on the request sending time includes: Send the pending request of the current sub-library according to the request sending time; Detecting whether the request to be sent is successfully sent; If not, a sending failure alarm is generated and pushed to the security administrator.

8. A sub-library request control device, characterized in that: include: The acquisition module is used to obtain the total sub-library list and the sub-library information corresponding to the current sub-library; A determination module, configured to determine, based on the total sub-library list and the sub-library information, a first preceding sub-library corresponding to the current sub-library, and determine a most recent request time of the first preceding sub-library; A calculation module, used for calculating the request sending time corresponding to the current sub-library based on the most recent request time; The control module is used to perform request control on the current sub-library based on the request sending time.

9. A sub-library request management and control device, characterized in that: The sub-library request management device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the sub-library request management method as described in any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the sub-library request management method according to any one of claims 1 to 7 are implemented.