Credit inquiry control method and device, electronic equipment and storage medium

By using caching and control lock mechanisms, the problem of repeated queries of credit information by the same user is solved, which optimizes resource utilization and reduces supplier pressure in high-concurrency environments, thereby improving system stability and efficiency.

CN121764969APending Publication Date: 2026-03-31SHANGHAI SHUHE INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-13
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

In traditional credit inquiry methods, repeated queries of the same credit information by the same user within a short period of time lead to resource waste and inefficiency, and put excessive pressure on credit providers when concurrent queries occur.

Method used

The caching mechanism controls the number of times a single user can query the same credit data within a short period of time, and allows only one query request to call the supplier interface under high concurrency. Combined with control locks and rate limiting mechanisms, the number of query requests and routing are dynamically adjusted.

Benefits of technology

Effectively control the number of times the same user queries the same credit data, optimize resource utilization, reduce supplier pressure, and improve system stability and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121764969A_ABST
    Figure CN121764969A_ABST
Patent Text Reader

Abstract

The invention relates to a credit query control method and device, electronic equipment and a storage medium, and the method comprises the steps: receiving a credit query request of a target user, and analyzing the identification of the target credit and the identification of the target user from the credit query request; acquiring a cache key according to the identifier of the target user and the identifier of the target credit, and querying credit cache according to the cache key; if the target credit is obtained from the credit cache, feeding back the target credit to the target user; if the target credit is not acquired from the credit cache, acquiring a key of a control lock according to the target user and the identifier of the target credit, if the control lock is acquired according to the key of the control lock, sending a query request of the target credit to the target supplier, and feeding back the target credit to the target user when the target credit fed back by the target supplier is received. According to the method, the number of times of externally querying suppliers for the same credit data by the same user in a short time can be controlled, and only one query request is allowed to call a supplier interface under high concurrency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of credit information processing technology, and in particular to a credit information query control method, apparatus, electronic device, and storage medium. Background Technology

[0002] In the risk control industry, business systems frequently need to call third-party credit information provider interfaces to obtain users' credit data. Traditional request rate limiting is mostly based on IP (Internet Protocol) or interface-level QPS (Queries Per Second) for rate control. This approach will cause the same user to repeatedly query the same credit information in a short period of time, resulting in wasted resources and low efficiency. Furthermore, during concurrent queries, multiple requests simultaneously send queries to the credit information provider, causing excessive pressure on the provider. Summary of the Invention

[0003] Based on this, it is necessary to provide a credit information query control method, device, electronic device, and storage medium to address the above-mentioned technical problems. This method and device can control the number of times a single user queries the same credit information data from external suppliers within a short period of time, and allow only one query request to call the supplier interface under high concurrency.

[0004] According to a first aspect of certain exemplary embodiments of this application, a credit information query control method is provided, comprising: receiving a credit information query request from a target user; parsing an identifier of the target credit information and an identifier of the target user from the credit information query request; obtaining a cache key based on the identifier of the target user and the identifier of the target credit information; querying a credit information cache based on the cache key; if the target credit information is obtained from the credit information cache, then feeding back the target credit information to the target user; if the target credit information is not obtained from the credit information cache, then obtaining a control lock key based on the identifier of the target user and the identifier of the target credit information; if a control lock is obtained based on the control lock key, then sending a query request for the target credit information to a target supplier, and feeding back the target credit information to the target user upon receiving feedback of the target credit information from the target supplier.

[0005] In one example, a credit information query control method further includes: configuring a credit information cache and configuring a cache key for the target credit information based on the identifier of the target user and the identifier of the target credit information.

[0006] In one example, a credit information query control method further includes: obtaining the business scenario, credit type, and update frequency of the target credit information; and configuring the caching time of the target credit information in the credit information cache according to the business scenario, credit type, and update frequency of the target credit information.

[0007] In one example, the cache time of the target information in the information cache is configured according to the business scenario, credit type, and update frequency of the target information. This includes: obtaining the first cache time corresponding to the business scenario, the second cache time corresponding to the credit type, and the third cache time corresponding to the update frequency of the target information; and setting the cache time of the target information in the information cache according to the first cache time, the second cache time, and the third cache time.

