Resource calling method and device

By combining database and cache technology, distributed lock services are provided, distributed lock sharing problems in multi-local deployments are solved, efficient lock management is achieved, system complexity and operation and maintenance costs are reduced, and performance and reliability are improved. .

CN119311386APending Publication Date: 2025-01-14SICHUAN RURAL COMMERCIAL UNITED BANK CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411341597.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

In information systems deployed in multiple places and multiple places, it is difficult to achieve cross-regional or cross-unit sharing of distributed locks. The existing technology is complex and costly, making it difficult to meet the reliability and performance requirements of distributed locks.

Method used

By combining database and caching technology, distributed lock services are provided, and distributed lock components are used for locking, unlocking and lock checking, which avoids dependence on third-party products, and realizes lock monitoring, notification and failure scanning mechanisms, reducing the lock System complexity and operation and maintenance costs.

Benefits of technology

While ensuring the reliability of distributed lock functions, it improves performance and system reliability, reduces the complexity of system design, construction and maintenance, and meets business needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311386A_ABST
    Figure CN119311386A_ABST
Patent Text Reader

Abstract

The invention provides a resource calling method and device. The method comprises the following steps: calling a distributed lock service through a first distributed lock component to lock a target resource; wherein the distributed lock service is a micro-service for managing a lock by using a database and a cache technology; obtaining a first target lock of the business processing application to the target resource; in the resource calling process, lock checking is carried out through the first distributed lock component, or the resource service type application is triggered to carry out lock checking through the second distributed lock component, so that the target resource is called under the condition that the business processing type application holds the first target lock. The distributed lock service is realized by comprehensively using the database, the micro-service and the cache technology, the lock operation is carried out under the condition of not introducing a third-party product, the complexity of the system in design, construction and maintenance is reduced and the reliability is improved while the business function requirements are met, and the performance can be improved by fully utilizing the cache.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a resource calling method and device. Background Art

[0002] During the resource call process, distributed locks are used to ensure that concurrent access to the same resource is coordinated between multiple machines or multiple processes to avoid data competition and inconsistency issues. Distributed locks are a mechanism used to control access to shared resources in a distributed system. This mechanism ensures that only the application instance (process) that obtains the lock can write, while other instances can only read, thereby avoiding damage to shared resources and ensuring that each application instance can read the latest data.

[0003] An information system with multi-site, multi-active deployment and distributed architecture often adopts a unitized design, splitting data into deployment units in different regions according to certain dimensions, deploying the same application in each deployment unit, and routing transaction traffic to different deployment units for processing according to certain rules. Under this architecture, the use of Redis (RemoteDictionary Server, remote data service) to implement a distributed lock mechanism may cause the lock to fail due to the loss of lock information, because it is difficult to share locks across regions or units when each deployment unit independently deploys a Redis cluster. Implementing a distributed lock mechanism through a database often requires the introduction of additional monitoring and notification mechanisms, which not only reduces performance but also increases the complexity of implementation. Implementing a distributed lock mechanism by introducing third-party products, such as Zookeeper, requires the deployment of corresponding third-party product clusters, which increases additional maintenance costs and system complexity. Summary of the invention

[0004] The present disclosure provides a resource calling method and device to solve one of the technical problems in the related art at least to a certain extent. The technical solution of the present disclosure is as follows:

[0005] According to a first aspect of an embodiment of the present disclosure, a resource calling method is provided, which is applied to a business processing application, comprising: locking a target resource by calling a distributed lock service through a first distributed lock component; wherein the distributed lock service is a microservice that manages locks using database and cache technology, and the first distributed lock component is a client library or software development kit SDK of the distributed lock service introduced by the business processing application; obtaining a first target lock of the target resource by the business processing application; performing a lock check through the first distributed lock component, or triggering a resource service application to perform a lock check through a second distributed lock component, so as to call the target resource when the business processing application holds the first target lock; wherein the second distributed lock component is a client library or SDK of the distributed lock service introduced by the resource service application.

[0006] According to a second aspect of an embodiment of the present disclosure, a resource calling device is provided, which is applied to a business processing application, and includes: a locking module, which is used to lock a target resource by calling a distributed lock service through a first distributed lock component; wherein the distributed lock service is a microservice that manages locks using database and cache technology, and the first distributed lock component is a client library or software development kit SDK of the distributed lock service introduced by the business processing application; an acquisition module, which is used to obtain a first target lock of the target resource by the business processing application; a calling module, which is used to perform a lock check through the first distributed lock component, or trigger a resource service application to perform a lock check through a second distributed lock component, so as to call the target resource when the business processing application holds the first target lock; wherein the second distributed lock component is a client library or SDK of the distributed lock service introduced by the resource service application.

[0007] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the resource calling method as described in the embodiment of the first aspect of the present disclosure.

[0008] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute the resource calling method as described in the embodiment of the first aspect of the present disclosure.

[0009] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including: a computer program, wherein when the computer program is executed by a processor, the resource calling method as described in the embodiment of the first aspect of the present disclosure is implemented.

[0010] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0011] In the technical scheme, the target resource is locked by calling the distributed lock service through the first distributed lock component; wherein the distributed lock service is a microservice that uses database and cache technology to manage locks, and the first distributed lock component is a client library or software development kit SDK of the distributed lock service introduced by the business processing application; the first target lock of the target resource by the business processing application is obtained; the lock check is performed through the first distributed lock component, or the resource service application is triggered to perform the lock check through the second distributed lock component, so as to call the target resource when the business processing application holds the first target lock; wherein the second distributed lock component is a distributed The client library or SDK of the lock service, thus, in the process of resource calling, the distributed lock service is realized by comprehensively using database, microservice and cache technology, and the distributed lock service provides external APIs such as locking, unlocking, lock checking, etc., which functionally meet the business needs; without introducing third-party products, such as Zookeeper, the lock monitoring, notification and failure scanning mechanisms are realized, which reduces the implementation complexity of the system while meeting the business needs, improves the reliability and maintainability of the system, and reduces the operation and maintenance costs; while ensuring the reliability of the distributed lock function (based on the database), the performance can be improved by making full use of the cache.

