Data counting methods, devices, equipment, storage media, and program products

By distributing task queues to data blocks in parallel and starting counters in the storage system, the problem of low counter update efficiency is solved, and efficient counter updates in the storage system are achieved.

CN122086299APending Publication Date: 2026-05-26DAWNING INFORMATION IND (BEIJING) CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DAWNING INFORMATION IND (BEIJING) CO LTD
Filing Date
2024-11-13
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

The low efficiency of counter updates in existing storage systems limits the processing performance of the storage system.

Method used

By distributing tasks to be executed in multiple task queues to data blocks in the storage space in parallel, and starting corresponding counters in parallel, the partitioning of the storage space enables each data block to execute tasks in parallel, thereby updating the counter values ​​in parallel.

Benefits of technology

It improves the counting efficiency of the storage space counter, thereby enhancing the overall processing performance of the storage system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122086299A_ABST
    Figure CN122086299A_ABST
Patent Text Reader

Abstract

This application relates to a data counting method, apparatus, device, storage medium, and program product. The method includes: distributing tasks to be executed from multiple task queues to corresponding data blocks in a storage space; processing data in the data blocks according to the tasks to be executed, and starting a first counter in the data block to count; the storage space includes multiple data regions, and each data region includes multiple data blocks. By distributing tasks to be executed from each task queue to corresponding data blocks in the storage space in parallel, the above method enables each corresponding data block to execute its corresponding data in parallel, thereby starting the corresponding first counter in parallel. Compared to the method of sequentially executing tasks and updating the counter, the above method can update the counter value in parallel, thus improving the counting efficiency of the counter across the entire storage space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data storage technology, and in particular to a data counting method, apparatus, device, storage medium, and program product. Background Technology

[0002] A counter is a general term for quantity update operations. For example, in a storage system, uploading a file increments the counter (the number of files in the storage system) by 1, and deleting a file decrements the counter by 1. The update efficiency of the counter significantly affects the overall processing performance of the storage system, making improving the update efficiency an important technical achievement in storage systems.

[0003] Currently, the methods for using counters in storage systems include: updating the counter by locking, that is, locking before updating the counter and releasing the lock after the counter is updated. The lock ensures the accuracy of the quantity update. Since locking is done before each quantity update, other tasks are waiting in a queue for the lock to be released while a task is holding the lock and updating the quantity. Therefore, the quantity update is a serial processing method.

[0004] However, the above counting method suffers from low efficiency. Summary of the Invention

[0005] Therefore, it is necessary to provide a data counting method, apparatus, device, storage medium, and program product that can improve counting efficiency in response to the above-mentioned technical problems.

[0006] Firstly, this application provides a data counting method, including:

[0007] Tasks to be executed from multiple task queues are distributed to corresponding data blocks in the storage space; the storage space includes multiple data regions, and each data region includes multiple data blocks.

[0008] The data in the data block is processed according to the task to be executed, and the first counter in the data block is started to count.

[0009] The above method provides a way to update the corresponding value of a counter in parallel. By pre-dividing the storage space, the tasks to be executed in each task queue are distributed to the corresponding data blocks in the storage space in parallel, so that each corresponding data block can execute the corresponding task to be executed in parallel, and then start the corresponding first counter in parallel. Compared with the method of executing the tasks to be executed sequentially and updating the counter, the above method can update the counter value in parallel, thereby improving the counting efficiency of the counter in the entire storage space.

[0010] In one embodiment, the above-mentioned distribution of tasks to be executed from multiple task queues to corresponding data blocks in the storage space includes:

[0011] For each task to be executed, determine the target data area corresponding to the task based on the type of the task;

[0012] Based on the random information of the task to be executed and the number of data blocks contained in the target data area, the data block corresponding to the task to be executed is determined, and the task to be executed is sent to the data block.

[0013] The method for determining data blocks provided in this application takes into account the type of task to be executed, the random information of the task to be executed, and the number of data blocks contained in the target data area. This makes the data blocks corresponding to each task to be executed as different as possible, so that each data block can execute the corresponding task in parallel, and update the counter value in parallel after the task is executed, which greatly improves the counting efficiency of data.

