A method, device and computer-readable storage medium for implementing concurrent access

By acquiring and inserting the parameters of the node to be accessed of the target interface, the control nodes access the interface simultaneously, thus solving the problem of low concurrent access efficiency in the prior art and achieving efficient concurrent access and smooth control.

CN113760370BActive Publication Date: 2025-09-16BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110130102.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-29
Publication Date
2025-09-16
Estimated Expiration
2041-01-29

AI Technical Summary

Technical Problem

The concurrent access method in the prior art has low execution efficiency, cannot achieve smooth concurrent access, and cannot execute the next access process in time.

Method used

By receiving the access request of the node to be accessed, obtaining the current parameters of the node to be accessed on the target interface, inserting the nodes in the order of access time, and controlling the nodes to access the interface at the same time, using distributed locks to manage concurrency and allow emergencies.

Benefits of technology

The efficiency of concurrent access is improved, ensuring the timely execution of the next access and achieving smooth concurrent access.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760370B_ABST
    Figure CN113760370B_ABST
Patent Text Reader

Abstract

An embodiment of the present application discloses a method for implementing concurrent access, the method comprising: receiving a first access request sent by a first node to be accessed for accessing a target interface; based on the first access request, obtaining parameters of a second node to be accessed currently on the target interface; wherein the second node to be accessed includes a plurality of nodes, and the second nodes to be accessed are arranged in order of access time; based on the parameters of the second node to be accessed, inserting the first node to be accessed into the second node to be accessed; and controlling the second node to be accessed and the first node to be accessed to perform an access operation on the target interface. The embodiment of the present application also discloses a device and a computer-readable storage medium for implementing concurrent access.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to access technology in the field of communications, and in particular to a method, device, and computer-readable storage medium for implementing concurrent access. Background Art

[0002] Currently, the demand for concurrent access is increasing. Related technologies typically implement concurrent access using token bucket smoothing and current limiting, thread pools, or semaphores. However, token bucket smoothing and current limiting allows for unexpected events, thread pools require threads to sleep for one second after execution, and semaphores simply limit the maximum number of accesses. Clearly, these related technologies have low execution efficiency and fail to achieve smooth concurrent access. Summary of the Invention

[0003] To solve the above-mentioned technical problems, the embodiments of the present application hope to provide a method, device and computer-readable storage medium for implementing concurrent access, which solves the problem of low execution efficiency of the method for implementing concurrent access in the related art, improves the efficiency of implementing concurrent access, ensures that the next concurrent access processing is executed in a timely manner; and can achieve smooth concurrent access.

[0004] The technical solution of this application is achieved as follows:

[0005] A method for implementing concurrent access, the method comprising:

[0006] receiving a first access request for accessing a target interface sent by a first node to be accessed;

[0007] Based on the first access request, obtaining parameters of a second node to be accessed currently on the target interface; wherein the second node to be accessed includes a plurality of nodes, and the second nodes to be accessed are arranged in order of access time;

[0008] inserting the first node to be visited into the second node to be visited based on the parameters of the second node to be visited;

[0009] The second node to be accessed and the first node to be accessed are controlled to perform an access operation on the target interface.

[0010] In the above solution, the acquiring, based on the first access request, the parameters of the second node to be accessed currently on the target interface includes:

[0011] Based on the first access request, obtaining the number of the second nodes to be visited;

[0012] Accordingly, the inserting the first node to be visited into the second node to be visited based on the parameters of the second node to be visited includes:

[0013] When it is determined that the number of the second nodes to be visited is less than the current concurrent amount allowed by the target interface, the first node to be visited is inserted into the second node to be visited, and the access time of the first node to be visited is recorded.

[0014] In the above solution, obtaining the number of the second nodes to be visited based on the first access request includes:

[0015] Based on the first access request, acquiring a distributed lock;

[0016] Based on the distributed lock, the number of the second nodes to be accessed is obtained.

[0017] In the above solution, the method further includes:

[0018] When it is determined that the number of the second nodes to be visited is greater than or equal to the current allowed concurrent number of the target interface, determining a first node to be visited that is ranked first among the second nodes to be visited;

[0019] Based on the access time of the first node to be visited, the first node to be visited is inserted into the second node to be visited.

[0020] In the above solution, inserting the first node to be visited into the second node to be visited based on the access time of the first node to be visited includes:

[0021] Obtaining the access time of the first node to be accessed, and comparing the access time of the first node to be accessed with the current time;

[0022] Based on the relationship between the access time of the first node to be visited and the current time, the first node to be visited is inserted into the second node to be visited.

[0023] In the above solution, the step of inserting the first node to be visited into the second node to be visited based on the relationship between the access time of the first node to be visited and the current time includes:

[0024] When it is determined that the difference between the current time and the access time of the first node to be visited is greater than or equal to a preset time threshold, deleting the first node to be visited from the second node to be visited and inserting the first node to be visited;

[0025] Record the access time of the first node to be visited.

[0026] In the above solution, before receiving the first access request for accessing the target interface sent by the first node to be accessed, the method further includes:

[0027] receiving a second access request for accessing a target interface sent by the second node to be accessed;

[0028] Based on the second access request, obtaining an access time of each of the second nodes to be visited;

[0029] The second nodes to be visited are stored in the order of the visit time of each of the second nodes to be visited.

[0030] In the above solution, the method further includes:

[0031] When the first node to be accessed and the second node to be accessed complete the access operation to the target interface, the distributed lock is released.

[0032] In the above solution, the node to be accessed on the target interface has a distributed application coordination service ZooKeeper.

[0033] A device for implementing concurrent access, the device comprising: a processor, a memory, and a communication bus;

[0034] The communication bus is used to realize the communication connection between the processor and the memory;

[0035] The processor is configured to execute a program for implementing concurrent access stored in the memory to implement the following steps:

[0036] receiving a first access request for accessing a target interface sent by a first node to be accessed;

[0037] Based on the first access request, obtaining parameters of a second node to be accessed currently on the target interface; wherein the second node to be accessed includes a plurality of nodes, and the second nodes to be accessed are arranged in order of access time;

[0038] inserting the first node to be visited into the second node to be visited based on the parameters of the second node to be visited;

[0039] The second node to be accessed and the first node to be accessed are controlled to perform an access operation on the target interface.

[0040] A computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the method for implementing concurrent access described above.

[0041] Because it is possible to receive a first access request for accessing a target interface sent by a first node to be accessed, based on an access request, obtain the parameters of a second node to be accessed currently on the target interface, which are arranged in order of access time, and the second node to be accessed includes multiple nodes. Based on the parameters of the second node to be accessed, the first node to be accessed is inserted into the second node to be accessed, and the second node to be accessed and the first node to be accessed are controlled to perform an access operation on the target interface. In this way, when a node needs to access the target interface, it can be inserted into multiple access nodes with a sequence and these nodes can be controlled to access the target interface at the same time, without the need for a node to sleep for a certain period of time after the access is completed, and sudden events are allowed, which solves the problem of low execution efficiency of the method for realizing concurrent access in the related art, improves the efficiency of realizing concurrent access, and ensures that the next concurrent access processing is executed in time; and smooth concurrent access can be realized. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 A flowchart of a method for implementing concurrent access provided in an embodiment of the present application;

[0043] Figure 2 A flowchart of another method for implementing concurrent access provided by an embodiment of the present application;

[0044] Figure 3 A flowchart of a method for implementing concurrent access provided in an embodiment of the present application;

[0045] Figure 4 A schematic diagram of sorting nodes to be accessed in a method for implementing concurrent access provided in an embodiment of the present application;

[0046] Figure 5 Another schematic diagram of sorting nodes to be accessed in a method for implementing concurrent access provided by an embodiment of the present application;

[0047] Figure 6 A schematic diagram of the structure of a device for implementing concurrent access provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application.

[0049] The embodiment of the present application provides a method for implementing concurrent access, which can be applied to a device for implementing concurrent access. Figure 1 As shown, the method includes the following steps:

[0050] Step 101: Receive a first access request for accessing a target interface sent by a first node to be accessed.

[0051] The first node to be accessed may be a newly added access node that needs to access the target interface when a second access node that needs to access the target interface already exists in the target interface.

[0052] Step 102: Based on the first access request, obtain the parameters of the second node to be accessed currently on the target interface.

[0053] The second nodes to be visited include multiple nodes, and the second nodes to be visited are arranged in order of visit time.

[0054] In an embodiment of the present application, the second node to be accessed may be a node that already exists on the target interface and is intended to access the target interface. The parameters of the second interface to be accessed may be attribute parameters of the second interface to be accessed. After receiving the first access request, the attribute parameters of the second interface to be accessed may be obtained in response to the first access request.