[0012] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0014] Figure 1 is a flowchart of a resource calling method shown in the first embodiment of the present disclosure;

[0015] Figure 2 is a flowchart of a resource calling method shown in the second embodiment of the present disclosure;

[0016] Figure 3 is a flowchart of a resource calling method shown in the third embodiment of the present disclosure;

[0017] Figure 4 is a flowchart of a resource calling method shown in the fourth embodiment of the present disclosure;

[0018] Figure 5is a flowchart of a resource calling method shown in the fifth embodiment of the present disclosure;

[0019] Figure 6 is a schematic diagram of the principle of resource calling provided by the sixth embodiment of the present disclosure;

[0020] Figure 7 It is a flow chart of a business processing application reading a local resource of a device where the business processing application is located, provided by the seventh embodiment of the present disclosure;

[0021] Figure 8 It is a schematic diagram of a process of a business processing application modifying resources within a resource service application provided by an eighth embodiment of the present disclosure;

[0022] Fig. 9 is a schematic diagram of the structure of a resource calling device shown in the ninth embodiment of the present disclosure;

[0023] Fig.10 It is a schematic structural diagram of an electronic device 1000 shown in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0024] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

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

[0026] It should be noted that in the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information are all carried out with the user's consent, and are in compliance with relevant laws and regulations and do not violate public order and good morals.

[0027] In distributed systems in the banking and other financial industries, distributed locks are often used in scenarios such as resource mutual exclusion, task coordination, and fault recovery in a distributed environment. Typical usage scenarios in a distributed banking core system are as follows:

[0028] 1. Mutually exclusive control of account operations:

[0029] Ensure that only one operation can modify the balance of an account at the same time to avoid data inconsistency caused by concurrent operations. For example, if user A and user B transfer money to user C's account at the same time, the order of the transfer operation can be ensured through distributed locks.

[0030] 2. Atomicity of transaction processing:

[0031] When processing distributed transactions across multiple systems, use distributed locks to ensure the atomicity of the entire transaction process and avoid partial success and partial failure. For example, the linkage operation between the payment system and the accounting system requires distributed locks to ensure consistency between the two sides.

[0032] 3. Coordination of time-limited tasks:

[0033] There are many time-limited tasks in the banking system (such as batch processing, report generation, etc.) that require multiple services to work together. Distributed locks can ensure that only one instance of these tasks is running in multiple nodes to avoid repeated execution.

[0034] 4. Fault recovery and high availability:

[0035] In a distributed environment, the locks of certain resources may not be released due to node failures. The lease and renewal mechanism of distributed locks can achieve automatic recovery and failover to ensure high availability of the system.

[0036] In the related art, there are many ways to implement distributed locks, usually using Redis, database locks, Zookeeper distributed locks, etc., but these implementation methods are not suitable for information systems deployed in multi-site multi-active architectures. To this end, the present disclosure proposes a resource calling method and device to optimize and improve distributed locks for multi-site multi-active deployment architectures.

[0037] The resource calling method and device according to the embodiments of the present disclosure are described below with reference to the accompanying drawings.

[0038] Figure 1 It is a flowchart of the resource calling method shown in the first embodiment of the present disclosure.

[0039] It should be noted that the resource calling method of the embodiment of the present disclosure is applied to a business processing application, wherein the business processing application is an application that performs business logic processing.

[0040] like Figure 1 As shown, the resource calling method includes the following steps:

[0041] Step 101: Lock a target resource by calling a distributed lock service through a first distributed lock component.

[0042] Among them, the distributed lock service is a microservice that uses database and cache technology to manage locks, and the first distributed lock component is a client library or SDK (Software Development Kit) of the distributed lock service introduced by the business processing application.

[0043] In order to reduce the implementation complexity of the distributed lock mechanism under the multi-site multi-active architecture, the present disclosure uses a combination of database, microservices and cache technology to implement a distributed lock service, and the distributed lock service provides external APIs such as locking, unlocking, and lock checking to meet business needs in terms of functionality. Accordingly, business processing applications can interact with the distributed lock service by introducing a client library or SDK for the distributed lock service, i.e., the first distributed lock component, using the API provided by the first distributed lock component to call the distributed lock service through the first distributed lock component to perform lock operations such as locking, unlocking, and lock checking when executing business logic processing, to ensure data consistency.

[0044] In addition, the present disclosure uses a combination of database, microservices and cache technology to implement a distributed lock service. In addition to being able to functionally meet business needs, it can also improve performance by making full use of the cache while ensuring the reliability of the distributed lock function (based on the database).

[0045] The target resource is a resource that needs to be locked and is accessed by a business processing application, such as a business parameter.

[0046] It should be noted that the target resource may be a local resource or a resource within a resource service application, and this disclosure does not impose any limitation on this.

[0047] Among them, resource service applications are applications that provide operation services for certain shared resources. These shared resources can be database tables, files, third-party system interfaces, etc. Since these shared resources may be accessed by multiple systems or applications at the same time, a certain mechanism is needed to ensure data consistency and system stability. Locks are one of the commonly used mechanisms to control concurrent access to shared resources.

[0048] In order to prevent multiple machines or multiple processes from modifying the same resource at the same time, thereby avoiding data corruption or inconsistency, as a possible implementation method, before the business processing application calls the target resource, the target resource can be locked by calling the distributed lock service through the first distributed lock component.

[0049] Step 102: Acquire a first target lock of a business processing application on a target resource.

[0050] It should be noted that in the embodiment of the present disclosure, the business processing application can only call the target resource when it holds the lock of the target resource. Therefore, the business processing application needs to obtain the first target lock of the target resource by the business processing application before calling the target resource.

[0051] Since the business processing application can use the API provided by the first distributed lock component to interact with the distributed lock service, as a possible implementation method, the business processing application can obtain the first target lock of the business processing application for the target resource from the distributed lock service through the API provided by the first distributed lock component.

[0052] Step 103: Perform a lock check through the first distributed lock component, or trigger the resource service application to perform a lock check through the second distributed lock component, so as to call the target resource when the business processing application holds the first target lock.

[0053] Among them, the second distributed lock component is a client library or SDK of the distributed lock service introduced by the resource service application.