[0014] In one embodiment, determining the data block corresponding to the task to be executed based on the random information of the task to be executed and the number of data blocks contained in the target data region includes:

[0015] The index value is obtained by performing a modulo operation on the random information and the number of data blocks contained in the target data region;

[0016] Locate the data block corresponding to the index value in the target data area.

[0017] The method for determining the data block of the task to be executed provided in this application provides a basis for the subsequent execution of the task on the data block.

[0018] In one embodiment, the method further includes:

[0019] After the first counter corresponding to all data blocks in the data area has completed counting, the second counter corresponding to the data area is started to count.

[0020] The data region counting method provided in this application determines the counter value of the data region based on the counter value of each data block in the data region. Compared with the existing method that requires storage space to count once after each task is completed, the data regions in this application can be counted in parallel, which greatly improves the counting efficiency of storage space.

[0021] In one embodiment, the method further includes:

[0022] After the second counter corresponding to all data areas in the storage space has completed counting, the third counter corresponding to the storage space is started to count.

[0023] The storage space counting method provided in this application determines the counter value of the data region based on the counter value of each data block in the data region. Compared with the existing method that requires storage space to count once after each task is completed, the data regions in this application can count in parallel, which greatly improves the counting efficiency of storage space.

[0024] In one embodiment, the method further includes:

[0025] Upon receiving a data processing task, the pre-storage location of the data processing task is determined based on the random information of the data processing task and the number of data blocks contained in the data area.

[0026] Based on the pre-storage location and the number of task queues, determine the target task queue where the data processing task is located, and store the data processing task in the target task queue.

[0027] The method for storing data processing tasks in the target task queue provided in this application provides a data foundation for subsequently placing the tasks to be executed in the task queue into the corresponding data blocks in parallel.

[0028] Secondly, this application also provides a data counting device, comprising:

[0029] The dispatch module is used to dispatch tasks to be executed from multiple task queues to corresponding data blocks in the storage space; the storage space includes multiple data areas, and each data area includes multiple data blocks.

[0030] The counting module is used to process the data in the data block according to the task to be executed, and to start the first counter in the data block to count.

[0031] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0032] Tasks to be executed from multiple task queues are distributed to corresponding data blocks in the storage space; the storage space includes multiple data regions, and each data region includes multiple data blocks.

[0033] The data in the data block is processed according to the task to be executed, and the first counter in the data block is started to count.

[0034] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0035] Tasks to be executed from multiple task queues are distributed to corresponding data blocks in the storage space; the storage space includes multiple data regions, and each data region includes multiple data blocks.

[0036] The data in the data block is processed according to the task to be executed, and the first counter in the data block is started to count.

[0037] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0038] Tasks to be executed from multiple task queues are distributed to corresponding data blocks in the storage space; the storage space includes multiple data regions, and each data region includes multiple data blocks.

[0039] The data in the data block is processed according to the task to be executed, and the first counter in the data block is started to count.

[0040] The above-mentioned data counting method, apparatus, device, storage medium, and program product. The method includes: distributing tasks to be executed from multiple task queues to corresponding data blocks in a storage space; processing the data in the data blocks according to the tasks to be executed, and starting a first counter in the data block to count; the storage space includes multiple data regions, and each data region includes multiple data blocks. The above method provides a method for updating the corresponding values ​​of the counter in parallel. By pre-dividing the storage space, the tasks to be executed from each task queue are distributed to the corresponding data blocks in the storage space in parallel, so that each corresponding data block can execute its corresponding task in parallel, and then start the corresponding first counter in parallel to count. Compared with the method of executing the tasks to be executed sequentially and updating the counter, the above method can update the counter value in parallel, thereby improving the counting efficiency of the counter in the entire storage space. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0042] Figure 1 This is a diagram illustrating the application environment of the data counting method in one embodiment;

[0043] Figure 2 This is a flowchart illustrating a data counting method in one embodiment;

[0044] Figure 3This is a flowchart illustrating the data counting method in another embodiment;

[0045] Figure 4 This is a flowchart illustrating the data counting method in another embodiment;