[0055] Step 103: Based on the parameters of the second node to be visited, insert the first node to be visited into the second node to be visited.

[0056] Among them, the access nodes included in the second node to be visited can be analyzed and processed according to the attribute parameters of the second node to be visited, and the first node to be visited can be directly inserted into the second node to be visited according to the processing results, or the nodes in the second node to be visited can be processed according to the processing results and then the first node to be visited can be inserted into the second node to be visited.

[0057] Step 104: Control the second node to be accessed and the first node to be accessed to perform an access operation on the target interface.

[0058] In an embodiment of the present application, all nodes included in the second node to be accessed and the first node to be accessed can be controlled to simultaneously execute access operations on the target interface, thereby achieving concurrent access to the target interface. Concurrent access can actually be based on the principle of smooth concurrency control. Smooth concurrency control can refer to access volume control per second, or access volume control for any one second within an execution time period. For example, if the concurrency is 50, a maximum of 50 threads can access the target interface simultaneously per second.

[0059] The method for realizing concurrent access provided by the embodiment of the present application can receive a first access request for accessing a target interface sent by a first node to be accessed, and based on an access request, obtain the parameters of a second node to be accessed currently on the target interface, which are arranged in order of access time, wherein the second node to be accessed includes multiple nodes, and the first node to be accessed is inserted into the second node to be accessed based on the parameters of the second node to be accessed, and the second node to be accessed and the first node to be accessed are controlled to perform an access operation on the target interface. In this way, when a node needs to access the target interface, the node can be inserted into multiple access nodes with a sequence and these nodes can be controlled to access the target interface at the same time, without the need for a node to sleep for a certain period of time after the access is completed, and sudden events are allowed, thereby solving the problem of low execution efficiency of the method for realizing concurrent access in the related art, improving the efficiency of realizing concurrent access, and ensuring that the next concurrent access processing is executed in time; and smooth concurrent access can be realized.

[0060] Based on the above embodiments, the embodiments of the present application provide a method for implementing concurrent access, referring to Figure 2 As shown, the method includes the following steps:

[0061] Step 201: A device for implementing concurrent access receives a first access request for accessing a target interface sent by a first node to be accessed.

[0062] Step 202: The device for implementing concurrent access obtains the number of second nodes to be accessed based on the first access request.

[0063] The second nodes to be visited include multiple nodes, and the second nodes to be visited are arranged in order of visit time.

[0064] In an embodiment of the present application, the number of second nodes to be visited may be the number of all nodes to be visited included in the second nodes to be visited; the number of second nodes to be visited may be the number of child nodes included in a specific directory; wherein the specific directory may be a customized directory used to store nodes for concurrent access.

[0065] It should be noted that step 202 can be implemented in the following ways:

[0066] Step 202a: The device implementing concurrent access acquires a distributed lock based on the first access request.

[0067] Step 202b: The device for implementing concurrent access obtains the number of the second nodes to be accessed based on the distributed lock.

[0068] The second number of nodes to be accessed can be determined by using the distributed lock after the distributed lock is acquired. In one feasible implementation, the specific directory can include the path / root / custom_path. Of course, if the distributed lock is not acquired, the current thread will sleep for a fixed period of time before continuing to acquire the distributed lock. If the distributed lock is not acquired within the preset time, a failure result is returned.

[0069] Step 203: When the device for implementing concurrent access determines that the number of the second nodes to be accessed is less than the current concurrent amount allowed by the target interface, the device inserts the first node to be accessed into the second node to be accessed and records the access time of the first node to be accessed.

[0070] In an embodiment of the present application, the current allowed concurrency of the target interface can be determined based on the properties of the target interface and the current performance of the device. If the number of the second node to be accessed is less than the current allowed concurrency of the target interface, it indicates that other nodes are currently able to continue accessing the target interface. In this case, the first node to be accessed is directly inserted into a specific directory storing the second node to be accessed. In one feasible implementation, the first node to be accessed can be inserted into the directory / root / custom_path. Furthermore, the access time of the first node to be accessed, i.e., the current timestamp information, is stored in the specific directory.

[0071] Step 204: When the device for implementing concurrent access determines that the number of the second nodes to be accessed is greater than or equal to the current concurrent number allowed by the target interface, it determines the first node to be accessed that is ranked first among the second nodes to be accessed.

