CN101923577B - Expandable counting method and system - Google Patents

Expandable counting method and system Download PDF

Info

Publication number
CN101923577B
CN101923577B CN 201010270075 CN201010270075A CN101923577B CN 101923577 B CN101923577 B CN 101923577B CN 201010270075 CN201010270075 CN 201010270075 CN 201010270075 A CN201010270075 A CN 201010270075A CN 101923577 B CN101923577 B CN 101923577B
Authority
CN
China
Prior art keywords
counting
server
counter buffer
request
access
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
CN 201010270075
Other languages
Chinese (zh)
Other versions
CN101923577A (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.)
BEIJING KAIXINREN INFORMATION TECHNOLOGY Co Ltd
Original Assignee
BEIJING KAIXINREN INFORMATION TECHNOLOGY Co 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 BEIJING KAIXINREN INFORMATION TECHNOLOGY Co Ltd filed Critical BEIJING KAIXINREN INFORMATION TECHNOLOGY Co Ltd
Priority to CN 201010270075 priority Critical patent/CN101923577B/en
Publication of CN101923577A publication Critical patent/CN101923577A/en
Application granted granted Critical
Publication of CN101923577B publication Critical patent/CN101923577B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses an expandable counting method and an expandable counting system. The expandable counting system comprises a client, a web server, and a counting server with a counting cache, wherein the client is connected with the web server connected with the counting server; and the counting server is connected with a database server. The special counting server is arranged, so different types of counting can be implemented by the same counting server; therefore, the expandability is enhanced; the counting cache is arranged, so massive users are supported to access the counting cache simultaneously, and the concurrency of the server is improved; because the data is not needed to be directly read from the database, the pressure of the database server is reduced; counting results are stored in the cache, whether the access is present recently is checked, if so, the counting is not repeated, so the invalid counting due to frequent refreshing is avoided; moreover, the counting results contain user basic information, access time and the like, so the expandable counting system also can save historical records.

Description