[0008] In one example, a credit information query control method further includes: if querying the target credit information from the target supplier fails, obtaining the error code of the query failure; obtaining the type of the error code, and if the type of the error code is a temporary error, obtaining the load information of the target supplier; obtaining a basic threshold based on the type of the error code, and obtaining an adjustment coefficient based on the load information of the target supplier; determining a dynamic threshold based on the basic threshold and the adjustment coefficient; and sending the query request for the target credit information to the target supplier again based on the dynamic threshold.

[0009] In one example, the process of resending a target credit information query request to the target supplier based on a dynamic threshold includes: obtaining the target supplier's health status information when the number of target credit information query requests does not exceed the dynamic threshold; resending the target credit information query request to the target supplier when the health status information meets the set health conditions; and sending the target credit information query request to alternative suppliers when the health status information does not meet the set health conditions. When the number of target credit information query requests exceeds the dynamic threshold, a rate limiting warning is sent to the target user. The health status information includes the interface error rate and / or interface response time, and the set health conditions include the set values ​​for the interface error rate and / or the set values ​​for the interface response time.

[0010] In one example, the control lock includes a local lock and a distributed lock. A credit query control method further includes: if a local lock is obtained based on the key of the local lock, then when a distributed lock is obtained based on the key of the distributed lock, it is determined that a control lock is obtained based on the key of the control lock; if a local lock is not obtained based on the key of the local lock, it is determined that a control lock is not obtained based on the key of the control lock.

[0011] According to a second aspect of certain exemplary embodiments of this application, a credit information query control device is provided, comprising: a parsing module, configured to receive a credit information query request from a target user, and parse out an identifier of the target credit information and an identifier of the target user from the credit information query request; a query module, configured to obtain a cache key based on the identifier of the target user and the identifier of the target credit information, and query a credit information cache based on the cache key; a first feedback module, configured to provide feedback on the target credit information to the target user if the target credit information is obtained from the credit information cache; and a second feedback module, configured to obtain a control lock key based on the identifier of the target user and the target credit information if the target credit information is not obtained from the credit information cache, and if a control lock is obtained based on the control lock key, send a query request for the target credit information to the target supplier, and provide feedback on the target credit information to the target user upon receiving feedback on the target credit information from the target supplier.

[0012] According to a third aspect of certain exemplary embodiments of this application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any of the above methods.

[0013] According to a fourth aspect of certain exemplary embodiments of this application, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described above.

[0014] The aforementioned credit information query control method, apparatus, electronic device, and storage medium include: receiving a credit information query request from a target user; parsing the identifier of the target credit information and the identifier of the target user from the credit information query request; obtaining a cache key based on the identifier of the target user and the identifier of the target credit information; querying the credit information cache based on the cache key; if the target credit information is obtained from the credit information cache, then feeding back the target credit information to the target user; if the target credit information is not obtained from the credit information cache, then obtaining a control lock key based on the identifier of the target user and the identifier of the target credit information; if a control lock is obtained based on the control lock key, then sending a query request for the target credit information to the target supplier, and feeding back the target credit information to the target user upon receiving feedback from the target supplier. Therefore, by caching credit information, the number of times the same user queries the supplier for the same credit information data within a short period is controlled. Furthermore, by using a control lock, only one query request is allowed to call the supplier interface under high concurrency. Attached Figure Description

[0015] Figure 1 This is an application scenario diagram of a credit information inquiry control method in some exemplary embodiments of this application; Figure 2 This is a flowchart illustrating a credit information inquiry control method as shown in some exemplary embodiments of this application; Figure 3This is a flowchart illustrating the rate limiting and failover sub-processes for error codes in some application scenarios of this application; Figure 4 This is a flowchart illustrating a credit information inquiry control method in some application scenarios of this application; Figure 5 This is a flowchart illustrating the rate limiting operation for error codes in some application scenarios of this application; Figure 6 This is a structural block diagram of a credit information inquiry control device in some other exemplary embodiments of this application; Figure 7 This is a diagram of the internal structure of an electronic device in some other exemplary embodiments of this application. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0017] The following detailed descriptions are provided to aid the reader in gaining a comprehensive understanding of the methods, apparatus, electronic devices, storage media, and / or computer program products described herein. However, after understanding the disclosure of this application, various changes, modifications, and equivalents of the methods, apparatus, storage media, and / or computer program products described herein will become apparent. For example, the order of operations described herein is merely illustrative and is not limited to those orders set forth herein, but may be changed as will become clear after understanding the disclosure of this application, except for operations that must occur in a specific order. Furthermore, for clarity and conciseness, descriptions of features known in the art may be omitted.

