Active object number query method based on multi-tenant multi-object pool and related equipment
By using a method to query the number of active objects in a multi-tenant, multi-object pool, the problem of tenants being unable to quickly and accurately obtain the number of active users in the user pool is solved, thus enabling fast and accurate user scale assessment.
Patent Information
- Application Number
- CN202210219881.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-08
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2042-03-08
AI Technical Summary
Tenants cannot quickly and accurately obtain the number of active users in their corresponding multiple user pools, which cannot meet the tenants' needs for assessing the market user scale in cloud service scenarios.
A method for querying the number of active objects based on multi-tenant multi-object pools is provided. By obtaining the first identifier information of each object pool of the target tenant, the active object record is searched from the target cache corresponding to the target tenant, the number of active objects in each object pool within a preset time period is determined, and the result is displayed.
It enables the rapid and accurate determination of the number of active objects in each object pool within a preset time period, meeting the tenant's needs for assessing the scale of market users.
Smart Images

Figure CN116775688B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and storage medium for querying the number of active objects based on a multi-tenant, multi-object pool. Background Technology
[0002] Multi-tenancy, also known as multi-tenancy technology, is a software architecture technology in a cloud environment. It explores and implements how to share the same system or program components in a multi-user environment, with resources and configurations isolated between different tenants, and each tenant can personalize the rented instance according to its own needs.
[0003] Tenants divide users of different types or scenarios into different user isolation units in the system. Each user isolation unit is a user pool for that tenant. Each user pool corresponds to independent users, applications, resources, etc. Typically, each tenant can have multiple user pools. Users, permissions, configurations, etc. are completely isolated between different user pools.
[0004] In related technologies, tenants cannot quickly and accurately obtain the number of active users (such as the number of monthly active users) of their corresponding multiple user pools, thus failing to meet the tenants' needs for assessing the market user scale in cloud service scenarios. Summary of the Invention
[0005] To address the problems of existing technologies, embodiments of the present invention provide a method and related equipment for querying the number of active objects based on a multi-tenant, multi-object pool. The technical solution is as follows:
[0006] On the one hand, a method for querying the number of active objects based on a multi-tenant, multi-object pool is provided, the method comprising:
[0007] In response to a query request for the number of active objects of a target tenant, the first identifier information of each object pool corresponding to the target tenant is obtained; the target tenant is any one of multiple tenants.
[0008] The active object records corresponding to each of the first identifiers are retrieved from the target cache corresponding to the target tenant to obtain the search results corresponding to each of the first identifiers; the active object records in the target cache are used to record the active objects of the object pool corresponding to the corresponding first identifier within a preset time period;
[0009] Based on the search results corresponding to each of the first identifier information, determine the number of active objects in the object pool corresponding to each of the first identifier information within the preset time period;
[0010] Display the number of active objects in each of the object pools during the preset time period.
[0011] On the other hand, a device for querying the number of active objects based on a multi-tenant, multi-object pool is provided, the device comprising:
[0012] The first identifier acquisition module is used to obtain the first identifier information of each object pool corresponding to the target tenant in response to the active object count query request of the target tenant; the target tenant is any one of multiple tenants;
[0013] The active object record lookup module is used to look up the active object record corresponding to each of the first identifier information from the target cache corresponding to the target tenant, and obtain the lookup result corresponding to each of the first identifier information; the active object record in the target cache is used to record the active objects of the object pool corresponding to the corresponding first identifier information within a preset time period;
[0014] The active object quantity determination module is used to determine the number of active objects in the object pool corresponding to each of the first identifier information within the preset time period based on the search results corresponding to each of the first identifier information.
[0015] The display module is used to display the number of active objects in each of the object pools within the preset time period.
[0016] In one exemplary embodiment, the apparatus further includes:
[0017] The active log acquisition module is used to retrieve target active logs within the time range corresponding to the current task cycle from the active log database in response to the task execution command within the preset time period. The active logs in the active log database are generated in response to the active behavior of the corresponding object. The active logs include the second identification information of the corresponding object, the first identification information of the object pool to which the object belongs, and the behavior time of the active behavior.
[0018] The information extraction module is used to extract the second target identifier information and the first target identifier information from the target activity log;
[0019] The first search module is used to search for target active object records in the target cache that match the target's first identifier information;
[0020] The record update module is used to record the object corresponding to the second target identifier information into the target active object record according to the data storage structure of the target active object record when the first search module finds the target active object record and the target active object record indicates that the object corresponding to the second target identifier information is not an active object.
[0021] A creation module is used to create a target active object record corresponding to the target first identifier information in the target cache when the first search module fails to find the target, based on a data storage structure that matches the generation rule of the target second identifier information; the created target active object record indicates that the object corresponding to the target second identifier information is an active object.
[0022] In one exemplary embodiment, the apparatus further includes:
[0023] The judgment module is used to determine whether the task execution instruction is the first task execution instruction within the preset time period;
[0024] The cache clearing module is used to store the active object records in the target cache to a specified storage space and clear the target cache when the task execution instruction is the first task execution instruction within the preset time period.
[0025] The first task cycle determination module is used to determine the current task cycle based on the preset time period and the preset task cycle.
[0026] The second task cycle determination module is used to determine the current task cycle according to the preset task cycle when the task execution instruction is not the first task execution instruction within the preset time period.
[0027] In an exemplary implementation, when the data storage structure of the target active object record is a set of identification information, the record update module includes:
[0028] The second search module is used to search for the target second identification information in the target identification information set;
[0029] The first storage module is used to store the target second identification information into the target identification information set when the second search module does not find it.
[0030] In one exemplary implementation, the active object count determination module includes:
[0031] The first determining module is used to determine the total number of identifiers in the identifier information set corresponding to the corresponding first identifier when the search result indicates that the identifier information set corresponding to the corresponding first identifier is found, and to obtain the number of active objects in the object pool corresponding to the corresponding first identifier within the preset time period.
[0032] The second determining module is used to determine that the number of active objects in the object pool corresponding to the first identifier information within the preset time period is zero when the search result indicates that no identifier information set corresponding to the first identifier information is found.
[0033] In an exemplary implementation, when the data storage structure of the target active object record is a bitmap, the record update module includes:
[0034] The bitmap position determination module is used to determine the target bitmap position corresponding to the second target identification information in the target bitmap; the target bitmap includes the bitmap positions corresponding to each object in the object pool corresponding to the first target identification information;
[0035] The first state value adjustment module is used to adjust the state value of the target bitmap position to a preset state value when the state value of the target bitmap position is the initial state value.
[0036] In one exemplary implementation, the active object count determination module includes:
[0037] The third determining module is used to determine the total number of bitmap positions in the bitmap corresponding to the first identifier information with a state value of the preset state value when the search result indicates that the bitmap corresponding to the first identifier information has been found, so as to obtain the number of active objects in the object pool corresponding to the first identifier information within the preset time period.
[0038] The fourth determining module is used to determine that the number of active objects in the object pool corresponding to the first identifier information within the preset time period is zero when the search result indicates that no bitmap corresponding to the first identifier information is found.
[0039] In one exemplary implementation, the creation module includes:
[0040] A rule determination module is used to determine the generation rules for the target second identifier information;
[0041] The first storage structure determination module is used to determine that the matching data storage structure is a bitmap when the generation rule is an incrementing identifier rule;
[0042] The bitmap creation module is used to obtain the second identification information of each object in the object pool corresponding to the first identification information of the target, and to create an initial bitmap corresponding to the first identification information of the target in the target cache according to the second identification information of each object; the state value of each bitmap position in the initial bitmap is the initialization state value.
[0043] The second state value adjustment module is used to adjust the state value of the bitmap position corresponding to the second identifier information of the target in the initial bitmap to a preset state value to obtain the target bitmap.
[0044] In one exemplary implementation, the creation module further includes:
[0045] The second storage structure determination module is used to determine the matching data storage structure as an identification information set when the generation rule is a non-identifier increment rule.
[0046] An identifier information set creation module is used to create an initial identifier information set corresponding to the first identifier information of the target in the target cache; the initial identifier information set is empty.
[0047] The second storage module is used to store the target second identification information into the initial identification information set to obtain the target identification information set.
[0048] In one exemplary embodiment, the first storage structure determination module includes:
[0049] The historical reverse lookup request lookup module is used to look up the historical reverse lookup requests of the target tenant for the active object when the generation rule is an incrementing identifier rule; the historical reverse lookup request is a request initiated based on the second identifier information of the active object;
[0050] The first storage structure determination submodule is used to determine the matching data storage structure as a bitmap when the historical reverse lookup request module fails to find it.
[0051] The second storage structure determination submodule is used to determine the matching data storage structure as an identification information set when the historical reverse lookup request search module finds it.
[0052] In one exemplary embodiment, the information extraction module includes:
[0053] The deduplication module is used to perform deduplication processing on the target activity log based on the target second identifier information in the target activity log to obtain the deduplicated target activity log.
[0054] The extraction module is used to extract the second target identifier information and the first target identifier information from the deduplicated target active logs.
[0055] On the other hand, an electronic device is provided, including a processor and a memory, wherein the memory stores at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the above-described method for querying the number of active objects based on a multi-tenant multi-object pool.
[0056] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction or at least one program is stored therein, the at least one instruction or the at least one program being loaded and executed by a processor to implement the active object count query method based on a multi-tenant multi-object pool as described above.
[0057] On the other hand, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the aforementioned method for querying the number of active objects based on a multi-tenant, multi-object pool.
[0058] In this embodiment of the invention, when a tenant queries the activity level of an object, the first identifier information of each object pool corresponding to the tenant is obtained, and the active object record corresponding to each first identifier information is searched in the target cache corresponding to the tenant to obtain the search result corresponding to each first identifier information. Since the active object record in the target cache is used to record the active objects of the object pool corresponding to the first identifier information within a preset time period, the number of active objects of the object pool corresponding to each first identifier information within the preset time period can be quickly and accurately determined and displayed based on the search result corresponding to each first identifier information. This allows each tenant to quickly obtain the accurate number of active users of its corresponding multiple user pools, meeting the tenant's need for market user scale assessment in cloud service scenarios. Attached Figure Description
[0059] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0060] Figure 1 This is a schematic diagram of an application environment provided by an embodiment of the present invention;
[0061] Figure 2 This is a system architecture diagram provided in an embodiment of the present invention;
[0062] Figure 3 This is a flowchart illustrating a method for querying the number of active objects based on a multi-tenant, multi-object pool, according to an embodiment of the present invention.
[0063] Figure 4 This is a demonstration interface example provided by an embodiment of the present invention;
[0064] Figure 5 This is a schematic diagram of the process for generating and updating active object records in the target cache provided by an embodiment of the present invention;
[0065] Figure 6 This is a schematic diagram of a process for generating and updating active object records in a target cache, provided by an embodiment of the present invention;
[0066] Figure 7 This is an example of a cache service storage structure provided in an embodiment of the present invention;
[0067] Figure 8 This is another example of the cache service storage structure provided in the embodiments of the present invention;
[0068] Figure 9 This is a structural block diagram of an active object count query device based on a multi-tenant multi-object pool provided by an embodiment of the present invention;
[0069] Figure 10 This is a hardware structure block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0070] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0071] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0072] It is understood that in the specific embodiments of this application, data such as user information are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0073] The embodiments of the present invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.
[0074] Cloud computing is a computing model that distributes computing tasks across a resource pool composed of a large number of computers, enabling various application systems to access computing power, storage space, and information services as needed. The network providing these resources is called the "cloud." From the user's perspective, the resources in the "cloud" are infinitely scalable, readily available, on-demand, expandable, and pay-as-you-go. As a provider of fundamental cloud computing capabilities, a cloud resource pool (referred to as a cloud platform, generally called an IaaS (Infrastructure as a Service) platform) is established. Various types of virtual resources are deployed within this pool for external customers to choose from. The cloud resource pool mainly includes: computing devices (virtualized machines containing operating systems), storage devices, and network devices. Logically, a PaaS (Platform as a Service) layer can be deployed on top of the IaaS layer, and a SaaS (Software as a Service) layer can be deployed on top of the PaaS layer. Alternatively, SaaS can be directly deployed on top of IaaS. PaaS is a platform for running software, such as databases and web containers. SaaS refers to various types of business software, such as web portals and bulk SMS senders. Generally, SaaS and PaaS are upper layers compared to IaaS.
[0075] Cloud security refers to the collective term for security software, hardware, users, organizations, and security cloud platforms based on cloud computing business models. Cloud security integrates emerging technologies and concepts such as parallel processing, grid computing, and the identification of unknown virus behavior. Through a large network of clients, it monitors abnormal software behavior on the network, obtains the latest information on Trojans and malware on the internet, sends it to the server for automatic analysis and processing, and then distributes solutions for viruses and Trojans to each client.
[0076] The main research directions in cloud security include: 1. Cloud computing security, which mainly studies how to ensure the security of the cloud itself and various applications on the cloud, including cloud computer system security, secure storage and isolation of user data, user access authentication, information transmission security, network attack protection, and compliance auditing; 2. Cloudification of security infrastructure, which mainly studies how to use cloud computing to build and integrate security infrastructure resources and optimize security protection mechanisms, including building a large-scale security event and information collection and processing platform through cloud computing technology to achieve the collection and correlation analysis of massive amounts of information and improve the ability to control network-wide security events and risks; 3. Cloud security services, which mainly studies various security services provided to users based on cloud computing platforms, such as antivirus services.
[0077] The following is a description of the terminology that may be involved in the embodiments of the present invention.
[0078] MAU, also known as Monthly Active Users, is a method and standard used to measure the activity level of users in an online application. The number of monthly active users reflects the activity level of users.
[0079] Tenant: also known as multi-tenancy technology, is a software architecture technology that explores and implements how to share the same system or program components in a multi-user environment. Resources and configurations are isolated between different tenants, and each tenant can personalize the rented instance according to its own needs.
[0080] User pools: Tenants divide users of different types or scenarios into different user isolation units in the system. Each user pool has independent users, applications, resources, etc. Tenants can have multiple user pools, and users, permissions, configurations, etc. are completely isolated between different user pools.
[0081] CIAM, also known as Customer Identity and Access Management, provides tenants with a convenient registration and login experience, improves user retention on the platform, connects application identity data, better describes users, and can also identify malicious users to avoid business losses.
[0082] UUID: Also known as Universally Unique Identifier, it is a software construction standard. Its purpose is to provide a unique identifier in a distributed system, rather than relying on a central control point for identification and assignment. Each unit in the system has a unique identifier that will not be repeated.
[0083] Snowflake: Also known as the Snowflake algorithm, it is an algorithm created by Twitter for generating distributed globally unique IDs. The first 41 bits are a timestamp, representing the number of milliseconds since the selected time. The next 10 bits represent the machine ID to prevent collisions. The last 12 bits are the sequence number on each machine that generates the ID, allowing multiple Snowflake IDs to be generated incrementally within the same millisecond.
[0084] The application environment of the embodiments of the present invention will be described below.
[0085] Please see Figure 1The diagram shown is a schematic diagram of an application environment provided by an embodiment of the present invention, which may include a first terminal 110, a second terminal 120, a first server 130, a second server 140, and a database 150.
[0086] The first terminal 110 is the terminal used by the tenant, and includes, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. The first terminal 110 runs client software, such as an application (App), that provides data query functions. This application can be a standalone application or a subroutine within an application. Specifically, the data query function queries the number of active users of the tenant within a preset time period. The tenant of the first terminal 110 can log in to the application using pre-registered tenant information, which may include an account and password.
[0087] The second terminal 120 is the terminal used by the user of the tenant corresponding to the first terminal 110. The second terminal 120 includes, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc. The second terminal 110 runs client software such as an application (App) that provides identity authentication functions. The application can be a standalone application or a subroutine within an application. The user of the second terminal 110 can log in to the application using pre-registered user information, which may include an account and password.
[0088] The first server 130 is communicatively connected to the first terminal 110 and the second terminal 120, providing background services for the applications in the first terminal 110 and the second terminal 120. Specifically, the first server 130 can provide identity authentication services for tenant users and generate corresponding user activity logs when users authenticate through the second terminal 120, sending the generated user activity logs to the database 150 for storage. The first server 130 can also provide data query services for tenants and return the number of active users in each user pool corresponding to the tenant within a preset time period based on the cached content in the second server 130. The second server 140 is used to provide caching services, the cached content of which includes active user records for each tenant, used to record the active users of the user pool corresponding to the tenant within a preset time period.
[0089] In a specific application scenario, the first server 130 could be CIAM (Customer Identity and Access Management, a public digital identity management platform), such as... Figure 2The system architecture diagram shown indicates that CIAM includes three independent services: the console, which responds to tenant data query requests and displays the monthly active user counts of multiple user pools corresponding to the tenant; the core management platform, which processes user activity logs into active user counts and updates them; the portal application, which generates user activity logs and stores them in the database when tenant users perform identity authentication operations; and the caching service, which provides efficient statistical analysis of active user counts.
[0090] It should be noted that the communication connection in the embodiments of the present invention can be a wired network or a wireless network. The server and database in the embodiments of the present invention can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. They can also be cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0091] In one exemplary embodiment, the aforementioned terminal, server, and database can all be node devices in a blockchain system, capable of sharing acquired and generated information with other node devices in the blockchain system, thus realizing information sharing among multiple node devices. Multiple node devices in the blockchain system can be configured with the same blockchain, which consists of multiple blocks, and adjacent blocks are related, ensuring that any data tampering in any block can be detected by the next block, thereby preventing data tampering in the blockchain and guaranteeing the security and reliability of the data in the blockchain.
[0092] The following is combined Figure 1 and Figure 2 The technical solutions of the embodiments of the present invention will be described in detail.
[0093] Please see Figure 3 The diagram shows a flowchart of a method for querying the number of active objects based on a multi-tenant, multi-object pool, according to an embodiment of the present invention. This method can be applied to... Figure 1 The first server. It should be noted that this specification provides the operational steps of the methods described in the embodiments or flowcharts, but based on conventional or non-inventive labor, more or fewer operational steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many steps and does not represent the only execution order. In actual system or product execution, the methods shown in the embodiments or drawings can be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment). Specifically, as shown... Figure 3 As shown, the method may include:
[0094] S301, in response to the query request for the number of active objects of the target tenant, obtain the first identification information of each object pool corresponding to the target tenant.
[0095] The target tenant refers to the tenant that initiates the active object count query request. This target tenant can be any one of multiple tenants. Each target tenant corresponds to multiple object pools, and the objects, permissions, and configurations of these multiple object pools are completely isolated. In other words, the objects in different object pools are different.
[0096] For example, the aforementioned object could be a user of the tenant. The aforementioned active object count query request could be used to query the number of active objects in the object pool corresponding to the target tenant within a preset time period, wherein the preset time period can be set according to actual needs, for example, it could be one month.
[0097] In this embodiment of the invention, each object pool of a tenant corresponds to a unique identifier, namely the first identifier. That is, there is a one-to-one correspondence between a tenant's object pool and the first identifier. The format of the first identifier may include, but is not limited to, UUID, SnowflakeID, database auto-incrementing ID, and digest value.
[0098] by Figure 2 Taking the application scenario shown as an example, when the target tenant enters the target menu through the front-end interface of the console, the target tenant initiates a query request for the number of active objects. The console responds to the query request and obtains the first identification information of each object pool corresponding to the target tenant.
[0099] S303, search for the active object record corresponding to each of the first identifier information from the target cache corresponding to the target tenant, and obtain the search result corresponding to each of the first identifier information.
[0100] The active object records in the target cache are used to record active objects in the object pool corresponding to the first identifier information within a preset time period. Different active object records correspond to different object pools, and the active objects recorded in each active object record belong to the objects in the object pool corresponding to that active object record. For example, the target cache corresponding to target tenant R has active object records A, B, and C. Active object record A is only used to record active objects in object pool 1 of target tenant R, active object record B is only used to record active objects in object pool 2 of target tenant R, and active object record C is only used to record active objects in object pool 3 of target tenant R.
[0101] In this embodiment of the invention, the caching service provides a corresponding cache for each tenant. The target cache is the cache corresponding to the target tenant, that is, the target cache only stores the active object records of each first identifier information corresponding to the target tenant within a preset time period.
[0102] In this embodiment of the invention, a unique second identifier is configured for each object of the target tenant. The format of this second identifier may include, but is not limited to, UUID, SnowflakeID, database auto-incrementing ID, and digest value. Different formats of the second identifier correspond to different identifier generation rules. These identifier generation rules can include identifier increment rules and non-identifier increment rules. Identifier increment rules refer to generating identifier information in a sequentially increasing manner, while non-identifier increment rules refer to generating identifier information in a non-sequentially increasing manner. For example, SnowflakeID and database auto-incrementing ID are identifier information generated based on identifier increment rules, while UUID and digest value are identifier information generated based on non-identifier increment rules.
[0103] In this embodiment of the invention, the data storage structure for active object records can include various methods. In one exemplary implementation, the data storage structure for active object records can be an identification information set. This identification information set stores the second identification information of the active object identified as an active object in the corresponding object pool, and the identification information set is named after its corresponding first identification information. Therefore, when searching for active object records corresponding to each first identification information in the target cache, the identification information set named after each first identification information can be searched. It should be noted that the identification information set uses a set of non-repeating elements; that is, the elements in the identification information set are not repeated. For example, this identification information set can be a Redis set (such as a set).
[0104] In another exemplary implementation, to reduce storage space consumption, the data storage structure for active object records can be a bitmap. Each object pool with active objects in the target tenant can use a bitmap to store the activity status of the objects. Each bitmap can be named according to its corresponding first identification information. In a specific implementation, a corresponding key (value) can be generated based on the second identification information of each object in the object pool with active objects. This key (value) is then used as the bit index of a bit in the bitmap. Each bit has only two states, 0 and 1, used to identify the state at that position and also the state of the key (0 or 1). The initial state value of each bit in the bitmap is set to 0. For objects determined to be active, the corresponding bit is set to 1. Then, when searching for active object records corresponding to each first identification information in the target cache, the bitmap named after each first identification information can be searched.
[0105] S305, based on the search results corresponding to each of the first identification information, determine the number of active objects in the object pool corresponding to each of the first identification information within the preset time period.
[0106] In specific implementation, for a certain first identifier, if the search result indicates that no active object record corresponding to the first identifier is found, it means that none of the objects in the object pool corresponding to the first identifier are active objects, that is, the number of active objects in the object pool corresponding to the first identifier within the preset time period is zero; if the search result indicates that an active object record corresponding to the first identifier is found, the number of active objects in the object pool corresponding to the first identifier within the preset time period can be determined based on the found active object record.
[0107] Taking the data storage structure of active object records as the aforementioned set of identification information as an example, for the first identification information User1 (corresponding to object pool 1), the set of identification information named User1 is found in the target cache. Since this set of identification information only stores the second identification information of active objects in object pool 1 and is not duplicated, the total number of the second identification information in this set of identification information can be directly counted to obtain the number of active objects in object pool 1 within the preset time period.
[0108] Taking the data storage structure of the active object record as the aforementioned bitmap as an example, for the first identification information User1 (corresponding to object pool 1), the bitmap named User1 is found in the target cache, and the total number of all bits in the bitmap that are 1 can be counted to obtain the number of active objects in object pool 1 within the preset time period.
[0109] S307, Display the number of active objects in each of the object pools during the preset time period.
[0110] In specific implementation, the number of active objects in each object pool of the target tenant during the preset time period can be displayed separately. Alternatively, based on the number of active objects in each object pool during the preset time period, the total number of active objects of the target tenant during the preset time period can be displayed (i.e., the sum of the number of active objects in each object pool).
[0111] like Figure 4 The image shown is an example of an interface provided by an embodiment of the present invention. Applying the embodiment of the present invention to the resource usage scenario of CIAM, it displays the monthly active users (MAU) of multiple user pools of the current tenant. The tenant can understand the monthly active users of the user pool through the MAU statistics of the user pool.
[0112] This invention, when a tenant queries the activity level of an object, obtains the first identifier information of each object pool corresponding to that tenant, and searches for the active object record corresponding to each first identifier information in the target cache corresponding to that tenant, thus obtaining the search result corresponding to each first identifier information. Since the active object record in the target cache is used to record the active objects of the object pool corresponding to the first identifier information within a preset time period, the number of active objects of the object pool corresponding to each first identifier information within the preset time period can be quickly and accurately determined and displayed based on the search result corresponding to each first identifier information. The entire query time complexity is O(1), enabling each tenant to quickly obtain the accurate number of active users of its corresponding multiple user pools within the preset time period, which is convenient for tenants to manage users and businesses and meets the tenant's assessment needs for market user scale in cloud service scenarios.
[0113] In one exemplary embodiment, the query method of this invention further includes generating and updating active object records in the target cache. Specifically, as shown below... Figure 5 The provided flowchart for generating and updating active object records in the target cache may include:
[0114] S501, in response to the task execution instruction within the preset time period, retrieve the target active logs within the time range corresponding to the current task cycle from the active log database.
[0115] The active logs in the active log database are generated in response to the active behaviors of the corresponding objects. The active logs include the second identification information of the corresponding object, the first identification information of the object pool to which the object belongs, and the behavior time of the active behavior.
[0116] by Figure 2 For example, when a user performs an identity authentication operation through a portal application, the operation time of the authentication operation is obtained as the behavior time of the user's active behavior. The user's second identifier information and the first identifier information of the user pool to which the user belongs are also obtained. An activity log is generated based on the behavior time of the user's active behavior, the second identifier information, and the first identifier information of the user pool, and this activity log is stored in the activity log database. It is understandable that the activity log may also include other information, such as activity type (e.g., login, registration, obtaining verification code, resetting password, etc.) and the operation result of the identity authentication operation (which can be divided into success and failure). Table 1 below is an example of key information in the activity log:
[0117] Table 1
[0118] Log attributes describe createTime Operation time, the time of user active behavior userId Unique identifier of active users userStore The unique identifier of the user pool to which an active user belongs type Activity types, such as login, registration, obtaining verification codes, resetting passwords, etc. result The operation results are divided into success and failure.
[0119] In practice, tenants can customize scheduled tasks according to preset task cycles. When the scheduled task's execution time is reached, the scheduled task will be started to issue a task execution instruction. For example, the preset task cycle could be to execute once a day at 07:00, once a week at 23:59, once a month at 00:00, etc.
[0120] In this embodiment of the invention, in order to accurately obtain the number of active objects within a preset time period, the current task period needs to be accurately determined before retrieving the target active logs within the time range corresponding to the current task period from the active log database. Specifically, after the scheduled task starts, it first determines whether the current task execution instruction is the first task execution instruction within the preset time period. If it is the first task execution instruction within the preset time period, the current task period needs to be determined based on the preset time period and the preset task period; if it is not the first task execution instruction within the preset time period, the current task period can be directly determined based on the preset task period.
[0121] For example, if a tenant's custom task is scheduled to execute daily at 07:00, with a preset time period of one month, and the current scheduled task starts at 07:00 on August 1, 2021, then the current task execution instruction is the first task execution instruction of the month. Therefore, the current task period can be determined to be [2021-8-1 00:00:00, 2021-8-1 07:00:00). Furthermore, based on the behavior time of active behaviors in the active logs, target active logs with behavior times between [2021-8-1 00:00:00, 2021-8-1 07:00:00) can be retrieved from the active log database. If the current scheduled task starts at 07:00 on August 2, 2021, then the current task execution instruction is not the first task execution instruction of the month. Therefore, the current task period can be determined to be [2021-8-1 07:00:00, 2021-8-2 07:00:00]. 07:00:00), and then the target active logs with behavior times between [2021-8-1 07:00:00, 2021-8-2 07:00:00) can be obtained from the active log database based on the behavior time of the active behavior in the active log.
[0122] In this embodiment of the invention, to ensure that the target cache accurately records active object records within a preset time period, thereby improving the speed and accuracy of determining the number of active objects, when it is determined that the current task execution instruction is the first task execution instruction within the preset time period, the active object records in the target cache are stored in a designated storage space, and the target cache is then cleared. Storing the active object records in the target cache in the designated storage space can be used for business analysis and management, while clearing the target cache ensures that it is only used to record active object records within the preset time period. This reduces storage space usage and improves the speed and accuracy of counting the number of active objects.
[0123] Based on this, such as Figure 6 Another flowchart illustrating the generation and updating of active object records in the target cache is provided. Before retrieving the target active logs within the time range corresponding to the current task period from the active log database, the method may further include:
[0124] S601, determine whether the task execution instruction is the first task execution instruction within the preset time period.
[0125] Specifically, if the result of the judgment is yes, the following steps S603 to S605 can be executed; otherwise, if the result of the judgment is no, the following step S607 can be executed.
[0126] S603, store the active object records in the target cache to the specified storage space, and clear the target cache.
[0127] S605, determine the current task cycle based on the preset time period and the preset task cycle.
[0128] Specifically, the current task cycle starts at the beginning of a preset time period and ends at the end of the preset task cycle. For example, if the preset task cycle is to be executed at 07:00 every day and the preset time period is one month, and the start time of the current scheduled task is 07:00 on August 1, 2021, then the current task execution instruction is the first task execution instruction of this month. Therefore, the current task cycle can be determined as [2021-8-1 00:00:00, 2021-8-1 07:00:00].
[0129] S607, determine the current task cycle according to the preset task cycle.
[0130] Specifically, the current task cycle can be directly the preset task cycle. For example, if the start time of the current scheduled task is 07:00 on August 2, 2021, then the current task execution instruction is not the first task execution instruction of this month. Therefore, the current task cycle can be determined as [2021-8-1 07:00:00, 2021-8-2 07:00:00).
[0131] S503, extract the second target identifier information and the first target identifier information from the target activity log.
[0132] Specifically, the second target identifier information and the corresponding first target identifier information are extracted from the target activity log.
[0133] In this embodiment of the invention, to improve the processing efficiency of active logs, the target active logs can be deduplicated based on the second identifier information. Then, the second identifier information and the corresponding first identifier information are extracted from the deduplicated target active logs to obtain the target second identifier information and the target first identifier information corresponding to the target second identifier information. Table 2 below shows an example of the active log extraction result based on the example in Table 1:
[0134] Table 2
[0135] userId (user identifier, i.e., secondary identification information) userStore (user pool identifier, i.e., primary identifier information) 134fcdff-c1f2-447c-8904-aaaaaaaaaaaa a222e107-c3d3-40f1-817f-8596fc500001 134fcdff-c1f2-447c-8904-bbbbbbbbbbbb a222e107-c3d3-40f1-817f-8596fc500001 134fcdff-c1f2-447c-8904-cccccccccccc a222e107-c3d3-40f1-817f-8596fc500003
[0136] S505, Search for the target active object record in the target cache that matches the target first identification information.
[0137] Specifically, the target active object record named with the target's first identifier information can be searched in the target cache. If it is found, step S507 can be executed; otherwise, if it is not found, step S509 can be executed.
[0138] S507, if the target active object record indicates that the object corresponding to the target second identification information is not an active object, the object corresponding to the target second identification information is recorded in the target active object record according to the data storage structure of the target active object record.
[0139] In one specific implementation, the data storage structure of the target active object record is a set of identification information, that is, the active object record in the target cache is a set of identification information with the second identification information as the element. Then, the above step S507 may include the following when implemented:
[0140] Search for the second identification information of the target in the target identification information set;
[0141] If not found, the second target identification information is stored in the target identification information set.
[0142] Understandably, if it is found, it means that the target identification information set already contains the target's second identification information, that is, the object corresponding to the target's second identification information has been identified as an active object. In order to avoid duplicate counting and thus inaccurate final number of active objects, the target identification information set is not updated at this time, and the target's second identification information is directly discarded.
[0143] In this embodiment, the caching service can actually be viewed as a three-level storage data structure. The first level is the target cache corresponding to the target tenant. The next level of the target cache is the first identifier information, and the next level of the first identifier information is the second identifier information. Taking a preset time period of one month and counting monthly active users (MAU) as an example, the first level is fixed at MAU, the second level is the unique identifier of the user pool (userStore), such as the user pool a222e107-c3d3-40f1-817f-8596fc500001 in Table 2. The second level and the first level together form MAU / a222e107-c3d3-40f1-817f-8596fc500001. Each element in the third level must be unique. Figure 7 This is an example of the cache service storage structure provided in the embodiments of the present invention. MAU represents the target cache. The user pool identifiers userStore contained under MAU are unique, and the user identifiers userId of active users under the user pool are also unique.
[0144] In one example, the second identifier for a unique object can be a UUID (Universally Unique Identifier). A UUID consists of 32 characters and four hyphens, totaling 36 bits, in the format 8-4-4-4-12, as shown in the userId example in Table 2: 134fcdff-c1f2-447c-8904-aaaaaaaaaaaaa. A UUID is 128 bits long, which is 16 bytes. When a tenant contains 5 object pools, each containing 1,000,000 active objects (in reality, this may be much greater than 1,000,000), storing this data theoretically only requires 16 bytes * 1,000,000 * 5 = 80,000,000 bytes, approximately 76.29 MB. This saves storage resources while still meeting the requirements for managing active objects within a preset time period.
[0145] Based on this, when the above step S305 is implemented, it may include: when the search result indicates that the set of identification information corresponding to the corresponding first identification information has been found, determining the total number of second identification information in the set of identification information corresponding to the corresponding first identification information, and obtaining the number of active objects in the object pool corresponding to the corresponding first identification information within the preset time period.
[0146] When the search result indicates that no set of identifier information corresponding to the corresponding first identifier information is found, it is determined that the number of active objects in the object pool corresponding to the corresponding first identifier information within the preset time period is zero.
[0147] In another specific implementation, if the data storage structure of the target active object record is a bitmap, then step S507 above may include:
[0148] Determine the target bitmap position corresponding to the second target identifier information in the target bitmap; the target bitmap includes the bitmap positions corresponding to each object in the object pool corresponding to the first target identifier information;
[0149] If the state value of the target bitmap position is the initial state value, then the state value of the target bitmap position is adjusted to the preset state value.
[0150] Understandably, if the state value of the target bitmap location is the preset state value, it indicates that the object corresponding to that bitmap location is already active, and there is no need to update the target bitmap. The initial state value can be 0, indicating an inactive state, while the preset state value can be 1, indicating an active state.
[0151] In specific implementation, the caching service can use a bitmap to store the active status of objects in an object pool. When the bitmap position (i.e., the bit position) specified by the second identifier of an object pool is a preset state value (such as 1), it indicates that the second identifier of that object pool already exists. The total number of bits = 1 in the bitmap is the total number of active objects in the current object pool. Figure 8 Another example of the cache service storage structure provided in the embodiments of the present invention is that MAU is the target cache, and the active user record of each user pool under MAU is in the form of a bitmap. Each bit in the bitmap corresponds to a user in the corresponding user pool, and the status value of the bit indicates the active status of the corresponding user. 0 indicates that the user is not active, and 1 indicates that the user is active.
[0152] It should be noted that when performing a lookup based on a Bitmap, the Bitmap uses a key (numerical value) as an index to access a specific bit position (i.e., the bitmap location) within the Bitmap. Since Bitmap requires the index to be a numerical value, when creating a Bitmap corresponding to an object pool, depending on the format of the object's second identifier information, there are two possible methods:
[0153] For situations where non-numeric values are used as the second identifier of an object, such as using UUIDs, digest values, or other non-numeric identifiers generated through various implementations, a hash value (hashCode) can be calculated for this second identifier to generate a unique numerical value used as an index in the Bitmap. If this value is negative, it can be uniformly converted to an integer before being used as an index in the Bitmap. Therefore, when determining the target bitmap position corresponding to the target's second identifier, it is also necessary to calculate the hash value of the target's second identifier and find the corresponding bit in the bitmap with that hash value as the index. This bit is the target bitmap position.
[0154] When using numerical values as the second identifier of an object, since the condition for using numerical values as indices in a Bitmap is met, the object's second identifier can be directly used as the index in the Bitmap. Therefore, when determining the target bitmap position corresponding to the target's second identifier, the corresponding bit in the bitmap with that second identifier as its index can be directly found; this bit is the target bitmap position.
[0155] In the above embodiments, BitMap uses less storage space. The existence of a key (value) only requires one bit. Assuming a set of non-repeating values from 1 to 1 billion (such as for user unique identification), the memory required to store these values is: 1000000000 bits = 125000000 bytes, which is approximately 119.21 MB. That is, only about 119.21 MB of memory is needed to process 1 billion numbers, which greatly reduces the occupation of storage resources in the caching service.
[0156] Based on this, when the above step S305 is implemented, it may include: when the search result indicates that the bitmap corresponding to the corresponding first identifier information has been found, determining the total number of bitmap positions in the bitmap corresponding to the corresponding first identifier information with the state value of the preset state value, and obtaining the number of active objects in the object pool corresponding to the corresponding first identifier information within the preset time period.
[0157] When the search result indicates that no bitmap corresponding to the first identifier information is found, it is determined that the number of active objects in the object pool corresponding to the first identifier information within the preset time period is zero.
[0158] S509, according to the data storage structure that matches the generation rule of the second identification information of the target, create a target active object record corresponding to the first identification information of the target in the target cache.
[0159] The created target active object record indicates that the object corresponding to the target second identification information is an active object.
[0160] Considering that when the target's second identifier information is generated based on a non-identifier incrementing rule (such as UUID or digest value), using a bitmap data storage structure requires numerical conversion of the second identifier information to conform to the bitmap structure requirements, whether recording active objects in the target cache or querying them. This inevitably negatively impacts the update speed and query efficiency of the target cache, and a slow update speed may result in inaccurate counts of active objects retrieved. To minimize storage resource consumption while ensuring query speed and accuracy, and to maximize storage resource utilization, in this embodiment of the invention, the target active object record corresponding to the target's first identifier information is created based on a data storage structure that matches the generation rule of the target's second identifier information.
[0161] In one exemplary embodiment, step S509 may include the following when implemented:
[0162] Determine the rules for generating the target's second identifier information;
[0163] When the generation rule is an incrementing identifier rule, the matching data storage structure is determined to be a bitmap;
[0164] Obtain the second identification information of each object in the object pool corresponding to the first identification information of the target, and create an initial bitmap corresponding to the first identification information of the target in the target cache according to the second identification information of each object; the state value of each bitmap position in the initial bitmap is the initialization state value;
[0165] The state value of the bitmap position corresponding to the second identifier information of the target in the initial bitmap is adjusted to a preset state value to obtain the target bitmap.
[0166] When the generation rule is a non-identifier incrementing rule, the matching data storage structure is determined to be an identification information set;
[0167] Create an initial identification information set corresponding to the first identification information of the target in the target cache; the initial identification information set is empty; in practical applications, the initial identification information set can be a Redis set (such as a Set set), and a Redis set can store multiple different elements in an unordered manner.
[0168] The second identifier information of the target is stored in the initial identifier information set to obtain the target identifier information set.
[0169] The above embodiments, by creating a target active object record corresponding to the target first identifier information in the target cache based on a data storage structure that matches the generation rule of the target second identifier information, can achieve the effect of minimizing the occupation of storage resources while ensuring query speed and query accuracy, thereby improving the utilization rate of storage resources.
[0170] In practical applications, after querying the number of active objects, tenants may need to initiate a reverse lookup request based on the second identifier information of the active objects to obtain relevant business data of the active objects. However, the bitmap data storage structure stores activity status information (such as 0 or 1). This means that if the data storage structure of the target active object record is a bitmap, it cannot meet the tenant's reverse lookup requirements. Therefore, to meet the tenant's reverse lookup requirements while reducing storage resource consumption and improving the flexibility of active object records, in an exemplary implementation, the specific implementation of determining the matching data storage structure as a bitmap when the generation rule is an incrementing identifier rule may include:
[0171] When the generation rule is an incrementing identifier rule, the historical reverse lookup requests of the target tenant for the active object are retrieved; the historical reverse lookup requests are requests initiated based on the second identifier information of the active object;
[0172] If no match is found, it indicates that the target tenant has no need for a reverse lookup, and the matching data storage structure can be determined to be a bitmap.
[0173] If found, it indicates that the target tenant has a reverse lookup requirement. The matching data storage structure can be determined as an identification information set. When the target tenant performs a reverse lookup, the second identification information of each active object can be obtained from the target identification information set. Based on the second identification information of the active objects, the relevant business data of the active objects can be further obtained.
[0174] Among them, the target tenant's historical reverse lookup requests for active objects can be the target tenant's historical reverse lookup requests for active objects within a certain historical time period. This historical time period can be set according to actual needs, such as the most recent month, two months, etc.
[0175] Corresponding to the active object quantity query methods based on multi-tenant multi-object pools provided in the above embodiments, this embodiment of the invention also provides an active object quantity query device based on multi-tenant multi-object pools. Since the active object quantity query device based on multi-tenant multi-object pools provided in this embodiment corresponds to the active object quantity query methods based on multi-tenant multi-object pools provided in the above embodiments, the implementation methods of the aforementioned active object quantity query methods based on multi-tenant multi-object pools are also applicable to the active object quantity query device based on multi-tenant multi-object pools provided in this embodiment, and will not be described in detail in this embodiment.
[0176] Please see Figure 9 The diagram shows a structural schematic of an active object quantity query device based on a multi-tenant multi-object pool provided in an embodiment of the present invention. This active object quantity query device 900 based on a multi-tenant multi-object pool has the function of implementing the active object quantity query method based on a multi-tenant multi-object pool in the above-described method embodiment. This function can be implemented in hardware or by hardware executing corresponding software. Figure 9 As shown, the active object count query device 900 based on a multi-tenant, multi-object pool may include:
[0177] The first identifier acquisition module 910 is used to obtain the first identifier information of each object pool corresponding to the target tenant in response to the active object count query request of the target tenant; the target tenant is any one of multiple tenants;
[0178] The active object record lookup module 920 is used to look up the active object record corresponding to each of the first identifier information from the target cache corresponding to the target tenant, and obtain the lookup result corresponding to each of the first identifier information; the active object record in the target cache is used to record the active objects of the object pool corresponding to the corresponding first identifier information within a preset time period;
[0179] The active object quantity determination module 930 is used to determine the number of active objects in the object pool corresponding to each of the first identifier information within the preset time period based on the search results corresponding to each of the first identifier information.
[0180] The display module 940 is used to display the number of active objects in each of the object pools during the preset time period.
[0181] In one exemplary embodiment, the apparatus further includes:
[0182] The active log acquisition module is used to retrieve target active logs within the time range corresponding to the current task cycle from the active log database in response to the task execution command within the preset time period. The active logs in the active log database are generated in response to the active behavior of the corresponding object. The active logs include the second identification information of the corresponding object, the first identification information of the object pool to which the object belongs, and the behavior time of the active behavior.
[0183] The information extraction module is used to extract the second target identifier information and the first target identifier information from the target activity log;
[0184] The first search module is used to search for target active object records in the target cache that match the target's first identifier information;
[0185] The record update module is used to record the object corresponding to the second target identifier information into the target active object record according to the data storage structure of the target active object record when the first search module finds the target active object record and the target active object record indicates that the object corresponding to the second target identifier information is not an active object.
[0186] A creation module is used to create a live target object record corresponding to the first target identifier information in the target cache when the first search module fails to find the target, based on a data storage structure that matches the generation rule of the second target identifier information; the created live target object record indicates that the object corresponding to the second target identifier information is an active object.
[0187] In one exemplary embodiment, the apparatus further includes:
[0188] The judgment module is used to determine whether the task execution instruction is the first task execution instruction within the preset time period;
[0189] The cache clearing module is used to store the active object records in the target cache to a specified storage space and clear the target cache when the task execution instruction is the first task execution instruction within the preset time period.
[0190] The first task cycle determination module is used to determine the current task cycle based on the preset time period and the preset task cycle.
[0191] The second task cycle determination module is used to determine the current task cycle according to the preset task cycle when the task execution instruction is not the first task execution instruction within the preset time period.
[0192] In an exemplary implementation, when the data storage structure of the target active object record is a set of identification information, the record update module includes:
[0193] The second search module is used to search for the target second identification information in the target identification information set;
[0194] The first storage module is used to store the target second identification information into the target identification information set when the second search module does not find it.
[0195] In one exemplary implementation, the active object count determination module 930 includes:
[0196] The first determining module is used to determine the total number of identifiers in the identifier information set corresponding to the corresponding first identifier when the search result indicates that the identifier information set corresponding to the corresponding first identifier is found, and to obtain the number of active objects in the object pool corresponding to the corresponding first identifier within the preset time period.
[0197] The second determining module is used to determine that the number of active objects in the object pool corresponding to the first identifier information within the preset time period is zero when the search result indicates that no identifier information set corresponding to the first identifier information is found.
[0198] In an exemplary implementation, when the data storage structure of the target active object record is a bitmap, the record update module includes:
[0199] The bitmap position determination module is used to determine the target bitmap position corresponding to the second target identification information in the target bitmap; the target bitmap includes the bitmap positions corresponding to each object in the object pool corresponding to the first target identification information;
[0200] The first state value adjustment module is used to adjust the state value of the target bitmap position to a preset state value when the state value of the target bitmap position is the initial state value.
[0201] In one exemplary implementation, the active object count determination module 930 includes:
[0202] The third determining module is used to determine the total number of bitmap positions in the bitmap corresponding to the first identifier information with a state value of the preset state value when the search result indicates that the bitmap corresponding to the first identifier information has been found, so as to obtain the number of active objects in the object pool corresponding to the first identifier information within the preset time period.
[0203] The fourth determining module is used to determine that the number of active objects in the object pool corresponding to the first identifier information within the preset time period is zero when the search result indicates that no bitmap corresponding to the first identifier information is found.
[0204] In one exemplary implementation, the creation module includes:
[0205] A rule determination module is used to determine the generation rules for the target second identifier information;
[0206] The first storage structure determination module is used to determine that the matching data storage structure is a bitmap when the generation rule is an incrementing identifier rule;
[0207] The bitmap creation module is used to obtain the second identification information of each object in the object pool corresponding to the first identification information of the target, and to create an initial bitmap corresponding to the first identification information of the target in the target cache according to the second identification information of each object; the state value of each bitmap position in the initial bitmap is the initialization state value.
[0208] The second state value adjustment module is used to adjust the state value of the bitmap position corresponding to the second identifier information of the target in the initial bitmap to a preset state value to obtain the target bitmap.
[0209] In one exemplary implementation, the creation module further includes:
[0210] The second storage structure determination module is used to determine the matching data storage structure as an identification information set when the generation rule is a non-identifier increment rule.
[0211] An identifier information set creation module is used to create an initial identifier information set corresponding to the first identifier information of the target in the target cache; the initial identifier information set is empty.
[0212] The second storage module is used to store the target second identification information into the initial identification information set to obtain the target identification information set.
[0213] In one exemplary embodiment, the first storage structure determination module includes:
[0214] The historical reverse lookup request lookup module is used to look up the historical reverse lookup requests of the target tenant for the active object when the generation rule is an incrementing identifier rule; the historical reverse lookup request is a request initiated based on the second identifier information of the active object;
[0215] The first storage structure determination submodule is used to determine the matching data storage structure as a bitmap when the historical reverse lookup request module fails to find it.
[0216] The second storage structure determination submodule is used to determine the matching data storage structure as an identification information set when the historical reverse lookup request search module finds it.
[0217] In one exemplary embodiment, the information extraction module includes:
[0218] The deduplication module is used to perform deduplication processing on the target activity log based on the target second identifier information in the target activity log to obtain the deduplicated target activity log.
[0219] The extraction module is used to extract the second target identifier information and the first target identifier information from the deduplicated target active logs.
[0220] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0221] This invention provides an electronic device including a processor and a memory. The memory stores at least one instruction or at least one program segment, which is loaded and executed by the processor to implement the method for querying the number of active objects based on a multi-tenant multi-object pool as provided in the above method embodiments.
[0222] The memory can be used to store software programs and modules. The processor executes various functional applications and data queries by running the software programs and modules stored in the memory. The memory can mainly include a program storage area and a data storage area. The program storage area can store the operating system, application programs required for functions, etc.; the data storage area can store data created according to the use of the device, etc. In addition, the memory can include high-speed random access memory, and can also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory can also include a memory controller to provide the processor with access to the memory.
[0223] The methods and embodiments provided in this invention can be executed on a computer terminal, server, or similar computing device. Taking running on a server as an example... Figure 10 This is a hardware structure block diagram of a server that runs a method for querying the number of active objects based on a multi-tenant, multi-object pool, as provided in an embodiment of the present invention. Figure 10As shown, the server 1000 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1010 (CPUs 1010 may include, but are not limited to, microprocessors (MCUs) or programmable logic devices (FPGAs), a memory 1030 for storing data, and one or more storage media 1020 (e.g., one or more mass storage devices) for storing application programs 1023 or data 1022. The memory 1030 and storage media 1020 may be temporary or persistent storage. The program stored in the storage media 1020 may include one or more modules, each module may include a series of instruction operations on the server. Furthermore, the CPU 1010 may be configured to communicate with the storage media 1020 and execute the series of instruction operations in the storage media 1020 on the server 1000. Server 1000 may also include one or more power supplies 1060, one or more wired or wireless network interfaces 1050, one or more input / output interfaces 1040, and / or one or more operating systems 1021, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0224] The input / output interface 1040 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of server 1000. In one example, the input / output interface 1040 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 1040 may be a radio frequency (RF) module for wireless communication with the Internet.
[0225] Those skilled in the art will understand that Figure 10 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, server 1000 may also include... Figure 10 The more or fewer components shown, or having the same Figure 10 The different configurations shown.
[0226] Embodiments of the present invention also provide a computer-readable storage medium that can be disposed in an electronic device to store at least one instruction or at least one program related to implementing a method for querying the number of active objects based on a multi-tenant multi-object pool. The at least one instruction or the at least one program is loaded and executed by the processor to implement the method for querying the number of active objects based on a multi-tenant multi-object pool provided in the above-described method embodiments.
[0227] Embodiments of the present invention also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the aforementioned method for querying the number of active objects based on a multi-tenant, multi-object pool.
[0228] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0229] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, specific embodiments have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0230] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0231] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0232] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for querying the number of active objects based on a multi-tenant, multi-object pool, characterized in that, The method includes: In response to a query request for the number of active objects of a target tenant, the first identifier information of each object pool corresponding to the target tenant is obtained; the target tenant is any one of multiple tenants. The active object records corresponding to each of the first identifier information are retrieved from the target cache corresponding to the target tenant to obtain the search results corresponding to each of the first identifier information; the active object records in the target cache are used to record the active objects of the object pool corresponding to the corresponding first identifier information within a preset time period; the method for generating and updating the active object records in the target cache includes: In response to the task execution instruction within the preset time period, the system retrieves the target active logs within the time range corresponding to the current task cycle from the active log database. The active logs in the active log database are generated in response to the active behavior of a corresponding object. Each active log includes the second identifier information of the corresponding object, the first identifier information of the object pool to which the object belongs, and the behavior time of the active behavior. The system extracts the target second identifier information and the target first identifier information from the target active logs. It then searches the target cache for a target active object record that matches the target first identifier information. If a record is found, and the target active object record indicates that the object corresponding to the target second identifier information is not an active object, the system records the object corresponding to the target second identifier information in the target active object record according to its data storage structure. If no record is found, the system creates a target active object record corresponding to the target first identifier information in the target cache according to a data storage structure that matches the generation rule of the target second identifier information. The created target active object record indicates that the object corresponding to the target second identifier information is an active object. Based on the search results corresponding to each of the first identifier information, determine the number of active objects in the object pool corresponding to each of the first identifier information within the preset time period; Display the number of active objects in each of the object pools during the preset time period.
2. The method according to claim 1, characterized in that, Before retrieving the target active logs within the time range corresponding to the current task period from the active log database, the method further includes: Determine whether the task execution instruction is the first task execution instruction within the preset time period; When the task execution instruction is the first task execution instruction within the preset time period, the active object records in the target cache are stored in the specified storage space, and the target cache is cleared. The current task cycle is determined based on the preset time period and the preset task cycle; When the task execution instruction is not the first task execution instruction within the preset time period, the current task period is determined according to the preset task period.
3. The method according to claim 1 or 2, characterized in that, When the data storage structure of the target active object record is a set of identification information, the step of recording the object corresponding to the second identification information of the target active object record into the target active object record according to the data storage structure of the target active object record includes: Search for the second identification information of the target in the target identification information set; If not found, the second target identification information is stored in the target identification information set.
4. The method according to claim 3, characterized in that, The step of determining the number of active objects in the object pool corresponding to each of the first identifiers within the preset time period based on the search results corresponding to each of the first identifiers includes: When the search result indicates that the set of identifier information corresponding to the corresponding first identifier information has been found, the total number of identifier information in the set of identifier information corresponding to the corresponding first identifier information is determined, and the number of active objects in the object pool corresponding to the corresponding first identifier information within the preset time period is obtained. When the search result indicates that no set of identifier information corresponding to the corresponding first identifier information is found, it is determined that the number of active objects in the object pool corresponding to the corresponding first identifier information within the preset time period is zero.
5. The method according to claim 1 or 2, characterized in that, When the data storage structure of the target active object record is a bitmap, the step of recording the object corresponding to the second target identifier information into the target active object record according to the data storage structure of the target active object record includes: Determine the target bitmap position corresponding to the second target identifier information in the target bitmap; the target bitmap includes the bitmap positions corresponding to each object in the object pool corresponding to the first target identifier information; If the state value of the target bitmap position is the initial state value, then the state value of the target bitmap position is adjusted to the preset state value.
6. The method according to claim 5, characterized in that, The step of determining the number of active objects in the object pool corresponding to each of the first identifiers within the preset time period based on the search results corresponding to each of the first identifiers includes: When the search result indicates that a bitmap corresponding to the corresponding first identifier information has been found, the total number of bitmap positions in the bitmap corresponding to the corresponding first identifier information with a state value of the preset state value is determined, and the number of active objects in the object pool corresponding to the corresponding first identifier information within the preset time period is obtained. When the search result indicates that no bitmap corresponding to the corresponding first identifier information is found, it is determined that the number of active objects in the object pool corresponding to the corresponding first identifier information within the preset time period is zero.
7. The method according to claim 1, characterized in that, The step of creating a target active object record corresponding to the target first identifier information in the target cache according to a data storage structure that matches the generation rule of the target second identifier information includes: Determine the rules for generating the second identifier information of the target; When the generation rule is an incrementing identifier rule, the matching data storage structure is determined to be a bitmap; Obtain the second identification information of each object in the object pool corresponding to the first identification information of the target, and create an initial bitmap corresponding to the first identification information of the target in the target cache according to the second identification information of each object; the state value of each bitmap position in the initial bitmap is the initialization state value. The state value of the bitmap position corresponding to the second identifier information of the target in the initial bitmap is adjusted to a preset state value to obtain the target bitmap.
8. The method according to claim 7, characterized in that, The method further includes: When the generation rule is a non-identifier incrementing rule, the matching data storage structure is determined to be an identification information set; An initial identification information set corresponding to the first identification information of the target is created in the target cache; the initial identification information set is empty. The target second identification information is stored in the initial identification information set to obtain the target identification information set.
9. The method according to claim 7, characterized in that, When the generation rule is an incrementing identifier rule, determining the matching data storage structure as a bitmap includes: When the generation rule is an incrementing identifier rule, the historical reverse lookup requests of the target tenant for the active object are retrieved; the historical reverse lookup requests are requests initiated based on the second identifier information of the active object; If not found, the matching data storage structure is determined to be a bitmap; If a match is found, the matching data storage structure is determined to be a set of identification information.
10. The method according to claim 1, characterized in that, The extraction of the target's second identifier information and the target's first identifier information from the target's active log includes: Based on the target second identifier information in the target activity log, the target activity log is deduplicated to obtain the deduplicated target activity log. Extract the second and first identifier information of the target from the deduplicated target activity log.
11. A device for querying the number of active objects based on a multi-tenant, multi-object pool, characterized in that, The device includes: The first identifier acquisition module is used to obtain the first identifier information of each object pool corresponding to the target tenant in response to the active object count request of the target tenant; the target tenant is any one of multiple tenants; An active object record lookup module is used to search for active object records corresponding to each of the first identifiers in the target cache corresponding to the target tenant, and obtain the search results corresponding to each of the first identifiers; the active object records in the target cache are used to record the active objects of the object pool corresponding to the corresponding first identifier within a preset time period; the method for generating and updating the active object records in the target cache includes: In response to the task execution instruction within the preset time period, the system retrieves the target active logs within the time range corresponding to the current task cycle from the active log database. The active logs in the active log database are generated in response to the active behavior of a corresponding object. Each active log includes the second identifier information of the corresponding object, the first identifier information of the object pool to which the object belongs, and the behavior time of the active behavior. The system extracts the target second identifier information and the target first identifier information from the target active logs. It then searches the target cache for a target active object record that matches the target first identifier information. If a record is found, and the target active object record indicates that the object corresponding to the target second identifier information is not an active object, the system records the object corresponding to the target second identifier information in the target active object record according to its data storage structure. If no record is found, the system creates a target active object record corresponding to the target first identifier information in the target cache according to a data storage structure that matches the generation rule of the target second identifier information. The created target active object record indicates that the object corresponding to the target second identifier information is an active object. The active object quantity determination module is used to determine the number of active objects in the object pool corresponding to each of the first identifier information within the preset time period based on the search results corresponding to each of the first identifier information. The display module is used to display the number of active objects in each of the object pools within the preset time period.
12. The apparatus according to claim 11, characterized in that, The device further includes: The judgment module is used to determine whether the task execution instruction is the first task execution instruction within the preset time period; The cache clearing module is used to store the active object records in the target cache to a specified storage space and clear the target cache when the task execution instruction is the first task execution instruction within the preset time period. The first task cycle determination module is used to determine the current task cycle based on the preset time period and the preset task cycle. The second task cycle determination module is used to determine the current task cycle according to the preset task cycle when the task execution instruction is not the first task execution instruction within the preset time period.
13. The apparatus according to claim 11 or 12, characterized in that, When the data storage structure of the target active object record is a set of identification information, the record update module includes: The second search module is used to search for the target second identification information in the target identification information set; The first storage module is used to store the target second identification information into the target identification information set when the second search module does not find it.
14. The apparatus according to claim 13, characterized in that, The active object quantity determination module includes: The first determining module is used to determine the total number of identifiers in the identifier information set corresponding to the corresponding first identifier when the search result indicates that the identifier information set corresponding to the corresponding first identifier is found, and to obtain the number of active objects in the object pool corresponding to the corresponding first identifier within the preset time period. The second determining module is used to determine that the number of active objects in the object pool corresponding to the first identifier information within the preset time period is zero when the search result indicates that no identifier information set corresponding to the first identifier information is found.
15. The apparatus according to claim 11 or 12, characterized in that, When the data storage structure of the target active object record is a bitmap, the record update module includes: The bitmap position determination module is used to determine the target bitmap position corresponding to the second target identification information in the target bitmap; the target bitmap includes the bitmap positions corresponding to each object in the object pool corresponding to the first target identification information; The first state value adjustment module is used to adjust the state value of the target bitmap position to a preset state value when the state value of the target bitmap position is the initial state value.
16. The apparatus according to claim 15, characterized in that, The active object quantity determination module includes: The third determining module is used to determine the total number of bitmap positions in the bitmap corresponding to the first identifier information with a state value of the preset state value when the search result indicates that the bitmap corresponding to the first identifier information has been found, so as to obtain the number of active objects in the object pool corresponding to the first identifier information within the preset time period. The fourth determining module is used to determine that the number of active objects in the object pool corresponding to the first identifier information within the preset time period is zero when the search result indicates that no bitmap corresponding to the first identifier information is found.
17. The apparatus according to claim 11, characterized in that, Creating modules includes: A rule determination module is used to determine the generation rules for the target second identifier information; The first storage structure determination module is used to determine that the matching data storage structure is a bitmap when the generation rule is an incrementing identifier rule; The bitmap creation module is used to obtain the second identification information of each object in the object pool corresponding to the first identification information of the target, and to create an initial bitmap corresponding to the first identification information of the target in the target cache according to the second identification information of each object; the state value of each bitmap position in the initial bitmap is the initialization state value. The second state value adjustment module is used to adjust the state value of the bitmap position corresponding to the second identifier information of the target in the initial bitmap to a preset state value to obtain the target bitmap.
18. The apparatus according to claim 17, characterized in that, The creation module also includes: The second storage structure determination module is used to determine the matching data storage structure as an identification information set when the generation rule is a non-identifier increment rule; An identifier information set creation module is used to create an initial identifier information set corresponding to the first identifier information of the target in the target cache; the initial identifier information set is empty. The second storage module is used to store the target second identification information into the initial identification information set to obtain the target identification information set.
19. The apparatus according to claim 17, characterized in that, The first storage structure determination module includes: The historical reverse lookup request lookup module is used to look up the historical reverse lookup requests of the target tenant for the active object when the generation rule is an incrementing identifier rule; the historical reverse lookup request is a request initiated based on the second identifier information of the active object; The first storage structure determination submodule is used to determine a bitmap as the matching data storage structure when the historical reverse lookup request module fails to find the matching data storage structure. The second storage structure determination submodule is used to determine the matching data storage structure as the identification information set when the historical reverse lookup request search module finds it.
20. The apparatus according to claim 11, characterized in that, The information extraction module includes: The deduplication module is used to perform deduplication processing on the target activity log based on the target second identifier information in the target activity log to obtain the deduplicated target activity log. The extraction module is used to extract the second target identifier information and the first target identifier information from the deduplicated target active logs.
21. An electronic device, characterized in that, The method includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the method for querying the number of active objects based on a multi-tenant multi-object pool as described in any one of claims 1 to 10.
22. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one instruction or at least one program, which is loaded and executed by a processor to implement the method for querying the number of active objects based on a multi-tenant multi-object pool as described in any one of claims 1 to 10.
23. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the method for querying the number of active objects based on a multi-tenant multi-object pool as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Traffic statistics method and device, computer device and storage medium
CN109889401A