[0054] In order to prevent accidental lock loss or release between acquiring the lock and calling the resource, in the embodiment of the present disclosure, when calling the target resource, the business processing application needs to perform a lock check first, and then call the target resource if the lock check passes.

[0055] As a possible implementation method, the business processing application can perform a lock check through the first distributed lock component, or trigger the resource service application to perform a lock check through the second distributed lock component to confirm whether the business processing application still holds the first target lock of the business processing application for the target resource, and then call the target resource when the business processing application still holds the first target lock.

[0056] The resource calling method of the embodiment of the present disclosure calls the distributed lock service through the first distributed lock component to lock the target resource; wherein the distributed lock service is a microservice that uses database and cache technology to manage locks, and the first distributed lock component is a client library or SDK of the distributed lock service introduced by the business processing application; obtains the first target lock of the target resource by the business processing application; performs a lock check through the first distributed lock component, or triggers the resource service application to perform a lock check through the second distributed lock component, so as to call the target resource when the business processing application holds the first target lock; wherein the second distributed lock component is a client library or SDK of the distributed lock service introduced by the resource service application, thereby, in the resource calling process, the distributed lock service is realized by comprehensively using the database, microservice and cache technology, and the lock operation is performed without introducing third-party products, which meets the business function requirements while reducing the complexity of the system in design, construction and maintenance, improving reliability, and improving performance by making full use of the cache.

[0057] In order to clearly illustrate how the target resource is locked by calling the distributed lock service through the first distributed lock component in the above embodiment, the present disclosure proposes another resource calling method.

[0058] Figure 2 It is a flowchart of a resource calling method shown in the second embodiment of the present disclosure.

[0059] Similarly, the resource calling method of the embodiment of the present disclosure is applied to business processing applications.

[0060] like Figure 2 As shown, the resource calling method includes the following steps:

[0061] Step 201, a lock request for locking a target resource is sent to a distributed lock service through an API provided by a first distributed lock component, so that the distributed lock service queries the lock information of the target resource from the target cache based on the resource identifier of the target resource carried in the lock request, so as to complete the locking of the target resource through database operations when there is no second target lock that conflicts with the first target lock or the target resource has a second target lock but the second target lock has expired.

[0062] The target cache is used to store the lock information of the resource. Optionally, the target cache can be a database table.

[0063] As a possible implementation method, the business processing application can interact with the distributed lock service through the API provided by the first distributed lock component, and send a lock request to the distributed lock service for requesting to lock the target resource. Among them, the lock request carries the resource identifier of the target resource. Then, the distributed lock service can query the lock information of the target resource from the target cache based on the resource identifier of the target resource carried in the lock request, so as to complete the locking of the target resource through database operations when the target resource does not have a second target lock that conflicts with the first target lock or the target resource has a second target lock but the second target lock has expired. Thus, the distributed lock service determines whether the business processing application can lock the target resource by querying the lock information of the target resource in the target cache, thereby avoiding problems such as deadlock and lock conflict.

[0064] In order to optimize resource synchronization, in this disclosure, locks are divided into three types: read locks, write locks, and exclusive locks. Read locks allow the holder to read resources. Write locks not only allow the holder to write data, but also allow other read lock holders to read resources in parallel. Exclusive locks ensure that when it is held, no other read-write locks are allowed to operate on the locked resources.

[0065] As an example, assuming that the target lock is a write lock, if the distributed lock service queries from the target cache based on the resource identifier of the target resource carried in the lock request, all the locks existing on the target resource are read locks. Since the write lock allows other read lock holders to read the resource in parallel, the locks existing on the target resource at this time do not conflict with the target lock, that is, the target resource does not have a second target lock that conflicts with the first target lock. Therefore, the distributed lock service can complete the locking of the target resource by the business processing application by using database operations in the target cache, such as a database table.

[0066] Alternatively, if the distributed lock service queries the target resource from the target cache based on the resource identifier of the target resource carried in the lock request and finds that there is a write lock in the locks existing on the target resource, then the write lock existing on the target resource conflicts with the target lock, and the business processing application cannot lock the target resource. However, if the write lock existing on the target resource has expired, the business processing application can still call the distributed lock service through the first distributed lock component to lock the target resource, so that the distributed lock service can add the lock information of the first target lock of the target resource of the business processing application in the target cache, such as a database table, by using database operations, and complete the locking of the target resource by the business processing application.

[0067] It should be noted that in the read-write separation scenario, the read lock holder queries the read database, and the write lock holder makes modifications in the write database. In order to ensure that the resources called by the write lock holder and the read lock holder are consistent, in this disclosure, the distributed lock service also needs to switch the database to the write database for query through all read lock holders after the write lock is locked.

[0068] As a possible implementation method, after the distributed lock service completes locking the target resource, if there is a third target lock compatible with the first target lock for the target resource and the third target lock has not expired, the holder of the third target lock is determined based on the lock information of the third target lock queried from the target cache, and a first notification message is sent to the holder of the third target lock, wherein the first notification message is used to notify the holder of the third target lock to switch databases.

[0069] As an example, in a read-write separation scenario, some business processing applications hold a read lock on the target resource. When the business processing application wants to modify the target resource, it will call the distributed lock service through the first distributed lock component (the client library or SDK of the distributed lock service that should be introduced by this business processing application) to lock the target resource. After the locking is completed, the distributed lock service needs to send a first notification message to the business processing application holding the read lock of the target resource to notify them to switch the query data source from the read library to the write library to ensure data consistency.

[0070] In summary, in order to improve the performance of distributed lock operations, the present disclosure implements a cache strategy in the distributed lock service. When locking, the lock status is first queried from the cache, and when the conditions are met, a database write operation is performed to complete the lock. Then the lock holder is queried from the cache (if it misses, the database query is performed again), and notified one by one. As a result, the performance of read-only operations such as lock checking and lock query is greatly improved.

[0071] Step 202: Acquire a first target lock of a business processing application on a target resource.

[0072] Step 203, in response to calling the target resource, performing a lock check through the first distributed lock component, or triggering the resource service application to perform a lock check through the second distributed lock component, so as to call the target resource when the business processing application holds the first target lock.