[0072] If the number of the second nodes to be accessed is greater than or equal to the current allowed concurrency of the target interface, it indicates that other nodes are no longer able to access the target interface. In this case, the nodes included in the second nodes to be accessed need to be processed to enable other nodes to continue accessing the target interface. It should be noted that the first node to be accessed can be obtained by determining the first-ranked node in the second nodes to be accessed from a specific directory.

[0073] Step 205: The device for implementing concurrent access inserts the first node to be accessed into the second node to be accessed based on the access time of the first node to be accessed.

[0074] In an embodiment of the present application, the access time of the first node to be visited can be analyzed, and then the nodes to be visited in the second node to be visited can be processed according to the analysis result. After the processing is completed, the first node to be visited can be inserted into the second node to be visited.

[0075] Step 205 can be implemented in the following ways:

[0076] Step 205a: The device implementing concurrent access obtains the access time of the first node to be accessed, and compares the access time of the first node to be accessed with the current time.

[0077] The access time of the first node to be accessed may be the time when the first node to be accessed accesses the target interface.

[0078] Step 205b: The device for implementing concurrent access inserts the first node to be accessed into the second node to be accessed based on the relationship between the access time of the first node to be accessed and the current time.

[0079] In an embodiment of the present application, the first node to be visited stored in a specific directory can be processed based on the relationship between the access time of the first node to be visited and the current time, and then the first node to be visited can be inserted into the sorting of the second node to be visited; it should be noted that the first node to be visited can be inserted into a specific directory.

[0080] Step 206: The device for implementing concurrent access controls the second node to be accessed and the first node to be accessed to perform an access operation on the target interface.

[0081] It should be noted that, for the description of the same steps and contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.

[0082] The method for realizing concurrent access provided by the embodiment of the present application can, when a node needs to access the target interface, insert the node into multiple access nodes with a sequence and control these nodes to access the target interface at the same time, without requiring a node to sleep for a certain period of time after the access is completed, and allows for emergencies. It solves the problem in the related art that the method for realizing concurrent access has low execution efficiency and cannot execute the next processing in time, improves the efficiency of realizing concurrent access, and ensures that the next concurrent access processing is executed in time.

[0083] Based on the above embodiments, the embodiments of the present application provide a method for implementing concurrent access, referring to Figure 4 As shown, the method includes the following steps:

[0084] Step 301: A device for implementing concurrent access receives a first access request for accessing a target interface sent by a first node to be accessed.

[0085] Step 302: The device implementing concurrent access acquires a distributed lock based on the first access request.

[0086] Step 303: The device implementing concurrent access obtains the number of the second nodes to be accessed based on the distributed lock.

[0087] The second nodes to be visited include multiple nodes, and the second nodes to be visited are arranged in order of visit time.

[0088] It should be noted that the nodes that implement concurrent access in the embodiment of the present application are controlled by distributed locks to achieve concurrent access, thereby supporting a distributed environment, being convenient to implement and simple to operate.

[0089] Step 304: When the device for implementing concurrent access determines that the number of the second nodes to be accessed is less than the current concurrent amount allowed by the target interface, the device inserts the first node to be accessed into the second node to be accessed and records the access time of the first node to be accessed.

[0090] Step 305: When the device for implementing concurrent access determines that the number of the second nodes to be accessed is greater than or equal to the current concurrent number allowed by the target interface, it determines the first node to be accessed that is ranked first among the second nodes to be accessed.

[0091] Among them, all the nodes to be visited included in the second nodes to be visited are arranged in the order of first visited first; that is, the first node to be visited may be the node that first visits the target interface.

[0092] Step 306: The device implementing concurrent access obtains the access time of the first node to be accessed, and compares the access time of the first node to be accessed with the current time.

[0093] The access time of the first node to be accessed may be stored in a specific directory; that is, the access time of the first node to be accessed may be obtained from the specific directory.

[0094] Step 307: When the concurrent access device determines that the difference between the current time and the access time of the first node to be accessed is greater than or equal to a preset time threshold, the first node to be accessed is deleted from the second node to be accessed and the first node to be accessed is inserted.

