Access processing method and apparatus, electronic device, and storage medium

By updating the access permission identifier and the local variable of the number of times in the distributed business system, the high time consumption problem caused by thread lock contention was solved, and the system's processing efficiency was improved.

CN115114612BActive Publication Date: 2026-07-24BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING BAIDU NETCOM SCI & TECH CO LTD
Filing Date
2022-04-06
Publication Date
2026-07-24

Smart Images

  • Figure CN115114612B_ABST
    Figure CN115114612B_ABST
Patent Text Reader

Abstract

The present disclosure provides an access processing method and device, electronic equipment and storage medium, relates to the technical field of computers, in particular to the technical field of software, big data and cloud services. The specific implementation scheme is: in response to receiving an access request from an object for a target service, an access permission identifier of the object is obtained, wherein the access permission identifier is used to indicate the access permission of the object to the target service within a predetermined period of time; in the case where it is determined according to the access permission identifier that the object has access permission, the variable value of a times local variable of the current accessed thread is updated, wherein the times local variable is used to indicate the cumulative access times of the object within the predetermined period of time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more particularly to the fields of software technology, big data, and cloud services. Specifically, it relates to an access processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] As business grows, the functionalities offered by applications become increasingly complex and diverse. To ensure the application's concurrent processing capabilities, it can be implemented based on a distributed business system. For example, the functionalities provided by the application can be implemented based on multiple services within a distributed business system, and each service can have multiple instances. These instances can then be used to handle access requests to the service. Summary of the Invention

[0003] This disclosure provides an access processing method, apparatus, electronic device, and storage medium.

[0004] According to one aspect of this disclosure, an access processing method is provided, comprising: in response to receiving an access request from an object for a target service, obtaining an access permission identifier of the object, wherein the access permission identifier is used to indicate the access permission of the object to access the target service within a predetermined time period; and, if it is determined from the access permission identifier that the object has the access permission, updating the value of a local variable of the number of times the currently accessed thread is accessed, wherein the local variable of the number of times is used to indicate the cumulative number of times the object accesses the target service within the predetermined time period.

[0005] According to another aspect of this disclosure, an access processing apparatus is provided, comprising: a first acquisition module, configured to acquire an access permission identifier of the object in response to receiving an access request from an object for a target service, wherein the access permission identifier is used to indicate the access permission of the object to access the target service within a predetermined time period; and a first update module, configured to update the value of a local variable of the number of times a currently accessed thread is accessed, wherein the local variable of the number of times is used to indicate the cumulative number of times the object accesses the target service within the predetermined time period, if it is determined from the access permission identifier that the object has the access permission.

[0006] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method described in this disclosure.

[0007] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform the methods described in this disclosure.

[0008] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the methods described in this disclosure.

[0009] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0010] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0011] Figure 1 This illustration schematically shows an exemplary system architecture to which access processing methods and apparatus can be applied according to embodiments of the present disclosure;

[0012] Figure 2 A flowchart illustrating an access processing method according to an embodiment of the present disclosure is shown schematically.

[0013] Figure 3A A flowchart illustrating an access processing method according to another embodiment of the present disclosure is shown schematically;

[0014] Figure 3B This illustration schematically shows an example of a variable value for updating the number of times a currently accessed thread is accessed, according to an embodiment of the present disclosure.

[0015] Figure 3C This illustration shows a schematic diagram of updating the value of an access permission variable stored in a second data block according to an access permission identifier to be updated, according to an embodiment of the present disclosure.

[0016] Figure 4 A block diagram of an access processing apparatus according to embodiments of the present disclosure is schematically shown; and

[0017] Figure 5 A block diagram of an electronic device suitable for implementing an access processing method according to an embodiment of the present disclosure is shown schematically. Detailed Implementation

[0018] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0019] The service may include online services. Online services may include an access count verification module. This module can be used to provide users of the paid service with a maximum number of accesses within a predetermined time period, ensuring that users utilize the service within their quota. Furthermore, the access count verification module can also be used to ensure that the service operates within a reasonable load, avoiding exceeding the service's concurrency limit.

[0020] Services implemented based on distributed business systems can be called distributed services. For distributed services deployed across multiple instances, the access count verification module, as one of the fundamental modules, needs to ensure high processing capacity. Instances can include multiple threads. Threads can be used to handle access requests to the service.

[0021] High concurrency scenarios will arise when utilizing distributed services. To ensure thread safety, thread locks can be used. However, thread locks consume a significant amount of time in thread lock contention, thus increasing access processing time. Thread locks can be used to control the execution of multiple threads in a predetermined order. A thread lock first locks the thread, and then releases the lock after the thread completes its task. Types of thread locks can include mutexes and spin locks, among others.