[0073] It should be noted that the execution process of steps 202 to 203 can be implemented in any manner in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0074] The resource calling method of the disclosed embodiment sends a lock request for requesting to lock the target resource to the distributed lock service through the API provided by the first distributed lock component, so that the distributed lock service queries the lock information of the target resource from the target cache based on the resource identifier of the target resource carried in the lock request, so as to complete the locking of the target resource through database operation when there is no second target lock that conflicts with the first target lock in the target resource or the second target lock exists in the target resource but the second target lock has expired, and when the locking is successful, registers the lock information of the first target lock of the target resource by the business processing application in the target cache; wherein the target cache is used to store the lock information of the resource, thereby the business processing application can A lock request is sent to the distributed lock service through the API provided by the first distributed lock component to complete the locking of the target resource; wherein, during the locking process, the distributed lock service determines whether the business processing application can lock the target resource by querying the lock information of the target resource in the target cache, thereby avoiding problems such as deadlock and lock conflict; in addition, after the locking is completed, the distributed lock service queries the lock information of the target resource from the target cache, and sends a first notification message to the holder of the third target lock that is compatible with the first target lock on the target resource to notify the holder of the third target lock to switch the database, thereby ensuring that the resources called by the write lock holder and the read lock holder in the read-write separation scenario are consistent, and at the same time, the cache can be fully utilized to improve performance.

[0075] In order to clearly explain how to perform a lock check through the first distributed lock component in the above embodiments, or trigger a resource service application to perform a lock check through the second distributed lock component, the present disclosure proposes another resource calling method.

[0076] Figure 3 It is a flowchart of a resource calling method shown in the third embodiment of the present disclosure.

[0077] Similarly, the resource calling method of the embodiment of the present disclosure is applied to business processing applications.

[0078] like Figure 3 As shown, the resource calling method includes the following steps:

[0079] Step 301: Lock a target resource by calling a distributed lock service through a first distributed lock component.

[0080] Step 302: Acquire a first target lock of a target resource by a business processing application.

[0081] Step 303: In response to the target resource being a local resource, when calling the target resource, checking through the first distributed lock component whether the business processing application holds the first target lock.

[0082] In the embodiment of the present disclosure, when the target resource is a local resource, the business processing application performs a lock check through the first distributed lock component. Optionally, the business processing application can check whether the business processing application holds the first target lock through the first distributed lock component when calling the target resource.

[0083] Step 304 , in response to the target resource being a resource within the resource service application, triggering the resource service application to check whether the business processing application holds the first target lock through the second distributed lock component when calling the target resource.

[0084] In the embodiment of the present disclosure, when the target resource is a resource within a resource service application, the business processing application triggers the resource service application to perform a lock check through the second distributed lock component. Optionally, the business processing application can trigger the resource service application to check whether the business processing application holds the first target lock through the second distributed lock component when calling the target resource.

[0085] Step 305: calling the target resource when the business processing application holds the first target lock.

[0086] It should be noted that the execution process of steps 301 to 302 and step 305 can be implemented in any way in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0087] The resource calling method of the embodiment of the present disclosure, in response to the target resource being a local resource, checks whether the business processing application holds the first target lock through the first distributed lock component when calling the target resource; in response to the target resource being a resource within a resource service application, triggers the resource service application to check whether the business processing application holds the first target lock through the second distributed lock component when calling the target resource. Therefore, according to different situations, the business processing application can perform a lock check through the first distributed lock component, or trigger the resource service application to perform a lock check through the second distributed lock component.

[0088] In order to clearly explain how to call the target resource when the business processing application holds the first target lock in the above embodiment, the present disclosure proposes another resource calling method.

[0089] Figure 4 It is a flowchart of a resource calling method shown in the fourth embodiment of the present disclosure.

[0090] Similarly, the resource calling method of the embodiment of the present disclosure is applied to business processing applications. In the embodiment of the present disclosure, the lock type of the first target lock includes a read lock, a write lock and an exclusive lock.

[0091] like Figure 4As shown, the resource calling method includes the following steps:

[0092] Step 401: Lock a target resource by calling a distributed lock service through a first distributed lock component.

[0093] Step 402: Acquire a first target lock of a business processing application on a target resource.

[0094] Step 403: In response to calling the target resource, a lock check is performed through the first distributed lock component, or the resource service application is triggered to perform a lock check through the second distributed lock component.

[0095] Step 404 , in response to the first target lock being a read lock, reading the target resource when the business processing application holds the first target lock.

[0096] When the business processing application performs a read operation on the target resource in response to the first target lock being a read lock, business processing applications other than the business processing application are allowed to call the target resource.

[0097] In the present disclosure, in order to optimize resource synchronization, the read lock not only allows the holder to read data, but also allows other read lock holders to read resources in parallel, and allows other write lock holders to write to the target resource in parallel.

[0098] It should be noted that write locks are not compatible with each other. When a target resource has a write lock, adding a write lock to the target resource later requires waiting for the previous write lock to be unlocked.

[0099] Step 405 , in response to the first target lock being a write lock, when the business processing application holds the first target lock, a write operation is performed on the target resource.

[0100] When the business processing application performs a write operation on the target resource in response to the first target lock being a write lock, only business processing applications other than the business processing application are allowed to read the target resource while holding a read lock on the target resource.

[0101] In the present disclosure, in order to optimize resource synchronization, the write lock not only allows the holder to write data, but also allows other read lock holders to read resources in parallel. However, the write lock only allows other read lock holders to read resources in parallel, and it conflicts with other write locks and will not exist at the same time.

[0102] Step 406 : In response to the first target lock being an exclusive lock, invoking the target resource when the business processing application holds the first target lock.

[0103] The business processing application, in response to the first target lock being an exclusive lock, does not allow business processing applications other than the business processing application to call the target resource when calling the target resource.

[0104] In the present disclosure, an exclusive lock may also be added, and the exclusive lock can ensure that when it is held, no other read-write lock is allowed to operate (read and / or write) on the locked resource.