[0046] Figure 5 This is a flowchart illustrating the data counting method in another embodiment;

[0047] Figure 6 This is a flowchart illustrating the data counting method in another embodiment;

[0048] Figure 7 This is a flowchart illustrating the data counting method in another embodiment;

[0049] Figure 8 This is a flowchart illustrating the data counting method in another embodiment;

[0050] Figure 9 This is a flowchart illustrating the process of assigning tasks to corresponding data blocks in one embodiment;

[0051] Figure 10 This is a structural block diagram of a data counting device in one embodiment;

[0052] Figure 11 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

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

[0054] A counter is a general term for quantity update operations. For example, in a storage system, uploading a file increments the counter (the number of files in the storage system) by 1, and deleting a file decrements the counter by 1. The update efficiency of the counter significantly affects the overall processing performance of the storage system, making improving the update efficiency an important technical achievement in storage systems.

[0055] Currently, methods for counting using counters in storage systems include: updating the counter by locking, i.e., locking before updating the counter and releasing the lock after the update is complete, using the lock to ensure the accuracy of the count update. However, because locking is required before each count update, other tasks are queued waiting for the lock to be released while one task is holding the lock and updating the count, making count updates a serial process. However, the above counting methods suffer from low efficiency. This application aims to solve this problem.

[0056] Having described the background technology of the data counting method provided in the embodiments of this application, the following will briefly describe the implementation environment involved in the data counting method provided in the embodiments of this application. The data counting method provided in the embodiments of this application can be applied to, for example... Figure 1 The implementation environment shown includes a server 104, which can be implemented as a standalone server or a server cluster composed of multiple servers 104. A data storage system 102 stores the data that the server 104 needs to process. The data storage system 102 can be integrated onto the server 104 or placed on a cloud or other network server. The data storage system 102 can pre-store multiple tasks to be executed. The server 104 can retrieve multiple tasks to be executed from the data storage system 102 and allocate each task to a corresponding task queue. The tasks in each task queue are then sequentially distributed to data blocks in the storage space for processing. After processing is complete, the counter value corresponding to the data block is updated.

[0057] In other possible implementations, the data counting method provided in this application embodiment can also be applied to a terminal. The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart in-vehicle devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc.

[0058] After introducing the application scenarios of the data counting method provided in the embodiments of this application above, the data counting method described in this application will be described in detail below.

[0059] In one embodiment, such as Figure 2 As shown, a data counting method is provided, which can be applied to... Figure 1 Taking the server in the example, the following steps are included:

[0060] S201. Distribute the tasks to be executed from multiple task queues to the corresponding data blocks in the storage space.

[0061] Each task queue contains at least one task to be executed. When a task queue contains multiple tasks to be executed, the tasks to be executed in the task queue are sequentially sent to the corresponding database blocks in the storage space.

[0062] Optionally, multiple tasks in the task set can be pre-assigned to corresponding task queues. For example, if the task set includes 5 tasks (task 1, task 2, task 3, task 4, and task 5) and there are 3 task queues (task queue 1, task queue 2, and task queue 3), then tasks 1, 2, and 3 can be placed into task queue 1, task queue 2, and task queue 3 respectively. Then, tasks 4 and 5 can be placed into task queue 1 and task queue 2 respectively. The final result is: Task queue 1: Task 1, Task 4; Task queue 2: Task 2, Task 5; Task queue 3: Task 3. When the tasks in the task queues are sent to storage, task 1 has a higher priority than task 4, and task 2 has a higher priority than task 5.

[0063] Storage space refers to devices used for long-term data preservation. Once data is stored in storage space, it will not be lost even if the storage space is powered off. Storage space includes disks, optical discs, etc.

[0064] The storage space comprises multiple data regions, each storing data of different business types. Each data region includes multiple data blocks, and the number of data blocks in each region is the same. Each data block corresponds to a first counter, whose value can be positive, negative, or 0. For example, the business types of the data include communication data types, image data types, etc.

