WO2015081715A1 - Procédé et appareil de comptage d'utilisateurs connectés sur un site web - Google Patents

Procédé et appareil de comptage d'utilisateurs connectés sur un site web Download PDF

Info

Publication number
WO2015081715A1
WO2015081715A1 PCT/CN2014/083637 CN2014083637W WO2015081715A1 WO 2015081715 A1 WO2015081715 A1 WO 2015081715A1 CN 2014083637 W CN2014083637 W CN 2014083637W WO 2015081715 A1 WO2015081715 A1 WO 2015081715A1
Authority
WO
WIPO (PCT)
Prior art keywords
user
heap
timer
heartbeat message
online
Prior art date
Application number
PCT/CN2014/083637
Other languages
English (en)
Chinese (zh)
Inventor
左文建
曲文庆
Original Assignee
北京奇虎科技有限公司
奇智软件(北京)有限公司
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 北京奇虎科技有限公司, 奇智软件(北京)有限公司 filed Critical 北京奇虎科技有限公司
Publication of WO2015081715A1 publication Critical patent/WO2015081715A1/fr

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/535Tracking the activity of the user

Definitions

  • the present invention relates to the field of Internet technologies, and in particular, to a method and apparatus for online user statistics of a website.
  • the online user sends a heartbeat to the online statistics month.
  • the heartbeat is sent for the first time, the user is online.
  • the heartbeat interval is exceeded, the heartbeat signal is not received.
  • the website platform currently has 1.2 million users online, send a heartbeat every 10 seconds.
  • online statistics 1 request to reach 120,000 QPS (Query Per Second, Query Per Second).
  • Ordinary WEB services (lOOOOQPS) will require 120 sets of services to be accepted.
  • the heartbeat information of the user is recorded into the database in the form of a session.
  • the session life cycle is extended.
  • the session is automatically deleted. This requires querying each session life cycle in the database one by one, and the query volume is very large. This solution is based on a database for storage, and a large number of queries result in poor performance.
  • the present invention has been made in order to provide an online user statistical method and apparatus for a website that overcomes the above problems or at least partially solves the above problems.
  • a method for online user statistics of a website comprising:
  • the user identifier of the user Upon receiving the heartbeat message including the user identifier, the user identifier of the user is checked according to the user identifier in the heartbeat message; if it exists, the timer is delayed for a certain time; if not, the user is added to the heap. a timer, and sending an online notification of the user; wherein, the online heartbeat message of the user is sent once every preset time for each online user; When the timer in the heap reaches the top of the heap, the timer is deleted from the heap and the offline notification of the user corresponding to the timer is sent.
  • an online user statistics device for a website comprising:
  • a heap creation unit adapted to create a heap for storing an online user's timer, each node in the heap corresponding to an online user's timer;
  • the online user statistic unit is configured to: when the heartbeat message including the user identifier is received, check whether the timer of the user exists in the heap according to the user identifier in the heartbeat message; if yes, delay the timer for a certain period of time; if not, Adding the user's timer to the heap, and triggering the user status event interface unit to send the user's online notification; when the timer in the heap times out to the top of the heap, the timer is deleted from the heap, and the user status event interface is triggered.
  • the unit sends the offline notification of the user corresponding to the timer; wherein, the online heartbeat message of the user is sent once every preset time for each online user;
  • the user status event interface unit is adapted to send the user's online notification and offline notification according to the trigger of the online user statistics unit.
  • a computer program comprising computer readable code, when the computer readable code is run on a server, causes the server to perform the method of one aspect of the present invention.
  • a computer readable medium storing a computer program according to still another aspect of the present invention is provided.
  • FIG. 1 shows a flow of an online user statistical method for a website according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram showing an online user statistical method of a website according to still another embodiment of the present invention;
  • FIG. 3 is a diagram showing online user statistics of a website according to an embodiment of the present invention;
  • FIG. 4 is a block diagram showing the structure of the online user statistic unit 320 shown in FIG. 3 according to an embodiment of the present invention;
  • Fig. 6 schematically shows a storage unit for holding or carrying program code implementing the statistical method according to the present invention.
  • FIG. 1 is a flow chart showing an online user statistical method of a website according to an embodiment of the present invention. As shown in FIG. 1 , the method includes:
  • Step S1 10 Create a heap for storing an online user's timer, and each node in the heap corresponds to a timer of an online user;
  • Step S120 When receiving the heartbeat message including the user identifier, check whether the timer of the user exists in the heap according to the user identifier in the heartbeat message; delay the timer for a certain time if it exists, or in the heap if it does not exist Adding a timer of the user, and sending an online notification of the user; wherein, the online heartbeat message of the user is sent once every preset time for each online user;
  • Step S130 When the timer in the heap reaches the top of the heap, the timer is deleted from the heap, and the offline notification of the user corresponding to the timer is sent.
  • step S120 is performed when a heartbeat message containing the user identification is received
  • step S130 is performed when the timer in the heap times out to reach the top of the heap.
  • FIG. 2 is a diagram showing a method for online user statistics of a website according to still another embodiment of the present invention. This method requires the creation of a heap for storing the timers of online users, each node in the heap corresponding to a timer of an online user. As shown in Figure 2, the process of the method includes:
  • Step S210 the heartbeat message receiving thread receives the heartbeat message of the online user including the user identifier.
  • the heartbeat message of the user is sent once every preset time for each online user.
  • Step S220 Send a heartbeat message including the user identifier to the processing thread.
  • Step S230 View, according to the user identifier in the heartbeat message, whether the user's timer exists in the heap.
  • Step S240 according to whether there is a timer of the user, there are two cases:
  • timer of the user If the timer of the user does not exist, add a timer of the user to the heap, and send an online notification of the user.
  • Step S250-S270 When the timer in the heap times out to reach the top of the heap, the timer is deleted from the heap, and the offline notification of the user corresponding to the timer is sent.
  • the heap described here is a sorted complete binary tree in which the data values of any of the non-terminal nodes are not greater than (or not less than) the values of its left and right child nodes.
  • the largest heap and the smallest heap are two forms of a binary heap.
  • Maximum heap The key value of the root node is the largest of all heap node key values.
  • Minimum heap The root node's key value is the smallest of all heap node key values.
  • the method shown in FIG. 2 further includes: dividing the user into a plurality of groups according to the user identifier, and setting a plurality of processing threads corresponding to the plurality of groups; the heartbeat message receiving thread is Receiving the heartbeat message including the user identifier, forwarding the heartbeat message to the corresponding processing thread according to the user identifier in the heartbeat message; checking whether the user's timer exists in the heap according to the user identifier in the heartbeat message; delaying if present The timer is for a certain period of time; if it does not exist, the user's timer is added to the heap, and the step of sending the user's online notification is processed by the corresponding processing thread.
  • Such a scheme of dividing a user into a plurality of groups based on a user identifier and setting a plurality of processing threads to separately process heartbeat messages of users of multiple groups makes the processing of heartbeat messages more timely and can bear The QPS is higher.
  • the heartbeat message receiving thread forwarding the heartbeat message to the corresponding processing thread comprises: forwarding the heartbeat message to the corresponding processing thread according to the UDP protocol. This effectively improves the efficiency of internal data transmission.
  • the step of forwarding the heartbeat message to the corresponding processing thread according to the user identifier in the heartbeat message is performed by the method shown in FIG.
  • the Nginx server is complete.
  • the high performance of the Nginx server can improve processing efficiency.
  • a heap for storing timers for online users is created in memory. In this way, the query and read speed of the timer is faster.
  • the method shown in FIG. 2 further includes: using a hash table to establish a correspondence between a timer in the heap and a user identifier. In this way, a faster query can be achieved.
  • a minimum heap for storing a timer of an online user is created, and a timer in the minimum heap is a decrement timer; or, a user is created to store an online user.
  • the maximum heap of the timer, the timer in the largest heap is the increment timer.
  • Fig. 3 is a block diagram showing an online user statistical device of a website according to an embodiment of the present invention. As shown in FIG. 3, the online user statistics device 300 of the website includes:
  • the heap creation unit 310 is adapted to create a heap for storing a timer of the online user, and each node in the heap corresponds to a timer of the online user;
  • the online user statistic unit 320 is adapted to: when the heartbeat message including the user identifier is received, check whether the timer of the user exists in the heap according to the user identifier in the heartbeat message; if yes, delay the timer for a certain time; if not Adding the user's timer to the heap, and triggering the user status event interface unit to send the user's online notification; when the timer in the heap times out to the top of the heap, the timer is deleted from the heap, and the user status event is triggered.
  • the interface unit sends the offline notification of the user corresponding to the timer; wherein, for each online user, the user's heart mega-message message is sent every preset time;
  • the user status event interface unit 330 is adapted to send the user's online notification and offline notification according to the trigger of the online user statistics unit.
  • the device shown in Figure 3 because of the heap used to store the online user's timer, according to the characteristics of the heap, When the timer is about to time out, it will automatically reach the top of the heap, so it is easy to know the offline users, without having to query one by one, which greatly improves the performance.
  • FIG. 4 shows a block diagram of the online user statistics unit 320 of Figure 3, in accordance with one embodiment of the present invention.
  • the online user statistics unit 320 includes: a heartbeat message receiving unit 3200 and a plurality of heartbeat message processing units; three heartbeat message processing units are drawn in FIG. , marked with 3201, 3202, and 3203, respectively.
  • the user is divided into a plurality of groups according to the user identifier, and the plurality of heartbeat message processing units are corresponding to the plurality of groups.
  • the heartbeat message receiving unit 3200 is adapted to forward the heartbeat message to the corresponding heartbeat message processing unit according to the user identifier in the heartbeat message when receiving the heartbeat message including the user identifier; the heartbeat message processing unit is adapted to receive the heartbeat according to the heartbeat
  • the user ID in the message checks whether the user's timer exists in the heap; if it exists, delays the timer for a certain time; if it does not exist, adds the user's timer to the heap, and sends the user's online notification; When the timer expires and reaches the top of the heap, the timer is deleted from the heap, and the user status event interface unit is triggered to send the offline notification of the user corresponding to the timer.
  • the solution that divides the user into multiple groups based on the user identifier and sets a plurality of heartbeat message processing units to respectively process the heartbeat messages of the users of the multiple groups makes the processing of the heartbeat message more timely and can bear higher QPS. .
  • the heartbeat message receiving unit 3200 is adapted to forward the heartbeat message to the corresponding heartbeat message processing unit according to the UDP protocol. This effectively improves the efficiency of internal data transmission.
  • the heartbeat message receiving unit 3200 is implemented on an Nginx server.
  • the high performance of the Nginx server can improve processing efficiency.
  • the heap creation unit 310 is adapted to create a heap in memory for storing timers for online users. In this way, the query and read speed of the timer is faster.
  • the heap creation unit 310 further creates a hash table for saving a correspondence between a timer in the heap and a user identifier.
  • the heap creation unit 310 is adapted to create a minimum heap for storing a timer of an online user, the timer in the minimum heap is a decrement timer; or, is suitable for creating for storage
  • the maximum heap of the online user's timer, the timer in the largest heap is the incrementing timer.
  • a heap for creating a timer for an online user each node in the heap corresponds to a timer of an online user; when receiving a heartbeat message including the user identifier, according to the heartbeat The user identifier in the message is used to check whether the timer of the user exists in the heap; if it exists, the timer is delayed for a certain period of time; if not, the timer of the user is added to the heap, and the online notification of the user is sent; For each online user, the heartbeat message of the user is sent once every preset time; when the timer in the heap reaches the top of the heap, the timer is deleted from the heap, and the user's offline line corresponding to the timer is sent.
  • the heap is used to store the timer of the online user, according to the characteristics of the heap, when the timer will time out, it will automatically reach the top of the heap, so that the offline user can be easily learned without the need of query one by one, which greatly improves the performance. .
  • the scheme of using the Nginx server, creating a heap in the memory, and the like in the present invention further improves the performance, can perform real-time statistics on millions of simultaneous online users with few servers, and trigger the user to go online and offline. It should be noted:
  • DSP DSP
  • the invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
  • a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
  • Figure 5 schematically illustrates a server for performing a statistical method in accordance with the present invention
  • an application server conventionally includes a processor 510 and a computer program product or computer readable medium in the form of a memory 520.
  • the memory 520 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read Only Memory), an EPROM, a hard disk, or a ROM.
  • Memory 520 has a memory space 530 for program code 531 for performing any of the method steps described above.
  • storage space 530 for program code may include separate programs for implementing various steps in the above methods, respectively.
  • the program code can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks.
  • Such a computer program product is typically a portable or fixed storage unit as described with reference to FIG. Figure 6 schematically illustrates a storage unit for holding or carrying program code implementing a statistical method in accordance with the present invention; the storage unit may have storage segments, storage spaces, etc. arranged similarly to memory 520 in the server of Figure 5; .
  • the program code can be compressed, for example, in an appropriate form.
  • the storage unit includes computer readable code 53 ⁇ , i.e., code readable by a processor, such as 510, that when executed by the server causes the server to perform various steps in the methods described above.
  • an embodiment or “one or more embodiments” as used herein means that the particular features, structures, or characteristics described in connection with the embodiments are included in at least one embodiment of the invention.
  • the phrase “in one embodiment” herein does not necessarily refer to the same embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Measuring And Recording Apparatus For Diagnosis (AREA)