[0095] In an embodiment of the present application, if the difference between the current time and the access time of the first node to be visited is greater than or equal to the preset time threshold, it means that the first node to be visited in the second node to be visited has expired. At this time, the first node to be visited can be deleted, and the first node to be visited can be inserted into the second node to be visited after the first node to be visited is deleted; if the difference between the current time and the access time of the first node to be visited is less than the preset time threshold, it means that all nodes in the second node to be visited are within the valid time range. At this time, the first node to be visited will not be inserted into the second node to be visited in the specific directory, but the result of insertion failure will be returned. After the first node to be visited is inserted, a new ordered node to be visited can be formed in the specific directory, and the first node in the new ordered node to be visited will be updated; and the first node in the new ordered node to be visited can be the second-ranked node in the second node to be visited. In a feasible implementation method, the preset time threshold can be 1 second.

[0096] In a feasible implementation, the second node to be visited stored in the specific directory may be presented as follows: Figure 4 The arrangement style shown in , that is, the subdirectory " / custom_path" under the root directory " / root" of the specific directory stores nodes n-1, n-2, n-3, n-4...nm in the order of arrangement; when it is determined that the difference between the current time and the access time of the first node to be accessed is greater than or equal to the preset time threshold, the process of deleting the accessed first node and inserting the first node to be accessed can be as follows Figure 5 As shown, the node n-1 is deleted and the first node to be visited n-m+1 is inserted; that is, Figure 5 As shown in , after deleting node n-1 and inserting node n-m+1, the subdirectory " / custom_path" under the root directory " / root" of the specific directory stores nodes n-2, n-3, n-4...nm and n-m+1 in order.

[0097] It should be noted that the method for implementing concurrent access provided in the embodiments of the present application can control the number of nodes to be accessed that simultaneously access a certain target node within a fixed time, rather than simply controlling the number of concurrent accesses to the certain target node, thereby achieving precise control of concurrent access nodes and ensuring efficient operation of the program.

[0098] Step 308: The device implementing concurrent access records the access time of the first node to be accessed.

[0099] In the embodiment of the present application, the access time of the first node to be accessed may be stored in a specific directory, that is, in the directory / root / custom_path. Moreover, the access time of each node to be accessed corresponds to the node to be accessed itself.

[0100] Step 309: The device for implementing concurrent access controls the second node to be accessed and the first node to be accessed to perform an access operation on the target interface.

[0101] Based on the foregoing embodiment, in other embodiments of the present application, the method may further include the following steps:

[0102] Step 310: After the first node to be accessed and the second node to be accessed complete the access operation to the target interface, the device for implementing concurrent access releases the distributed lock.

[0103] Based on the above embodiment, in other embodiments of the present application, the following steps may be further included before step 301:

[0104] Step 311: The device for implementing concurrent access receives a second access request for accessing a target interface sent by a second node to be accessed.

[0105] Step 312: The device for implementing concurrent access obtains the access time of each second node to be accessed based on the second access request.

[0106] Step 313: The device for implementing concurrent access stores the second nodes to be visited in the order of access time of each second node to be visited.

[0107] In the embodiment of the present application, the second access request is initiated before the first access request; that is, the second node to be accessed has already initiated access to the target node before the first node to be accessed requests access to the target node. In addition, the second nodes to be accessed can be stored in an orderly manner in a specific directory.

[0108] Among them, the node to be accessed on the target interface has a distributed application coordination service ZooKeeper; that is, in an embodiment of the present application, all nodes accessing the target interface can be ZooKeeper ordered nodes, and precisely because all nodes accessing the target interface are ZooKeeper ordered nodes, it is possible to achieve concurrency control requirements while having high efficiency and low latency effects.

[0109] It should be noted that, for the description of the same steps and contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.

[0110] The method for realizing concurrent access provided by the embodiment of the present application can, when a node needs to access the target interface, insert the node into multiple access nodes with a sequence and control these nodes to access the target interface at the same time, without requiring a node to sleep for a certain period of time after the access is completed, and allows for emergencies. It solves the problem in the related art that the method for realizing concurrent access has low execution efficiency and cannot execute the next processing in time, improves the efficiency of realizing concurrent access, and ensures that the next concurrent access processing is executed in time.

[0111] Based on the above embodiments, the embodiments of the present application provide a device for implementing concurrent access, which can be applied to Figures 1 to 3 In the method for implementing concurrent access provided by the corresponding embodiment, refer to Figure 6 As shown, the device may include: a processor 41, a memory 42 and a communication bus 43, wherein:

[0112] The communication bus 43 is used to realize the communication connection between the processor 41 and the memory 42;