A kind of extendible method of counting and system
Technical field
The present invention relates to a kind of method of counting, particularly a kind of extendible method of counting and system, it is more frequent to be suitable for counting, upgrades than very fast, in the higher numbered access of requirement of real-time.
Background technology
In the network service, relate to a large amount of countings, the kind of counting is various.Browse the counting of number such as, the visitor's of individual subscriber homepage counting, one piece of article or photo.The object that this counting is faced is very discrete, and type is various, and single amount is very large, and such as a famous person's homepage, also the amount of having is very little, such as a common photo page or leaf.Have based on the people, such as user home page, have based on thing, count such as the daily record visitor.
Counter is the instrument of the accessed number of times of statistical web page.Traditional counter is realized by page program direct control database.When visitor's browser is read counter code in the page, can remove to read a numerical value in the database by appointment in the code.Then this numerical value can be done by cgi script and add 1 computing and the numerical value that must make new advances.New numerical value can be presented at by the form of appointment in the code in the browser, is saved to original position with stylish numerical value and covers old numerical value.Above process can repeat once when each this page is accessed, and the numerical value of counter demonstration also can add up gradually thereupon.
In traditional method of counting, general different objects uses different counters, is the counting that various objects are directly preserved various objects with database.When causing counter to change when access is arranged, just directly change data-base recording.And when the page constantly refreshed, counting was also constantly updated.Bring like this three problems:
At first, use a plurality of counters, the poor expandability of counter;
Next is, and is large especially to the renewal pressure of database;
Moreover be, frequently refresh the count update that brings, do not have essence to be worth, this for the creation of counting cheating condition, produced a lot of invalid countings.
Summary of the invention
The object of the invention is to, a kind of extendible method of counting and system are provided, it can be used for dissimilar countings, and extensibility is strong, and can alleviate the pressure of database server, improves the concurrent ability of server, can also avoid the generation of invalid counting.
For solving the problems of the technologies described above, the present invention adopts following technical scheme: a kind of extendible method of counting, by special counting server is set, and counter buffer is set at counting in the server and realizes writing and reading of count results, the count results of different counting types is stored respectively, different counting types adopt same counting server, the related counting type of counting server is expanded, the counting server is used for carrying out the counting operation in the webpage, and writing and read count results, counter buffer is used for the count results in the cache web pages; The counting type is the counting to different viewing object in the webpage.The counting type comprises: diary counting, photo counting, personal homepage counting etc.
Aforesaid a kind of extendible method of counting, concrete steps are as follows: comprise wiring method and read method;
The said write method comprises:
Web server receives the request of access that the user sends;
Triggering writes the request of counting server;
Count results in the counting server update counter buffer;
The counting server is with the count results write into Databasce server in the counter buffer;
Described read method comprises:
Web server receives the request of access that the user sends;
Triggering is from the request of counting server reading out data;
The counting server reads count results from counter buffer.
In aforesaid a kind of extendible method of counting, described counting server is with the method for the count results write into Databasce server in the counter buffer, comprise: the counting server is periodically with the count results write into Databasce server in the counter buffer, thus the renewal database server.Regularly, refer to not be at every turn all count results write into Databasce immediately, but the counting server is with certain frequency new data write into Databasce more.Such as, ten requests may be arranged simultaneously at New count more, and the counting server only has a more new thread, with nearest renewal successively write into Databasce.This time may the fastest several seconds, long number minute.
In aforesaid a kind of extendible method of counting, described triggering writes the method for the request of counting server, and comprising: access related counting type by the user, the flip-flop number server writes the request of corresponding counter buffer.
In aforesaid a kind of extendible method of counting, described triggering is from the method for the request of counting server reading out data, comprise: according to the accessing request information of user's proposition, web server need in the page to determine the counting type that shows, and the flip-flop number server is from the request of corresponding counter buffer reading out data.
In aforesaid a kind of extendible method of counting, described counting server detects the data in the counter buffer, whether check has access in the recent period, if access is arranged, then repeat count not can effectively be avoided frequently refreshing bringing invalid counting, and this detection in buffer memory, owing to entirely in internal memory, carry out, so efficient is quite high.
In aforesaid a kind of extendible method of counting, described count results comprises: access times, visitor's essential information and access time.Therefore, it is record by whose generation that the present invention can preserve counting, for example, whom can demonstrate and access my homepage on " my homepage ", and definite says, stays visitor's vestige.
Realize a kind of extendible number system of claim preceding method, comprise client, web server and be provided with the counting server of a plurality of counter buffer, client connects web server, web server connection count server, counting server connection data storehouse server.
In aforesaid a kind of extendible number system, described counting server is provided with the timing interactive module that is connected with counter buffer, and regularly interactive module is used for clocked flip counting server with the count results write into Databasce server of counter buffer.
In aforesaid a kind of extendible number system, described web server is provided with the trigger request module, be used for to determine that the page needs counting type to be processed, and the flip-flop number server writes data to corresponding counter buffer or from the request of corresponding counter buffer reading out data.
In aforesaid a kind of extendible number system, described counting server is provided with detection module, is used for the data of counter buffer are detected, whether check has access in the recent period, if access is arranged, then repeat count not can effectively be avoided frequently refreshing and bring invalid counting.
Compared with prior art, the present invention can realize with same counting server dissimilar countings owing to be provided with special counting server, do not disturb each other, so extensibility strengthens; Owing to be provided with counting cache equipment, directly read count results from counting cache equipment during user's access count page again, can support large batch of user to access simultaneously, improved the concurrent power of server.Owing to do not need directly reading out data from database, reduced the visit capacity of database server, alleviated the pressure of database server.It is placed on buffer memory with count results, in buffer memory, can check first whether access is arranged in the recent period, if access is arranged, repeat count has not then effectively been avoided frequently refreshing and has been brought invalid counting, and this detection in buffer memory, owing to entirely in internal memory, carry out, so efficient is quite high.Data in the counting cache equipment can the data with in the database server regularly be carried out alternately, guarantee data in the database and the data consistent in the counting cache equipment, also guaranteed data in the database server and the renewal of the data in the counting cache equipment.In addition, since comprise user basic information and access time etc. in the count results, all right keeping track of history record of number system of expanding of the present invention, specifically, can preserve some information of visitor, whom a modal use-case preserved exactly and accessed " my homepage ".
Description of drawings
Fig. 1 is the structural representation of a kind of embodiment of the present invention;
Fig. 2 is the workflow diagram that writes of embodiments of the invention;
Fig. 3 is the read work process flow diagram of embodiments of the invention.
Reference numeral: the 1-client, the 2-web server, the 3-counter buffer, 4-counts server, the 5-database server, 6-is interactive module regularly, 7-request of access module, 8-trigger request module, 9-detection module.
The present invention is further illustrated below in conjunction with the drawings and specific embodiments.
Embodiment
Embodiments of the invention: a kind of extendible method of counting, by special counting server 4 is set, and counter buffer 3 is set at counting in the server 4 and realizes writing and reading of count results, the count results of different counting types is stored respectively, different counting types adopt same counting server 4, counting server 4 related counting types are expanded, counting server 4 is used for carrying out the counting operation in the webpage, and writing and read count results, counter buffer 3 is used for the count results in the cache web pages; The counting type is the counting to different viewing object in the webpage.
Concrete steps are as follows: comprise wiring method and read method;
The said write method comprises:
Web server 2 receives the request of access that the user sends;
Triggering writes the request of counting server 4;
The count results that counting server 4 upgrades in the counter buffer 3;
Counting server 4 is with the count results write into Databasce server 5 in the counter buffer 3;
Described read method comprises:
Web server 2 receives the request of access that the user sends;
Triggering is from the request of counting server 4 reading out datas;
Counting server 4 reads count results from counter buffer 3.
Described counting server 4 is with the method for the count results write into Databasce server 5 in the counter buffer 3, comprise: counting server 4 is periodically with the count results write into Databasce server 5 in the counter buffer 3, thereby upgrade database server 5, regularly, refer to it is not at every turn all count results write into Databasce immediately, but the counting server is with certain frequency new data write into Databasce more.Such as, ten requests may be arranged simultaneously at New count more, and the counting server only has a more new thread, with nearest renewal successively write into Databasce.This time may the fastest several seconds, long number minute.In the present embodiment, count server 4 handles with the count results write into Databasce server 5 in the counter buffer 3 every 1min.
Described triggering writes the method for the request of counting server, and comprising: access related counting type by the user, the flip-flop number server writes the request of corresponding counter buffer.
Described triggering is from the method for the request of counting server reading out data, comprise: according to the accessing request information of user's proposition, web server need in the page to determine the counting type that shows, and the flip-flop number server is from the request of corresponding counter buffer reading out data.
Data in 4 pairs of counter buffer 3 of described counting server detect, and whether check has access in the recent period, if access is arranged, and then repeat count not, and this detection in buffer memory, owing to entirely in internal memory, carry out, so efficient is quite high.
Described count results comprises: access times, visitor's essential information and access time.
Realize a kind of extendible number system of preceding method, structure as shown in Figure 1; Comprise client 1, web server 2, be provided with the counting server 4 of a plurality of counter buffer 3, client 1 connects web server 2, web server 2 connection count servers 4, counting server 4 connection data storehouse servers 5.
Described counting server 4 is provided with the timing interactive module 6 that is connected with counter buffer 3, and regularly interactive module 6 is used for clocked flip counting server 4 with the count results write into Databasce server 5 of counter buffer 3.
Described web server 2 is provided with trigger request module 8, be used for to determine that the page needs counting type to be processed, and flip-flop number server 4 writes data to corresponding counter buffer 3 or from the request of corresponding counter buffer 3 reading out datas.
Described counting server 4 is provided with detection module 9, and the data in the counter buffer 3 are detected, and whether check has access in the recent period, if access is arranged, and repeat count not then.
The embodiment of the invention write workflow: (such as Fig. 2)
S10:web server 2 receives request of access;
S11: the write request in the flip-flop number server 4;
S12: the count results that counting server 4 upgrades in the counter buffer 3;
S13: every 1min with the count results write into Databasce server 5 in the counter buffer 3.
The read work flow process of embodiments of the invention: (such as Fig. 3)
S20:web server 2 receives request of access;
S21: the read requests in the flip-flop number server 4;
S22: counting server 4 reads count results from counter buffer 3.
The example explanation: such as " visiting recently " function is arranged in the individual homepage, this function realizes by counting server as herein described.In the time of the homepage of " Zhang San " access " Li Si ", the counting server of " visiting recently " this function in the webpage just has been triggered, send and write the counting server request, the counting server is received after this request, the visiting counting of interviewee in the counter buffer can be added 1, and " Zhang San " this people's visiting record is write corresponding counter buffer.Every 1min, the Visitor Logs write into Databasce server of " Zhang San ".In the time of webpage output, can read " visiting recently " people's record from counter buffer, wherein " Zhang San " shows, and is presented at the foremost of visiting record.
When " Zhang San " logs in the page of oneself, when checking " visiting recently " of oneself, just can't see the information of oneself, this time, just from having read the numerical value of " visiting recently " the counter buffer, the log-on message of oneself is not write the counter buffer of " visiting recently ".And " Zhang San " can see the information of oneself from " visiting recently " of " Li Si ", because this time, first the visiting information of " Zhang San " is write the counter buffer of " visiting recently ", and then read again from the counter buffer of " recently visiting " and to have got data, " Zhang San " just can see the visiting information of oneself like this.