[0065] It should be noted that, considering only the update efficiency of the first counter, the more data blocks included in the data area, the better. A larger number of data blocks means better concurrent execution capability of the first counter, but at the same time, the space occupied by the counter is also larger. Furthermore, storing data from the task to be executed contiguously in each data block has the advantage of allowing the entire data area to be read at once when reading its disk contents, avoiding multiple batch reads from different data areas, thus improving read efficiency.

[0066] In this embodiment, when it is necessary to update the count value of the storage space after a task has been completed, multiple tasks to be executed can be first assigned to pre-defined task queues. Based on the relevant information of the tasks to be executed, the tasks in each task queue are then distributed to the corresponding data blocks in the storage space. It should be noted that the tasks to be executed in each task queue can be distributed to the corresponding data blocks in the storage space in parallel, allowing each corresponding data block to execute its corresponding data in parallel. This, in turn, starts the corresponding first counter in parallel. Compared to the method of executing tasks sequentially and updating the counter, the above method can update the counter value in parallel, thereby improving the counting efficiency of the entire storage space's counter.

[0067] Optionally, based on the type of tasks to be executed in the task queue, tasks can first be assigned to the data area corresponding to their type, and then the data blocks in the data area can be determined based on the task's identifier information. It should be noted that the identifier information of the task is its unique number; each task has a unique number.

[0068] S202. Process the data in the data block according to the task to be executed, and start the first counter in the data block to count.

[0069] The tasks to be performed include upload tasks and delete tasks.

[0070] In this embodiment of the application, after the task to be executed is sent to the corresponding data block, the data in the corresponding data block can be processed according to the task to be executed, and after the data in the data block is processed, the first counter in the data block is started to count.

[0071] Optionally, if the task to be executed is an upload task, after the upload task is sent to the corresponding data block, the data in the upload task can be uploaded to the corresponding data block, and after the upload is completed, the first counter in the data block is started to perform an "+1" operation.

[0072] Optionally, if the task to be executed is a deletion task, after the deletion task is sent to the corresponding data block, the corresponding data in the data block can be deleted according to the deletion task, and after the deletion is completed, the first counter in the data block is started to perform a "-1" operation.

[0073] The data counting method provided in this application involves distributing tasks to be executed from multiple task queues to corresponding data blocks in a storage space; processing the data in the data blocks according to the tasks to be executed; and starting a first counter in the data block to count. The storage space includes multiple data regions, and each data region includes multiple data blocks. This method provides a way to update the corresponding counter value in parallel. By pre-dividing the storage space, the tasks to be executed from each task queue are distributed to the corresponding data blocks in the storage space in parallel. This allows each corresponding data block to execute its corresponding task in parallel, thereby starting the corresponding first counter in parallel. Compared to the method of sequentially executing tasks and updating the counter, this method can update the counter value in parallel, thus improving the counting efficiency of the entire storage space.

[0074] In one embodiment, in Figure 2 Based on the illustrated embodiment, the process of distributing the task to be executed to the corresponding data block can be described, such as... Figure 3 As shown, the above-mentioned S201 "distributing tasks to be executed from multiple task queues to corresponding data blocks in the storage space" includes:

[0075] S301. For each task to be executed, determine the target data area corresponding to the task based on the type of the task.

[0076] The types of tasks to be executed include communication tasks and filling tasks. Each type of task corresponds one-to-one with a data area in the storage space; that is, if the tasks to be executed include both communication and filling tasks, the data areas in the storage space will also include communication data areas and filling data areas.

[0077] In this embodiment of the application, for each task to be executed, the target data area corresponding to the type of the task to be executed can be determined according to the correspondence between the task type and the data area.

[0078] S302. Based on the random information of the task to be executed and the number of data blocks contained in the target data area, determine the data block corresponding to the task to be executed, and send the task to be executed to the data block.

[0079] The random information of the task to be executed refers to the random number generated by the server when the task is executed. The random numbers corresponding to different tasks should be as different as possible. The data blocks of the target data area determined based on different random numbers will also be different, so as to make the parallel efficiency of the task to be executed higher.

[0080] Optionally, the server can use the current time as a random seed for the task to be executed, and generate a corresponding random number based on the random seed of the task to be executed.