Abstract

L'invention concerne un procédé et un appareil de comptage d'utilisateurs connectés sur un site web. Le procédé comporte les étapes consistant à: créer une pile destinée à stocker des temporisations d'utilisateurs connectés, chaque nœud de la pile correspondant à une temporisation d'un utilisateur connecté; lorsqu'un message de détection de collision comportant un identifiant d'utilisateur est reçu, examiner, en fonction de l'identifiant d'utilisateur figurant dans le message de détection de collision, si une temporisation de l'utilisateur existe dans la pile et, si c'est le cas, retarder la temporisation d'un certain temps ou, si ce n'est pas le cas, ajouter la temporisation de l'utilisateur à la pile et émettre une notification de connexion de l'utilisateur, un message de détection de collision de l'utilisateur étant émis, pour chaque utilisateur connecté, à un intervalle de temps prédéfini; et lorsqu'une temporisation de la pile expire et atteint le sommet de la pile, supprimer la temporisation de la pile et émettre une notification de déconnexion d'un utilisateur correspondant à la temporisation. Au moyen des solutions techniques de la présente invention, le rendement et les performances du comptage d'utilisateurs connectés sont considérablement améliorés.
PCT/CN2014/083637 2013-12-05 2014-08-04 Procédé et appareil de comptage d'utilisateurs connectés sur un site web WO2015081715A1 (fr)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310652889.7 2013-12-05
CN201310652889.7A CN103684911B (zh) 2013-12-05 2013-12-05 一种网站的在线用户统计方法和装置