Claims (10)

1. extendible method of counting, it is characterized in that: by special counting server (4) is set, and in counting server (4), counter buffer (3) is set and realizes writing and reading of count results, the count results of different counting types is stored respectively, different counting types adopt same counting server (4), the related counting type of counting server (4) is expanded, counting server (4) is used for carrying out the counting operation in the webpage, and writing and read count results, counter buffer (3) is used for the count results in the cache web pages; Described counting type is the different viewing object in the webpage;
Described method comprises write step and read step;
The said write step comprises:
Web server (2) receives the request of access that the user sends;
Triggering writes the request of counting server (4);
Counting server (4) upgrades the count results in the counter buffer (3);
Counting server (4) is with the count results write into Databasce server (5) in the counter buffer (3);
Described read step comprises:
Web server (2) receives the request of access that the user sends;
Triggering is from the request of counting server (4) reading out data;
Counting server (4) reads count results from counter buffer (3).
2. a kind of extendible method of counting according to claim 1, it is characterized in that: described counting server (4) comprises the step of the count results write into Databasce server (5) in the counter buffer (3): counting server (4) is regularly with the count results write into Databasce server (5) in the counter buffer (3), thus renewal database server (5).
3. a kind of extendible method of counting according to claim 1, it is characterized in that: the step that described triggering writes the request of counting server (4) comprises: access related counting type by the user, flip-flop number server (4) writes the request of corresponding counter buffer (3).
4. a kind of extendible method of counting according to claim 1, it is characterized in that: described triggering comprises from the step of the request of counting server (4) reading out data: according to the accessing request information of user's proposition, web server (2) need in the page to determine the counting type that shows, and flip-flop number server (4) is from the request of corresponding counter buffer (3) reading out data.
5. a kind of extendible method of counting according to claim 1, it is characterized in that: described counting server (4) detects the data in the counter buffer (3), checks whether access is arranged in the recent period, if access is arranged, repeat count not then.
6. a kind of extendible method of counting according to claim 1, it is characterized in that: described count results comprises: access times, visitor's essential information and access time.
7. realize a kind of extendible number system of the described method of the arbitrary claim of claim 1~6, it is characterized in that: comprise client (1), web server (2) and be provided with the counting server (4) of a plurality of counter buffer (3), client (1) connects web server (2), web server (2) connection count server (4), counting server (4) connection data storehouse server (5).
8. a kind of extendible number system according to claim 7, it is characterized in that: described counting server (4) is provided with the timing interactive module (6) that is connected with counter buffer (3), and regularly interactive module (6) is used for clocked flip counting server (4) with the count results write into Databasce server (5) of counter buffer (3).
9. a kind of extendible number system according to claim 7, it is characterized in that: described web server (2) is provided with trigger request module (8), be used for to determine that the page needs counting type to be processed, and flip-flop number server (4) writes data to corresponding counter buffer (3) or from the request of corresponding counter buffer (3) reading out data.
10. a kind of extendible number system according to claim 7, it is characterized in that: described counting server (4) is provided with detection module (9), is used for the data of counter buffer (3) are detected, and whether check has access in the recent period, if access is arranged, repeat count not then.
CN 201010270075 2010-09-02 2010-09-02 Expandable counting method and system Active CN101923577B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010270075 CN101923577B (en) 2010-09-02 2010-09-02 Expandable counting method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010270075 CN101923577B (en) 2010-09-02 2010-09-02 Expandable counting method and system