[0113] The processor 41 is configured to execute the concurrent access implementation program stored in the memory 42 to implement the following steps:

[0114] receiving a first access request for accessing a target interface sent by a first node to be accessed;

[0115] Based on the first access request, obtaining parameters of a second node to be accessed currently on the target interface;

[0116] The second nodes to be visited include multiple nodes, and the second nodes to be visited are arranged in the order of visit time;

[0117] inserting the first node to be visited into the second node to be visited based on the parameters of the second node to be visited;

[0118] The second node to be accessed and the first node to be accessed are controlled to perform an access operation on the target interface.

[0119] In other embodiments of the present application, the processor 41 is configured to execute the instructions stored in the memory 42 to obtain the parameters of the second node to be accessed currently on the target interface based on the first access request, so as to implement the following steps:

[0120] Based on the first access request, obtaining the number of second nodes to be accessed;

[0121] Accordingly, the processor 41 is configured to execute the parameters based on the second node to be visited stored in the memory 42 to insert the first node to be visited into the second node to be visited, including:

[0122] When it is determined that the number of the second nodes to be visited is less than the current concurrent number allowed by the target interface, the first node to be visited is inserted into the second node to be visited, and the access time of the first node to be visited is recorded.

[0123] In other embodiments of the present application, the processor 41 is configured to execute the instructions stored in the memory 42 to obtain the number of second nodes to be accessed based on the first access request, so as to implement the following steps:

[0124] Based on the first access request, acquiring a distributed lock;

[0125] Based on the distributed lock, the number of the second node to be accessed is obtained.

[0126] In other embodiments of the present application, the processor 41 is configured to execute the method for implementing concurrent access stored in the memory 42, and may further implement the following steps:

[0127] When it is determined that the number of the second nodes to be visited is greater than or equal to the current allowed concurrent number of the target interface, determining the first node to be visited that is ranked first among the second nodes to be visited;

[0128] Based on the access time of the first node to be visited, the first node to be visited is inserted into the second node to be visited.

[0129] In other embodiments of the present application, the processor 41 is configured to execute the access time based on the first node to be visited stored in the memory 42, and insert the first node to be visited into the second node to be visited, so as to implement the following steps:

[0130] Obtain the access time of the first node to be accessed, and compare the access time of the first node to be accessed with the current time;

[0131] Based on the relationship between the access time of the first node to be visited and the current time, the first node to be visited is inserted into the second node to be visited.

[0132] In other embodiments of the present application, the processor 41 is configured to execute the relationship between the access time of the first node to be visited and the current time stored in the memory 42, and insert the first node to be visited into the second node to be visited, so as to implement the following steps:

[0133] When it is determined that the difference between the current time and the access time of the first node to be visited is greater than or equal to the preset time threshold, deleting the first node to be visited from the second node to be visited and inserting the first node to be visited;

[0134] Record the access time of the first node to be visited.

[0135] In other embodiments of the present application, the processor 41 may further implement the following steps before executing the steps stored in the memory 42 to receive the first access request for accessing the target interface sent by the first node to be accessed:

[0136] receiving a second access request for accessing the target interface sent by a second node to be accessed;

[0137] Based on the second access request, obtaining an access time of each second node to be accessed;

[0138] The second nodes to be visited are stored in the order of their visit times.

[0139] In other embodiments of the present application, the processor 41 is configured to execute the method for implementing concurrent access stored in the memory 42, and may further implement the following steps:

[0140] When the first node to be accessed and the second node to be accessed complete the access operation to the target interface, the distributed lock is released.

[0141] In other embodiments of the present application, the node to be accessed on the target interface has a distributed application coordination service ZooKeeper.

[0142] It should be noted that the specific implementation process of the steps executed by the processor in this embodiment can be referred to Figures 1 to 3 The implementation process of the method for implementing concurrent access provided by the corresponding embodiment will not be repeated here.

[0143] The device for implementing concurrent access provided by the embodiments of the present application can, when a node needs to access a target interface, insert the node into multiple access nodes with a sequence and control these nodes to access the target interface at the same time, without requiring a node to sleep for a certain period of time after the access is completed, and allows for emergencies. It solves the problem in the related art that the method for implementing concurrent access has low execution efficiency and cannot execute the next processing in time, improves the efficiency of implementing concurrent access, and ensures that the next concurrent access processing is executed in time.