[0022] To address this, embodiments of this disclosure propose a near-lock-free access processing scheme. According to the technical solution of this disclosure, in response to receiving an access request from an object for a target service, an access permission identifier of the object is obtained. The access permission identifier indicates the object's access permissions to the target service within a predetermined time period. If it is determined that the object has access permissions based on the access permission identifier, the value of a local variable indicating the number of times the currently accessed thread has accessed the service is updated. The local variable indicating the number of times the object has accessed the service within the predetermined time period. This reduces lock contention and lowers access processing time.

[0023] According to the embodiments of this disclosure, since the value of the local variable that updates the number of times the currently accessed thread is updated, it will not affect other threads in the instance. That is, the threads do not affect each other. Therefore, the operation of updating the cumulative number of times does not require locking, thereby reducing lock contention and reducing access processing time.

[0024] Figure 1An exemplary system architecture for which access processing methods and apparatus can be applied according to embodiments of this disclosure is illustrated.

[0025] It is important to note that Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.

[0026] like Figure 1 As shown, the system architecture 100 according to this embodiment may include a business system 101, a network 102, and a database 103. The network 102 serves as a medium for providing a communication link between the business system 101 and the database 103. The network 102 may include various connection types, such as wired and / or wireless communication links.

[0027] Business system 101 can be a distributed system. Business system 101 can include M services, namely, service 101_1, service 101_2, ..., service 101_m, ..., service 101_M-1 and service 101_M. Service 101_m can have P instances corresponding to it, namely, instance 101_m_1, instance 101_m_2, ..., instance 101_m_p, ..., instance 101_m_P-1 and instance 101_m_P. Instance 101_m_p can have Q threads corresponding to it, namely, thread 101_m_p_1, thread 101_m_p_2, ..., thread 101_m_p_q, ..., thread 101_m_p_Q-1 and thread 101_m_p_Q. M, P and Q can all be integers greater than 1. Instance 101_m_p can run on electronic devices. Electronic devices can include at least one of terminal devices and servers. Terminal devices can be various electronic devices with a display screen and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers. Servers can be various types of servers providing various services. For example, a server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product in the cloud computing service system to solve the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability. A server can also be a server integrated with blockchain technology.

[0028] Example 101_m_p can respond to an access request from an object for a target service and obtain the object's access permission identifier. The access permission identifier indicates the object's access permissions to the target service within a predetermined time period. If the access permission identifier determines that the object has the necessary permissions, the value of the local variable representing the number of times the currently accessed thread has been accessed is updated. The local variable representing the number of times the object has accessed the service within the predetermined time period indicates the cumulative number of accesses.

[0029] Database 103 can, in response to receiving the local total access counts for an object from instances 101_m_1 to 101_m_P within a predetermined time period, obtain P local total access counts. The database can then use these P local total access counts to determine the object's global total access count within the predetermined time period.

[0030] Instance 101_m_p can respond to a request to retrieve the total global access count for an object, and obtain the total global access count for the object within a predetermined time period. Based on the total global access count and a predetermined access count threshold for the object within the predetermined time period, it determines the object's access permission identifier.

[0031] It should be noted that the access processing method provided in this embodiment can generally be executed by the business system 101. Accordingly, the access processing device provided in this embodiment can also be configured in the business system 101.

[0032] It should be understood that Figure 1 The number of business systems, networks, and databases shown is merely illustrative. Depending on implementation needs, there can be any number of business systems, networks, and databases.

[0033] It should be noted that the sequence numbers of the operations in the following methods are for descriptive purposes only and should not be considered as indicating the execution order of the operations. Unless explicitly stated otherwise, the method does not need to be executed in the exact order shown.

[0034] Figure 2 A flowchart illustrating an access processing method according to an embodiment of the present disclosure is shown schematically.

[0035] like Figure 2 As shown, the method 200 includes operations S210 to S220.

[0036] In operation S210, in response to receiving an access request from an object for a target service, the access permission identifier of the object is obtained. The access permission identifier is used to indicate the object's access permissions to the target service within a predetermined time period.

[0037] In operation S220, if it is determined that the object has access permissions based on the access permission identifier, the value of the local variable for the number of times the currently accessed thread has been updated. The local variable for the number of times the object has been accessed is used to indicate the cumulative number of times the object has been accessed within a predetermined time period.

[0038] According to embodiments of this disclosure, the application can be implemented based on a distributed business system. The distributed business system can include multiple services. A service can include at least one instance. An instance can have at least one thread corresponding to that instance; that is, an instance can include at least one thread. The at least one thread can include a thread for providing services and a thread for processing access permission identifiers. The thread for processing access permissions can be called the permission thread. The thread for providing services can be called the accessed thread. The thread for providing services can include at least one. If the thread for providing services is the currently providing service thread, then the currently providing service thread is called the currently accessed thread. If the thread is performing an access operation (i.e., a read operation), then that thread can be called a read thread. If the thread is performing an update operation (i.e., a write operation), then that thread can be called a write thread. The accessed thread can be a read thread or a write thread. The permission thread can be a read thread or a write thread.