Publications (1)

Publication Number Publication Date
WO2015081715A1 true WO2015081715A1 (fr) 2015-06-11

Family

ID=50321290

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/083637 WO2015081715A1 (fr) 2013-12-05 2014-08-04 Procédé et appareil de comptage d'utilisateurs connectés sur un site web

Country Status (2)

Country Link
CN (1) CN103684911B (fr)
WO (1) WO2015081715A1 (fr)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103684911B (zh) * 2013-12-05 2017-05-03 北京奇虎科技有限公司 一种网站的在线用户统计方法和装置
WO2016086345A1 (fr) * 2014-12-01 2016-06-09 华为技术有限公司 Dispositif et procédé de reconnaissance pour chronomètre de paquets de battements du cœur
CN106571973A (zh) * 2016-09-28 2017-04-19 杭州鸿雁智能科技有限公司 心跳包超时管理方法及系统
CN106789913B (zh) * 2016-11-23 2020-02-07 北京云中融信网络科技有限公司 用户账号管理方法及装置
CN107704533B (zh) * 2017-09-21 2021-11-19 上海云淞信息技术有限公司 一种用户终端在线量统计方法及系统
CN111182464B (zh) * 2019-11-28 2024-01-26 贵阳朗玛信息技术股份有限公司 一种在线采样的方法及装置
CN112738547B (zh) * 2020-12-31 2022-08-12 杭州当虹科技股份有限公司 一种实时统计直播在线人数的系统
CN113014446B (zh) * 2021-02-10 2022-09-16 北京字跳网络技术有限公司 异常离线用户检测方法、装置、服务器、存储介质和系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102647314A (zh) * 2012-05-16 2012-08-22 深圳市乐唯科技开发有限公司 一种客户端在线状态判定方法及其系统
CN102761438A (zh) * 2012-05-18 2012-10-31 江苏金马扬名信息技术有限公司 一种网站统计在线用户人数的方法、服务器和系统
US20120310877A1 (en) * 2004-04-05 2012-12-06 George Eagan Knowledge archival and recollection systems and methods
CN103684911A (zh) * 2013-12-05 2014-03-26 北京奇虎科技有限公司 一种网站的在线用户统计方法和装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1332548C (zh) * 2002-08-07 2007-08-15 华为技术有限公司 海量定时器的调度方法
CN101394307B (zh) * 2008-11-07 2011-06-15 阿里巴巴集团控股有限公司 一种统计在线用户数量的方法、装置及系统
US8296262B1 (en) * 2009-05-04 2012-10-23 United Services Automobile Association (Usaa) Systems and methods for real-time online monitoring of computing devices
CN101729571A (zh) * 2009-12-28 2010-06-09 广州游家信息技术有限公司 网络在线用户人数统计方法、服务器和系统
CN101917437B (zh) * 2010-08-20 2013-03-20 迈普通信技术股份有限公司 基于sip的用户离线检测方法以及sip用户状态检测系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120310877A1 (en) * 2004-04-05 2012-12-06 George Eagan Knowledge archival and recollection systems and methods
CN102647314A (zh) * 2012-05-16 2012-08-22 深圳市乐唯科技开发有限公司 一种客户端在线状态判定方法及其系统
CN102761438A (zh) * 2012-05-18 2012-10-31 江苏金马扬名信息技术有限公司 一种网站统计在线用户人数的方法、服务器和系统
CN103684911A (zh) * 2013-12-05 2014-03-26 北京奇虎科技有限公司 一种网站的在线用户统计方法和装置