[0081] In this embodiment of the application, after the target data region corresponding to the task to be executed is determined as described above, the data block corresponding to the task to be executed can be determined according to the random information of the task to be executed and the number of data blocks contained in the target data region, and the task to be executed can be sent to the data block.

[0082] Optionally, the ratio between the random information of the task to be executed and the number of data blocks contained in the target data region can be determined first. Then, the data block identifier corresponding to this ratio can be found from multiple data block identifiers in the target data region, and the database corresponding to the data block identifier corresponding to this ratio can be identified as the corresponding data block. It should be noted that a corresponding identifier can be set for each data block in advance, and the identifiers of each data block are different.

[0083] For example, if the random information of the task to be executed is 7 and the number of data blocks in the target data area is 3, then the ratio between the random information and the number of data blocks is determined to be 2. Then, the data block with the data block identifier 2 can be found in the target data area, and the task to be executed can be sent to the data block with the data block identifier 2.

[0084] The method for determining data blocks provided in this application takes into account the type of task to be executed, the random information of the task to be executed, and the number of data blocks contained in the target data area. This makes the data blocks corresponding to each task to be executed as different as possible, so that each data block can execute the corresponding task in parallel, and update the counter value in parallel after the task is executed, which greatly improves the counting efficiency of data.

[0085] In one embodiment, in Figure 3 Based on the illustrated embodiment, the process of determining the data block corresponding to the task to be executed can be described, such as... Figure 4 As shown, the above-mentioned S302 "determine the data block corresponding to the task to be executed based on the random information of the task to be executed and the number of data blocks contained in the target data region" includes:

[0086] S401. Perform a modulo operation on the random information and the number of data blocks contained in the target data area to obtain the index value.

[0087] In this embodiment of the application, after obtaining the random information of the task to be executed and the number of data blocks contained in the target data region, a modulo operation can be performed on the random information and the number of data blocks contained in the target data region to obtain the index value.

[0088] S402. Locate the data block corresponding to the index value in the target data area.

[0089] In this embodiment of the application, after obtaining the index value as described above, the data block corresponding to the index value can be searched in the target data area.

[0090] The method for determining the data block of the task to be executed provided in this application provides a basis for the subsequent execution of the task on the data block.

[0091] In one embodiment, in Figure 2-4 Based on any of the embodiments shown, such as Figure 5 As shown, the above method also includes:

[0092] S203. After the first counter corresponding to all data blocks in the data area has completed counting, start the second counter corresponding to the data area to start counting.

[0093] Each data area corresponds to a second counter.

[0094] In this embodiment of the application, after the first counter corresponding to all data blocks in the data area has completed counting, the second counter corresponding to the data area is started to accumulate the count values ​​of the first counters in each data block to obtain the count value corresponding to the second counter, that is, the count value corresponding to the data area.

[0095] The data region counting method provided in this application determines the counter value of the data region based on the counter value of each data block in the data region. Compared with the existing method that requires storage space to count once after each task is completed, the data regions in this application can be counted in parallel, which greatly improves the counting efficiency of storage space.

[0096] In one embodiment, in Figure 2-4 Based on any of the embodiments shown, such as Figure 6 As shown, the above method also includes:

[0097] S204. After the second counter corresponding to all data areas in the storage space has completed counting, start the third counter corresponding to the storage space to count.

[0098] The storage space corresponds to a third counter.

[0099] In this embodiment of the application, after all data blocks in the data area have completed counting, the third counter corresponding to the storage space is started to accumulate the count values ​​of the second counters in each data area to obtain the count value corresponding to the third counter, that is, the count value corresponding to the storage space.

[0100] The storage space counting method provided in this application determines the counter value of the data region based on the counter value of each data block in the data region. Compared with the existing method that requires storage space to count once after each task is completed, the data regions in this application can count in parallel, which greatly improves the counting efficiency of storage space.

[0101] In one embodiment, in Figure 2-4 Based on any of the embodiments shown, such as Figure 7 As shown, the above method also includes:

[0102] S205. Upon receiving a data processing task, determine the pre-storage location of the data processing task based on the random information of the data processing task and the number of data blocks contained in the data area.

[0103] Among them, data processing tasks are those tasks that have not been assigned to the corresponding task queue and are yet to be executed.

[0104] In this embodiment of the application, when it is necessary to send the tasks to be executed in the task queue to the corresponding data blocks, it is necessary to first allocate a corresponding task queue for the data processing task. Then, when the data processing task is obtained, the random information of the data processing task and the number of data blocks contained in the data area can be moduloed to obtain an index value. Then, the pre-storage location of the data processing task is determined in the data area according to the index value.

[0105] S206. Based on the pre-storage location and the number of task queues, determine the target queue where the data processing task is located, and store the data processing task in the target queue.

[0106] The number of task queues is a pre-defined number of tasks that can be received in parallel, based on the data processing capacity of the storage space. The task queues are used to handle all data processing tasks related to counter updates, such as uploading and deleting files, and update the corresponding counter value after each task is completed.

[0107] It's important to note that data processing tasks located in different data regions but within the same data block will be placed in the same task queue. Since data processing tasks in the same queue need to be executed sequentially to ensure the accuracy of number updates, theoretically, the more data blocks a data region contains, the better. Assuming the data region has N data blocks, before determining the task queue for each data processing task, a data block `location_x` can be randomly calculated. The more random and dispersed the data blocks, the better the concurrent update capability of the counter.

[0108] In this embodiment of the application, after determining the pre-storage location corresponding to the data processing task, a remainder operation can be performed on the pre-storage location and the number of task queues to obtain the remainder value. Based on the remainder value, the target task queue where the data processing task is located can be determined, and the data processing task can be stored in the target task queue.

[0109] Generally, the number of data blocks N in the data area needs to be greater than or equal to the total number of task queues Y. Otherwise, there will be (YN) extra task queues, and no tasks will be processed, resulting in a waste of thread resources.

[0110] The method for storing data processing tasks in the target task queue provided in this application provides a data foundation for subsequently placing the tasks to be executed in the task queue into the corresponding data blocks in parallel.

[0111] In one embodiment, see Figure 8 As shown, a data counting method is also provided, including:

[0112] S10. Upon receiving a data processing task, determine the pre-storage location of the data processing task based on the random information of the data processing task and the number of data blocks contained in the data area.

[0113] S11. Based on the pre-storage location and the number of task queues, determine the target task queue where the data processing task is located, and store the data processing task in the target task queue;

[0114] S12. For each task to be executed in the execution queue, determine the target data area corresponding to the task to be executed based on the type of the task to be executed;

[0115] S13. Perform a modulo operation on the random information and the number of data blocks contained in the target data region to obtain the index value;

[0116] S14. Locate the data block corresponding to the index value in the target data area and send the task to be executed to the data block;

[0117] S15. Process the data in the data block according to the task to be executed, and start the first counter in the data block to count;

[0118] S16. After the first counter corresponding to all data blocks in the data area has finished counting, start the second counter corresponding to the data area to count.

[0119] S17. After the second counter corresponding to all data areas in the storage space has completed counting, start the third counter corresponding to the storage space to count.

[0120] See Figure 9For multiple tasks in a set of tasks to be processed, the task queues corresponding to each task can be determined based on the random information of the tasks, the number of data blocks in the data area, and the number of task queues. Each task to be processed is then stored in its corresponding task queue, thus establishing the correspondence between the task queues and the tasks to be executed. The data blocks corresponding to each task to be executed in each task queue are then determined, and the tasks to be executed are placed into the corresponding data blocks for processing. After each data block has finished processing its corresponding task to be executed, the counter values ​​corresponding to each data block are updated accordingly.

[0121] The above method provides a way to update the corresponding value of a counter in parallel. By pre-dividing the storage space, the tasks to be executed in each task queue are distributed to the corresponding data blocks in the storage space in parallel, so that each corresponding data block can execute the corresponding task to be executed in parallel, and then start the corresponding first counter in parallel. Compared with the method of executing the tasks to be executed sequentially and updating the counter, the above method can update the counter value in parallel, thereby improving the counting efficiency of the counter in the entire storage space.

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