[0039] According to embodiments of this disclosure, the target service may refer to the service that an object requests access to. The access request may refer to a request used to request access to the target service. The access request may include an object identifier, a service identifier, and access information. The access information may include an access address identifier. The object identifier may be used to indicate an object. The service identifier may be used to indicate the target service. The access address identifier may indicate an access address.

[0040] According to embodiments of this disclosure, an access permission identifier can be used to indicate whether an object has access permission to access a target service within a predetermined time period. The access permission identifier can include identifiers indicating that the object has access permission and identifiers indicating that the object does not have access permission. The form of the access permission identifier can be configured according to actual business needs and is not limited herein. For example, an identifier indicating that the object has access permission can be indicated by "1", and an identifier indicating that the object does not have access permission can be indicated by "0". The predetermined time period can be configured according to actual business needs and is not limited herein. For example, the predetermined time period can be a member's valid time period.

[0041] According to embodiments of this disclosure, the instances include threads that have a corresponding local variable for the number of accesses. The local variable for the number of accesses can refer to a local variable used to indicate the cumulative number of accesses to an object within a predetermined time period. The value of the local variable for the number of accesses can refer to the cumulative number of accesses. The local variable for the number of accesses belongs to the thread itself, and the local variables for the number of accesses of each thread are independent of each other.

[0042] According to embodiments of this disclosure, the currently accessed thread in an instance can parse the access request upon receiving an access request from an object for a target service, and obtain a first parsing result. The first parsing result may include an object identifier, a service identifier, and access information.

[0043] According to embodiments of this disclosure, after obtaining the first parsing result, the currently accessed thread can obtain an access permission identifier corresponding to the object identifier and service identifier from the permission thread based on the object identifier and service identifier. The currently accessed thread can determine whether the object has access permission to access the target service within a predetermined time period based on the access permission identifier. If the currently accessed thread determines that the object has access permission to access the target service within the predetermined time period based on the access permission identifier, it can modify the value of the local variable representing the number of times accessed. For example, it can increment the value of the local variable representing the number of times accessed by 1 to obtain the updated value. If the currently accessed thread determines that the object does not have access permission to access the target service within the predetermined time period based on the access permission identifier, it can refuse to provide the target service to the object.

[0044] According to embodiments of this disclosure, when it is determined that an object has access permissions based on an access permission identifier, the value of the local variable for the current accessed thread's count is updated. Since updating the value of the local variable for the current accessed thread does not affect other threads in the instance, i.e., the threads do not affect each other, therefore, the operation of updating the cumulative count does not require locking. This reduces lock contention and lowers access processing time.

[0045] According to embodiments of this disclosure, the frequency local variable may include a thread-local variable.

[0046] According to embodiments of this disclosure, a thread-local variable (TLV) refers to a variable that is confined to the internal workings of a single thread. A TLV belongs to the thread itself and is not shared among multiple threads; that is, each thread's TLV is independent of the others. Since there is no situation where multiple threads operate on the same TLV at the same time, thread safety issues are avoided.

[0047] According to embodiments of this disclosure, the above access processing method may further include the following operations.

[0048] In response to a request to retrieve the total global access count for an object, the system retrieves the total global access count for the object within a predetermined time period. The total global access count is determined based on the total local access count of at least one instance included in the target service. The total local access count is determined based on the cumulative access count of at least one thread included in the instance. Based on the total global access count and a predetermined access count threshold for the object within the predetermined time period, an access permission identifier for the object is determined.

[0049] According to embodiments of this disclosure, a count acquisition request may refer to a request for acquiring the total global access count of an object within a predetermined time period. The count acquisition request may include an object identifier and a service identifier.

[0050] According to embodiments of this disclosure, a thread has a local variable representing the number of visits corresponding to that thread. An instance may include at least one thread. An instance can obtain the cumulative number of visits to an object within a predetermined time period, as indicated by the local variable representing the number of visits corresponding to the at least one thread, to obtain at least one cumulative visit count. An instance can determine a local total visit count based on the at least one cumulative visit count; that is, it can perform a weighted summation of the at least one cumulative visit count to obtain a local total visit count. Instances included in the target service can all use the above method to obtain the local total visit count of the object within the predetermined time period.

[0051] According to embodiments of this disclosure, an instance can send a partial total access count to a database, so that the database can obtain the global total access count based on the partial total access count corresponding to the instance of the target service and the partial total access count corresponding to other instances of the target service. The database may include data tables. Data tables may include relational data tables. An instance can send the partial total access count of an object to the database at first predetermined intervals. The first predetermined interval can be configured according to actual business needs and is not limited thereto. For example, the first predetermined interval may be 30 seconds.

[0052] According to embodiments of this disclosure, an instance may, upon receiving a request to retrieve the total global access count of an object, send a request to the database so that the database can retrieve the total global access count of the object within a predetermined time period. This is in response to receiving the total global access count of the object from the database within the predetermined time period.