Also Published As

Publication number Publication date
CN103684911B (zh) 2017-05-03
CN103684911A (zh) 2014-03-26

Similar Documents

Publication Publication Date Title
WO2015081715A1 (fr) Procédé et appareil de comptage d'utilisateurs connectés sur un site web
US11122067B2 (en) Methods for detecting and mitigating malicious network behavior and devices thereof
CN108345642B (zh) 采用代理ip爬取网站数据的方法、存储介质和服务器
US11909753B2 (en) Virtual private cloud flow log event fingerprinting and aggregation
CN106933854B (zh) 短链接处理方法、装置及服务器
CN110943961B (zh) 数据处理方法、设备以及存储介质
IL273861A (en) Event context management system
WO2017084529A1 (fr) Procédé et dispositif d'identification d'attaques de réseau
JP5837940B2 (ja) 非アクティブのブラウザウィンドウを検出するための技術
WO2014067320A1 (fr) Procédé et système de partage de page web, serveur, client, programme informatique et support lisible par ordinateur
WO2017166644A1 (fr) Procédé et système d'acquisition de données
JP6018080B2 (ja) 新しいブラウザウィンドウを検出するための技術
EP2698730A1 (fr) Procédé, dispositif et système d'acquisition de données
CN113766035A (zh) 一种业务受理及共识的方法及装置
TW201638779A (zh) 一種對虛擬主機的資源管理的方法、裝置、系統及電子設備
WO2016070718A1 (fr) Procédé, dispositif, et navigateur, pour le téléchargement de fichiers
WO2015062201A1 (fr) Procédé, dispositif, serveur et système d'interrogation de données
CN104239353B (zh) 一种web分类控制和日志审计的方法
WO2013189254A1 (fr) Procédé et dispositif d'agrégation de points d'accès
WO2016107306A1 (fr) Procédé d'abonnement à des messages, dispositif de nœud de traitement et bus de message
WO2023087769A1 (fr) Procédé de déduplication de champ clé en temps réel sur la base d'un moteur flink de calcul distribué pour le traitement de flux
WO2013117151A1 (fr) Procédé et système pour le balayage rapide de fichiers
CN105095299A (zh) 图片抓取方法和系统
WO2021226781A1 (fr) Procédé et appareil de mise à jour de règle de pare-feu, serveur et support d'enregistrement
WO2015154416A1 (fr) Procédé et dispositif de gestion comportementale d'accès à internet

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14867546

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14867546

Country of ref document: EP

Kind code of ref document: A1