[0123] Based on the same inventive concept, this application also provides a data counting device for implementing the data counting method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more data counting device embodiments provided below can be found in the limitations of the data counting method described above, and will not be repeated here.

[0124] In one exemplary embodiment, such as Figure 10 As shown, a data counting device is provided, including: a data distribution module 10 and a processing module 11, wherein:

[0125] The distribution module 10 is used to distribute the tasks to be executed in multiple task queues to the corresponding data blocks in the storage space; the storage space includes multiple data areas, and each data area includes multiple data blocks.

[0126] The processing module 11 is used to process the data in the data block according to the task to be executed, and to start the first counter in the data block to count.

[0127] In an exemplary embodiment, the above-described sending module 10 includes: a determining unit and a sending unit, wherein:

[0128] The determination unit is specifically used to determine the target data area corresponding to each task to be executed, based on the type of the task.

[0129] The distribution unit is specifically used to determine the data block corresponding to the task to be executed based on the random information of the task to be executed and the number of data blocks contained in the target data area, and to distribute the task to be executed to the data block.

[0130] In an exemplary embodiment, the aforementioned sending unit is further configured to perform a modulo operation on the random information and the number of data blocks contained in the target data region to obtain an index value; and to find the data block corresponding to the index value in the target data region.

[0131] In an exemplary embodiment, the above-described apparatus further includes: a first startup module, configured to start a second counter corresponding to the data area to start counting after the first counter corresponding to all data blocks in the data area has completed counting.

[0132] In an exemplary embodiment, the above-described apparatus further includes: a second startup module, configured to start a third counter corresponding to the storage space for counting after the second counter corresponding to all data areas in the storage space has completed counting.

[0133] In an exemplary embodiment, the above-described apparatus further includes: a first determining module and a second determining module, wherein:

[0134] The first determining module is used to determine the pre-storage location of the data processing task based on the random information of the data processing task and the number of data blocks contained in the data area when the data processing task is received.

[0135] The second determining module is used to determine the target task queue where the data processing task is located based on the pre-storage location and the number of task queues, and to store the data processing task in the target task queue.

[0136] Each module in the aforementioned data counting device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0137] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 11 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data to be stored. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When executed by the processor, the computer program implements a data counting method.

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

[0139] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0140] Tasks to be executed from multiple task queues are distributed to corresponding data blocks in the storage space; the storage space includes multiple data regions, and each data region includes multiple data blocks.

[0141] The data in the data block is processed according to the task to be executed, and the first counter in the data block is started to count.

[0142] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0143] For each task to be executed, determine the target data area corresponding to the task based on the type of the task;

[0144] Based on the random information of the task to be executed and the number of data blocks contained in the target data area, the data block corresponding to the task to be executed is determined, and the task to be executed is sent to the data block.

[0145] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0146] The index value is obtained by performing a modulo operation on the random information and the number of data blocks contained in the target data region;

[0147] Locate the data block corresponding to the index value in the target data area.

[0148] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0149] After the first counter corresponding to all data blocks in the data area has completed counting, the second counter corresponding to the data area is started to count.

[0150] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0151] After the second counter corresponding to all data areas in the storage space has completed counting, the third counter corresponding to the storage space is started to count.

[0152] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0153] Upon receiving a data processing task, the pre-storage location of the data processing task is determined based on the random information of the data processing task and the number of data blocks contained in the data area.

[0154] Based on the pre-storage location and the number of task queues, determine the target task queue where the data processing task is located, and store the data processing task in the target task queue.

[0155] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0156] Tasks to be executed from multiple task queues are distributed to corresponding data blocks in the storage space; the storage space includes multiple data regions, and each data region includes multiple data blocks.

[0157] The data in the data block is processed according to the task to be executed, and the first counter in the data block is started to count.

[0158] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0159] For each task to be executed, determine the target data area corresponding to the task based on the type of the task;

[0160] Based on the random information of the task to be executed and the number of data blocks contained in the target data area, the data block corresponding to the task to be executed is determined, and the task to be executed is sent to the data block.