[0053] According to embodiments of this disclosure, an instance can compare the total global access count with a predetermined access count threshold for an object within a predetermined time period to obtain a comparison result. Based on the comparison result, an access permission identifier for the object is determined. The predetermined access count threshold can be configured according to actual business needs and is not limited herein. An instance can store the access permission variable indicating the object's access permission identifier in a first data block and a second data block within a double buffer (DB) structure. An instance can point a read pointer to the first data block.

[0054] According to embodiments of this disclosure, the operation of obtaining the access permission identifier of an object can be performed by the permission thread in the instance.

[0055] According to embodiments of this disclosure, obtaining an access permission identifier for an object may include the following operations.

[0056] Determine the first data block currently used for access. The first data block stores access permission variables that indicate access permission identifiers. Retrieve the object's access permission identifier from the access permission variables of the first data block.

[0057] According to embodiments of this disclosure, the first data block may refer to the data block currently used to support access operations. The first data block may store access permission variables (i.e., over_flag). The first data block may be the foreground in a double-buffered structure.

[0058] According to embodiments of this disclosure, an instance can determine the first data block currently being accessed. A variable value corresponding to an object identifier and a service identifier is retrieved from access permission variables stored in the first data block. The variable value corresponding to the object identifier and service identifier may refer to the object's access permission identifier.

[0059] According to embodiments of this disclosure, determining the first data block currently used for access may include the following operations.

[0060] Determine the data block currently pointed to by the read pointer. Designate the data block currently pointed to by the read pointer as the first data block to be accessed.

[0061] According to embodiments of this disclosure, a read pointer can be a pointer variable that points to data in the currently being read data block. A pointer variable can be a variable used to indicate the address of a variable. When a pointer variable is correctly assigned a value, the variable it points to can be accessed through that pointer variable.

[0062] According to embodiments of this disclosure, the currently accessed thread (i.e., the current read thread) can read data from the data block currently pointed to by the read pointer by calling the read pointer. The data block currently pointed to by the read pointer can be referred to as the first data block.

[0063] According to embodiments of this disclosure, the above access processing method may further include the following operations.

[0064] In response to receiving an update request for an access permission identifier of an object, the access permission identifier to be updated is determined. A second data block currently used for updating is determined. This second data block stores access permission variables that indicate the access permission identifier. The value of the access permission variable stored in the second data block is updated according to the access permission identifier to be updated.

[0065] According to embodiments of this disclosure, an update request may refer to a request for updating an access permission identifier of an object. The update request may include the access permission identifier to be updated. The access permission identifier to be updated may be an identifier indicating that the object has access permission to access the target service during a predetermined period, or it may be an identifier indicating that the object does not have access permission to access the target service during the predetermined period. Furthermore, the update request may also include an object identifier and a service identifier.

[0066] According to embodiments of this disclosure, the second data block may refer to the data block currently used to support update operations (i.e., write operations). The second data block may store access permission variables (i.e., over_flag). The second data block may be the back buffer (i.e., Background) in a double-buffered structure.

[0067] According to embodiments of this disclosure, an instance can determine the total global access count of an object within a predetermined time period. Based on the total global access count and a predetermined access count threshold for the object within the predetermined time period, an access permission identifier for the object is determined. If the instance determines that the object's access permission identifier is inconsistent with the current access permission identifier, it can determine the access permission identifier as an access permission identifier to be updated. Based on the access permission identifier to be updated, an update request for the object's access permission identifier is generated.

[0068] According to embodiments of this disclosure, an instance can parse an update request for an access permission identifier of an object upon detection, obtaining a second parsing result. The second parsing may include the access permission identifier to be updated. Furthermore, the second parsing result may also include an object identifier and a service identifier.

[0069] According to embodiments of this disclosure, upon receiving an update request for an access permission identifier of an object, an instance can determine the second data block currently being updated. The instance can modify the value of an access permission variable stored in the second data block to the access permission identifier to be updated. The value of the access permission variable stored in the first data block remains unchanged.

[0070] According to embodiments of this disclosure, an instance may perform an update operation on the variable values ​​of access permission variables stored in a second block at second predetermined intervals. The second predetermined interval may be the same as or different from the first predetermined interval. The second predetermined interval can be configured according to actual business needs and is not limited herein. For example, the second predetermined interval may be 60 seconds.

[0071] According to embodiments of this disclosure, the update operation for the variable value of the access permission variable stored in the second data block can be performed by the permission thread in the instance. When the permission thread determines that an update operation needs to be performed, it can first set the thread lock state corresponding to the permission thread to a locked state. Furthermore, the operation of generating an update request for the access permission identifier of the object can also be performed by the permission thread in the instance.

[0072] According to embodiments of this disclosure, determining the second data block currently used for updating may include the following operations.