[0105] It should be noted that the execution process of steps 401 to 403 can be implemented in any manner in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0106] The resource calling method of the embodiment of the present disclosure reads the target resource in response to the first target lock being a read lock and the business processing application holding the first target lock; writes to the target resource in response to the first target lock being a write lock and the business processing application holding the first target lock; wherein, when the business processing application writes to the target resource, business processing applications other than the business processing application are allowed to read the target resource while holding the read lock of the target resource; and writes to the target resource in response to the first target lock being an exclusive lock and the business processing application holding the first target lock; wherein, when the business processing application writes to the target resource, business processing applications other than the business processing application are not allowed to read the target resource, thereby determining whether other business processing applications can call the target resource while holding the corresponding lock of the target resource when the business processing application calls the target resource based on whether the first target lock is a read lock, a write lock or an exclusive lock.

[0107] It should be noted that in the present disclosure, the business processing application can also release the first target lock when the call of the target resource is completed. Figure 5 This process is described below.

[0108] Figure 5 It is a flowchart of a resource calling method shown in the fifth embodiment of the present disclosure.

[0109] Similarly, the resource calling method of the embodiment of the present disclosure is applied to business processing applications.

[0110] like Figure 5 As shown, the resource calling method includes the following steps:

[0111] Step 501: Lock a target resource by calling a distributed lock service through a first distributed lock component.

[0112] Step 502: Acquire a first target lock of a business processing application on a target resource.

[0113] Step 503: In response to calling the target resource, a lock check is performed through the first distributed lock component, or the resource service application is triggered to perform a lock check through the second distributed lock component.

[0114] Step 504: In response to completing the call of the target resource, the first distributed lock component calls the distributed lock service to release the first target lock.

[0115] As a possible implementation method, the business processing application can respond to completing the call of the target resource by sending a release lock request for requesting the release of the first target lock to the distributed lock service through the API provided by the first distributed lock component, so that the distributed lock service queries the lock information of the target resource from the target cache based on the resource identifier of the target resource carried in the release lock request, so as to delete the lock information of the first target lock of the target resource of the business processing application in the target cache through database operations.

[0116] The target cache is used to store the lock information of the resource. Optionally, the target cache can be a database table.

[0117] That is to say, the business processing application can interact with the distributed lock service through the API provided by the first distributed lock component, and send a lock release request to the distributed lock service for requesting the release of the first target lock. The lock release request carries the resource identifier of the target resource. The distributed lock service can then query the lock information of the target resource from the target cache based on the resource identifier of the target resource carried in the lock release request, so as to delete the lock information of the first target lock of the target resource in the target cache by the business processing application through database operations.

[0118] It should be noted that when a business processing application modifies a target resource, other read lock holders of the target resource need to re-read the latest data to ensure data consistency. As a possible implementation method, after the distributed lock service deletes the lock information of the first target lock of the target resource by the business processing application in the target cache through a database operation, if the target resource still has a fourth target lock compatible with the first target lock and the fourth target lock has not expired, the holder of the fourth target lock is determined based on the lock information of the fourth target lock queried from the target cache, so as to send a second notification message to the holder of the fourth target lock, wherein the second notification message is used to notify the holder of the fourth target lock to reacquire the target resource.

[0119] In order to improve the performance of distributed lock operations, a cache strategy is implemented in the distributed lock service. When unlocking, the database operation is performed first to complete the unlocking, and then the lock holder is queried from the cache (if it misses, the database query is performed again) and notified one by one. As a result, the performance of read-only operations such as lock checking and lock query is greatly improved.

[0120] The resource calling method of the disclosed embodiment releases the first target lock by calling the distributed lock service through the first distributed lock component in response to completing the calling of the target resource, thereby, the business processing application can send a lock release request to the distributed lock service through the API provided by the first distributed lock component to complete the unlocking of the target resource; wherein, during the unlocking process, the distributed lock service unlocks the target resource by the business processing application by querying the lock information of the target resource in the target cache, and after the unlocking is completed, queries the lock information of the target resource from the target cache, and sends a second notification message to the holder of the fourth target lock that is compatible with the first target lock of the target resource to notify the holder of the fourth target lock to re-acquire the target resource, thereby ensuring data consistency and making full use of the cache to improve performance.

[0121] Based on any embodiment of the present disclosure, the present disclosure proposes a distributed lock implementation method that optimizes and improves a multi-site multi-active deployment architecture. The distributed lock method of the database is improved, which is mainly reflected in the following aspects:

[0122] 1) Add distributed lock services and provide APIs such as lock, unlock, lock upgrade, lock downgrade, lock check, and lock query.

[0123] 2) Distributed lock service provides necessary services such as lock management, lock monitoring, lock notification, lock timeout, lock renewal, etc. based on database tables.

[0124] 3) For a certain resource, an instance of an application can only hold one lock.

[0125] 4) To optimize resource synchronization, we divide locks into three types: read locks, write locks, and exclusive locks. Read locks allow the holder to read the target resource. Write locks not only allow the holder to write data, but also allow other read lock holders to read the resource in parallel. The exclusive lock ensures that when it is held, no other read-write lock is allowed to operate on the resource.

[0126] 5) In order to improve the performance of distributed lock operations, a cache strategy is implemented in the distributed lock service. There is a great performance improvement for read-only operations such as lock checking and lock querying. For example, when locking, first query the lock status from the cache, and then perform a database write operation to complete the lock when the conditions are met. Then query the lock holder from the cache (if it misses, query the database again), and notify them one by one; when unlocking, first perform a database operation to complete the unlocking, and then query the lock holder from the cache (if it misses, query the database again), and notify them one by one.

[0127] The main design principles are as follows: Figure 6As shown, the business processing application is an application for specific business logic processing; the resource service application is an application that provides operation services for certain shared resources, and needs to use locks to control the call to these shared resources, such as access to a database table, access to a file, and call to a third-party system interface; the distributed lock service is an application that provides distributed lock operations, mainly including locking, unlocking, and lock checking functions; the first distributed lock component is a client library or SDK of the distributed lock service introduced by the business processing application; the second distributed lock component is a client library or SDK of the distributed lock service introduced by the resource processing application; the "resources that need to be locked" below the business processing application are local resources of the device where the business processing application is located; the "resources that need to be locked" below the resource service application are resources within the resource service application, which are remote resources relative to the business processing application; the "DB (Data Base, database)" below the distributed lock service is used for the lock information of the existing resources. Optionally, the resources that need to be locked are resources in DB / Redis / files / …