Publications (2)

Publication Number Publication Date
CN101923577A CN101923577A (en) 2010-12-22
CN101923577B true CN101923577B (en) 2013-03-20

Family

ID=43338510

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010270075 Active CN101923577B (en) 2010-09-02 2010-09-02 Expandable counting method and system

Country Status (1)

Country Link
CN (1) CN101923577B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722405B (en) * 2012-06-06 2015-05-13 新浪网技术(中国)有限公司 Counting method and system in high concurrent and multithreaded application
CN103853671B (en) * 2012-12-07 2018-03-02 北京百度网讯科技有限公司 A kind of data write-in control method and device
CN104794172B (en) * 2015-03-31 2018-09-11 北京奇艺世纪科技有限公司 A kind of data processing method and device
CN105095423B (en) * 2015-07-15 2018-10-09 北京奇虎科技有限公司 Enumeration data wiring method and device
CN107040558A (en) * 2016-02-03 2017-08-11 阿里巴巴集团控股有限公司 A kind of Mission Monitor method and device
CN106326340B (en) * 2016-08-01 2019-08-02 网易无尾熊(杭州)科技有限公司 A kind of data processing method and device
CN112650913A (en) * 2020-12-30 2021-04-13 福建福诺移动通信技术有限公司 Counting method and system for coping with big data high concurrency counting scene

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1310521A (en) * 2000-02-21 2001-08-29 光洋电子工业株式会社 Electronic counter
WO2004092970A1 (en) * 2003-04-14 2004-10-28 Zedo, Inc. System and method for determining the unique web users and calculating the reach, frequency and effective reach of user web access
CN1764916A (en) * 2003-03-07 2006-04-26 诺基亚公司 Method and apparatus for frequency count

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1310521A (en) * 2000-02-21 2001-08-29 光洋电子工业株式会社 Electronic counter
CN1764916A (en) * 2003-03-07 2006-04-26 诺基亚公司 Method and apparatus for frequency count
WO2004092970A1 (en) * 2003-04-14 2004-10-28 Zedo, Inc. System and method for determining the unique web users and calculating the reach, frequency and effective reach of user web access