[0073] Identify the data block that the read pointer is not currently pointing to. Designate the data block that the read pointer is not currently pointing to as the second data block to be updated.

[0074] According to embodiments of this disclosure, the currently accessed thread (i.e., the current read thread) can determine the data block that the read pointer is not currently pointing to based on the direction of the read pointer. This data block can be referred to as the second data block.

[0075] According to embodiments of this disclosure, the first data block and the second data block can be data blocks in a double-buffered structure. The first data block and the second data block described above are used to distinguish between two data blocks, and are not intended to limit one data block in the double-buffered structure to be the first data block and the other to be the second data block. For the two data blocks in the double-buffered structure, one data block can be either the first data block or the second data block. The other data block can also be either the first data block or the second data block. Whether a data block is the first data block or the second data block is determined by the current pointer position of the read pointer; the data block currently pointed to by the read pointer is called the first data block. The data block that the read pointer is not currently pointing to is called the second data block.

[0076] According to embodiments of this disclosure, in the case of concurrent read and write operations, if it is necessary to update the value of the access permission variable, the value of the access permission variable stored in the second data block can be updated, while the value of the access permission variable stored in the first data block remains unchanged. Therefore, access operations to the first data block do not require locking; that is, operations to obtain the value of the access permission variable do not require locking, avoiding a large amount of lock contention and thus reducing access processing time.

[0077] According to embodiments of this disclosure, the above access processing method may further include the following operations.

[0078] After updating the value of the access permission variable stored in the second data block, in response to the absence of detected access operation for the first data block, the value of the access permission variable stored in the first data block is updated according to the access permission identifier to be updated.

[0079] According to embodiments of this disclosure, after modifying the value of an access permission variable stored in the second data block, the instance can determine whether an access operation for the first data block has been detected. For example, determining whether an access operation for the first data block has been detected may include: the instance determining whether an access operation for the first data block has been detected within a predetermined delay period. The predetermined delay period can be configured according to actual business needs and is not limited thereto. The instance can determine that no access operation for the first data block has been detected if it determines that no access operation for the first data block has been detected within the predetermined delay period. The instance can also determine that an access operation for the first data block has been detected if it determines that an access operation for the first data block has been detected within the predetermined delay period.

[0080] According to embodiments of this disclosure, if no access operation to the first data block is detected, the read pointer can be changed from pointing to the first data block to pointing to the second data block. If the read pointer points to the second data block, the value of the access permission variable stored in the first data block is modified to the access permission identifier to be updated. If an access operation to the first data block is detected, the value of the access permission variable stored in the first data block remains unchanged.

[0081] According to embodiments of this disclosure, the above-described update operation on the variable value of the access permission variable stored in the first data block can be performed by the permission thread (i.e., the current write thread) in the instance.

[0082] According to embodiments of this disclosure, determining the access permission identifier of an object based on the total global access count and a predetermined access count threshold for the object within a predetermined time period may include the following operations.

[0083] If the total number of global accesses is less than or equal to the predetermined number of accesses to an object within a predetermined time period, the access permission identifier of the object is determined to be an identifier indicating that the object has access permissions.

[0084] According to embodiments of this disclosure, an example can determine whether the total number of global accesses to an object within a predetermined time period is less than or equal to a predetermined access threshold. If the example determines that the total number of global accesses to an object within a predetermined time period is less than or equal to the predetermined access threshold, it can determine that the object's access permission identifier is an identifier indicating that the object has access permissions.

[0085] According to embodiments of this disclosure, determining the access permission identifier of an object based on the total global access count and a predetermined access count threshold for the object within a predetermined time period may further include the following operations.

[0086] According to embodiments of this disclosure, when it is determined that the total number of global accesses is greater than a predetermined threshold for the number of accesses to an object within a predetermined time period, the access permission identifier of the object is determined to be an identifier indicating that the object does not have access permission.

[0087] According to embodiments of this disclosure, if an instance determines that the total number of global accesses to an object within a predetermined time period is greater than a predetermined access threshold, it can determine that the object's access permission identifier is an identifier indicating that the object does not have access permission.

[0088] The following is for reference. Figure 3A , Figure 3B and Figure 3C The access processing method described in this disclosure will be further explained in conjunction with specific embodiments.

[0089] Figure 3A A flowchart illustrating an access processing method according to another embodiment of the present disclosure is shown schematically.

[0090] like Figure 3A As shown, the method 300A includes operations S301 to S311.

[0091] In operation S301, in response to receiving a request to obtain the total number of global accesses for an object, the total number of global accesses for the object within a predetermined time period is obtained.

[0092] In operation S302, the access permission identifier of the object is determined based on the total number of global accesses and the predetermined access threshold for the object within a predetermined time period.

[0093] In operation S303, access permission variables used to indicate the access permission identifier of an object are stored in the first data block and the second data block.