[0128] like Figure 6 As shown, the business processing application can call the first distributed lock component through the business code to interact with the distributed lock service to complete the call of the local resources of the device where the business processing application is located, and can also call the resource read and write service provided by the resource service application through the business code to complete the call of the resources within the resource service application. Among them, the business processing application calls the first distributed lock component through the business code to interact with the distributed lock service, so that when executing business logic processing, the first distributed lock component calls the distributed lock service to perform lock operations such as locking, unlocking, and lock checking to ensure data consistency. In the process of executing resource read and write services, the resource service application interacts with the distributed lock service through the second distributed lock component, so that when executing resource read and write services, the second distributed lock component calls the distributed lock service to perform lock checking operations to ensure data consistency.

[0129] It should be noted that when the business processing application calls the first distributed lock component through the business code to interact with the distributed lock service, and completes the call of the local resources of the device where the business processing application is located, the lock check operation is performed by the business processing application calling the distributed lock service through the first distributed lock component; when the business processing application calls the resource read and write service provided by the resource service application through the business code, and completes the call of the resources within the resource service application, the lock check operation is triggered by the business processing application to call the distributed lock service through the second distributed lock component.

[0130] As an example, Figure 7 It is a flowchart of a business processing application reading local resources of a device where the business processing application is located, as provided in the seventh embodiment of the present disclosure.

[0131] like Figure 7 As shown, the specific implementation steps are:

[0132] Step 701, lock.

[0133] When a business processing application accesses resources that need to be locked (local resources of the device where the business processing application is located), such as reading business parameters, the distributed lock service is called to read the resource; and the lock status is registered in the database table.

[0134] Step 702, read with lock.

[0135] The business processing application obtains the read lock of the resource through the first distributed lock component.

[0136] Step 703, lock check.

[0137] The business processing application checks whether the visitor holds the lock corresponding to the resource through the API provided by the first distributed lock component (SDK). If the visitor holds the lock, step 704 is executed. If not, the acquisition of the lock resource fails.

[0138] Step 704, read.

[0139] The business processing application reads the resource from a database, a file system, or a memory (a database, a file system, or a memory of a device where the business processing application is located).

[0140] Step 705, release the lock.

[0141] Release the lock and update the database table lock status.

[0142] As an example, Figure 8 It is a flowchart of a business processing application modifying resources within a resource service application provided by the eighth embodiment of the present disclosure.

[0143] like Figure 8 As shown, the specific implementation steps are:

[0144] Step 801, lock.

[0145] When a business processing application needs to modify resources (resources within a resource service application), such as modifying business parameters, the distributed lock service is called to add a write lock to the resource; and the lock status is registered in the database table.

[0146] Step 802, write with lock.

[0147] The business processing application obtains the write lock of the resource through the first distributed lock component.

[0148] Step 803, lock check.

[0149] The business processing application triggers the resource service application to check whether the visitor holds the lock corresponding to the resource through the API provided by the second distributed lock component (SDK). If the lock is held, step 804 is executed. If not, obtaining and modifying the resource fails.

[0150] Step 804, write.

[0151] Write the updated resources to the database, file system or memory (the database, file system or memory of the device where the resource service application is located).

[0152] Step 805, release the lock.

[0153] Release the lock and update the database table lock status.

[0154] It should be noted that when an application instance needs to modify a resource, it must first obtain a write lock for the resource. This lock ensures that only one application instance can modify the resource at any time. When the application instance releases the write lock, all read-only lock holders will receive notification of the resource update.

[0155] If an application instance needs to modify a resource exclusively and prevent other instances from reading the data before the modification is completed, it can apply for an exclusive lock. An exclusive lock ensures that only the lock holder can access the resource, and all other locks that attempt to access will fail. When an exclusive lock is released, just like the write lock mentioned above, all locks that are in an invalid state will be notified to allow them to try to access the resource again.

[0156] For example, in order to ensure that the data in the business parameter table is updated in real time in the memory cache, the distributed lock service is used to manage the consistency of the data. The operation process is as follows:

[0157] 1. When the business parameter management service needs to modify the business parameters, it first calls the distributed lock service to obtain the write lock of the business parameter table.

[0158] 2. The business parameter management service needs to actively release this write lock after writing is completed.

[0159] 3. When the write lock is released, the distributed lock service will notify all current read lock holders (application instances). These read lock holders need to clear the cache and reload the latest data into the memory.

[0160] In summary, the present disclosure provides a solution that combines cache and database to achieve efficient lock checking and querying. Distributed lock services provide distributed lock-related services for other microservices without the need to introduce third-party products. While meeting functional requirements, it reduces the complexity of system design, construction, and maintenance and improves reliability. On the premise of meeting functional requirements and reliability, performance is improved to a certain extent to meet business needs.

[0161] Specifically, the present disclosure uses a combination of database, microservices and cache technology to implement distributed lock services, and provides APIs such as lock unlocking, lock upgrade, lock downgrade, lock check, lock query, etc. to other microservices, which functionally meets business needs. At the same time, without introducing third-party products, such as Zookeeper, lock monitoring, notification and failure scanning mechanisms are implemented, which reduces the complexity of the system, improves the reliability and maintainability of the system, and reduces operation and maintenance costs while meeting business needs. Moreover, while ensuring the reliability of the distributed lock function (based on the database), make full use of the cache to improve performance.

[0162] Corresponding to the resource calling method provided in the above embodiment, the present disclosure also provides a resource calling device. Since the resource calling device provided in the embodiment of the present disclosure corresponds to the resource calling method provided in the above embodiment, the implementation method of the resource calling method is also applicable to the resource calling device provided in the embodiment of the present disclosure, and will not be described in detail in the embodiment of the present disclosure.

[0163] Fig. 9 It is a structural diagram of a resource calling device shown in the ninth embodiment of the present disclosure.

[0164] like Fig. 9 As shown, the resource calling device 900 includes: a locking module 910 , an acquisition module 920 and a calling module 930 .