[0144] Based on the above embodiments, the embodiments of the present application provide a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement Figures 1 to 3 The corresponding embodiment provides steps for implementing a method for concurrent access.

[0145] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The above-mentioned serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.

[0146] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0147] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0148] In addition, all functional units in the embodiments of the present application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the above-mentioned integrated units can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0149] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, and other media that can store program codes.

[0150] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods of each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0151] The above are only specific embodiments of the present application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A method for implementing concurrent access, characterized in that: The method includes: receiving a first access request for accessing a target interface sent by a first node to be accessed; Based on the first access request, obtaining parameters of a second node to be visited currently on the target interface; wherein the second node to be visited includes a plurality of nodes, and the second nodes to be visited are arranged in order of access time; and the parameters of the second node to be visited include the number of the second nodes to be visited; inserting the first node to be visited into the second node to be visited based on a relationship between the number of the second node to be visited and the current allowed concurrency of the target interface; The second node to be accessed and the first node to be accessed are controlled to perform an access operation on the target interface.

2. The method according to claim 1, characterized in that The acquiring, based on the first access request, parameters of the second node to be accessed currently on the target interface includes: Based on the first access request, obtaining the number of the second nodes to be visited; Accordingly, the inserting the first node to be visited into the second node to be visited based on the relationship between the number of the second nodes to be visited and the current allowed concurrency of the target interface includes: When it is determined that the number of the second nodes to be visited is less than the current concurrent amount allowed by the target interface, the first node to be visited is inserted into the second node to be visited, and the access time of the first node to be visited is recorded.

3. The method according to claim 2, characterized in that The acquiring, based on the first access request, the number of the second nodes to be visited, includes: Based on the first access request, acquiring a distributed lock; Based on the distributed lock, the number of the second nodes to be accessed is obtained.

4. The method according to claim 2 or 3, characterized in that The method further comprises: When it is determined that the number of the second nodes to be visited is greater than or equal to the current allowed concurrent number of the target interface, determining a first node to be visited that is ranked first among the second nodes to be visited; Based on the access time of the first node to be visited, the first node to be visited is inserted into the second node to be visited.

5. The method according to claim 4, characterized in that The step of inserting the first node to be visited into the second node to be visited based on the access time of the first node to be visited comprises: Obtaining the access time of the first node to be accessed, and comparing the access time of the first node to be accessed with the current time; Based on the relationship between the access time of the first node to be visited and the current time, the first node to be visited is inserted into the second node to be visited.

6. The method according to claim 5, characterized in that The inserting the first node to be visited into the second node to be visited based on the relationship between the access time of the first node to be visited and the current time includes: When it is determined that the difference between the current time and the access time of the first node to be visited is greater than or equal to a preset time threshold, deleting the first node to be visited from the second node to be visited and inserting the first node to be visited; Record the access time of the first node to be visited.

7. The method according to claim 1, characterized in that Before receiving the first access request for accessing the target interface sent by the first node to be accessed, the method further includes: receiving a second access request for accessing a target interface sent by the second node to be accessed; Based on the second access request, obtaining an access time of each of the second nodes to be visited; The second nodes to be visited are stored in the order of the visit time of each of the second nodes to be visited.

8. The method according to claim 3, characterized in that The method further comprises: When the first node to be accessed and the second node to be accessed complete the access operation to the target interface, the distributed lock is released.

9. The method according to claim 1, characterized in that The node to be accessed on the target interface has a distributed application coordination service ZooKeeper.

10. A device for implementing concurrent access, characterized in that: The device includes: a processor, a memory and a communication bus; The communication bus is used to realize the communication connection between the processor and the memory; The processor is configured to execute a program for implementing concurrent access stored in the memory to implement the following steps: receiving a first access request for accessing a target interface sent by a first node to be accessed; Based on the first access request, obtaining parameters of a second node to be visited currently on the target interface; wherein the second node to be visited includes a plurality of nodes, and the second nodes to be visited are arranged in order of access time; and the parameters of the second node to be visited include the number of the second nodes to be visited; inserting the first node to be visited into the second node to be visited based on a relationship between the number of the second node to be visited and the current allowed concurrency of the target interface; The second node to be accessed and the first node to be accessed are controlled to perform an access operation on the target interface.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the method for implementing concurrent access according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Concurrent access control method, terminal device and medium

    CN108683604A

  • Distributed storage file access method and device and storage medium

    CN109871715A