[0094] In operation S304, in response to receiving an access request from an object for a target service, the first data block to be accessed is determined.

[0095] In operation S305, the access permission identifier of the object is obtained from the access permission variable of the first data block.

[0096] In operation S306, determine whether the object has access permissions based on the access permission identifier. If yes, proceed to operation S307; otherwise, proceed to operation S308.

[0097] In operation S307, update the value of the local variable for the number of times the currently accessed thread has been accessed.

[0098] In operation S308, the target service is refused to be provided to the object.

[0099] In operation S309, in response to receiving an update request for the access permission identifier of an object, the access permission identifier to be updated is determined and the second data block currently used for the update is determined.

[0100] In operation S310, the value of the access permission variable stored in the second data block is updated according to the access permission identifier to be updated.

[0101] In operation S311, after updating the value of the access permission variable stored in the second data block, in response to the absence of detected access operation for the first data block, the value of the access permission variable stored in the first data block is updated according to the access permission identifier to be updated.

[0102] According to embodiments of this disclosure, the execution order of operations S301-S308 and operations S309-S311 is not limited. For example, operations S301-S308 can be executed first, followed by operations S309-S311. Alternatively, operations S309-S311 can be executed first, followed by operations S301-S308. Alternatively, operations S301-S308 and operations S309-S311 can be executed in parallel.

[0103] According to embodiments of this disclosure, in high-concurrency scenarios, each access request can correspond to a thread (i.e., the currently accessed thread). The currently accessed thread, upon determining that it has access rights to the object based on an access permission identifier, modifies the value of its local variable indicating the number of accesses. Furthermore, the currently accessed instance periodically sends the value of its local variable indicating the number of accesses to public storage. The above operations are write-heavy and read-light. Embodiments of this disclosure utilize thread-local variables to indicate the cumulative number of accesses to an object within a predetermined time period. Since updating the value of the thread-local variable of the currently accessed thread does not affect other threads in the instance, the operation of updating the cumulative number of accesses does not require locking, avoiding significant lock contention and thus reducing access processing time.

[0104] According to embodiments of this disclosure, instances need to periodically update the values ​​of access permission variables. However, for each access request, the value of the access permission variable (i.e., the access permission identifier) ​​is retrieved. Therefore, operations on the access permission variable are read-heavy and write-light. Embodiments of this disclosure utilize a double-buffered structure. In the case of concurrent reads and writes, if the value of the access permission variable needs to be updated, the value of the access permission variable stored in the second data block can be updated, while the value of the access permission variable stored in the first data block remains unchanged. Therefore, access operations on the first data block do not require locking; that is, operations to retrieve the value of the access permission variable do not require locking, avoiding a large amount of lock contention and thus reducing access processing time.

[0105] Figure 3B The illustration shows an example diagram of updating the value of a local variable for the number of times the currently accessed thread is updated according to an embodiment of the present disclosure.

[0106] like Figure 3B As shown, in 300B, instance 301 includes N threads, namely thread 301_1, thread 301_2, ..., thread 301_n, ..., thread 301_N-1 and thread 301_N. Thread 301_1 has a thread-local variable 302_1 corresponding to thread 301_1, thread 301_2 has a thread-local variable 302_2 corresponding to thread 301_2, ..., thread 301_n has a thread-local variable 302_n corresponding to thread 301_n, ..., thread 301_N-1 has a thread-local variable 302_N-1 corresponding to thread 301_N-1, and thread 301_N has a thread-local variable 302_N corresponding to thread 301_N. The thread-local variables of each thread are independent of each other. The thread-local variables are used to indicate the cumulative number of times an object is accessed within a predetermined time period. n∈{1, 2, ..., (N-1), N}. N is an integer greater than 1.

[0107] For example, in response to receiving an access request from an object for a target service, thread 301_1 obtains the object's access permission identifier. If it determines that the object has the necessary access permissions based on the access permission identifier, it updates the value of thread-local variable 302_1 for thread 301_1. The values ​​of thread-local variables for other threads included in instance 301, excluding thread 301_1, remain unchanged.

[0108] Figure 3C The illustration shows a schematic diagram of updating the value of an access permission variable stored in a second data block according to an access permission identifier to be updated, according to an embodiment of the present disclosure.

[0109] like Figure 3CAs shown, in the 300C, the double-buffered structure 303 includes data block 3030 and data block 3031. Data block 3030 is the data block currently pointed to by the read pointer, that is, data block 3030 is the first data block. Data block 3031 is the data block that the read pointer is not currently pointing to, that is, data block 3031 is the second data block.

[0110] In response to receiving an update request for an access permission identifier of an object, the access permission identifier to be updated is determined to be 304. Based on the read pointer, the data block currently being updated is determined to be data block 3031 (i.e., the second data block). The value of the access permission variable stored in the second data block 3031 is updated according to the access permission identifier to be updated 304. The value of the access permission variable stored in the first data block 3030 remains unchanged.