[0161] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0162] The index value is obtained by performing a modulo operation on the random information and the number of data blocks contained in the target data region;

[0163] Locate the data block corresponding to the index value in the target data area.

[0164] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0165] After the first counter corresponding to all data blocks in the data area has completed counting, the second counter corresponding to the data area is started to count.

[0166] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0167] After the second counter corresponding to all data areas in the storage space has completed counting, the third counter corresponding to the storage space is started to count.

[0168] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0169] Upon receiving a data processing task, the pre-storage location of the data processing task is determined based on the random information of the data processing task and the number of data blocks contained in the data area.

[0170] Based on the pre-storage location and the number of task queues, determine the target task queue where the data processing task is located, and store the data processing task in the target task queue.

[0171] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:

[0172] Tasks to be executed from multiple task queues are distributed to corresponding data blocks in the storage space; the storage space includes multiple data regions, and each data region includes multiple data blocks.

[0173] The data in the data block is processed according to the task to be executed, and the first counter in the data block is started to count.

[0174] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0175] For each task to be executed, determine the target data area corresponding to the task based on the type of the task;

[0176] Based on the random information of the task to be executed and the number of data blocks contained in the target data area, the data block corresponding to the task to be executed is determined, and the task to be executed is sent to the data block.

[0177] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0178] The index value is obtained by performing a modulo operation on the random information and the number of data blocks contained in the target data region;

[0179] Locate the data block corresponding to the index value in the target data area.

[0180] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0181] After the first counter corresponding to all data blocks in the data area has completed counting, the second counter corresponding to the data area is started to count.

[0182] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0183] After the second counter corresponding to all data areas in the storage space has completed counting, the third counter corresponding to the storage space is started to count.

[0184] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0185] Upon receiving a data processing task, the pre-storage location of the data processing task is determined based on the random information of the data processing task and the number of data blocks contained in the data area.

[0186] Based on the pre-storage location and the number of task queues, determine the target task queue where the data processing task is located, and store the data processing task in the target task queue.

[0187] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

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

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

Claims

1. A method for counting data, characterized in that, The method includes: Tasks to be executed from multiple task queues are distributed to corresponding data blocks in the storage space; the storage space includes multiple data regions, and each data region includes multiple data blocks. The data in the data block is processed according to the task to be executed, and the first counter in the data block is started to count.

2. The method according to claim 1, characterized in that, The step of distributing tasks to be executed from multiple task queues to corresponding data blocks in the storage space includes: For each task to be executed, the target data region corresponding to the task to be executed is determined according to the type of the task to be executed; Based on the random information of the task to be executed and the number of data blocks contained in the target data region, the data block corresponding to the task to be executed is determined, and the task to be executed is sent to the data block.

3. The method according to claim 2, characterized in that, The step of determining the data block corresponding to the task to be executed based on the random information of the task to be executed and the number of data blocks contained in the target data region includes: Perform a modulo operation on the random information and the number of data blocks contained in the target data region to obtain the index value; The data block corresponding to the index value is located in the target data area.

4. The method according to any one of claims 1-3, characterized in that, The method further includes: After the first counter corresponding to all data blocks in the data area has completed counting, the second counter corresponding to the data area is started to count.

5. The method according to claim 4, characterized in that, The method further includes: After the second counter corresponding to all data areas in the storage space has completed counting, the third counter corresponding to the storage space is started to count.

6. The method according to any one of claims 1-3, characterized in that, The method further includes: Upon receiving a data processing task, the pre-storage location of the data processing task is determined based on the random information of the data processing task and the number of data blocks contained in the data area. Based on the pre-storage location and the number of task queues, the target task queue where the data processing task is located is determined, and the data processing task is stored in the target task queue.

7. A data counting device, characterized in that, The device includes: The distribution module is used to distribute tasks to be executed from multiple task queues to corresponding data blocks in the storage space; the storage space includes multiple data regions, and each data region includes multiple data blocks; The counting module is used to process the data in the data block according to the task to be executed, and to start the first counter in the data block to count.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.