[0018] The features described herein may be implemented in different forms and should not be construed as limited to the examples described herein. Rather, the examples described herein are provided only to illustrate some of the many feasible ways of implementing the methods, electronic devices, and / or storage media described herein, many of which will become clear upon understanding this application.

[0019] The terminology used herein is for the purpose of describing various examples only and is not intended to limit disclosure. Unless the context clearly indicates otherwise, the singular form is intended to include the plural form as well. The terms “comprising,” “including,” and “having” indicate the presence of the described features, quantities, operations, components, elements, and / or combinations thereof, but do not exclude the presence or addition of one or more other features, quantities, operations, components, elements, and / or combinations thereof. Unless otherwise stated, “ / ” means “or,” for example, A / B can mean A or B; “and / or” in the text is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can mean: A alone, A and B simultaneously, and B alone. Furthermore, in the description of embodiments of the invention, “multiple” means two or more.

[0020] Unless otherwise defined, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains upon understanding this application. Unless expressly defined herein, terms (such as those defined in a general dictionary) shall be interpreted as having a meaning consistent with their meaning in the context of the relevant field and in this application, and shall not be interpreted in an idealized or overly formalistic manner.

[0021] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in some of the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0022] Furthermore, in the description of the examples, detailed descriptions of well-known related structures or functions will be omitted when it is believed that such detailed descriptions would lead to a vague interpretation of this application.

[0023] In the following description, embodiments will be described in detail with reference to the accompanying drawings. However, embodiments may be implemented in various forms and are not limited to the examples described herein.

[0024] In some exemplary embodiments of this application, a credit information inquiry control method is provided. A credit information inquiry control method is applied to, for example... Figure 1 The application environment shown. Specifically, such as Figure 1As shown, the business system 100 is used to execute a credit information query control method according to this application. Specifically, the business system 100 receives a credit information query request from a target user of the terminal 200, and parses the identifier of the target credit information and the identifier of the target user from the credit information query request; obtains a cache key based on the identifier of the target user and the identifier of the target credit information, and queries the credit information cache based on the cache key; if the target credit information is obtained from the credit information cache, the target credit information is fed back to the target user; if the target credit information is not obtained from the credit information cache, the key of the control lock is obtained based on the identifier of the target user and the identifier of the target credit information; if the control lock is obtained based on the key of the control lock, the target credit information query request is sent to the target supplier 300, and the target credit information is fed back to the target user upon receiving the target credit information fed back by the target supplier 300.

[0025] In some exemplary embodiments of this application, a credit information inquiry control method is provided. For example... Figure 2 As shown, a credit information inquiry control method includes the following steps: S201, Receive the credit query request of the target user, and parse the identifier of the target credit information and the identifier of the target user from the credit query request.

[0026] In this embodiment, when the terminal initiates a credit query request for a target user, it encapsulates the target user's identifier and the identifier of the target credit information being queried into the credit query request. When the business system receives the credit query request, it parses out the identifier of the target credit information and the identifier of the target user. The identifier of the target user can be a user ID, and the identifier of the target credit information can be a product name.

[0027] S202: Obtain the cache key based on the target user's identifier and the target credit information identifier, and query the credit information cache based on the cache key.

[0028] In one example, prior to step S202 above, a credit information query control method further includes: configuring a credit information cache and configuring a cache key for the target credit information based on the identifier of the target user and the identifier of the target credit information.

[0029] In this embodiment, a credit information cache is configured to cache various credit information data. Furthermore, a cache key for each credit information is configured based on the user's identifier and the credit information's identifier. The cache key for each credit information is used to identify the corresponding credit information from the credit information cache.

[0030] Specifically, a credit information cache is configured. Each credit information item has a cache expiration time (TTL). Within the expiration time, the same credit information query request from the same user will only be sent to the supplier once, and subsequent credit information query requests will directly return the cached credit information. The cache key generation rule is: User ID + Credit Information Product. For example: if the user ID is U123, the credit information product is CREDIT_SCORE, and the cache key is U123_CREDIT_SCORE.

[0031] In one example, each piece of information in the information cache is configured with a cache time, i.e., the validity period of the cache. The configuration method for the cache time of the target information is as follows: obtain the business scenario, information type, and update frequency of the target information; configure the cache time of the target information in the information cache according to the business scenario, information type, and update frequency of the target information.

[0032] Specifically, the cache time of the target information in the information cache is configured according to the business scenario, credit type, and update frequency of the target information. This includes: obtaining the first cache time corresponding to the business scenario, the second cache time corresponding to the credit type, and the third cache time corresponding to the update frequency of the target information; and setting the cache time of the target information in the information cache according to the first cache time, the second cache time, and the third cache time.

[0033] In this example, the cache time is dynamically calculated based on three dimensions: "business scenario + credit type + data update frequency". The cache time is not a fixed value. For example, the cache time can be set according to business needs, such as 10 minutes, 1 hour, etc.

[0034] For example, if the update frequency of a certain credit rating type suddenly increases, such as the number of updates in a single day exceeding the average by more than 200%, the TTL of that credit rating type will be automatically reduced by 50%; if there are no updates for 24 consecutive hours, the TTL will be increased by 100%.

[0035] S203, if the target information is obtained from the information cache, the target information is fed back to the target user.

[0036] In this embodiment, if the target information has been queried from an external supplier, the target information is cached in the information cache when the external supplier returns the target information. If the target information has not been queried from an external supplier, the target information is not cached in the information cache.

[0037] Upon receiving a credit query request for the target information, the system first checks the credit cache. If the target information is found in the cache, there's no need to call external supplier interfaces to request it; the information is directly read from the cache and sent back to the target user. Therefore, caching the credit information allows control over the number of times a single user queries external suppliers for the same credit data within a short period.

[0038] S204. If the target information is not obtained from the information cache, the key of the control lock is obtained according to the identifier of the target user and the target information. If the control lock is obtained according to the key of the control lock, a query request for the target information is sent to the target supplier, and the target information is fed back to the target user when the target information is received from the target supplier.

[0039] In this embodiment, if the target information is not retrieved from the information cache, it indicates that the target information has not been queried from an external supplier within the cache's validity period. In this case, a query request for the target information needs to be sent to the external target supplier. However, to prevent concurrent query requests within a short period and to intercept concurrent and duplicate query requests, a control lock is set. Only those who acquire the control lock are qualified to call the target supplier's interface. If the control lock is acquired based on its key, it means that there are no other query requests for the target information that currently exist that need to be processed, and a query request for the target information can be sent to the target supplier. Conversely, if the control lock is not acquired, it means that there are other query requests for the target information that exist that need to be processed, and the current query request needs to be queued for processing, or a query failure message can be directly sent to the target user. Therefore, by using a control lock, it is possible to ensure that only one query request is allowed to call the supplier interface under high concurrency.

[0040] In one example, the control lock includes a local lock and a distributed lock. The detection step of obtaining the control lock based on the key of the control lock includes: if the local lock is obtained based on the key of the local lock, then if the distributed lock is obtained based on the key of the distributed lock, it is determined that the control lock has been obtained based on the key of the control lock; if the local lock is not obtained based on the key of the local lock, it is determined that the control lock has not been obtained based on the key of the control lock.

[0041] In this example, to ensure that only one thread can execute at a time under high concurrency, in a traditional monolithic application deployed on a single machine, Java concurrency APIs are used for mutual exclusion control, i.e., local locks are used for mutual exclusion control. As business needs evolve, the original monolithic system is transformed into a distributed system. Because distributed systems involve multiple threads and processes distributed across different machines, the concurrency control lock strategy used in the original single-machine deployment becomes ineffective. Therefore, a cross-JVM mutual exclusion mechanism is set up to control access to shared resources, i.e., a distributed lock is configured. For the distributed lock: When each user initiates a credit query request, it first attempts to acquire the distributed lock. The key of the distributed lock is consistent with the cache key, such as both being U123_CREDIT_SCORE. If the distributed lock is successfully acquired, the process continues, querying the credit cache. If the target credit is found, it returns; otherwise, it queries the target supplier. If the distributed lock acquisition fails, a "processing" error code is returned directly to avoid concurrent queries. Distributed lock release: The distributed lock is released after the supplier query is completed, regardless of whether the query succeeds or fails.

[0042] Specifically, a layered lock architecture is used to address the inefficiencies and risks associated with traditional distributed locks.

[0043] The first layer is the local lock: Within the same application instance, for the same "user-credit" credit query request, a local lock is first acquired, based on Java ReentrantLock or Redis local caching. If the acquisition is successful, a distributed lock request is then initiated; if it fails, it means that the same credit query request is already being processed in this instance, and the instance directly waits for the reuse result after the local lock is released, reducing the number of distributed lock calls, thereby improving performance and reducing Redis pressure.

[0044] The second layer, distributed locks, avoids lock failure due to a single Redis node failure by employing the Redis red lock mechanism, requiring at least three independent Redis nodes. A credit query request must acquire locks on at least two nodes to be considered successful, thus ensuring the reliability of the distributed lock. The distributed lock timeout is dynamically calculated: based on the average time of the last 10 credit queries for that user, multiplied by 1.5, the query timeout is dynamically calculated. For example, if the average time is 200ms, the timeout is set to 300ms to prevent premature lock release due to excessively long query times.

[0045] In addition, a request queuing mechanism is configured. For information query requests that fail to acquire a local lock or distributed lock, instead of directly returning an error, they are added to a local queue cache and responded to in batches after the current information query is completed, improving the user experience. Specifically, each "user-information" corresponds to a blocking queue. When lock acquisition (local or distributed lock) fails, the information query request is encapsulated as a task and added to the blocking queue, and a "queuing" status message is returned to the user. The status message may also include the queue position of the information query request. When an information query request holding a lock (local or distributed lock) completes the query, the blocking queue is traversed, and the results are responded to in batches to the queued requests. Queue timeout control: If a task is not processed within 500ms after being enqueued, a "processing timeout" message is automatically returned to avoid infinite waiting.

[0046] The aforementioned credit information query control method includes: receiving a credit information query request from a target user; parsing the identifier of the target credit information and the identifier of the target user from the credit information query request; obtaining a cache key based on the identifier of the target user and the identifier of the target credit information; querying the credit information cache based on the cache key; if the target credit information is obtained from the credit information cache, then feeding back the target credit information to the target user; if the target credit information is not obtained from the credit information cache, then obtaining a control lock key based on the identifier of the target user and the identifier of the target credit information; if the control lock is obtained based on the control lock key, then sending a query request for the target credit information to the target supplier, and feeding back the target credit information to the target user upon receiving feedback from the target supplier. Therefore, by caching credit information, the number of times the same user queries the supplier for the same credit information data within a short period is controlled. Furthermore, by using a control lock, only one query request is allowed to call the supplier interface under high concurrency.

[0047] In one embodiment, after the step of sending a query request for target credit information to the target supplier in step S204 above, a credit information query control method further includes: if querying the target credit information from the target supplier fails, obtaining a query failure error code; obtaining the type of the error code, and if the type of the error code is a temporary error, obtaining the load information of the target supplier; obtaining a basic threshold based on the type of the error code, and obtaining an adjustment coefficient based on the load information of the target supplier; determining a dynamic threshold based on the basic threshold and the adjustment coefficient; and sending a query request for target credit information to the target supplier again based on the dynamic threshold.

[0048] In this embodiment, a rate-limiting threshold is set to control the number of times query requests for target information are sent to the target supplier. Unlike existing rate-limiting thresholds which are fixed values, this embodiment uses a dynamic threshold. Specifically, it is adjusted in real-time based on "supplier load + error code type". A base threshold is configured based on the error code type, and an adjustment coefficient is configured based on the target supplier's load. After obtaining the base threshold based on the error code type, the base threshold is adjusted using the adjustment coefficient corresponding to the target supplier's load to obtain the dynamic threshold. Then, the dynamic threshold is used to control the number of query requests for target information sent to the target supplier.

[0049] Specifically, the response time and error code type of the supplier interface are collected in real time. A supplier interface response time > 500ms is identified as high load. Error codes are divided into temporary errors and permanent errors. The dynamic threshold is calculated as follows: Dynamic Threshold = Base Threshold × Adjustment Coefficient. The adjustment coefficient can be configured within the range of (0.5, 2.0). For permanent errors, the dynamic threshold is directly set to 0, disabling any retries.

[0050] The error codes include the types shown in the table below: Example: Error code C5 is a temporary error, and the base threshold for error code C5 is 5 times / hour. If the supplier load is high, such as a response time of 600ms, and the adjustment factor is configured to 0.6, then the dynamic threshold is 3 times / hour. If the supplier load is low, such as a response time of 200ms, and the adjustment factor is configured to 1.5, then the dynamic threshold is 7 times / hour.

[0051] In one example, the above-mentioned method of resending the target credit information query request to the target supplier based on a dynamic threshold includes: obtaining the target supplier's health status information when the number of target credit information query requests does not exceed the dynamic threshold; resending the target credit information query request to the target supplier when the health status information meets the set health conditions; and sending the target credit information query request to alternative suppliers when the health status information does not meet the set health conditions. When the number of target credit information query requests exceeds the dynamic threshold, a rate limiting prompt is sent to the target user. The health status information includes the interface error rate and / or interface response time, and the set health conditions include the set values ​​for the interface error rate and / or the set values ​​for the interface response time.

[0052] In this example, before sending another query request for target credit information to the target supplier, it checks whether the number of query requests for target credit information has exceeded a dynamic threshold. If so, rate limiting is applied directly. If not, the health status of the target supplier needs to be further assessed. If its health status does not meet the set health conditions, alternative suppliers are identified, and query requests are sent to the alternative suppliers. This can be achieved by configuring a multi-supplier priority list and routing query requests to the healthiest alternative supplier.

[0053] Specifically, a multi-vendor failover mechanism is configured. Design logic: For example, if the primary vendor's interface error rate is ≥30% within 1 minute, automatically switch to a backup vendor, and simultaneously trigger rate limiting on the primary vendor to avoid invalid requests. The specific implementation is as follows: Configure a multi-vendor priority list, such as primary vendor A → alternative vendor B → alternative vendor C. Monitor the error rate and response time of each vendor in real time. When the primary vendor fails to meet the set health conditions, such as an error rate <30% and a response time <500ms, trigger failover. Route query requests to the other healthy vendor with the highest priority in the multi-vendor priority list, and switch back to the primary vendor through "canary phase switching" after the primary vendor recovers its health. See the sub-processes for error code rate limiting and failover. Figure 3 As shown.

[0054] Specifically, error code rate limiting is implemented by recording the number of failures for each user and each error code. For example, a Redis record key is `LIMIT_U123_10001`, and the value is the current count. If a user initiates another credit query request and encounters the same error code, the count is checked to see if it has exceeded the configured limit. If not, the count is incremented by 1, and retrying is allowed. If the limit is exceeded, the error code is returned directly, and no further requests are made to the provider. An example of error code rate limiting configuration is as follows: [ { "errorCode":"10001", / / Error code; "count":2, / / The number of times this error code can be queried within a certain period of time; "time":1, / / Time; "timeUnit":"DAY" / / Time unit }, { "errorCode":"10002"; "count":1; "time":1; "timeUnit":"HOUR"; } ].

[0055] The specific implementation process is as follows: Figure 4 As shown.

[0056] The error code rate limiting execution process is as follows: Figure 5 As shown.

[0057] In summary, the credit information inquiry control method of this application achieves the following through a triple mechanism of "caching-locking-rate limiting": a) The same user can only query the same information once within the cache validity period; b) Under high concurrency, only one credit information query request is allowed to actually call the supplier interface; c) Implement precise rate limiting for abnormal error codes based on user, error code, and time granularity to suppress retry storms; d) Reduce the overall number of calls from suppliers and improve system throughput and stability.

[0058] It should be understood that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order constraint on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0059] In some exemplary embodiments of this application, such as Figure 6 As shown, a credit information query control device includes a parsing module 601, a query module 602, a first feedback module 603, and a second feedback module 604. The parsing module 601 receives a credit information query request from a target user and parses the identifier of the target credit information and the identifier of the target user from the query request. The query module 602 obtains a cache key based on the identifier of the target user and the identifier of the target credit information, and queries the credit information cache based on the cache key. The first feedback module 603, if the target credit information is obtained from the credit information cache, provides feedback on the target credit information to the target user. The second feedback module 604, if the target credit information is not obtained from the credit information cache, obtains a control lock key based on the identifier of the target user and the identifier of the target credit information; if the control lock is obtained based on the control lock key, it sends a query request for the target credit information to the target supplier, and provides feedback on the target credit information to the target user upon receiving feedback on the target credit information from the target supplier.

[0060] In one example, a credit information query control device further includes a first configuration module for configuring a credit information cache and configuring a cache key for the target credit information based on the identifier of the target user and the identifier of the target credit information.

[0061] In one example, a credit information query control device further includes a second configuration module, used to obtain the business scenario, credit type, and update frequency of the target credit information; and to configure the caching time of the target credit information in the credit information cache according to the business scenario, credit type, and update frequency of the target credit information.

[0062] In one example, the cache time of the target information in the information cache is configured according to the business scenario, credit type, and update frequency of the target information. This includes: obtaining the first cache time corresponding to the business scenario, the second cache time corresponding to the credit type, and the third cache time corresponding to the update frequency of the target information; and setting the cache time of the target information in the information cache according to the first cache time, the second cache time, and the third cache time.

[0063] In one example, a credit information query control device further includes a retry module, configured to: if querying the target credit information from the target supplier fails, obtain an error code indicating the query failure; obtain the type of the error code; if the error code is a temporary error, obtain the load information of the target supplier; obtain a basic threshold based on the type of the error code, and obtain an adjustment coefficient based on the load information of the target supplier; determine a dynamic threshold based on the basic threshold and the adjustment coefficient; and resend the query request for the target credit information to the target supplier based on the dynamic threshold.

[0064] In one example, the process of resending a target credit information query request to the target supplier based on a dynamic threshold includes: obtaining the target supplier's health status information when the number of target credit information query requests does not exceed the dynamic threshold; resending the target credit information query request to the target supplier when the health status information meets the set health conditions; and sending the target credit information query request to alternative suppliers when the health status information does not meet the set health conditions. When the number of target credit information query requests exceeds the dynamic threshold, a rate limiting warning is sent to the target user. The health status information includes the interface error rate and / or interface response time, and the set health conditions include the set values ​​for the interface error rate and / or the set values ​​for the interface response time.

[0065] In one example, the control lock includes a local lock and a distributed lock. A credit query control device also includes a control lock acquisition module, which is used to determine that the control lock has been acquired based on the control lock key if the local lock is acquired based on the key of the local lock and the distributed lock is acquired based on the key of the distributed lock; and to determine that the control lock has not been acquired based on the control lock key if the local lock is not acquired based on the key of the local lock.

[0066] For specific limitations regarding a credit information inquiry control device, please refer to the limitations of a credit information inquiry control method described above, which will not be repeated here. Each module in the aforementioned credit information inquiry control device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the electronic device in hardware form, or stored in the memory of the electronic device in software form, so that the processor can call and execute the operations corresponding to each module.

[0067] In some exemplary embodiments of this application, an electronic device is provided, which may be a server of a business system 100, and its internal structure diagram may be as follows: Figure 7As shown, this electronic device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and the database. The internal memory provides the environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores information data and user data. The network interface communicates with external terminals via a network. When the computer program is executed by the processor, it implements an information query control method.

[0068] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0069] In some exemplary embodiments of this application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of a credit query control method in any of the above exemplary embodiments.

[0070] In some exemplary embodiments of this application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of a credit information query control method in any of the exemplary embodiments described above.

[0071] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0072] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0073] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A credit inquiry control method characterized by comprising: The method comprises: receiving a credit query request of a target user, and parsing an identification of a target credit and an identification of the target user from the credit query request; obtaining a cache key according to the identification of the target user and the identification of the target credit, and querying a credit cache according to the cache key; if the target credit is obtained from the credit cache, feeding back the target credit to the target user; if the target credit is not obtained from the credit cache, obtaining a key of a control lock according to the identification of the target user and the identification of the target credit, if the control lock is obtained according to the key of the control lock, sending a query request of the target credit to a target supplier, and feeding back the target credit to the target user when the target credit fed back by the target supplier is received.

2. The method of claim 1, wherein, The method further comprises: configuring the credit cache, and configuring the cache key of the target credit according to the identification of the target user and the identification of the target credit.

3. The method according to claim 1 or 2, characterized in that, The method further comprises: obtaining a business scenario of the target credit, a credit type and an update frequency of the target credit; configuring a cache time of the target credit in the credit cache according to the business scenario, the credit type and the update frequency of the target credit.

4. The method of claim 3, wherein, The configuration of the cache time of the target credit in the credit cache according to the business scenario, the credit type and the update frequency of the target credit comprises: obtaining a first cache time corresponding to the business scenario, a second cache time corresponding to the credit type and a third cache time corresponding to the update frequency of the target credit; configuring the cache time of the target credit in the credit cache according to the first cache time, the second cache time and the third cache time.

5. The method of claim 1, wherein, The method further comprises: if the target credit fails to be queried from the target supplier, obtaining an error code of the query failure; obtaining a type of the error code, if the type of the error code is a temporary error, obtaining load information of the target supplier; obtaining a basic threshold value according to the type of the error code, and obtaining an adjustment coefficient according to the load information of the target supplier; determining a dynamic threshold value according to the basic threshold value and the adjustment coefficient; sending the query request of the target credit to the target supplier again according to the dynamic threshold value.

6. The method of claim 5, wherein, The sending of the query request of the target credit to the target supplier again according to the dynamic threshold value comprises: if the number of request times of the query request of the target credit does not exceed the dynamic threshold value, obtaining health state information of the target supplier, if the health state information satisfies a set health condition, sending the query request of the target credit to the target supplier again, and if the health state information does not satisfy the set health condition, sending the query request of the target credit to an alternative supplier; if the number of request times of the query request of the target credit exceeds the dynamic threshold value, feeding back flow limiting prompt information to the target user; wherein the health state information comprises an interface error rate and / or an interface response time, and the set health condition comprises a set value of the interface error rate and / or a set value of the interface response time.

7. The method of claim 1, wherein, The control lock comprises a local lock and a distributed lock, and the method further comprises: if the local lock is acquired according to the key of the local lock, determining whether the control lock is acquired according to the key of the control lock when the distributed lock is acquired according to the key of the distributed lock; if the local lock is not acquired according to the key of the local lock, determining whether the control lock is acquired according to the key of the control lock.

8. A credit inquiry control device characterized by comprising: The device comprises: a parsing module, configured to receive a credit query request of a target user, and parse an identification of a target credit and an identification of the target user from the credit query request; a query module, configured to acquire a cache key according to the identification of the target user and the identification of the target credit, and query a credit cache according to the cache key; a first feedback module, configured to feed back the target credit to the target user if the target credit is acquired from the credit cache; a second feedback module, configured to acquire a key of a control lock according to the identification of the target user and the identification of the target credit if the target credit is not acquired from the credit cache, feed back a query request of the target credit to a target supplier if the control lock is acquired according to the key of the control lock, and feed back the target credit to the target user when the target credit fed back by the target supplier is received.

9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to realize the steps of the method in any one of claims 1 to 7.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the steps of the method in any one of claims 1 to 7.