Also Published As

Publication number Publication date
CN101923577A (en) 2010-12-22

Similar Documents

Publication Publication Date Title
CN101923577B (en) Expandable counting method and system
CN110674432B (en) Second-level caching method, device and computer readable storage medium
CN101454769B (en) Method and system for synchronizing data in client device and server device
CN101937467A (en) High-efficiency caching method and system of server
US10606806B2 (en) Method and apparatus for storing time series data
EP2590087A1 (en) Database log parallelization
CN102316166A (en) Website recommending method and system and network server
CN110704336B (en) Data caching method and device
CN105373541A (en) Processing method and system for data operation request of database
CN104077397A (en) Response method for distributed big data classification retrieval webpage
US10515102B2 (en) Pre-processing of geo-spatial sensor data
CN108363772A (en) A kind of register date storage method and device based on caching
CN104636395A (en) Count processing method and device
CN109614270A (en) Data read-write method, device, equipment and storage medium based on Hbase
CN107943846B (en) Data processing method and device and electronic equipment
CN104281673A (en) Cache building system and method for database
CN114416324A (en) Task triggering method and device, computer equipment and storage medium
CN104834719A (en) Database system applied to real-time big data scene
CN104270471A (en) Method, device and system for achieving new function reminding
CN201725332U (en) Expandable counting system
CN114020713A (en) File merging method and device of log structure merging tree, electronic equipment and storage medium
CN108363773A (en) A kind of method and device of registering based on binary operation
CN108460110A (en) A kind of binary operation based on the codings of two dimension Golay in length and breadth is registered method and device
CN111427920B (en) Data acquisition method, device, system, computer equipment and storage medium
CN110851758B (en) Webpage visitor quantity counting method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant