CN108021597B - Parallel counter, server and counting method - Google Patents

Parallel counter, server and counting method Download PDF

Info

Publication number
CN108021597B
CN108021597B CN201610974314.0A CN201610974314A CN108021597B CN 108021597 B CN108021597 B CN 108021597B CN 201610974314 A CN201610974314 A CN 201610974314A CN 108021597 B CN108021597 B CN 108021597B
Authority
CN
China
Prior art keywords
counting
module
counting module
count value
thread
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610974314.0A
Other languages
Chinese (zh)
Other versions
CN108021597A (en
Inventor
程正君
高超
丁宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Cloud Computing Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610974314.0A priority Critical patent/CN108021597B/en
Publication of CN108021597A publication Critical patent/CN108021597A/en
Application granted granted Critical
Publication of CN108021597B publication Critical patent/CN108021597B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services

Abstract

The embodiment of the invention discloses a parallel counter, a server and a counting method, wherein the parallel counter for counting business services is arranged in the server, each counting module of the parallel counter is provided with a corresponding storage position for storing an original counting value of the counting module, and if the first counting module receives a first thread, the first counting module can obtain the original counting value of the first counting module from the corresponding storage position and change the original counting value according to the counting requirement carried by the first thread. The parallel counter can obtain the count value aiming at the business service only by summing the original count values of all the counting modules through the summing module. Therefore, each counting module in the parallel counter can independently complete the change of the counting value aiming at the counting requirement in the received thread, so that the parallel counter can realize the parallel counting of a plurality of threads through at least two counting modules, and the counting efficiency is improved.

Description

Parallel counter, server and counting method
Technical Field
The present invention relates to the field of data processing, and in particular, to a parallel counter, a server, and a counting method.
Background
Computers may provide various types of business services. For the reasons of convenience in statistics and the like, a counting requirement is required for business services, for example, one computer provides access services for web page contents, and accordingly, the access amount of the computer to the web page contents can be counted; one computer provides a service for receiving messages, and accordingly, the number of messages received by the computer can be counted.
The traditional approach is to use a database to implement the counting. When a counting requirement is needed for a business service, a thread (or a process) accesses a database, extracts a corresponding original counting value from the database, changes the original counting value (such as increase and decrease of the counting value) according to the counting requirement carried by the thread to obtain a changed counting value, and updates the original counting value in the database into the changed counting value, thereby completing one counting.
However, as technology develops, a large number of counting requirements are required for one business service, so that a database simultaneously receives a plurality of threads for counting the business service, and a high-concurrency counting scene is formed. In order to ensure the data security and the accuracy of the count value, a plurality of threads cannot be allowed to update the count value at the same time, and only one thread can call the count value in the database in sequence to perform count modification and update the database. Resulting in low counting efficiency and not being suitable for the high-concurrency counting scenario described above.
Disclosure of Invention
In order to solve the technical problem, the invention provides a parallel counter, a server and a counting method, wherein the parallel counter can count a plurality of threads in parallel through at least two counting modules, so that the counting efficiency is improved.
The embodiment of the invention discloses the following technical scheme:
in a first aspect, the present invention provides a parallel counter, where the parallel counter is disposed in a server, and the parallel counter is used for counting for a service of the server, and the parallel counter includes a distribution module, a summation module, and at least two counting modules:
the distribution module is used for distributing the received threads to the at least two counting modules, and the threads carry the counting requirements of the business services;
the first counting module is one of the at least two counting modules and is used for receiving a first thread distributed by the distribution module, and the first thread is one of the threads received by the distribution module; the device is further used for taking out an original count value of the first counting module from the storage position corresponding to the first counting module, changing the original count value of the first counting module according to the counting requirement carried by the first thread, and updating the changed count value serving as the original count value of the first counting module into the storage position corresponding to the first counting module;
the summation module is configured to sum up original count values of the at least two counting modules to obtain a total count value, where the total count value is a count value for the service.
Optionally, the second counting module of the parallel counter is one of the at least two counting modules, and is configured to receive the second thread distributed by the distribution module, where the second thread is one of the threads received by the distribution module; and the counting module is also used for taking out the original counting value of the second counting module from the storage position corresponding to the second counting module, changing the original counting value of the second counting module according to the counting requirement carried by the second thread, and updating the changed counting value serving as the original counting value of the second counting module into the storage position corresponding to the second counting module.
Optionally, the first counting module is configured to change an original count value of the first counting module according to a counting requirement carried by the first thread, and update the changed count value serving as the original count value of the first counting module to a storage location corresponding to the first counting module, including:
the first counting module is used for calling the original count value of the first counting module from the storage position corresponding to the first counting module after the original count value of the first counting module is changed according to the counting requirement of the first thread;
the first counting module is used for comparing whether the original count value of the first counting module, which is obtained before and after the original count value of the first counting module is changed according to the counting requirement of the first thread, is the same or not; and if the comparison result is the same, the first counting module is used for updating the changed counting value serving as the original counting value of the first counting module to the storage position corresponding to the first counting module.
Optionally, if the comparison result is different, the first counting module is configured to re-execute the original count value of the first counting module taken out from the storage location corresponding to the first counting module, and change the original count value of the first counting module according to a counting requirement carried by the first thread.
Optionally, the distributing module is configured to distribute the first thread to the first counting module, and includes:
the distribution module is used for carrying out hash calculation according to the characteristic value of the first thread to obtain a corresponding hash value;
the distributing module is used for matching the hash value of the first thread from the at least two counting modules to the first counting module and distributing the first thread to the first counting module.
Optionally, the parallel counter is disposed in a memory of the server.
In a second aspect, the present invention provides a parallel counting method applied to a parallel counter, where the parallel counter is disposed in a server, and the parallel counter is used for counting service of the server, and includes at least two counting modules, where the method includes:
receiving a thread, wherein the thread carries the counting requirement of the business service;
distributing a first thread to a first counting module, wherein the first counting module is one of the at least two counting modules, and the first thread is one of the received threads;
taking out the original count value of the first counting module from the storage position corresponding to the first counting module;
changing an original count value of the first counting module according to a counting requirement carried by the first thread, and updating the changed count value serving as the original count value of the first counting module into a storage position corresponding to the first counting module;
and summing the original count values of the at least two counting modules to obtain a total counting value, wherein the total counting value is a count value aiming at the service.
Optionally, before summing the original count values of the at least two counting modules to obtain a total count value, the method further includes:
distributing a second thread to a second counting module, wherein the second counting module is one of the at least two counting modules, and the second thread is one of the received threads;
taking out the original count value of the second counting module from the storage position corresponding to the second counting module;
changing the original count value of the second counting module according to the counting requirement carried by the second thread, and updating the changed count value serving as the original count value of the second counting module into a storage position corresponding to the second counting module;
and summing the original count values of the at least two counting modules to obtain a total counting value, wherein the total counting value is a count value aiming at the service.
Optionally, the changing the original count value of the first counting module according to the counting requirement carried by the first thread, and updating the changed count value as the original count value of the first counting module to the storage location corresponding to the first counting module includes:
after the original count value of the first counting module is changed according to the counting requirement of the first thread, calling the original count value of the first counting module from a storage position corresponding to the first counting module;
comparing whether the original count value of the first counting module is the same before and after the original count value of the first counting module is changed according to the counting requirement of the first thread;
and if the comparison results are the same, updating the changed count value serving as the original count value of the first counting module into the storage position corresponding to the first counting module.
Optionally, the comparing whether the original count value of the first counting module, which is obtained before and after the original count value of the first counting module is changed according to the counting requirement of the first thread, is the same includes:
and if the comparison result is different, the original count value of the first counting module is taken out from the storage position corresponding to the first counting module and is used for re-executing, and the original count value of the first counting module is changed according to the counting requirement carried by the first thread.
Optionally, the distributing the first thread to the first counting module includes:
performing hash calculation according to the characteristic value of the first thread to obtain a corresponding hash value;
and according to the matching of the hash value of the first thread to the first counting module from the at least two counting modules, distributing the first thread to the first counting module.
Optionally, the parallel counter is disposed in a memory of the server.
In a third aspect, the present invention provides a server, where a parallel counter is disposed in the server, the parallel counter is used for counting a service of the server, the parallel counter includes at least two counting modules, and the server includes a distribution unit, a fetch unit, a change unit, and a summation unit:
the distribution unit is configured to distribute the received threads to the at least two counting modules, where the threads carry the counting requirements of the service; the distribution unit is configured to distribute a first thread to a first counting module, where the first counting module is one of the at least two counting modules, and the first thread is one of the received threads;
the calling unit is used for taking out the original count value of the first counting module from the storage position corresponding to the first counting module;
the changing unit is configured to change an original count value of the first counting module according to a counting requirement carried by the first thread, and update the changed count value serving as the original count value of the first counting module to a storage location corresponding to the first counting module;
the summing unit is configured to sum original count values of the at least two counting modules to obtain a total count value, where the total count value is a count value for the service.
Optionally, the distributing unit is further configured to distribute a second thread to a second counting module, where the second counting module is one of the at least two counting modules, and the second thread is one of the threads received by the distributing module;
the calling unit is further used for taking out the original count value of the second counting module from the storage position corresponding to the second counting module;
the changing unit is further configured to change an original count value of the second counting module according to a counting requirement carried by the second thread, and update the changed count value serving as the original count value of the second counting module to a storage location corresponding to the second counting module.
Optionally, the changing unit is further configured to, after changing the original count value of the first counting module according to the counting requirement of the first thread, call the original count value of the first counting module from a storage location corresponding to the first counting module; comparing whether the original count value of the first counting module is the same before and after the original count value of the first counting module is changed according to the counting requirement of the first thread; and if the comparison results are the same, updating the changed count value serving as the original count value of the first counting module into the storage position corresponding to the first counting module.
Optionally, if the comparison result is different, the changing unit is further configured to re-execute the original count value of the first counting module taken out from the storage location corresponding to the first counting module, and change the original count value of the first counting module according to a counting requirement carried by the first thread.
Optionally, the distributing unit is further configured to perform hash calculation according to the feature value of the first thread to obtain a corresponding hash value; and according to the matching of the hash value of the first thread to the first counting module from the at least two counting modules, distributing the first thread to the first counting module.
Optionally, the parallel counter is disposed in a memory of the server.
According to the technical scheme, the parallel counter for counting aiming at the business service is arranged in the server and comprises a distribution module, a summation module and at least two counting modules, each counting module is provided with a corresponding storage position and used for storing the original counting value of the counting module, if the first counting module receives a first thread, the first counting module can obtain the original counting value of the first counting module from the corresponding storage position and change the original counting value according to the counting requirement carried by the first thread. The parallel counter can obtain the count value aiming at the business service only by summing the original count values of all the counting modules through the summing module. Therefore, each counting module in the parallel counter can independently complete the change of the counting value aiming at the counting requirement in the received thread, so that the parallel counter can realize the parallel counting of a plurality of threads through at least two counting modules, and the counting efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating a parallel counter according to an embodiment of the present invention;
fig. 2 is a schematic diagram of parallel counting applied to a reconciliation system server according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method of parallel counting according to an embodiment of the present invention;
fig. 4 is a diagram illustrating an apparatus structure of a server according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments, but not all embodiments, of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The traditional approach is to use a database to fulfill the counting requirements for business services in a computer. Specifically, for the counting requirement of a business service, a corresponding thread is generated, and the thread carries the counting requirement and sends the counting requirement to a counter for the business service. In a conventional manner, counting for a service is performed by a counter, and a storage space is allocated to the counter in the database for storing an original count value of the counter, that is, a count value obtained by the counter counting last time. Every time the counter receives a thread, the original count value is changed (for example, the count value is increased or decreased) according to the count requirement carried by the thread to obtain a changed count value, and then the original count value in the database is updated to the changed count value, so that one count is completed. However, in a high-concurrency scenario, a large number of counting requirements are required for one service, and in order to ensure counting accuracy, one counter can only count for one thread at a time, so that the thread is heavily jammed at the counter and waits to be processed by the counter, the counting efficiency is low, and the counting requirements in the high-concurrency scenario cannot be met.
To this end, an embodiment of the present invention provides a parallel counter, as shown in fig. 1, which includes a distribution module 100, a summation module 200, and at least two counting modules 300. Each counting module (e.g., the first counting module 301 or the second counting module 302) of the at least two counting modules 300 can independently complete the change of the original counting value according to the counting requirement in the received thread, so that the parallel counter can count a plurality of threads in parallel through the at least two counting modules 300, thereby improving the counting efficiency.
Before specifically describing the functions and actions of each module in the parallel counter, an application scenario of the technical scheme of the invention is described first.
The parallel counter of the present invention may be disposed in a server, for example, a memory of the server, and the parallel counter mainly counts a service provided by the server. The business service described herein may include a service provided by a computer system and having a counting requirement, for example, a data packet storage service provided by the computer system, and then the corresponding counting requirement may be a statistic of the number of stored data packets, for example, the computer system provides an access service to a website or a website content externally, and then the corresponding counting requirement may be a statistic of the access amount to the website or the website content, and so on.
A parallel counter counts for only one traffic service, and if a traffic service has more than one type of counting requirement (e.g., a traffic service may have both a counting requirement for counting accesses and a counting requirement for counting transactions, etc.), a parallel counter counts for only one type of counting requirement in the traffic service. When there are multiple business services to be counted, multiple parallel counters may be used to count different business services respectively.
When a business service needs to be counted, the counting can be realized through a generated thread, and the thread carries a specific counting requirement for counting the business service. In general, when a server acquires a message for a service, the server may generate a corresponding thread according to the message, and the thread may carry a specific counting requirement brought by the message. After the thread is generated, the thread carries a counting requirement, so that a parallel counter arranged in a memory of the server can be actively called, or after the thread is generated, the parallel counter can actively acquire the thread through a distribution module. After the parallel counter acquires the thread, the thread can be distributed to a certain counting module through the distribution module, and the counting is carried out according to the specific counting requirement carried by the thread. The parallel counter may accumulate the count values of the included count modules and then input the count values, where the input object may be a server, or may be other equipment, such as a monitoring analysis device for managing a business service, or a client.
Because one parallel counter only counts for one type of counting requirement of one business service, threads received by one parallel counter are all threads carrying one type of counting requirement in one business service.
The count requirement carried in one thread may cause an increase or decrease of the count value counted by the parallel counter, and the specific value of the increase or decrease may also be related according to a specific content of the count requirement, for example, a thread carries a count requirement of the visit volume of the website post, and the count requirement may specifically be that the visit volume of the website post is increased by 1; or one thread carries a counting requirement for the transaction amount of the shopping website, and the counting requirement can be specifically the sum of the transaction amount of the shopping website and 1000; or one thread carries a counting requirement for the playing times of the website advertisement, and the counting requirement may specifically be the playing times of the website advertisement plus 500. The specific content of the counting requirement carried in one thread may be related to a specific application scenario, or may be related to counting accuracy and thread sending frequency.
The function and action of each block in the parallel counter will be described in detail below with reference to fig. 1.
The parallel counter provided by the embodiment of the invention mainly counts for one service or one type of counting requirements in one service, so that threads received by the distribution module 100 of the parallel counter carry the counting requirements of one service or one type of counting requirements of one service.
The distributing module 100 is mainly used to distribute the received threads to at least two counting modules 300 in the parallel counter. The present invention does not limit the manner by which the dispatch module 100 dispatches threads to each of the at least two counting modules 300. For example, the distribution module 100 may distribute the received threads to each of the at least two counting modules 300 on average, or may distribute the threads to each of the at least two counting modules 300 at random.
In the process of determining a corresponding counting module of the at least two counting modules 300 for each received thread, the distribution module 100 may process each received thread in a serial manner or in a parallel manner. After the counting module corresponding to the thread is determined, the thread can be distributed to the corresponding counting module in a serial mode, and the thread can also be distributed to the corresponding counting module in a parallel mode.
The parallel counter comprises at least two counting modules 300, by means of which the parallel counter can count in parallel.
The way of providing at least two counting modules is different from the conventional way in that, firstly, the counting modules are arranged in a parallel counter, and from the user's perspective, a counter (parallel counter) is counting a service, and the counter has a uniform receiving port (distributing module 100) and a uniform counting output port (summing module 200). That is, the parallel counter applied in the present invention does not need to make a great modification to the existing counting logic, and even replace it with a new counting logic, it still corresponds to a counter (parallel counter) to count a service.
Secondly, a storage space independently used for storing an original count value needs to be allocated to each of the at least two counting modules 300, if the at least two counting modules 300 comprise three counting modules, namely a counting module a, a counting module b and a counting module c, the counting module a has a corresponding storage space used for storing the original count value of the counting module a, the counting module b has a corresponding storage space used for storing the original count value of the counting module b, and the counting module c has a corresponding storage space used for storing the original count value of the counting module c. The original count value of one counting module may be understood as the count value that the counting module has completed counting for the last time and is successfully stored, for example, the count value when the counting module a completes counting for the first time is "10", the counting module updates the count value "10" as the original count value into the storage space corresponding to the counting module a, when the counting module a starts counting for the second time, the original count value "10" is called out from the storage space for counting for the second time, if the count value obtained when the counting for the second time is completed is "11", the counting module a updates the count value "11" as the original count value into the storage space corresponding to the counting module a, if the updating is successful, the count value in the storage space corresponding to the counting module a becomes "11", that is, the count value "11" is the count value that the counting module a has completed counting for the last time and is successfully stored, so the original count value of the counting module a becomes "11", if the updating is not successful for some reason, the count value in the corresponding storage space of the counting module a is still "10", that is, the count value "10" is the count value that the counting module a has completed counting for the last time and is successfully stored, so the original count value of the counting module a is still "10" as the count value stored in the storage space.
Compared with the traditional counting mode that one counter only has one corresponding original counting value, in the parallel counter, each counting module in at least two counting modules 300 has the corresponding original counting value, and for the parallel counter, a plurality of original counting values exist. For example, in a manner of implementing counting by using a database, only one allocated storage space is used for a counter for one business service to store an original count value. For the parallel counter of the present invention for one service, the database will allocate n storage locations to n counting modules in the parallel counter to store the original count values corresponding to the n counting modules.
Because each of the at least two counting modules 300 has a corresponding original count value, when each counting module counts, the corresponding original count value can be updated independently. That is, each counting module can count independently, so that the parallel counter can realize the function of parallel counting.
The summing module 200 is configured to sum the original count values of at least two counting modules 300 to obtain a total count value, where the total count value is a count value for the service.
The counting value of the service is the sum of the original counting values of the counting modules, that is, the counting value finally output by the parallel counter is the sum of the original counting values of the counting modules of the at least two counting modules 300.
For example, the following steps are carried out: when the parallel counter comprises three counting modules, the original count values respectively and correspondingly stored in the storage positions of the three counting modules are as follows: 1000,2000,3000, the count value of the service obtained finally is 1000+2000+ 3000-6000.
According to the above description, the parallel counter from the receiving thread to the output count value can be regarded as a function of one counter. I.e. whether the parallel counter is actually counting a traffic service as a counter. The parallelism counter can be configured in one server. Because the parallel counter in the server comprises at least two counting modules, each counting module can independently complete the change of the counting value aiming at the counting requirement in the received thread, so that the parallel counter can realize the parallel counting of a plurality of threads through the at least two counting modules, thereby realizing the parallel counting function in one server under the high concurrency condition.
The following will be counted by one of at least two counting modules 300: the first counting module 301 is an example and illustrates a counting manner of each of the at least two counting modules 300.
The first counting module 301 is one counting module of the at least two counting modules 300, and is configured to receive a first thread distributed by the distribution module 100, where the first thread is one thread of threads received by the distribution module 100; the first thread is further configured to take out an original count value of the first counting module 301 from the storage location corresponding to the first counting module 301, change the original count value of the first counting module 301 according to the counting requirement carried by the first thread, and update the changed count value serving as the original count value of the first counting module 301 to the storage location corresponding to the first counting module 301;
it should be noted that, after the distribution module 100 determines a counting module for a received thread, an original count value corresponding to the counting module is stored in a storage location of the counting module, where the original count value is used to represent a count value counted by the counting module before the thread arrives, and after a thread finds a corresponding counting module through the distribution module, the counting module can take out the corresponding original count value, and the purpose of counting and counting the service is achieved by updating the original count value.
In a specific implementation process, each counting module needs to be allocated with a storage position for storing an original counting value independently. The original count value stored in the storage location may be set to 0 when starting to count a traffic service. When a thread with a counting requirement reaches a counting module, the counting module takes out an original counting value from a corresponding storage position, changes the original counting value according to the counting requirement carried by the thread, and updates the changed counting value to the storage position corresponding to the counting module.
For example, the original count value corresponding to each counting module may be 0, when a thread carrying a counting requirement of adding 10 reaches the first counting module, the first counting module takes out the original count value of 0, changes the original count value into 0+ 10-10 according to the counting requirement of adding 10, stores the changed count value of 10 in the storage location corresponding to the first counting module, and waits for a next thread reaching the first counting module to perform fetching and updating operations. When the next counting demand with the count of 100 reaches the first counting module, the first counting module takes out the original counting value 10 at the moment, changes the original counting value into 10+ 100-110 according to the count demand with the count of 100, stores the changed counting value 110 in the storage position corresponding to the first counting module, and waits for the next thread reaching the first counting module to perform the operations of fetching and updating. Similarly, if there is a thread arriving at other counting modules, the same principle is used for processing, and the description is omitted here.
It can be understood that the counting requirement carried in one thread may be self-adding or self-subtracting the original count value in the counting module, for example: the original count value can be self-added by 1, or self-added by 3, or self-subtracted by 1 or 5, and the original count value needs to be updated according to the counting requirement carried in the thread, and the updated count value is used as the original count value corresponding to the counting module at the moment, and the original count value at the moment is updated to the storage position corresponding to the counting module.
In the technical solution provided in the embodiment of the present invention, optionally, the second counting module 302 of the parallel counter is one counting module of at least two counting modules 300, and is configured to receive a second thread distributed by the distribution module 100, where the second thread is one thread of threads received by the distribution module 100; and the processor is further configured to take out the original count value of the second counting module 302 from the storage location corresponding to the second counting module 302, change the original count value of the second counting module 302 according to the counting requirement carried by the second thread, and update the changed count value serving as the original count value of the second counting module 302 to the storage location corresponding to the second counting module 302.
It can be understood that the parallel counter provided by the present invention does not only include two counting modules, but also includes at least two counting modules, that is, three counting modules, ten counting modules, or even more counting modules, and at least two counting modules in the parallel counter are independently operated, and can receive a thread and update an original counting value in a storage location of the counting module according to a counting requirement carried in the thread, thereby implementing parallel counting and improving counting efficiency under high concurrency.
The following description is made with reference to specific application scenarios.
Taking fig. 2 as an example, the reconciliation system with the real-time verification function needs to perform data correctness verification on all business systems in a company, so the reconciliation system needs to collect data of each business system for analysis, in this scenario, the reconciliation system may be set in a server with a parallel counter, and the reconciliation system server provides a business service for data statistics, so the parallel counter set in the reconciliation system server can count the counting requirement of the business service for the data statistics of the reconciliation system server.
Data for the business service of the data statistics is transmitted between the business system and the reconciliation system server in a message mode, for example, a transaction system in the business system can send order messages to the reconciliation system server for data correctness check for the business service of the data statistics; a refund platform in the business system can send refund messages to the reconciliation system server for data correctness verification aiming at the business service of data statistics; the logistics platform in the business system can send logistics information to the reconciliation system server for correctness check and the like aiming at the business service of data statistics. The reconciliation system server can also acquire other various types of messages aiming at the business service of data statistics, such as point receiving messages, commodity issuing messages, paying messages and the like.
And one counting requirement in the business service is counting statistics of the message collection amount of the current reconciliation system server, and the message collection total amount obtained through the counting statistics can be used as a basis for evaluating the health condition of the current reconciliation system server.
For the account checking system, a corresponding thread may be generated according to a received message for the data statistics business service, generally, one message may generate one thread, for example, one order message may generate one order message thread, one refund message may generate one refund message thread, and one logistics message may generate one logistics message thread. A parallel counter in the tie-back system server may take these generated threads and count them up. The parallel counter in the reconciliation system server can count the acquired threads without considering the problem of the concurrency conflict and has high counting performance because the concurrency counter can count in parallel through the included counting module.
It can be seen that the parallel counter for counting service is arranged in the memory of the server, and comprises a distribution module, a summation module and at least two counting modules, each counting module has a corresponding storage location for storing an original count value of the counting module, and if the first counting module receives a first thread, the first counting module can obtain the original count value of the first counting module from the corresponding storage location, and change the original count value according to the counting requirement carried by the first thread. The parallel counter can obtain the count value aiming at the business service only by summing the original count values of all the counting modules through the summing module. Therefore, each counting module in the parallel counter can independently complete the change of the counting value aiming at the counting requirement in the received thread, so that the parallel counter can realize the parallel counting of a plurality of threads through at least two counting modules, and the counting efficiency is improved.
In a highly concurrent scenario, even if parallel counting is performed, there is a possibility that one counting module is distributed with a plurality of threads in a short time during counting. In a high concurrency scenario, it may happen that multiple threads need to make changes to the same counting module. In order to ensure the accuracy of the counting value and prevent false counting, the embodiment of the invention provides a counting mode aiming at a counting module. The first counting module 301 is taken as an example for explanation.
After the first counting module 301 changes the original count value of the first counting module 301 according to the counting requirement of the first thread, the first counting module 301 is configured to retrieve the original count value of the first counting module 301 from a storage location corresponding to the first counting module 301;
the first counting module 301 is configured to compare whether the original count values of the first counting module 301 obtained before and after the original count value of the first counting module 301 is changed according to the counting requirement of the first thread are the same; if the comparison result is the same, the first counting module 301 is configured to update the changed count value as the original count value of the first counting module 301 to the storage location corresponding to the first counting module 301.
When the comparison results are the same, it is indicated that the problem of resource competition does not occur in the counting process, and the original count value can be updated.
If the comparison result is different, the first counting module 301 is configured to re-execute the original count value of the first counting module 301 taken out from the storage location corresponding to the first counting module 301, and change the original count value of the first counting module 301 according to the counting requirement carried by the first thread.
When the comparison results are different, it is shown that another thread updates the original count value in the counting process, that is, the problem of resource competition occurs, at this time, the original count value cannot be updated, the original count value needs to be re-obtained from the first counting module again, the original count value needs to be changed according to the counting requirement, then comparison is performed until the comparison results are the same, and the changed original count value is updated to the first counting module.
Therefore, the first counting module compares whether the original counting value is the same before and after the original counting value of the first counting module is changed according to the counting requirement of the first thread, if so, the original counting value is not updated by the second thread in the process of updating the original counting value by the first thread, namely, resource competition does not occur, the changed counting value is updated to the storage position corresponding to the first counting module, if not, the resource competition is indicated, at the moment, the original counting value of the first counting module needs to be taken out again, after the original counting value is changed, the original counting value which is taken before and after the original counting value of the first counting module is compared again to be the same, and the changed counting value is updated to the storage position corresponding to the first counting module until the comparison result is the same. Therefore, the invention can process the situation when a plurality of threads need to update one counting module at the same time, namely the resource competition problem occurs.
The method comprises the steps of utilizing a high-efficiency machine-level atomic instruction CAS function provided by a modern processor, comparing whether the original count values of the first counting module, which are called before and after the original count value of the first counting module is changed, are the same or not by using the CAS function, and updating the changed count value serving as the original count value of the first counting module to a storage position corresponding to the first counting module if the original count values of the first counting module and the first counting module are the same.
Besides using the CAS function, the mutex mechanism can also be used to ensure that only one thread updates the original count value in the counting module at the same time, that is: the threads are executed in sequence, and therefore it is guaranteed that only one thread updates the original count value in the counting module at the same time.
When a mutual exclusion lock mechanism is used for ensuring that only one thread updates the original count value in the counting module at the same time, in the traditional mode, when one service is counted, a plurality of threads access the original count value in one database, namely, in the traditional mode, only one counting module with a counting function is used for one service, and when the plurality of threads update the numerical value in the counting module at the same time, only one thread updates the original count value in the counting module at the same time, but the same counting module is updated; compared with the traditional mode, in the scheme, each counting module in the parallel counter can independently complete the change of the original counting value according to the counting requirement in the received thread, namely for a certain service, the parallel counter can realize the parallel counting of a plurality of threads through at least two counting modules, and finally, the total counting value is obtained by summing the original counting values of at least two counting modules.
Therefore, compared with the traditional mode, the parallel counting of the multiple threads is realized through at least two counting modules in the parallel counter, and the counting efficiency under the high-concurrency condition is improved.
Although the present invention does not limit how the distribution module 100 distributes the threads to at least two counting modules 300, for example, the distribution module 100 may map the threads and the counting modules according to a predetermined algorithm, so as to allocate the corresponding counting modules to the threads, or may allocate the received threads to the corresponding counting modules in a random allocation manner. However, if the number of threads that can be distributed to each counting module is relatively average, the counting efficiency of each counting module can be effectively improved. Therefore, the embodiment of the invention also provides a thread distribution mode. When the number of counting modules is large, the distribution module 100 may calculate a hash value corresponding to the thread by using a hash algorithm, and find a corresponding counting module according to the obtained hash value; when the number of counting modules is small, a hash algorithm can be adopted to calculate a hash value corresponding to a thread, a modulo operation is performed on the hash value and the number of preset counting modules to obtain a modulo value, and the value is used as an index value to find the corresponding counting module. If the hash value calculated by the hash algorithm corresponding to the thread is 181, and the parallel counter includes 60 counting modules, modulo operation is performed on the hash value 181 and the number 60 of the counting modules, and mod (181, 60)' is 1, then the corresponding counting module is found to be the first counting module according to the index value 1.
In the case of this specific algorithm, optionally, the distribution module 100 corresponding to fig. 1 specifically includes:
the distribution module 100 is configured to perform hash calculation according to the feature value of the first thread to obtain a corresponding hash value;
the distributing module 100 is configured to match the hash value of the first thread from the at least two counting modules 300 to the first counting module 301, and distribute the first thread to the first counting module 301.
In this embodiment, the distribution module 100 obtains the corresponding hash value by using a hash calculation method, and the distribution module 100 finds the matching counting module according to the hash value, thereby determining the counting module corresponding to the thread. The counting module corresponding to the thread is determined by adopting a hash calculation method, so that the purpose of uniformly distributing the received thread to each counting module of at least two counting modules 300 can be realized.
The above distribution scheme is only one implementation manner, and the distribution module 100 may also implement distribution of threads by using other computing methods, for example: by adopting a random principle, the distribution module 100 randomly distributes the received threads to the counting module, and can also obtain the corresponding relationship between the threads and the counting module, so that the original count value corresponding to the counting module is updated according to the updating requirement carried in the threads. Of course, other distribution methods may be adopted, and the purpose of distributing the received threads to a plurality of counting modules more uniformly may be achieved.
It can be seen from the foregoing embodiments that, in the embodiments of the present invention, a parallel counter for counting service includes a distribution module, a summation module, and at least two counting modules, each counting module has a corresponding storage location for storing an original count value of the counting module, and if the first counting module receives a first thread, the first counting module may obtain the original count value of the first counting module from the corresponding storage location, and change the original count value according to a counting requirement carried by the first thread. The parallel counter can obtain the count value aiming at the business service only by summing the original count values of all the counting modules through the summing module. Therefore, each counting module in the parallel counter can independently complete the change of the counting value aiming at the counting requirement in the received thread, so that the parallel counter can realize the parallel counting of a plurality of threads through at least two counting modules, and the counting efficiency is improved.
Fig. 3 is a flowchart of a parallel counting method, which is applied to a parallel counter disposed in a server, the parallel counter being configured to count a service of the server, the parallel counter including at least two counting modules, and the method including:
s301: and receiving a thread, wherein the thread carries the counting requirement of the business service.
This step may refer to the related description about the distribution module in the embodiment corresponding to fig. 1, and is not described again.
S302: and distributing a first thread to a first counting module, wherein the first counting module is one of the at least two counting modules, and the first thread is one of the received threads.
This step may refer to the related description about the distribution module in the embodiment corresponding to fig. 1, and is not described again.
S303: and taking out the original count value of the first counting module from the storage position corresponding to the first counting module.
This step can refer to the related description of the counting module in the embodiment corresponding to fig. 1, and is not described again.
S304: and changing the original count value of the first counting module according to the counting requirement carried by the first thread, and updating the changed count value serving as the original count value of the first counting module into a storage position corresponding to the first counting module.
This step can refer to the related description of the counting module in the embodiment corresponding to fig. 1, and is not described again.
S305: and summing the original count values of the at least two counting modules to obtain a total counting value, wherein the total counting value is a count value aiming at the service.
For this step, reference may be made to the related description of the summing module in the embodiment corresponding to fig. 1, and details are not repeated here.
Optionally, before summing the original count values of the at least two counting modules to obtain a total count value, the method further includes:
distributing a second thread to a second counting module, wherein the second counting module is one of the at least two counting modules, and the second thread is one of the received threads;
taking out the original count value of the second counting module from the storage position corresponding to the second counting module;
changing the original count value of the second counting module according to the counting requirement carried by the second thread, and updating the changed count value serving as the original count value of the second counting module into a storage position corresponding to the second counting module;
and summing the original count values of the at least two counting modules to obtain a total counting value, wherein the total counting value is a count value aiming at the service.
Optionally, the changing the original count value of the first counting module according to the counting requirement carried by the first thread, and updating the changed count value as the original count value of the first counting module to the storage location corresponding to the first counting module includes:
after the original count value of the first counting module is changed according to the counting requirement of the first thread, calling the original count value of the first counting module from a storage position corresponding to the first counting module;
comparing whether the original count value of the first counting module is the same before and after the original count value of the first counting module is changed according to the counting requirement of the first thread;
and if the comparison results are the same, updating the changed count value serving as the original count value of the first counting module into the storage position corresponding to the first counting module.
Optionally, the comparing whether the original count value of the first counting module, which is obtained before and after the original count value of the first counting module is changed according to the counting requirement of the first thread, is the same includes:
and if the comparison result is different, the original count value of the first counting module is taken out from the storage position corresponding to the first counting module and is used for re-executing, and the original count value of the first counting module is changed according to the counting requirement carried by the first thread.
Optionally, the distributing the first thread to the first counting module includes:
performing hash calculation according to the characteristic value of the first thread to obtain a corresponding hash value;
and according to the matching of the hash value of the first thread to the first counting module from the at least two counting modules, distributing the first thread to the first counting module.
Optionally, the parallel counter is disposed in a memory of the server.
It can be seen that, the parallel counter for counting the service is disposed in the server, each counting module has a corresponding storage location for storing an original count value of the counting module, and if the first counting module receives the first thread, the first counting module can obtain the original count value of the first counting module from the corresponding storage location, and change the original count value according to a counting requirement carried by the first thread. The parallel counter can obtain the count value aiming at the business service only by summing the original count values of all the counting modules through the summing module. Therefore, each counting module in the parallel counter can independently complete the change of the counting value aiming at the counting requirement in the received thread, so that the parallel counter can realize the parallel counting of a plurality of threads through at least two counting modules, and the counting efficiency is improved.
Fig. 4 is a device structure diagram of a server according to an embodiment of the present invention, where a parallel counter is disposed in the server, the parallel counter is used for counting service services of the server, the parallel counter includes at least two counting modules, and the server includes a distribution unit 401, a fetching unit 402, a changing unit 403, and a summing unit 404:
a distributing unit 401, configured to distribute a received thread to the at least two counting modules, where the thread carries a counting requirement of the service; the distribution unit is configured to distribute a first thread to a first counting module, where the first counting module is one of the at least two counting modules, and the first thread is one of the received threads.
A retrieving unit 402, configured to retrieve the original count value of the first counting module from the storage location corresponding to the first counting module.
A changing unit 403, configured to change an original count value of the first counting module according to a counting requirement carried by the first thread, and update the changed count value serving as the original count value of the first counting module to a storage location corresponding to the first counting module.
A summing unit 404, configured to sum original count values of the at least two counting modules to obtain a total count value, where the total count value is a count value for the service.
For the description of each unit, please refer to the related description in the embodiment corresponding to fig. 1, which is not repeated here.
Optionally, the distributing unit is further configured to distribute a second thread to a second counting module, where the second counting module is one of the at least two counting modules, and the second thread is one of the threads received by the distributing module;
the calling unit is further used for taking out the original count value of the second counting module from the storage position corresponding to the second counting module;
the changing unit is further configured to change an original count value of the second counting module according to a counting requirement carried by the second thread, and update the changed count value serving as the original count value of the second counting module to a storage location corresponding to the second counting module.
Optionally, the changing unit is further configured to, after changing the original count value of the first counting module according to the counting requirement of the first thread, call the original count value of the first counting module from a storage location corresponding to the first counting module; comparing whether the original count value of the first counting module is the same before and after the original count value of the first counting module is changed according to the counting requirement of the first thread; and if the comparison results are the same, updating the changed count value serving as the original count value of the first counting module into the storage position corresponding to the first counting module.
Optionally, if the comparison result is different, the changing unit is further configured to re-execute the original count value of the first counting module taken out from the storage location corresponding to the first counting module, and change the original count value of the first counting module according to a counting requirement carried by the first thread.
Optionally, the distributing unit is further configured to perform hash calculation according to the feature value of the first thread to obtain a corresponding hash value; and according to the matching of the hash value of the first thread to the first counting module from the at least two counting modules, distributing the first thread to the first counting module.
Optionally, the parallel counter is disposed in a memory of the server.
It can be seen that, when a parallel counter for counting service is provided in the server, each counting module of the parallel counter has a corresponding storage location for storing an original counting value of the counting module, and if the first counting module receives the first thread, the first counting module can obtain the original counting value of the first counting module from the corresponding storage location, and change the original counting value according to a counting requirement carried by the first thread. The parallel counter can obtain the count value aiming at the business service only by summing the original count values of all the counting modules through the summing module. Therefore, each counting module in the parallel counter can independently complete the change of the counting value aiming at the counting requirement in the received thread, so that the parallel counter can realize the parallel counting of a plurality of threads through at least two counting modules, and the counting efficiency of the server is improved.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium may be at least one of the following media: various media that can store program codes, such as read-only memory (ROM), RAM, magnetic disk, or optical disk.
It should be noted that, in the present specification, all the embodiments are described in a progressive manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus and system embodiments, since they are substantially similar to the method embodiments, they are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described embodiments of the apparatus and system are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (18)

1. A parallel counter, wherein the parallel counter is disposed in a server, and the parallel counter is used for counting the service of the server, and the parallel counter comprises a distribution module, a summation module and at least two counting modules:
the distribution module is used for distributing the received threads to the at least two counting modules, and the threads carry the counting requirements of the business services;
each counting module of the at least two counting modules is provided with a corresponding storage position for storing the original counting value of the counting module; the first counting module is one of the at least two counting modules and is used for receiving a first thread distributed by the distribution module, and the first thread is one of the threads received by the distribution module; the device is further used for taking out an original count value of the first counting module from the storage position corresponding to the first counting module, changing the original count value of the first counting module according to the counting requirement carried by the first thread, and updating the changed count value serving as the original count value of the first counting module into the storage position corresponding to the first counting module;
the summation module is configured to sum up original count values of the at least two counting modules to obtain a total count value, where the total count value is a count value for the service.
2. The parallel counter according to claim 1, wherein the second counting module of the parallel counter is one of the at least two counting modules, and is configured to receive the second thread dispatched by the dispatching module, and the second thread is one of the threads received by the dispatching module; and the counting module is also used for taking out the original counting value of the second counting module from the storage position corresponding to the second counting module, changing the original counting value of the second counting module according to the counting requirement carried by the second thread, and updating the changed counting value serving as the original counting value of the second counting module into the storage position corresponding to the second counting module.
3. The parallel counter according to claim 1, wherein the first counting module is configured to change an original count value of the first counting module according to a counting requirement carried by the first thread, and update the changed count value as the original count value of the first counting module to a storage location corresponding to the first counting module, and the method includes:
the first counting module is used for calling the original count value of the first counting module from the storage position corresponding to the first counting module after the original count value of the first counting module is changed according to the counting requirement of the first thread;
the first counting module is used for comparing whether the original count value of the first counting module, which is obtained before and after the original count value of the first counting module is changed according to the counting requirement of the first thread, is the same or not; and if the comparison result is the same, the first counting module is used for updating the changed counting value serving as the original counting value of the first counting module to the storage position corresponding to the first counting module.
4. The parallel counter according to claim 3, wherein if the comparison result is different, the first counting module is configured to re-execute the original counting value of the first counting module taken from the storage location corresponding to the first counting module, and change the original counting value of the first counting module according to the counting requirement carried by the first thread.
5. The parallel counter according to any of claims 1 to 4, wherein the dispatch module is configured to dispatch the first thread to the first counting module, and comprises:
the distribution module is used for carrying out hash calculation according to the characteristic value of the first thread to obtain a corresponding hash value;
the distributing module is used for matching the hash value of the first thread from the at least two counting modules to the first counting module and distributing the first thread to the first counting module.
6. The parallel counter of claim 1, wherein the parallel counter is disposed in a memory of the server.
7. A parallel counting method is applied to a parallel counter, the parallel counter is arranged in a server, the parallel counter is used for counting aiming at business services of the server, the parallel counter comprises at least two counting modules, each counting module of the at least two counting modules has a corresponding storage position and is used for storing an original counting value of the counting module, and the method comprises the following steps:
receiving a thread, wherein the thread carries the counting requirement of the business service;
distributing a first thread to a first counting module, wherein the first counting module is one of the at least two counting modules, and the first thread is one of the received threads;
taking out the original count value of the first counting module from the storage position corresponding to the first counting module;
changing an original count value of the first counting module according to a counting requirement carried by the first thread, and updating the changed count value serving as the original count value of the first counting module into a storage position corresponding to the first counting module;
and summing the original count values of the at least two counting modules to obtain a total counting value, wherein the total counting value is a count value aiming at the service.
8. The method according to claim 7, wherein before said summing the original count values of said at least two counting modules to obtain a total count value, further comprising:
distributing a second thread to a second counting module, wherein the second counting module is one of the at least two counting modules, and the second thread is one of the received threads;
taking out the original count value of the second counting module from the storage position corresponding to the second counting module;
changing the original count value of the second counting module according to the counting requirement carried by the second thread, and updating the changed count value serving as the original count value of the second counting module into a storage position corresponding to the second counting module;
and summing the original count values of the at least two counting modules to obtain a total counting value, wherein the total counting value is a count value aiming at the service.
9. The method according to claim 7, wherein the changing the original count value of the first counting module according to the counting requirement carried by the first thread, and updating the changed count value as the original count value of the first counting module to the storage location corresponding to the first counting module comprises:
after the original count value of the first counting module is changed according to the counting requirement of the first thread, calling the original count value of the first counting module from a storage position corresponding to the first counting module;
comparing whether the original count value of the first counting module is the same before and after the original count value of the first counting module is changed according to the counting requirement of the first thread;
and if the comparison results are the same, updating the changed count value serving as the original count value of the first counting module into the storage position corresponding to the first counting module.
10. The method of claim 9, wherein the comparing whether the original count values of the first counting module, which are called before and after the original count value of the first counting module is changed according to the counting requirement of the first thread, are the same comprises:
and if the comparison result is different, the original count value of the first counting module is taken out from the storage position corresponding to the first counting module and is used for re-executing, and the original count value of the first counting module is changed according to the counting requirement carried by the first thread.
11. The method of any of claims 7 to 10, wherein said dispatching the first thread to the first counting module comprises:
performing hash calculation according to the characteristic value of the first thread to obtain a corresponding hash value;
and according to the matching of the hash value of the first thread to the first counting module from the at least two counting modules, distributing the first thread to the first counting module.
12. The method of claim 7, wherein the parallelism counter is disposed in a memory of the server.
13. A server is characterized in that a parallel counter is arranged in the server and used for counting aiming at business services of the server, the parallel counter comprises at least two counting modules, each counting module of the at least two counting modules is provided with a corresponding storage position and used for storing an original counting value of the counting module, and the server comprises a distribution unit, a calling unit, a changing unit and a summing unit:
the distribution unit is configured to distribute the received threads to the at least two counting modules, where the threads carry the counting requirements of the service; the distribution unit is configured to distribute a first thread to a first counting module, where the first counting module is one of the at least two counting modules, and the first thread is one of the received threads;
the calling unit is used for taking out the original count value of the first counting module from the storage position corresponding to the first counting module;
the changing unit is configured to change an original count value of the first counting module according to a counting requirement carried by the first thread, and update the changed count value serving as the original count value of the first counting module to a storage location corresponding to the first counting module;
the summing unit is configured to sum original count values of the at least two counting modules to obtain a total count value, where the total count value is a count value for the service.
14. The server according to claim 13, wherein the dispatching unit is further configured to dispatch a second thread to a second counting module, the second counting module being one of the at least two counting modules, the second thread being one of the threads received by the dispatching unit;
the calling unit is further used for taking out the original count value of the second counting module from the storage position corresponding to the second counting module;
the changing unit is further configured to change an original count value of the second counting module according to a counting requirement carried by the second thread, and update the changed count value serving as the original count value of the second counting module to a storage location corresponding to the second counting module.
15. The server according to claim 13, wherein the changing unit is further configured to retrieve the original count value of the first counting module from a storage location corresponding to the first counting module after changing the original count value of the first counting module according to the counting requirement of the first thread; comparing whether the original count value of the first counting module is the same before and after the original count value of the first counting module is changed according to the counting requirement of the first thread; and if the comparison results are the same, updating the changed count value serving as the original count value of the first counting module into the storage position corresponding to the first counting module.
16. The server according to claim 15, wherein if the comparison result is different, the changing unit is further configured to take out the original count value of the first counting module from the storage location corresponding to the first counting module for re-execution, and change the original count value of the first counting module according to a counting requirement carried by the first thread.
17. The server according to any one of claims 13 to 16, wherein the distribution unit is further configured to perform hash calculation according to the feature value of the first thread to obtain a corresponding hash value; and according to the matching of the hash value of the first thread to the first counting module from the at least two counting modules, distributing the first thread to the first counting module.
18. The server of claim 13, wherein the parallel counter is disposed in a memory of the server.
CN201610974314.0A 2016-10-28 2016-10-28 Parallel counter, server and counting method Active CN108021597B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610974314.0A CN108021597B (en) 2016-10-28 2016-10-28 Parallel counter, server and counting method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610974314.0A CN108021597B (en) 2016-10-28 2016-10-28 Parallel counter, server and counting method

Publications (2)

Publication Number Publication Date
CN108021597A CN108021597A (en) 2018-05-11
CN108021597B true CN108021597B (en) 2022-02-08

Family

ID=62084720

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610974314.0A Active CN108021597B (en) 2016-10-28 2016-10-28 Parallel counter, server and counting method

Country Status (1)

Country Link
CN (1) CN108021597B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109005217B (en) * 2018-07-05 2019-10-25 山东九州信泰信息科技股份有限公司 The method for solving concurrency conflict using read-only variable under cloud computing environment
CN112131267B (en) * 2020-08-14 2023-10-03 北京达佳互联信息技术有限公司 Count processing method, device, server and count processing system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102902512A (en) * 2012-08-31 2013-01-30 浪潮电子信息产业股份有限公司 Multi-thread parallel processing method based on multi-thread programming and message queue
CN105786973A (en) * 2016-02-02 2016-07-20 重庆秒盈电子商务有限公司 Concurrent data processing method and system based on big data technology

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7454600B2 (en) * 2001-06-22 2008-11-18 Intel Corporation Method and apparatus for assigning thread priority in a processor or the like
US7047337B2 (en) * 2003-04-24 2006-05-16 International Business Machines Corporation Concurrent access of shared resources utilizing tracking of request reception and completion order
CN101916281B (en) * 2010-08-17 2012-12-19 上海云数信息科技有限公司 Concurrent computational system and non-repetition counting method
CN201725332U (en) * 2010-09-02 2011-01-26 北京开心人信息技术有限公司 Expandable counting system
US20120180057A1 (en) * 2011-01-10 2012-07-12 International Business Machines Corporation Activity Recording System for a Concurrent Software Environment
CN102722405B (en) * 2012-06-06 2015-05-13 新浪网技术(中国)有限公司 Counting method and system in high concurrent and multithreaded application
CN104636395A (en) * 2013-11-15 2015-05-20 北京信威通信技术股份有限公司 Count processing method and device
US9697005B2 (en) * 2013-12-04 2017-07-04 Analog Devices, Inc. Thread offset counter
GB2528056B (en) * 2014-07-08 2021-06-16 Advanced Risc Mach Ltd A data processing apparatus and method for performing lock-protected processing operations for multiple threads
CN105630712B (en) * 2014-10-28 2019-10-22 深圳市中兴微电子技术有限公司 Counter and method of counting

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102902512A (en) * 2012-08-31 2013-01-30 浪潮电子信息产业股份有限公司 Multi-thread parallel processing method based on multi-thread programming and message queue
CN105786973A (en) * 2016-02-02 2016-07-20 重庆秒盈电子商务有限公司 Concurrent data processing method and system based on big data technology

Also Published As

Publication number Publication date
CN108021597A (en) 2018-05-11

Similar Documents

Publication Publication Date Title
CN108111554B (en) Control method and device for access queue
CN111698315B (en) Data processing method and device for block and computer equipment
CN110070445A (en) A kind of transaction processing method and device based on block catenary system
CN111523890A (en) Data processing method and device based on block chain, storage medium and equipment
CN110659905A (en) Transaction verification method, device, terminal equipment and storage medium
CN108021597B (en) Parallel counter, server and counting method
CN114022151A (en) Block chain data visualization method and system, electronic device and storage medium
JP7247217B2 (en) Clearing and reconciliation methods, equipment and computer equipment
CN114282011B (en) Knowledge graph construction method and device, and graph calculation method and device
CN107273192A (en) A kind of propulsion method of product trading, server and system
CN110222484B (en) User identity recognition method and device, electronic equipment and storage medium
CN110781134A (en) Data processing method and device, computer storage medium and electronic equipment
CN113656497A (en) Data verification method and device based on block chain
CN110119429B (en) Data processing method, data processing device, computer equipment and storage medium
CN111415168A (en) Transaction warning method and device
CN111105238A (en) Transaction risk control method and device
CN112488857B (en) Event identification method, device, electronic equipment and storage medium
CN110706051B (en) Order data aggregation method and device and server
CN106878369B (en) Service processing method and device
CN111897822A (en) Account state information processing method and device, electronic equipment and storage medium
CN113055401B (en) Enterprise business authorization processing method and device
CN113807923B (en) Order processing method and device, electronic equipment and readable storage medium
CN114362968B (en) Method, device, equipment and medium for acquiring random number by block chain
CN117171235B (en) Data analysis method based on industrial identification and related equipment
CN116506333B (en) Transaction system production inversion detection method and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20230526

Address after: Room 1-2-A06, Yungu Park, No. 1008 Dengcai Street, Sandun Town, Xihu District, Hangzhou City, Zhejiang Province

Patentee after: Aliyun Computing Co.,Ltd.

Address before: Box 847, four, Grand Cayman capital, Cayman Islands, UK

Patentee before: ALIBABA GROUP HOLDING Ltd.

TR01 Transfer of patent right