[0111] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0112] The above are merely exemplary embodiments, but are not limited thereto. Other access processing methods known in the art may also be included, as long as they can reduce access processing time.

[0113] Figure 4 A block diagram of an access processing apparatus according to an embodiment of the present disclosure is shown schematically.

[0114] like Figure 4 As shown, the access processing device 400 may include a first acquisition module 410 and a first update module 420.

[0115] The first acquisition module 410 is used to acquire the object's access permission identifier in response to receiving an access request from the object for the target service. The access permission identifier is used to indicate the object's access permissions to the target service within a predetermined time period.

[0116] The first update module 420 is used to update the value of the local variable for the number of times the object is currently accessed, provided that the object has access permissions based on the access permission identifier. The local variable for the number of times the object is accessed indicates the cumulative number of times the object has been accessed within a predetermined time period.

[0117] According to embodiments of this disclosure, the first acquisition module 410 may include a first determination submodule and an acquisition submodule.

[0118] The first determination submodule is used to determine the first data block currently being accessed. The first data block stores access permission variables that indicate access permission identifiers.

[0119] The `get` submodule is used to retrieve the access permission identifier of an object from the access permission variable of the first data block.

[0120] According to embodiments of this disclosure, the first determining submodule may include a first determining unit and a second determining unit.

[0121] The first determining unit is used to determine the data block currently pointed to by the read pointer.

[0122] The second determining unit is used to determine the data block currently pointed to by the read pointer as the first data block to be accessed.

[0123] According to embodiments of this disclosure, the access processing apparatus 400 may further include a first determining module, a second determining module, and a second updating module.

[0124] In response to receiving an update request for the access permission identifier of an object,

[0125] The first determination module is used to determine the access permission identifier to be updated.

[0126] The second determining module is used to determine the second data block currently being updated. The second data block stores access permission variables that indicate access permission identifiers.

[0127] The second update module is used to update the value of the access permission variable stored in the second data block according to the access permission identifier to be updated.

[0128] According to embodiments of this disclosure, the second determining module may include a second determining submodule and a third determining submodule.

[0129] The second determination submodule is used to determine the data block that the read pointer is not currently pointing to.

[0130] The third determination submodule is used to determine the data block that the read pointer is not currently pointing to as the second data block to be updated.

[0131] According to embodiments of this disclosure, the access processing apparatus 400 may further include a third update module.

[0132] The third update module is used to update the value of the access permission variable stored in the first data block according to the access permission identifier to be updated after completing the update of the variable value of the access permission variable stored in the second data block, in response to the absence of an access operation for the first data block.

[0133] According to embodiments of this disclosure, the access processing apparatus 400 may further include a second acquisition module and a third determination module.

[0134] The second acquisition module is used to, in response to receiving a request to acquire the total global access count of an object, acquire the total global access count of the object within a predetermined time period. The total global access count is determined based on the total local access count of at least one instance included in the target service. The total local access count is determined based on the cumulative access count of at least one thread included in the instance.

[0135] The third determination module is used to determine the access permission identifier of an object based on the total number of global accesses and the predetermined access threshold for the object within a predetermined time period.

[0136] According to embodiments of this disclosure, the third determining module may include a fourth determining submodule.

[0137] The fourth determination submodule is used to determine whether the access permission identifier of an object is an identifier indicating that the object has access permission when the total number of global accesses is less than or equal to the predetermined number of accesses for an object within a predetermined time period.

[0138] According to embodiments of this disclosure, the frequency local variable includes a thread-local variable.

[0139] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0140] According to an embodiment of the present disclosure, an electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method described above.

[0141] According to embodiments of the present disclosure, a non-transitory computer-readable storage medium stores computer instructions, wherein the computer instructions are used to cause a computer to perform the method described above.

[0142] According to an embodiment of this disclosure, a computer program product includes a computer program that, when executed by a processor, implements the method described above.

[0143] Figure 5A block diagram schematically illustrates an electronic device suitable for implementing an access processing method according to embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0144] like Figure 5 As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. The RAM 503 may also store various programs and data required for the operation of the electronic device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0145] Multiple components in electronic device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows electronic device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0146] The computing unit 501 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as access processing methods. For example, in some embodiments, the access processing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the access processing method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform access processing methods by any other suitable means (e.g., by means of firmware).

[0147] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0148] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0149] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0150] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0151] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0152] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, distributed system servers, or servers incorporating blockchain technology.