[0165] Among them, the locking module 910 is used to lock the target resource by calling the distributed lock service through the first distributed lock component; wherein the distributed lock service is a microservice that uses database and cache technology to manage locks, and the first distributed lock component is a client library or software development kit SDK of the distributed lock service introduced by the business processing application; the acquisition module 920 is used to obtain the first target lock of the target resource by the business processing application; the calling module 930 is used to perform a lock check through the first distributed lock component, or trigger the resource service application to perform a lock check through the second distributed lock component, so as to call the target resource when the business processing application holds the first target lock; wherein the second distributed lock component is a client library or SDK of the distributed lock service introduced by the resource service application.

[0166] As a possible implementation method of the embodiment of the present disclosure, the locking module 910 is used to: send a locking request for requesting to lock the target resource to the distributed lock service through the application programming interface API provided by the first distributed lock component, so that the distributed lock service queries the lock information of the target resource from the target cache based on the resource identifier of the target resource carried in the locking request, so as to complete the locking of the target resource through database operations when there is no second target lock that conflicts with the first target lock or the target resource has a second target lock but the second target lock has expired; wherein, the target cache is used to store the lock information of the resource.

[0167] As a possible implementation method of an embodiment of the present disclosure, after the distributed lock service completes locking the target resource, if there is a third target lock compatible with the first target lock and the third target lock has not expired, the holder of the third target lock is determined based on the lock information of the third target lock queried from the target cache, and a first notification message is sent to the holder of the third target lock, wherein the first notification message is used to notify the holder of the third target lock to switch databases.

[0168] As a possible implementation manner of the embodiment of the present disclosure, the acquisition module 920 is used to: acquire the first target lock from the distributed lock service through an API provided by the first distributed lock component.

[0169] As a possible implementation method of the embodiment of the present disclosure, the calling module 930 is used to: in response to the target resource being a local resource, check whether the business processing application holds the first target lock through the first distributed lock component when calling the target resource; in response to the target resource being a resource within a resource service application, trigger the resource service application to check whether the business processing application holds the first target lock through the second distributed lock component when calling the target resource.

[0170] As a possible implementation of the embodiment of the present disclosure, the lock types of the first target lock include a read lock, a write lock and an exclusive lock; the calling module 930 is used to: in response to the first target lock being a read lock, read the target resource when the business processing application holds the first target lock; wherein, when the business processing application reads the target resource in response to the first target lock being a read lock, the business processing application allows business processing applications other than the business processing application to call the target resource; in response to the first target lock being a write lock, write operations are performed on the target resource when the business processing application holds the first target lock; wherein, when the business processing application writes to the target resource in response to the first target lock being a write lock, only business processing applications other than the business processing application are allowed to read the target resource when holding the read lock of the target resource; in response to the first target lock being an exclusive lock, call the target resource when the business processing application holds the first target lock; wherein, when the business processing application calls the target resource in response to the first target lock being an exclusive lock, business processing applications other than the business processing application are not allowed to call the target resource.

[0171] As a possible implementation manner of the embodiment of the present disclosure, the above-mentioned device further includes: a lock release module, which is used to release the first target lock by calling the distributed lock service through the first distributed lock component in response to completing the call of the target resource.

[0172] As a possible implementation method of the embodiment of the present disclosure, a lock release module is used to: in response to completing the call of the target resource, send a lock release request for requesting the release of the first target lock to the distributed lock service through the API provided by the first distributed lock component, so that the distributed lock service queries the lock information of the target resource from the target cache based on the resource identifier of the target resource carried in the lock release request, so as to delete the lock information of the first target lock of the target resource by the business processing application in the target cache through a database operation; wherein, the target cache is used to store the lock information of the resource.

[0173] As a possible implementation method of an embodiment of the present disclosure, after the distributed lock service deletes the lock information of the first target lock of the target resource by the business processing application in the target cache through a database operation, if there is a fourth target lock compatible with the first target lock in the target resource and the fourth target lock has not expired, the holder of the fourth target lock is determined based on the lock information of the fourth target lock queried from the target cache, and a second notification message is sent to the holder of the fourth target lock, wherein the second notification message is used to notify the holder of the fourth target lock to reacquire the target resource.

[0174] The resource calling device of the embodiment of the present disclosure calls the distributed lock service through the first distributed lock component to lock the target resource; wherein the distributed lock service is a microservice that uses database and cache technology to manage locks, and the first distributed lock component is a client library or SDK of the distributed lock service introduced by the business processing application; obtains the first target lock of the target resource by the business processing application; performs a lock check through the first distributed lock component, or triggers the resource service application to perform a lock check through the second distributed lock component, so as to call the target resource when the business processing application holds the first target lock; wherein the second distributed lock component is a client library or SDK of the distributed lock service introduced by the resource service application, thereby, in the resource calling process, the distributed lock service is realized by comprehensively using the database, microservice and cache technology, and the lock operation is performed without introducing third-party products, which meets the business function requirements while reducing the complexity of the system in design, construction and maintenance, improving reliability, and improving performance by making full use of the cache.

[0175] In an exemplary embodiment, an electronic device is also provided.

[0176] Among them, electronic equipment includes:

[0177] processor;

[0178] a memory for storing processor-executable instructions;

[0179] The processor is configured to execute instructions to implement the resource calling method proposed in any of the aforementioned embodiments.

[0180] As an example, Fig.10 is a schematic diagram of the structure of an electronic device 1000 shown in an exemplary embodiment of the present disclosure, such as Fig.10 As shown, the electronic device 1000 may further include:

[0181] The memory 1010 and the processor 1020, a bus 1030 connecting different components (including the memory 1010 and the processor 1020), the memory 1010 stores a computer program, and when the processor 1020 executes the program, the resource calling method described in the embodiment of the present disclosure is implemented.

[0182] Bus 1030 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.

[0183] The electronic device 1000 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 1000, including volatile and non-volatile media, removable and non-removable media.

[0184] The memory 1010 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 1040 and / or cache memory 1050. The server 1000 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 1060 may be used to read and write non-removable, non-volatile magnetic media ( Fig.10 not shown, often referred to as a "hard drive packager"). Although Fig.10 Not shown in the figure, a disk driver package for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk driver package for reading and writing a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each driver package can be connected to the bus 1030 via one or more data medium interfaces. The memory 1010 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.

