High-concurrency counting method based on MySQL counter and web server

A counting method and counter technology, which is applied in the web field, can solve problems such as low counting performance, inability to perform concurrent counting, easy blocking of counters, etc., and achieve the effect of improving efficiency
CN107862082AActive Publication Date: 2018-03-30NUBIA TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN ยท China
Patent Type
Applications(China)
Current Assignee / Owner
NUBIA TECHNOLOGY CO LTD
Publication Date
2018-03-30

Smart Images

  • Figure 1
    Figure 1
  • Figure 2
    Figure 2
  • Figure 3
    Figure 3
Patent Text Reader

Abstract

The invention discloses a high-concurrency counting method based on a MySQL counter. The method comprises the steps of setting multiple trenches in the MySQL counter, and storing multiple trench values corresponding to the multiple trenches into a preset stack; detecting whether counting events occur or not in real time; if the counting events are detected, storing the counting events to a messagequeue; opening multiple counting threads of which the number is the same as that of the trenches to make all the counting stacks read the counting events from the message queue, reading the trench values from the preset stack, updating the counting events to the trench values, deleting the counting events which are already counted from the message queue, and returning the updated trench values tothe preset stack. Compared with the prior art, through the message queue, the counting operation of a web application and the counting operation of the MySQL counter are decoupled; by setting the multiple trenches to conduct concurrent counting operations on a large quantity of counting events at the same moment, it is guaranteed that the counting operation of the MySQL counter cannot be clogged,and the efficiency of high-concurrent counting is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

technical field

[0001] The invention relates to the field of web technologies, in particular to a high concurrency counting method based on a MySQL counter table and a web server. Background technique

[0002] MySQL counter tables are very common in web applications. For example, it is necessary to count the number of clicks by users on the website, the number of file downloads, and the number of new users on the website, etc., all of which need to use counters. Usually, web developers will create a separate table for count-related data, which can make the counter table small and fast, but in MySQL, there will be a row-level transaction for the row update operation of the counter of this record, that is, this Each record will have a global mutex. At the same time, only one process (or thread) can update the record. Therefore, in the case of high concurrency, the update operation of the counter will become very slow, causing the process (thread) to block and making the perfo...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More