CN106911528A - The method and apparatus of on-line user amount statistic - Google Patents
The method and apparatus of on-line user amount statistic Download PDFInfo
- Publication number
- CN106911528A CN106911528A CN201510982947.1A CN201510982947A CN106911528A CN 106911528 A CN106911528 A CN 106911528A CN 201510982947 A CN201510982947 A CN 201510982947A CN 106911528 A CN106911528 A CN 106911528A
- Authority
- CN
- China
- Prior art keywords
- ready
- deadline
- online
- sequence
- corresponding online
- 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.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/06—Generation of reports
- H04L43/062—Generation of reports related to network traffic
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/10—Active monitoring, e.g. heartbeat, ping or trace-route
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Health & Medical Sciences (AREA)
- Cardiology (AREA)
- General Health & Medical Sciences (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention provides a kind of method and apparatus of on-line user amount statistic.Wherein, method includes:Receive including getting when getting data ready of ID ready, set described in get ID corresponding online deadline ready;The all ID for having preserved are ranked up according to corresponding online deadline;All ID after for sequence, judge that active user identifies whether corresponding online deadline has reached according to clooating sequence successively, until stopping judging when certain ID corresponding online deadline does not reach;The quantity of online user is counted according to result of determination.The present invention without being inquired about whole ID one by one, it is only necessary to which the certain customers' mark after sequence is judged, therefore queries is smaller, it is possible to increase the statistical efficiency of online user's quantity, statistics is much sooner.
Description
Technical field
The present invention relates to network technique field, more particularly to a kind of method of on-line user amount statistic
With a kind of device of on-line user amount statistic.
Background technology
With developing rapidly for network technology, all kinds of websites continue to bring out, for the ease of the maintenance of website,
Generally need to count the real-time online number of users of website.But online user number reaches ten thousand grades simultaneously
When, on-line user amount statistic will become a thing for difficulty.For example, online user is to online
Statistical server sends heartbeat message, when first time heartbeat message is sent, represents that user reaches the standard grade, when
Judge user offline when not receiving the heartbeat message of the user more than 3 eartbeat intervals.If website
Platform currently has 120 general-purpose families online, sends a heartbeat within every 10 seconds, then Online statistics server
It is required that 120,000 QPS (QueryPer Second, query rate per second) are reached, if common WEB
Server (1000QPS) can just accept 120 groups of services of needs.
In the prior art, the heartbeat message of online user be recorded into number in the way of session (session)
According to storehouse, the corresponding session of the user is created when user reaches the standard grade, the user sends heartbeat letter again
Extend the life cycle of correspondence session during breath, when the heartbeat message without the user and by a timing
Between after, be automatically deleted the corresponding session of the user.But, need to inquire about number one by one in the above method
According to the life cycle of each user correspondence session in storehouse, queries is very big, causes online user number
The statistical efficiency of amount is relatively low, and statistics is not in time.
The content of the invention
In view of the above problems, it is proposed that the present invention overcomes above mentioned problem or at least portion to provide one kind
The method and corresponding on-line user amount statistic of the on-line user amount statistic for solving the above problems with dividing
Device.
According to one aspect of the present invention, there is provided a kind of method of on-line user amount statistic, bag
Include:
Receive including getting when getting data ready of ID ready, set described in get ID ready corresponding
Online deadline;
The all ID for having preserved are ranked up according to corresponding online deadline;
All ID after for sequence, active user's mark correspondence is judged according to clooating sequence successively
Online deadline whether reached, until when certain ID corresponding online deadline does not reach
Stop judging;
The quantity of online user is counted according to result of determination.
Alternatively, it is described for sequence after all ID, judge current successively according to clooating sequence
Whether ID corresponding online deadline has reached, until the corresponding online cut-off of certain ID
Have not timed out up to when stop judge the step of, including:
All ID after for sequence, since earliest ID of online deadline, press
Judge that whether active user identifies corresponding online deadline earlier than current time successively according to clooating sequence,
Until certain ID corresponding online deadline stops judging when being equal to or be later than current time.
Alternatively, received including getting when getting data ready of ID ready described, set described in get ready
Before the step of ID corresponding online deadline, also include:
ID is divided into multiple groups, and is that every group of ID creates a corresponding independent process
Thread.
Alternatively, it is described to receive including getting when getting data ready of ID ready, set described in get use ready
The step of family identifies corresponding online deadline, including:Receive including getting getting ready for ID ready
During data, the data forwarding of getting ready is got ready ID corresponding independent process thread to described, by
The independent process thread gets ID corresponding online deadline ready described in setting;
The all ID for having preserved the are ranked up step according to corresponding online deadline
Suddenly, including:For every group of ID, respectively by each self-corresponding independent process thread according to corresponding
Online deadline is ranked up to all ID for having preserved;
It is described for sequence after all ID, judge successively according to clooating sequence active user identify
The step of whether corresponding online deadline has reached, including:For the ID after every group of sequence,
Judge active user's mark correspondence successively according to clooating sequence by each self-corresponding independent process thread respectively
Online deadline whether reached.
Alternatively, the step of getting ID corresponding online deadline described in the setting ready, bag
Include:
Determine whether to have preserved and described get ID ready;
If so, then getting described ID corresponding online deadline ready and being updated to current time and add
Time after setting time;
If it is not, get ID ready described in then preserving, and to get ID ready corresponding online section by described
Only set of time is current time plus the time after setting time.
Alternatively, the step of foundation result of determination counts the quantity of online user, including:
The quantity of the ID that corresponding online deadline reached is determined, using the quantity as online
The quantity of user.
According to another aspect of the present invention, there is provided a kind of device of on-line user amount statistic, bag
Include:
Setup module, is suitable to receive including getting when getting data ready of ID ready, set described in get ready
ID corresponding online deadline;
Order module, being suitable to all ID according to corresponding online deadline to having preserved is carried out
Sequence;
Determination module, all ID after being suitable to for sequence judge to work as successively according to clooating sequence
Whether preceding ID corresponding online deadline has reached, until certain ID is corresponding online section
Only have not timed out up to when stop judge;
Statistical module, is suitable to be counted according to result of determination the quantity of online user.
Alternatively, the determination module, all ID after being particularly adapted to for sequence, from online
Deadline earliest ID starts, and judges that active user's mark is corresponding successively according to clooating sequence
Online deadline whether earlier than current time, until certain ID corresponding online deadline is equal to
Or stop judging when being later than current time.
Alternatively, described device also includes:Grouping module, is suitable to for ID to be divided into multiple groups,
And be that every group of ID creates a corresponding independent process thread.
Alternatively, the setup module, to be particularly adapted to receive and get data ready including get ID ready
When, get the data forwarding of getting ready ready ID corresponding independent process thread to described, it is only by this
Vertical treatment thread gets ID corresponding online deadline ready described in setting;
The order module, is particularly adapted to for every group of ID, respectively by each self-corresponding independent
Reason thread is ranked up according to corresponding online deadline to all ID for having preserved;
The determination module, is particularly adapted to for the ID after every group of sequence, respectively by each corresponding to
Independent process thread judge that active user identifies corresponding online deadline successively according to clooating sequence
Whether reach.
Alternatively, the setup module, is particularly adapted to determine whether to have preserved and described gets ID ready;
If so, then by it is described get ready ID corresponding online deadline be updated to current time plus setting
Time after time;If it is not, getting ID ready described in then preserving, and ID pair is got ready by described
The time after line deadline is set to current time plus setting time answered.
Alternatively, the statistical module, is particularly adapted to determine the use that corresponding online deadline has reached
Family mark quantity, using the quantity as online user quantity.
The method and apparatus of on-line user amount statistic of the invention, beating for user is got ready receiving
During point data, setting is got ready in data and gets ID corresponding online deadline ready, and according to right
The online deadline answered is ranked up to all ID for having preserved, for after sequence institute it is useful
Family identifies, and judges that active user identifies whether corresponding online deadline has arrived successively according to clooating sequence
Reach, until stop judging when certain ID corresponding online deadline does not reach, it is last according to judgement
Result counts the quantity of online user.It follows that the present invention to whole ID without carrying out one by one
Inquiry, it is only necessary to judged the certain customers' mark after sequence, therefore queries is smaller, can
The statistical efficiency of online user's quantity is improved, statistics is much sooner.
Described above is only the general introduction of technical solution of the present invention, of the invention in order to better understand
Technological means, and being practiced according to the content of specification, and in order to allow it is of the invention above-mentioned and
Other objects, features and advantages can become apparent, below especially exemplified by specific embodiment party of the invention
Formula.
Brief description of the drawings
By reading the detailed description of hereafter preferred embodiment, various other advantage and benefit for
Those of ordinary skill in the art will be clear understanding.Accompanying drawing is only used for showing the mesh of preferred embodiment
, and it is not considered as limitation of the present invention.And in whole accompanying drawing, with identical with reference to symbol
Number represent identical part.In the accompanying drawings:
The step of Fig. 1 shows the according to embodiments of the present invention one a kind of method of on-line user amount statistic
Flow chart;
The step of Fig. 2 shows the according to embodiments of the present invention two a kind of method of on-line user amount statistic
Flow chart;
The step of Fig. 3 shows the according to embodiments of the present invention three a kind of method of on-line user amount statistic
Flow chart;
Fig. 4 shows a kind of structure of the device of according to embodiments of the present invention four on-line user amount statistic
Block diagram;
Fig. 5 shows a kind of structure of the device of according to embodiments of the present invention five on-line user amount statistic
Block diagram.
Specific embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing in accompanying drawing
The exemplary embodiment of the disclosure is shown, it being understood, however, that may be realized in various forms the disclosure
Without that should be limited by embodiments set forth here.Conversely, there is provided these embodiments are able to more
Thoroughly understand the disclosure, and can be by the complete technology for conveying to this area of the scope of the present disclosure
Personnel.
Embodiment one
Reference picture 1, the method for showing a kind of according to embodiments of the present invention one on-line user amount statistic
The step of flow chart.The method of the present embodiment may include steps of:
Step 101, receives including getting when getting data ready of ID ready, set described in get user ready
Identify corresponding online deadline.
Current most business statistics data are dependent on browser end and get ready to complete, i.e., browser leads to
Crossing initiation and get request ready will get data is activation ready to server, and data are got ready by server record.It is so-called to beat
Point data is exactly the business datum of function point, such as when certain link in user's webpage clicking, to the link
Click information be exactly to get data ready.
In the present embodiment, it can be the heartbeat message that user sends to get data ready, wherein online for each
User sends once the heartbeat message of the user every Preset Time (such as 10s etc.).In getting data ready
Can include that sending the user for getting data ready gets ID ready, will set when receiving and getting data ready
ID corresponding online deadline is got ready described in putting.
The all ID for having preserved are ranked up by step 102 according to corresponding online deadline.
Each ID for having preserved corresponds to an online deadline, according to corresponding online cut-off
Time is ranked up to all ID for having preserved.Wherein, sequence can be ascending sort, also may be used
Think descending sort, the present embodiment is not any limitation as to this.
It should be noted that there is no dividing for strict sequencing between above-mentioned steps 101 and step 102,
All it is to be performed when condition is met.For example, step 101 is performed when receiving and getting data ready, step
102 can perform after step 101, or according to the execution that imposes a condition, such as execution in real time,
Or performed (such as perform a step 102 every 30s) according to setting time interval, etc., this
Inventive embodiments are not any limitation as to this.
Step 103, for sequence after all ID, judge current use successively according to clooating sequence
Family identifies whether corresponding online deadline has reached, until during the corresponding online cut-off of certain ID
Between stop when not reaching judging.
The ID reached to online deadline is only needed to be judged in said process, for
The ID that remaining online deadline does not reach need not be further continued for being judged, therefore without to all
ID is inquired about, and simply certain customers therein mark is judged, queries is big
It is big to reduce.
Step 104, the quantity of online user is counted according to result of determination.
The quantity of online user can be counted according to the result of determination of step 103, detailed process will
It is discussed in detail in embodiment two.
The embodiment of the present invention without being inquired about whole ID one by one, it is only necessary to the part after sequence
ID is judged, therefore queries is smaller, it is possible to increase the statistics effect of online user's quantity
Rate, statistics is much sooner.
Embodiment two
Reference picture 2, the method for showing a kind of according to embodiments of the present invention two on-line user amount statistic
The step of flow chart.The method of the present embodiment may include steps of:
Step 201, receiving thread receives the data of getting ready for including getting ID ready, and is beaten receiving
During point data, data is activation will be got ready and give treatment thread.
In the present embodiment, set that receiving thread is used to receiving user's transmission gets data ready, and sets treatment
Thread is used to perform subsequent treatment, can be in communication with each other between receiving thread and treatment thread, receiving thread
Receive get data ready when, will get ready data is activation to treatment thread.
Preferably, in the step 201 receiving thread receive get data ready when, data is activation will be got ready
Process to treatment thread can include:Receiving thread receive get data ready when, according to UDP (User
Datagram Protocol, UDP) will get ready data is activation to treatment thread.According to UDP
The transmission of data is carried out, the data transmission efficiency of inside can be effectively improved.
Preferably, in the step 201 receiving thread receive get data ready when, data is activation will be got ready
Process to treatment thread can be completed by Nginx servers.Nginx is the Web clothes of a lightweight
Business device, Reverse Proxy and Email (IMAP/POP3) proxy server, Nginx services
The performance of device is high, can improve treatment effeciency.
Step 202, to process and get ID corresponding online deadline ready described in thread setting.
Getting data ready includes getting ready ID, and treatment thread will be set after receiving and getting data ready
Get ID corresponding online deadline ready.
Preferably, the step 202 can include following sub-step:
Sub-step a1, it is determined whether get ID ready described in having preserved.If so, then performing sub-step
A2, if it is not, then performing sub-step a3.
Sub-step a2, gets described ID corresponding online deadline ready and is updated to current time and adds
Time after upper setting time.
Sub-step a3, preserve it is described get ID ready, and to get ID ready corresponding online by described
Deadline is set to current time plus the time after setting time.
Multiple ID are preserved in server, this will be in the server preserved when certain user reaches the standard grade
The ID of user, namely in server preserve be the ID of the user that reached the standard grade before.It is each to use
Each to that should have online deadline, online deadline shows that the user of correspondence ID exists to family mark
Reaching should be considered as offline after line deadline.Preferably, can be built using Hash table in the present embodiment
Vertical corresponding relation between ID and online deadline, can so realize more quickly looking into
Ask.
Treatment thread is after receiving and getting data ready, it is determined whether preserved it is therein get ID ready,
With determine this get ready ID correspondence user whether be first send get ready data (namely whether before not
Reach the standard grade), if having preserved this gets ID ready, ID correspondence directly can be got ready by described
Be updated to current time plus the time after setting time in line deadline;If not preserving this to get ready
ID, then first preserve this get ready ID (namely increase this in the server and get ID ready,
Show that the user reaches the standard grade), and get described ID corresponding online deadline ready and be set to currently
Time is plus the time after setting time.For setting time therein, those skilled in the art can be with root
Any suitable numerical value is selected according to practical experience, such as setting time 30s, 1min can be set to,
Specific numerical value is not any limitation as in the present embodiment.
Preferably, in the present embodiment after step 201, can also include:If it is determined that getting user's mark ready
Correspondence user is known to reach the standard grade first, then get the notice of reaching the standard grade of ID correspondence user described in transmission ready.
I.e. whether treatment thread is to reach the standard grade to judge first to getting ID correspondence user ready, if it is determined that headed by
Secondary to reach the standard grade, then treatment thread can send this and get ID ready to application to user's going on line or off line event interface
The notice of reaching the standard grade at family, by sending the notice of reaching the standard grade of user, can in time understand the situation of reaching the standard grade of user.
Wherein, if it is determined that described get ID correspondence user ready to reach the standard grade first, then user is got ready described in transmission
The process of the notice of reaching the standard grade of mark correspondence user can include:Determine whether to have preserved and described get user's mark ready
Know;If so, get ID correspondence user described in then judging ready being got ready to reach the standard grade first, and described in transmission
The notice of reaching the standard grade of ID correspondence user, is not processed otherwise, namely need not send reaching the standard grade for user
Notify.
User's mark is got ready it should be noted that not limiting step 202 treatment thread in the present embodiment and setting
The process of corresponding online deadline is known, with above-mentioned if it is determined that getting the corresponding user of ID ready for first
Reach the standard grade, then the priority performed between the process for sending the notice of reaching the standard grade for getting ID correspondence user ready is suitable
Sequence.
Step 203, treatment thread is according to corresponding online deadline to all ID for having preserved
It is ranked up.
Wherein, sequence can be to carry out ascending sort according to online deadline, or according to online
Deadline carries out descending sort, and the present embodiment is not any limitation as to this.
Step 204, all ID after processing thread for sequence, sentences successively according to clooating sequence
Whether settled preceding ID corresponding online deadline has reached, until certain ID it is corresponding
Stop judging when line deadline does not reach.
Preferably, the step 204 can include:All ID after for sequence, cut from online
Only time earliest ID starts, judge successively according to clooating sequence active user's mark it is corresponding
Line deadline whether earlier than current time, until certain ID corresponding online deadline be equal to or
Stop judging when being later than current time.
Judge since earliest ID of corresponding online deadline in the present embodiment, if the use
Family identifies corresponding online deadline earlier than current time, it is determined that online deadline has reached,
That is the corresponding user of the ID may be offline, will now be carried out continuing with next ID
Judge;If the ID corresponding online deadline is equal to or is later than current time, it is determined that
Line deadline does not reach also, namely the corresponding user of the ID is not also offline, now due to the use
It is corresponding online that family mark following ID corresponding online deadline is later than the ID
Deadline, therefore can directly determine the ID corresponding online deadline below the ID
Do not reach also, namely following ID is corresponding with also not offline per family, therefore need not be further continued for
Judged.
Step 205, treatment thread counts the quantity of online user according to result of determination.
After judgement by above-mentioned steps 204, you can the quantity of online user is counted according to result of determination.
The step 205 can specifically include:Treatment thread determines the user for having reached corresponding online deadline
The quantity of mark, using the quantity as online user quantity.
Preferably, in the present embodiment after above-mentioned steps 204, can also include:For it is corresponding
The ID that line deadline has reached, sends the offline notice of ID correspondence user.Namely
The ID that treatment thread has been reached for corresponding online deadline, can be to user's going on line or off line thing
Part interface sends the offline notice of ID correspondence user.If corresponding online deadline has arrived
Reach, then can illustrate that the corresponding user of the ID is offline, therefore the ID pair can be sent
Using the offline notice at family, by sending the offline notice of user, the offline feelings of user can be in time understood
Condition.
In the present embodiment, without being inquired about one by one whole ID, it is only necessary to the part after sequence
ID is judged, therefore queries is smaller, it is possible to increase the statistics effect of online user's quantity
Rate, statistics is much sooner.
Embodiment three
Reference picture 3, the method for showing a kind of according to embodiments of the present invention three on-line user amount statistic
The step of flow chart.The method of the present embodiment may include steps of:
Step 301, is divided into multiple groups, and be that every group of ID creates a correspondence by ID
Independent process thread.
In the present embodiment, ID can be divided into multiple groups according to setting means, for specific
Dividing mode, those skilled in the art select any suitable mode, the present invention according to practical experience
Embodiment is not any limitation as to this.For example, ID 1~10000 can be divided into a group,
ID 10001~20000 is divided into a group, by that analogy, etc..
For every group of ID, a corresponding independent process thread, the independent process line can be created
Journey is mainly for the treatment of one group of corresponding dependent event of ID.
Step 302, is received including getting when getting data ready of ID ready, and the data of getting ready are turned
The corresponding independent process thread of ID is got ready described in being sent to, beaten described in the independent process thread is set
Point ID corresponding online deadline.
Receiving including getting when getting data ready of ID ready, it is first determined get ready belonging to ID
Packet, it is determined that after will get data forwarding ready to getting the corresponding independent process thread of ID ready, namely
To get the corresponding independent process thread of the establishment of the ID in the packet belonging to ID ready.The independence
Treatment thread is received after getting data ready, and ID corresponding online deadline is got in setting ready, for
The detailed process of ID corresponding online deadline is got in setting ready, is walked with reference in above-described embodiment two
Rapid 202 associated description, is no longer discussed in detail herein in the present embodiment.
Preferably, receiving including getting when getting data ready of ID ready, the data of getting ready are being turned
After getting the corresponding independent process thread of ID ready described in being sent to, can also include:Use is got ready by described
Family identify corresponding independent process thread judges it is described get ready ID correspondingly user to reach the standard grade first
When, send the notice of reaching the standard grade for getting the corresponding user of ID ready.
Step 303, for every group of ID, respectively by each self-corresponding independent process thread according to right
The online deadline answered is ranked up to all ID for having preserved.
For the sequencer procedure of each independent process thread, with reference to the correlation of step 203 in above-described embodiment two
Description, is no longer discussed in detail herein in the present embodiment.
Step 304, for the ID after every group of sequence, respectively by each self-corresponding independent process line
Journey judges that active user identifies whether corresponding online deadline has reached according to clooating sequence successively, directly
Stop judging when not reached to certain ID corresponding online deadline.
For the decision process of each independent process thread, with reference to the correlation of step 204 in above-described embodiment two
Description, is no longer discussed in detail herein in the present embodiment.
Step 305, for the ID after every group of sequence, respectively by each self-corresponding independent process line
Journey counts this group of quantity of online user according to respective result of determination, and according to the statistics of each separate threads
Result determines the quantity of all on-line user.
For the statistic processes of each independent process thread, with reference to the correlation of step 205 in above-described embodiment two
Description, is no longer discussed in detail herein in the present embodiment.Each independent process thread obtains respective statistics
As a result after the quantity of online user (namely in each self-corresponding one group of ID), by each separate threads
Statistics be added, the quantity of the result obtained after addition as all on-line user.
Preferably, in the present embodiment after above-mentioned steps 304, can also include:For every group of sequence
ID afterwards, respectively by each self-corresponding independent process thread for corresponding online cut-off in the group
The ID for reaching is had timed out, the offline notice of ID correspondence user is sent.
In the present embodiment ID is divided into multiple groups, and multiple independent process threads are set and divided
The mode of the correlated process of the multiple groups of other places reason so that the treatment of air exercise point data much sooner, can hold
The QPS of load is higher.
For embodiment of the method, in order to be briefly described, therefore it is all expressed as a series of action group
Close, but those skilled in the art should know, and the embodiment of the present invention is not suitable by described action
The limitation of sequence, because according to the embodiment of the present invention, some steps can using other orders or simultaneously
Carry out.Secondly, those skilled in the art should also know, embodiment described in this description belongs to
Necessary to preferred embodiment, the involved action not necessarily embodiment of the present invention.
Example IV
Reference picture 4, shows a kind of device of according to embodiments of the present invention four on-line user amount statistic
Structured flowchart.The device of the present embodiment can include such as lower module:
Setup module 401, is suitable to receive including getting when getting data ready of ID ready, sets described
Get ID corresponding online deadline ready;
Order module 402, is suitable to according to corresponding online deadline to all ID for having preserved
It is ranked up;
Determination module 403, all ID after being suitable to for sequence, sentences successively according to clooating sequence
Whether settled preceding ID corresponding online deadline has reached, until certain ID it is corresponding
Stop judging when line deadline does not reach;
Statistical module 404, is suitable to be counted according to result of determination the quantity of online user.
The embodiment of the present invention without being inquired about whole ID one by one, it is only necessary to the part after sequence
ID is judged, therefore queries is smaller, it is possible to increase the statistics effect of online user's quantity
Rate, statistics is much sooner.
Embodiment five
Reference picture 5, shows a kind of device of according to embodiments of the present invention five on-line user amount statistic
Structured flowchart.The device of the present embodiment can include such as lower module:
Setup module 501, is suitable to receive including getting when getting data ready of ID ready, sets described
Get ID corresponding online deadline ready;
Order module 502, is suitable to according to corresponding online deadline to all ID for having preserved
It is ranked up;
Determination module 503, all ID after being suitable to for sequence, sentences successively according to clooating sequence
Whether settled preceding ID corresponding online deadline has reached, until certain ID it is corresponding
Stop judging when line deadline does not reach;
Statistical module 504, is suitable to be counted according to result of determination the quantity of online user.
Preferably, the determination module, all ID after being particularly adapted to for sequence, from online
Deadline earliest ID starts, and judges that active user's mark is corresponding successively according to clooating sequence
Online deadline whether earlier than current time, until certain ID corresponding online deadline is equal to
Or stop judging when being later than current time.
Preferably, the setup module, is particularly adapted to determine whether to have preserved and described gets ID ready;
If so, then by it is described get ready ID corresponding online deadline be updated to current time plus setting
Time after time;If it is not, getting ID ready described in then preserving, and ID pair is got ready by described
The time after line deadline is set to current time plus setting time answered.
Preferably, the statistical module, is particularly adapted to determine the use that corresponding online deadline has reached
Family mark quantity, using the quantity as online user quantity.
Preferably, the device of the present embodiment can also include:Grouping module 505, is suitable to ID
Multiple groups are divided into, and are that every group of ID creates a corresponding independent process thread.Accordingly,
The setup module, is particularly adapted to receive including getting when getting data ready of ID ready, is beaten by described in
Point data gets the corresponding independent process thread of ID ready described in being forwarded to, and is set by the independent process thread
ID corresponding online deadline is got ready described in putting;The order module, is particularly adapted to for every
Group ID, respectively by each self-corresponding independent process thread according to corresponding online deadline to
The all ID for preserving are ranked up;The determination module, is particularly adapted to for after every group of sequence
ID, judges active user successively by each self-corresponding independent process thread according to clooating sequence respectively
Identify whether corresponding online deadline has reached.
The embodiment of the present invention without being inquired about whole ID one by one, it is only necessary to the part after sequence
ID is judged, therefore queries is smaller, it is possible to increase the statistics effect of online user's quantity
Rate, statistics is much sooner;And the phase of multiple groups is processed respectively by setting multiple independent process threads
The mode of pass process so that much sooner, the QPS that can be undertaken is higher for the treatment of air exercise point data.
For device embodiment, because it is substantially similar to embodiment of the method, so the ratio of description
Relatively simple, the relevent part can refer to the partial explaination of embodiments of method.
Provided herein algorithm and display not with any certain computer, virtual system or miscellaneous equipment
It is intrinsic related.Various general-purpose systems can also be used together with based on teaching in this.According to above
Description, the structure constructed required by this kind of system is obvious.Additionally, the present invention is not also directed to
Any certain programmed language.It is understood that, it is possible to use various programming languages realize described here
The content of invention, and the description done to language-specific above is to disclose optimal reality of the invention
Apply mode.
In specification mentioned herein, numerous specific details are set forth.It is to be appreciated, however, that
Embodiments of the invention can be put into practice in the case of without these details.In some instances,
Known method, structure and technology is not been shown in detail, so as not to obscure the understanding of this description.
Similarly, it will be appreciated that in order to simplify the disclosure and helping understand in each inventive aspect one
Individual or multiple, in above to the description of exemplary embodiment of the invention, each feature of the invention
Sometimes it is grouped together into single embodiment, figure or descriptions thereof.However, should be by
The method of the disclosure is construed to reflect following intention:I.e. the present invention for required protection requirement ratio is at each
The more features of feature being expressly recited in claim.More precisely, as following right will
As asking book to reflect, inventive aspect is all spies less than single embodiment disclosed above
Levy.Therefore, it then follows thus claims of specific embodiment are expressly incorporated in the specific embodiment party
Formula, wherein each claim are in itself as separate embodiments of the invention.
Those skilled in the art are appreciated that can be carried out to the module in the equipment in embodiment
Adaptively change and they are arranged in one or more equipment different from the embodiment.
Module or unit or component in embodiment can be combined into a module or unit or component, and
In addition multiple submodule or subelement or sub-component can be divided into.Except such feature and/or
Outside at least some in process or unit exclude each other, can be using any combinations to this explanation
All features disclosed in book (including adjoint claim, summary and accompanying drawing) and so disclosed
All processes or unit of any method or equipment are combined.Unless expressly stated otherwise, this theory
Each feature disclosed in bright book (including adjoint claim, summary and accompanying drawing) can be by offer phase
The alternative features of same, equivalent or similar purpose replace.
Although additionally, it will be appreciated by those of skill in the art that some embodiments described herein include
Some included features are rather than further feature, but the feature of different embodiments in other embodiments
Combination mean to be within the scope of the present invention and formed different embodiments.For example, under
In the claims in face, the one of any of embodiment required for protection can be in any combination
Mode is used.
All parts embodiment of the invention can realize with hardware, or with one or more
The software module run on reason device is realized, or is realized with combinations thereof.Those skilled in the art
It should be appreciated that can be realized using microprocessor or digital signal processor (DSP) in practice
One of some or all parts in the equipment of on-line user amount statistic according to embodiments of the present invention
A little or repertoire.The present invention is also implemented as perform method as described herein one
Point or whole equipment or program of device (for example, computer program and computer program product).
It is such to realize that program of the invention be stored on a computer-readable medium, or can have one
The form of individual or multiple signals.Such signal can be downloaded from internet website and obtained, or
There is provided on carrier signal, or provided in any other form.
It should be noted that above-described embodiment the present invention will be described is limited rather than to the present invention
Make, and those skilled in the art can design without departing from the scope of the appended claims
Alternative embodiment.In the claims, any reference symbol being located between bracket should not be configured to
Limitations on claims.Word "comprising" do not exclude the presence of element not listed in the claims or
Step.Word "a" or "an" before element does not exclude the presence of unit as multiple
Part.The present invention can be by means of the hardware for including some different elements and by means of properly programmed
Computer is realized.If some in these devices in the unit claim for listing equipment for drying
Individual can be embodied by same hardware branch.Word first, second, and third
Using not indicating that any order.These words can be construed to title.
The invention discloses A1, a kind of method of on-line user amount statistic, including:
Receive including getting when getting data ready of ID ready, set described in get ID ready corresponding
Online deadline;
The all ID for having preserved are ranked up according to corresponding online deadline;
All ID after for sequence, active user's mark correspondence is judged according to clooating sequence successively
Online deadline whether reached, until when certain ID corresponding online deadline does not reach
Stop judging;
The quantity of online user is counted according to result of determination.
A2, the method as described in A1, it is described for sequence after all ID, according to sort it is suitable
Sequence judges that active user identifies whether corresponding online deadline has reached successively, until certain ID
Stop the step of judging when corresponding online deadline does not reach, including:
All ID after for sequence, since earliest ID of online deadline, press
Judge that whether active user identifies corresponding online deadline earlier than current time successively according to clooating sequence,
Until certain ID corresponding online deadline stops judging when being equal to or be later than current time.
A3, the method as described in A1, get data ready including get ID ready in described receiving
When, set described in the step of get ID corresponding online deadline ready before, also include:
ID is divided into multiple groups, and is that every group of ID creates a corresponding independent process
Thread.
A4, the method as described in A3, it is described to receive including getting when getting data ready of ID ready,
The step of getting ID corresponding online deadline described in setting ready, including:Receive including getting ready
When getting data ready of ID, by it is described get ready data forwarding to it is described get ready ID it is corresponding solely
Vertical treatment thread, when getting the corresponding online cut-off of ID ready described in the independent process thread is set
Between;
The all ID for having preserved the are ranked up step according to corresponding online deadline
Suddenly, including:For every group of ID, respectively by each self-corresponding independent process thread according to corresponding
Online deadline is ranked up to all ID for having preserved;
It is described for sequence after all ID, judge successively according to clooating sequence active user identify
The step of whether corresponding online deadline has reached, including:For the ID after every group of sequence,
Judge active user's mark correspondence successively according to clooating sequence by each self-corresponding independent process thread respectively
Online deadline whether reached.
A5, the method as described in A1, when getting the corresponding online cut-off of ID described in the setting ready
Between the step of, including:
Determine whether to have preserved and described get ID ready;
If so, then getting described ID corresponding online deadline ready and being updated to current time and add
Time after setting time;
If it is not, get ID ready described in then preserving, and to get ID ready corresponding online section by described
Only set of time is current time plus the time after setting time.
A6, the method as described in A1, the step of the quantity according to result of determination statistics online user
Suddenly, including:
The quantity of the ID that corresponding online deadline reached is determined, using the quantity as online
The quantity of user.
The invention also discloses B7, a kind of device of on-line user amount statistic, including:
Setup module, is suitable to receive including getting when getting data ready of ID ready, set described in get ready
ID corresponding online deadline;
Order module, being suitable to all ID according to corresponding online deadline to having preserved is carried out
Sequence;
Determination module, all ID after being suitable to for sequence judge to work as successively according to clooating sequence
Whether preceding ID corresponding online deadline has reached, until certain ID is corresponding online section
Only have not timed out up to when stop judge;
Statistical module, is suitable to be counted according to result of determination the quantity of online user.
B8, the device as described in B7, the determination module, the institute after being particularly adapted to for sequence are useful
Family identifies, and since earliest ID of online deadline, judges current successively according to clooating sequence
ID corresponding online deadline whether earlier than current time, until certain ID it is corresponding
Line deadline stops judging when being equal to or be later than current time.
B9, the device as described in B7, also include:
Grouping module, is suitable to for ID to be divided into multiple groups, and be that every group of ID creates one
Corresponding independent process thread.
B10, the device as described in B9, the setup module are particularly adapted to receive including getting use ready
When getting data ready of family mark, gets the data forwarding of getting ready ready ID corresponding independence to described
Treatment thread, ID corresponding online deadline is got ready described in the independent process thread is set;
The order module, is particularly adapted to for every group of ID, respectively by each self-corresponding independent
Reason thread is ranked up according to corresponding online deadline to all ID for having preserved;
The determination module, is particularly adapted to for the ID after every group of sequence, respectively by each corresponding to
Independent process thread judge that active user identifies corresponding online deadline successively according to clooating sequence
Whether reach.
B11, the device as described in B7, the setup module are particularly adapted to determine whether to have preserved described
Get ID ready;If so, then by it is described get ready ID corresponding online deadline be updated to work as
The preceding time is plus the time after setting time;If it is not, get ID described in then preserving ready, and will be described
Get the ID corresponding time after line deadline is set to current time plus setting time ready.
B12, the device as described in B7, the statistical module are particularly adapted to determination corresponding online section
Only have timed out the quantity of the ID for reaching, using the quantity as online user quantity.
Claims (10)
1. a kind of method of on-line user amount statistic, including:
Receive including getting when getting data ready of ID ready, set described in get ID ready corresponding
Online deadline;
The all ID for having preserved are ranked up according to corresponding online deadline;
All ID after for sequence, active user's mark correspondence is judged according to clooating sequence successively
Online deadline whether reached, until when certain ID corresponding online deadline does not reach
Stop judging;
The quantity of online user is counted according to result of determination.
2. the method for claim 1, it is characterised in that the institute for after sequence is useful
Family identifies, and judges that active user identifies whether corresponding online deadline has arrived successively according to clooating sequence
Reach, until stop the step of judging when certain ID corresponding online deadline does not reach, including:
All ID after for sequence, since earliest ID of online deadline, press
Judge that whether active user identifies corresponding online deadline earlier than current time successively according to clooating sequence,
Until certain ID corresponding online deadline stops judging when being equal to or be later than current time.
3. the method for claim 1, it is characterised in that received including getting use ready described
When getting data ready of family mark, set described in the step of get ID corresponding online deadline ready it
Before, also include:
ID is divided into multiple groups, and is that every group of ID creates a corresponding independent process
Thread.
4. method as claimed in claim 3, it is characterised in that
It is described to receive including getting when getting data ready of ID ready, set described in get ID pair ready
The step of online deadline answered, including:Receive including getting when getting data ready of ID ready,
The data forwarding of getting ready is got ready ID corresponding independent process thread to described, it is independent by this
Reason thread gets ID corresponding online deadline ready described in setting;
The all ID for having preserved the are ranked up step according to corresponding online deadline
Suddenly, including:For every group of ID, respectively by each self-corresponding independent process thread according to corresponding
Online deadline is ranked up to all ID for having preserved;
It is described for sequence after all ID, judge successively according to clooating sequence active user identify
The step of whether corresponding online deadline has reached, including:For the ID after every group of sequence,
Judge active user's mark correspondence successively according to clooating sequence by each self-corresponding independent process thread respectively
Online deadline whether reached.
5. the method for claim 1, it is characterised in that get user's mark described in the setting ready
The step of knowing corresponding online deadline, including:
Determine whether to have preserved and described get ID ready;
If so, then getting described ID corresponding online deadline ready and being updated to current time and add
Time after setting time;
If it is not, get ID ready described in then preserving, and to get ID ready corresponding online section by described
Only set of time is current time plus the time after setting time.
6. the method for claim 1, it is characterised in that described to exist according to result of determination statistics
The step of quantity of line user, including:
The quantity of the ID that corresponding online deadline reached is determined, using the quantity as online
The quantity of user.
7. a kind of device of on-line user amount statistic, including:
Setup module, is suitable to receive including getting when getting data ready of ID ready, set described in get ready
ID corresponding online deadline;
Order module, being suitable to all ID according to corresponding online deadline to having preserved is carried out
Sequence;
Determination module, all ID after being suitable to for sequence judge to work as successively according to clooating sequence
Whether preceding ID corresponding online deadline has reached, until certain ID is corresponding online section
Only have not timed out up to when stop judge;
Statistical module, is suitable to be counted according to result of determination the quantity of online user.
8. device as claimed in claim 7, it is characterised in that the determination module, is particularly adapted to
All ID after for sequence, since earliest ID of online deadline, according to row
Sequence order judges that whether active user identifies corresponding online deadline earlier than current time successively, until
Certain ID corresponding online deadline stops judging when being equal to or be later than current time.
9. device as claimed in claim 7, it is characterised in that also include:
Grouping module, is suitable to for ID to be divided into multiple groups, and be that every group of ID creates one
Corresponding independent process thread.
10. device as claimed in claim 9, it is characterised in that
The setup module, is particularly adapted to receive including getting when getting data ready of ID ready, by institute
State and get data forwarding ready and get the corresponding independent process thread of ID ready to described, by the independent process line
Journey gets ID corresponding online deadline ready described in setting;
The order module, is particularly adapted to for every group of ID, respectively by each self-corresponding independent
Reason thread is ranked up according to corresponding online deadline to all ID for having preserved;
The determination module, is particularly adapted to for the ID after every group of sequence, respectively by each corresponding to
Independent process thread judge that active user identifies corresponding online deadline successively according to clooating sequence
Whether reach.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510982947.1A CN106911528A (en) | 2015-12-23 | 2015-12-23 | The method and apparatus of on-line user amount statistic |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510982947.1A CN106911528A (en) | 2015-12-23 | 2015-12-23 | The method and apparatus of on-line user amount statistic |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106911528A true CN106911528A (en) | 2017-06-30 |
Family
ID=59207360
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510982947.1A Pending CN106911528A (en) | 2015-12-23 | 2015-12-23 | The method and apparatus of on-line user amount statistic |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106911528A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107277624A (en) * | 2017-07-12 | 2017-10-20 | 北京潘达互娱科技有限公司 | Duration calculation method and its device |
CN107704533A (en) * | 2017-09-21 | 2018-02-16 | 上海斐讯数据通信技术有限公司 | A kind of user terminal measures statistical method and system online |
CN108037988A (en) * | 2017-12-11 | 2018-05-15 | 郑州云海信息技术有限公司 | A kind of samba multi-threading performances get method and device ready |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1722821A (en) * | 2004-07-14 | 2006-01-18 | 上海微小卫星工程中心 | Automatic collection and statistical method and system for TV audience rating |
CN101378326A (en) * | 2008-09-18 | 2009-03-04 | 中兴通讯股份有限公司 | Method for enquiring multicast user processing aging |
CN101394307A (en) * | 2008-11-07 | 2009-03-25 | 阿里巴巴集团控股有限公司 | Method, apparatus and system for on-line user amount statistic |
CN101729571A (en) * | 2009-12-28 | 2010-06-09 | 广州游家信息技术有限公司 | Method, server and system for counting network on-line user number |
CN101860557A (en) * | 2009-04-08 | 2010-10-13 | 北京闻言科技有限公司 | Method for counting maximum on-line people according to period |
CN102761438A (en) * | 2012-05-18 | 2012-10-31 | 江苏金马扬名信息技术有限公司 | Method, server and system for counting on-line user population of website |
CN103310087A (en) * | 2012-03-16 | 2013-09-18 | 腾讯科技(深圳)有限公司 | Service data statistic analysis method and device |
US20140372102A1 (en) * | 2013-06-18 | 2014-12-18 | Xerox Corporation | Combining temporal processing and textual entailment to detect temporally anchored events |
-
2015
- 2015-12-23 CN CN201510982947.1A patent/CN106911528A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1722821A (en) * | 2004-07-14 | 2006-01-18 | 上海微小卫星工程中心 | Automatic collection and statistical method and system for TV audience rating |
CN101378326A (en) * | 2008-09-18 | 2009-03-04 | 中兴通讯股份有限公司 | Method for enquiring multicast user processing aging |
CN101394307A (en) * | 2008-11-07 | 2009-03-25 | 阿里巴巴集团控股有限公司 | Method, apparatus and system for on-line user amount statistic |
CN101860557A (en) * | 2009-04-08 | 2010-10-13 | 北京闻言科技有限公司 | Method for counting maximum on-line people according to period |
CN101729571A (en) * | 2009-12-28 | 2010-06-09 | 广州游家信息技术有限公司 | Method, server and system for counting network on-line user number |
CN103310087A (en) * | 2012-03-16 | 2013-09-18 | 腾讯科技(深圳)有限公司 | Service data statistic analysis method and device |
CN102761438A (en) * | 2012-05-18 | 2012-10-31 | 江苏金马扬名信息技术有限公司 | Method, server and system for counting on-line user population of website |
US20140372102A1 (en) * | 2013-06-18 | 2014-12-18 | Xerox Corporation | Combining temporal processing and textual entailment to detect temporally anchored events |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107277624A (en) * | 2017-07-12 | 2017-10-20 | 北京潘达互娱科技有限公司 | Duration calculation method and its device |
CN107277624B (en) * | 2017-07-12 | 2020-08-07 | 北京潘达互娱科技有限公司 | Duration calculation method and device |
CN107704533A (en) * | 2017-09-21 | 2018-02-16 | 上海斐讯数据通信技术有限公司 | A kind of user terminal measures statistical method and system online |
CN107704533B (en) * | 2017-09-21 | 2021-11-19 | 上海云淞信息技术有限公司 | User terminal online quantity statistical method and system |
CN108037988A (en) * | 2017-12-11 | 2018-05-15 | 郑州云海信息技术有限公司 | A kind of samba multi-threading performances get method and device ready |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105553880B (en) | Data processing method and device in a kind of software defined network | |
US8365284B2 (en) | Method for protecting a packet-based network from attacks, and security border node | |
CN108762911A (en) | Timing task management method, apparatus, computer equipment and storage medium | |
EP2765550A1 (en) | Automatic detection of fraudulent ratings/comments related to an application store | |
CN109787827B (en) | CDN network monitoring method and device | |
CA2471594A1 (en) | Method and apparatus for web farm traffic control | |
CN109842566B (en) | DNS (Domain name Server) analysis method and device | |
CN107888452A (en) | A kind of distributed website performance monitorings in 24 hours and Real-time Alarm method | |
JP2008507010A (en) | Server state estimation in stateless communication protocol | |
CN106911528A (en) | The method and apparatus of on-line user amount statistic | |
CN106790549A (en) | A kind of data-updating method and device | |
CN105227673B (en) | Data download method, client, server and the system of anti-abduction | |
CN107346272A (en) | The determination method and apparatus of dynamic heterogeneous redundant system | |
CN108768879A (en) | A kind of policy priority grade method of adjustment and device | |
CN106911748A (en) | The method and apparatus of on-line user amount statistic | |
CN108600368A (en) | A kind of HLS Internet videos download optimization method and device | |
CN106713187A (en) | Message transmission method and device | |
CN105245588B (en) | A kind of method of web service port separating treatment | |
CN105100216B (en) | A kind of multiple services monitoring method and device | |
CN106331106B (en) | Information issuing method and system | |
CN103248627B (en) | Method, forward proxy server and system for visiting website resources | |
CN104883705B (en) | A kind of the problem of data service is complained localization method and device | |
JP2006252067A (en) | Message distribution method and program | |
CN106911749A (en) | The method and apparatus for notifying user's going on line or off line | |
CN106911752A (en) | The method and apparatus for notifying user's going on line or off line |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170630 |