[0185] A program / utility 1080 having a set (at least one) of program modules 1070 may be stored, for example, in the memory 1010, such program modules 1070 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 1070 generally perform the functions and / or methods of the embodiments described in the present disclosure.

[0186] The electronic device 1000 may also communicate with one or more external devices 1090 (e.g., keyboard, pointing device, display 1091, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or communicate with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 1092. In addition, the electronic device 1000 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) through a network adapter 1093. As shown, the network adapter 1093 communicates with other modules of the electronic device 1000 through a bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device driver package, redundant processing unit, external disk driver package array, RAID system, tape driver package, and data backup storage system, etc.

[0187] The processor 1020 executes various functional applications and data processing by running the programs stored in the memory 1010 .

[0188] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the aforementioned explanation of the resource calling method of the embodiment of the present disclosure, and will not be repeated here.

[0189] In an exemplary embodiment, a computer-readable storage medium including instructions is also proposed, such as a memory including instructions, and the above instructions can be executed by a processor of an electronic device to complete the resource calling method proposed in any of the above embodiments. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0190] In an exemplary embodiment, a computer program product is also proposed, including a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, the resource calling method proposed in any of the above embodiments is implemented.

[0191] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0192] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A resource calling method, characterized in that: Applicable to business processing applications, including: The target resource is locked by calling a distributed lock service through a first distributed lock component; wherein the distributed lock service is a microservice that manages locks using database and cache technology, and the first distributed lock component is a client library or software development kit SDK of the distributed lock service introduced by the business processing application; Acquire a first target lock of the target resource by the business processing application; A lock check is performed through the first distributed lock component, or a resource service application is triggered to perform a lock check through a second distributed lock component, so as to call the target resource when the business processing application holds the first target lock; wherein the second distributed lock component is a client library or SDK of the distributed lock service introduced by the resource service application.

2. The method according to claim 1, characterized in that: The method of locking the target resource by calling the distributed lock service through the first distributed lock component includes: A lock request for locking the target resource is sent to the distributed lock service through an application programming interface API provided by the first distributed lock component, so that the distributed lock service queries the lock information of the target resource from the target cache based on the resource identifier of the target resource carried in the lock request, so as to complete the locking of the target resource through database operations when there is no second target lock that conflicts with the first target lock on the target resource or the second target lock exists on the target resource but the second target lock has expired; wherein the target cache is used to store the lock information of resources.

3. The method according to claim 2, characterized in that After the distributed lock service completes locking the target resource, if there is a third target lock compatible with the first target lock in the target resource and the third target lock has not expired, the holder of the third target lock is determined based on the lock information of the third target lock queried from the target cache, and a first notification message is sent to the holder of the third target lock, wherein the first notification message is used to notify the holder of the third target lock to switch databases.

4. The method according to claim 1, characterized in that: The acquiring of the first target lock of the target resource by the business processing application includes: The first target lock is obtained from the distributed lock service through an API provided by the first distributed lock component.

5. The method according to claim 1, characterized in that The performing lock check by the first distributed lock component, or triggering the resource service application to perform lock check by the second distributed lock component, includes: In response to the target resource being a local resource, checking, by the first distributed lock component, whether the business processing application holds the first target lock when calling the target resource; In response to the target resource being a resource within the resource service application, the resource service application is triggered to check through the second distributed lock component whether the business processing application holds the first target lock when the target resource is called.

6. The method according to claim 1, characterized in that The lock types of the first target lock include read lock, write lock and exclusive lock; The calling of the target resource when the business processing application holds the first target lock includes: In response to the first target lock being a read lock, the business processing application reads the target resource when the business processing application holds the first target lock; wherein, when the business processing application reads the target resource in response to the first target lock being a read lock, the business processing application allows business processing applications other than the business processing application to call the target resource; In response to the first target lock being a write lock, the business processing application performs a write operation on the target resource when the business processing application holds the first target lock; wherein, when the business processing application performs a write operation on the target resource in response to the first target lock being a write lock, only business processing applications other than the business processing application are allowed to read the target resource when holding a read lock on the target resource; In response to the first target lock being an exclusive lock, the target resource is called while the business processing application holds the first target lock; wherein, when the business processing application calls the target resource in response to the first target lock being an exclusive lock, no business processing application other than the business processing application is allowed to call the target resource.

7. The method according to claim 1, characterized in that The method further comprises: In response to completing the call of the target resource, the first distributed lock component calls the distributed lock service to release the first target lock.

8. The method according to claim 7, characterized in that In response to completing the calling of the target resource, calling the distributed lock service through the first distributed lock component to release the first target lock includes: In response to completing the call of the target resource, a release lock request for requesting the release of the first target lock is sent to the distributed lock service through the API provided by the first distributed lock component, so that the distributed lock service queries the lock information of the target resource from the target cache based on the resource identifier of the target resource carried in the release lock request, so as to delete the lock information of the first target lock of the target resource by the business processing application in the target cache through database operations; wherein, the target cache is used to store lock information of resources.

9. The method according to claim 8, characterized in that After the distributed lock service deletes the lock information of the first target lock of the target resource by the business processing application in the target cache through a database operation, if there is a fourth target lock compatible with the first target lock in the target resource and the fourth target lock has not expired, the holder of the fourth target lock is determined based on the lock information of the fourth target lock queried from the target cache, so as to send a second notification message to the holder of the fourth target lock, wherein the second notification message is used to notify the holder of the fourth target lock to reacquire the target resource.

10. A resource calling device, characterized in that: Applicable to business processing applications, including: A locking module, used to lock the target resource by calling a distributed lock service through a first distributed lock component; wherein the distributed lock service is a microservice that manages locks using database and cache technology, and the first distributed lock component is a client library or software development kit SDK of the distributed lock service introduced by the business processing application; An acquisition module, used for acquiring a first target lock of the target resource by the business processing application; A calling module, used to perform a lock check through the first distributed lock component, or trigger a resource service application to perform a lock check through a second distributed lock component, so as to call the target resource when the business processing application holds the first target lock; wherein the second distributed lock component is a client library or SDK of the distributed lock service introduced by the resource service application.