[0153] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0154] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. An access processing method, comprising: In response to receiving a request to obtain the total global access count for an object, the total global access count for the object within a predetermined time period is obtained, wherein the total global access count is determined based on the total local access count of at least one instance included in the target service, and the total local access count is determined based on the cumulative access count of at least one thread included in the instance; The access permission identifier of the object is determined based on the total global access count and the predetermined access count threshold for the object within the predetermined time period; In response to receiving an access request from the object for the target service, an access permission identifier of the object is obtained, wherein the access permission identifier is used to indicate the object's access permission to the target service within the predetermined time period; and If it is determined that the object has the access permission based on the access permission identifier, the value of the local variable of the number of times the currently accessed thread is updated, wherein the local variable of the number of times the object is accessed is used to indicate the cumulative number of times the object is accessed within the predetermined time period.

2. The method according to claim 1, wherein, The step of obtaining the access permission identifier for the object includes: Determine the first data block currently used for access, wherein the first data block stores access permission variables for indicating the access permission identifier; and Obtain the access permission identifier of the object from the access permission variable of the first data block.

3. The method according to claim 2, wherein, The step of determining the first data block currently used for access includes: Determine the data block currently pointed to by the read pointer; and The data block currently pointed to by the read pointer is determined as the first data block currently used for access.

4. The method according to claim 3, further comprising: In response to receiving an update request for the access permission identifier of the object, Determine the access permission identifier to be updated; Determine the second data block currently used for updating, wherein the second data block stores access permission variables for indicating the access permission identifier; as well as Update the value of the access permission variable stored in the second data block according to the access permission identifier to be updated.

5. The method according to claim 4, wherein, The step of determining the second data block currently used for updating includes: Determine the data block that the read pointer is not currently pointing to; and The data block that the read pointer is not currently pointing to is identified as the second data block currently used for updating.

6. The method according to claim 5, further comprising: After updating the value of the access permission variable stored in the second data block, in response to the absence of detected access operation for the first data block, the value of the access permission variable stored in the first data block is updated according to the access permission identifier to be updated.

7. The method according to claim 1, wherein, The step of determining the access permission identifier of the object based on the total global access count and a predetermined access count threshold for the object includes: If the total number of global accesses is determined to be less than or equal to a predetermined access threshold for the object within the predetermined time period, the access permission identifier of the object is determined to be an identifier indicating that the object has the access permission.

8. The method according to any one of claims 1 to 7, wherein, The local variable for the number of occurrences includes thread-local variables.

9. An access processing apparatus, comprising: The second acquisition module is configured to, in response to receiving a request to acquire the total global access count of an object, acquire the total global access count of the object within a predetermined time period, wherein the total global access count is determined based on the total local access count of at least one instance included in the target service, and the total local access count is determined based on the cumulative access count of at least one thread included in the instance. The third determining module is used to determine the access permission identifier of the object based on the total global access count and the predetermined access count threshold for the object within the predetermined time period; The first acquisition module is configured to, in response to receiving an access request from an object for a target service, acquire an access permission identifier of the object, wherein the access permission identifier is used to indicate the object's access permission to the target service within a predetermined time period; and The first update module is used to update the value of the local variable of the number of times the currently accessed thread is accessed when it is determined that the object has the access permission based on the access permission identifier. The local variable of the number of times the object is accessed is used to indicate the cumulative number of times the object is accessed within the predetermined time period.

10. The apparatus according to claim 9, wherein, The first acquisition module includes: A first determining submodule is configured to determine a first data block currently being accessed, wherein the first data block stores access permission variables indicating the access permission identifier; and The acquisition submodule is used to obtain the access permission identifier of the object from the access permission variable of the first data block.

11. The apparatus according to claim 10, wherein, The first determining submodule includes: The first determining unit is used to determine the data block currently pointed to by the read pointer; and The second determining unit is used to determine the data block currently pointed to by the read pointer as the first data block currently used for access.

12. The apparatus of claim 11, further comprising: In response to receiving an update request for the access permission identifier of the object, The first determining module is used to determine the access permission identifier to be updated; The second determining module is used to determine the second data block currently used for updating, wherein the second data block stores an access permission variable for indicating the access permission identifier; as well as The second update module is used to update the variable value of the access permission variable stored in the second data block according to the access permission identifier to be updated.

13. The apparatus according to claim 12, wherein, The second determining module includes: The second determining submodule is used to determine the data block that the read pointer is not currently pointing to; and The third determining submodule is used to determine the data block that the read pointer is not currently pointing to as the second data block currently used for updating.

14. The apparatus of claim 13, further comprising: The third update module is used to update the value of the access permission variable stored in the first data block according to the access permission identifier to be updated after completing the update of the variable value of the access permission variable stored in the second data block, in response to the absence of detected access operation for the first data block.

15. The apparatus according to claim 9, wherein, The third determining module includes: The fourth determining submodule is used to determine, when the total number of global accesses is less than or equal to a predetermined access threshold for the object within the predetermined time period, whether the access permission identifier of the object is an identifier indicating that the object has the access permission.

16. The apparatus according to any one of claims 9 to 15, wherein, The local variable for the number of occurrences includes thread-local variables.

17. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 8.

18. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 8.

19. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 8.