WO2017219740A1 - Method and system for maintaining active user set based on time roulette and page heartbeat - Google Patents

Method and system for maintaining active user set based on time roulette and page heartbeat Download PDF

Info

Publication number
WO2017219740A1
WO2017219740A1 PCT/CN2017/080776 CN2017080776W WO2017219740A1 WO 2017219740 A1 WO2017219740 A1 WO 2017219740A1 CN 2017080776 W CN2017080776 W CN 2017080776W WO 2017219740 A1 WO2017219740 A1 WO 2017219740A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
heartbeat
active user
user set
time
Prior art date
Application number
PCT/CN2017/080776
Other languages
French (fr)
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 WO2017219740A1 publication Critical patent/WO2017219740A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/25Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
    • H04N21/258Client or end-user data management, e.g. managing client capabilities, user preferences or demographics, processing of multiple end-users preferences to derive collaborative data
    • H04N21/25866Management of end-user data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/25Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
    • H04N21/258Client or end-user data management, e.g. managing client capabilities, user preferences or demographics, processing of multiple end-users preferences to derive collaborative data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/25Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
    • H04N21/262Content or additional data distribution scheduling, e.g. sending additional data at off-peak times, updating software modules, calculating the carousel transmission frequency, delaying a video stream transmission, generating play-lists
    • H04N21/26208Content or additional data distribution scheduling, e.g. sending additional data at off-peak times, updating software modules, calculating the carousel transmission frequency, delaying a video stream transmission, generating play-lists the scheduling operation being performed under constraints
    • H04N21/26241Content or additional data distribution scheduling, e.g. sending additional data at off-peak times, updating software modules, calculating the carousel transmission frequency, delaying a video stream transmission, generating play-lists the scheduling operation being performed under constraints involving the time of distribution, e.g. the best time of the day for inserting an advertisement or airing a children program
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • H04N21/8455Structuring of content, e.g. decomposing content into time segments involving pointers to the content, e.g. pointers to the I-frames of the video stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • H04N21/8456Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments

Definitions

  • the present invention relates to the field of maintenance technology for active user sets in live video broadcasts, and in particular, to a method and system for maintaining active user sets based on time roulette and page heartbeat.
  • Online live video broadcast refers to live video live broadcast service using Internet network resources. It is simultaneously posted to the network through live video capture. Users can see the real-time situation on the network at the same time.
  • live broadcast anchors need to only interact with active users who are watching live broadcasts or active users on the website when launching interactive activities or when the website launches a special event.
  • An active set of users to record and update live users in real time.
  • the server does not receive the page heartbeat event data for a period of time (usually it needs to customize the time, the timeout is Timeout),
  • the user culls the active user set. Specifically, it is usually divided into the following two methods:
  • the disadvantage of the method (1) is that the method (1) has only one repeated timer globally. (Repetition timer), when the number of users is large (for example, tens of thousands of users are maintained at the same time), the repeated timer traverses all user sessions each time, and the workload is long and the work efficiency is low.
  • Repetition timer when the number of users is large (for example, tens of thousands of users are maintained at the same time), the repeated timer traverses all user sessions each time, and the workload is long and the work efficiency is low.
  • method (2) is similar to method (1), the only difference is that method (2) is to set a one-shot timer for each user session, and each one-shot timer receives the corresponding one. When the time of the page heartbeat event data is automatically updated, if each one-shot timer finds a timeout, the corresponding user session is culled.
  • the method (2) improves the efficiency of the check to some extent, there are still disadvantages: the method (2) needs to set a larger number of one-shot timers, and the one-shot timer has a faster frequency.
  • the number of users is large, the number of connections in the user session is large, which may cause pressure on the "waiting to update the timer queue". In severe cases, the system may be congested or even collapsed.
  • the technical problem solved by the present invention is to provide an active user set maintenance method and system based on time roulette and page heartbeat.
  • the invention can use the time roulette to update the active user set and complete the timely maintenance of the active user set; not only the work efficiency is high, but also does not cause a large load on the system, and can effectively limit the non-active activities in some interactive activities.
  • the participation of active users ensures the effective implementation of interactive activities.
  • the method for maintaining an active user set based on time roulette and page heartbeat comprises the following steps:
  • the video heartbeat information includes a plurality of heartbeat information identification identifiers, and proceeds to step B;
  • step B determining the video heartbeat information according to the specified heartbeat information according to the heartbeat information identification, buffering and pre-processing the video heartbeat information that meets the requirements, and obtaining the page heartbeat pre-processing data, and proceeding to step C;
  • the page heartbeat pre-processing data is composed into a plurality of data pieces, each piece of data piece includes at least one page heartbeat pre-processing data; periodically all the currently cached pieces of data are allocated into groups according to a hashing policy, and the process proceeds to step D;
  • the active user set fragmentation refers to: a plurality of fragments that are divided into active user sets in advance according to a specified active calculation time period
  • Timing adds the updated active user set fragment to the pre-created time wheel.
  • the present invention provides a time-based roulette and page heartbeat-based active user set maintenance system for implementing the above method, the system comprising a video heartbeat information generating module located on each terminal device, a cache pre-processing module located on the server, and located on the server. Data slice component module, several real-time computing modules located on the server, and active user set function modules located on the server;
  • the video heartbeat information generating module is configured to: generate video heartbeat information according to the live video viewed by the user, where the video heartbeat information includes a plurality of heartbeat information identification identifiers, and the video heartbeat information is submitted to the buffer preprocessing module;
  • the buffer pre-processing module is configured to: determine, according to the heartbeat information identification identifier, the video heartbeat information that meets the requirements; and after buffering and pre-processing the video heartbeat information that meets the requirements, obtain the page heartbeat pre-processing data, and periodically send the data piece to the data slice component module.
  • Composition signal
  • the data slice forming module is configured to: after receiving the data slice forming signal, the page heartbeat preprocessing data is formed into a plurality of data pieces, each piece of data piece includes at least one page heartbeat preprocessing data; and all current cached data pieces are periodically timed according to A hashing policy is assigned to each real-time computing module;
  • the real-time computing module is configured to: verify all page heartbeat pre-processing data in the data piece allocated by the data piece forming module, determine all the page heartbeat pre-processing data passed by the verification; and all the users corresponding to the page heartbeat pre-processing data passed through the verification
  • the ID is updated to the active user set fragment corresponding to the current time;
  • the active user set fragment refers to: a plurality of fragments into which the active user set is divided into the specified active computing time period in advance;
  • the active user set function module is used to: periodically add the updated user set fragment of the real-time calculation module to the pre-created time wheel.
  • the present invention generates video heartbeat information according to the live video viewed by the user, and updates the video heartbeat information that is verified as an active user to the corresponding active user set fragment.
  • the present invention does not use a repeating timer or a one-time timer, but periodically adds an active user set fragment to the created time wheel to utilize the time roulette.
  • To update the active user set and complete the timely maintenance of the active user set not only work efficiency is high, but also does not cause a heavy load on the system, and can effectively limit the participation of inactive users in certain interactive activities, and ensure The interactive activities are carried out effectively.
  • the division time of the active user set fragment of the present invention and the timing period of adding the active user set fragment to the time wheel can be set and adjusted according to the specific use situation; thereby making the active user set fragmented.
  • Quantity, statistical granularity of active users that is, statistics by hourly activity, minute activity, or other activity
  • maintenance schedule of time roulette maintenance cycle is the same as the timing cycle, can be maintained for 1 hour, 1 Minute maintenance or other cycles to maintain
  • the system of the present invention includes a plurality of real-time computing modules for processing data pieces, and the plurality of real-time computing modules can simultaneously process a plurality of data pieces, thereby further improving work efficiency. Timeliness.
  • FIG. 1 is a flowchart of a method for maintaining an active user set based on a time roulette and a page heartbeat according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of a time wheel in an embodiment of the present invention.
  • FIG. 3 is a structural block diagram of an active user set maintenance system based on time roulette and page heartbeat.
  • a method for maintaining an active user set based on time roulette and page heartbeat in the embodiment of the present invention includes the following steps:
  • the terminal device used by each user generates video heartbeat information according to the live video viewed by the user, and the video heartbeat information includes a plurality of heartbeat information identification identifiers, and goes to S2.
  • the heartbeat information identification identifier includes a user ID (ie, an ID of the user uniqueness) and an identification code.
  • the identification code is a fixed length, and is encrypted after being generated.
  • the generation rule of the identification code is: a timestamp, a terminal device ID used by the user, and a random number, wherein the terminal device ID used by the user is based on the API of the terminal device (Application Programming Interface, application programming interface).
  • S2 Determine, according to the heartbeat information identification identifier, the video heartbeat information that meets the requirements (discard the video heartbeat information that does not meet the requirements), cache and pre-process the video heartbeat information that meets the requirements (that is, the unified data format), and obtain the page heartbeat preprocessing. Data, go to S3.
  • the heartbeat information identification identifier in the video heartbeat information that meets the requirements in S2 needs to meet the following conditions: the user ID is not empty (it is not compliant if it is empty), and the user ID conforms to the data field type (the data field type does not meet the requirements) ), the timestamp format is positive Indeed (the error is not in compliance with the regulations), the user terminal type identification is legal (illegal does not meet the requirements).
  • the page heartbeat preprocessing data format in S2 is:
  • the page heartbeat pre-processing data is formed into a plurality of data pieces, each piece of data piece has a capacity of less than or equal to 1 MB, and each piece of data piece includes at least one complete page heartbeat pre-processing data, and is transferred to S4.
  • the specific process of S3 is as follows:
  • the current cached page heartbeat preprocessing data is 3, and their sizes are 0.3M, 0.4M, and 0.5M respectively.
  • the process of S3 is: preprocessing two presets of 0.3M and 0.4M.
  • the data constitutes a piece of data, and then the 0.5M preprocessed data is formed into another piece of data, and so on.
  • S4 Timing all current cached data pieces according to a hash policy to be at least 3 groups, and going to S5.
  • the specific process of S4 is: defining a total number of groups of N, assigning a unique ID number UUID to each piece of data, performing a modulo operation (UUID mod N) for each UUID and N, and obtaining a remainder of the modulo operation All the same pieces of data are in the same group.
  • the purpose of grouping the data slices according to the hash strategy in S4 is to increase or decrease N according to the number of data slices in the grouping, thereby improving the horizontal expansion capability of each group of data slices.
  • S5 Verifying all the page heartbeat pre-processing data in each group of data pieces respectively, if the verification is passed, go to S6; if the verification fails, discard the page heartbeat of the failed verification page Preprocess the data and end.
  • the specific process of S5 is: decrypting the identification codes of all the page heartbeat preprocessing data in each group of data pieces to obtain a timestamp and a terminal device ID; determining whether the timestamp is within a reasonable range (ie, the timestamp and the current server) Whether the time difference is within one minute), and the terminal device ID conforms to the specification (the terminal device ID satisfies the generation rule of the identification code as conforming to the specification), and if so, determines that the current page heartbeat pre-processing data is verified, otherwise the current page heartbeat pre-processing is determined. Data verification failed.
  • S6 Update the user ID corresponding to the page heartbeat preprocessing data of all the verifications to the active user set fragment corresponding to the current time (that is, the time when the verification passes), and go to S7.
  • Active user set fragmentation refers to a number of fragments in which an active user set is divided into a specified active computing time period in advance.
  • Timing (the timing period can be set by itself, usually 1 minute) Add the updated active user set fragment to the pre-created time wheel and end.
  • the time wheel in S7 includes a circular data structure buffer loop queue (ie, circular buffer) connected end to end, and the ring data structure buffer loop queue is divided into several unit slots, and each unit slot is filled with one piece.
  • the active user set is fragmented; the circular data structure buffering loop queue is provided with a pointer to the tail unit slot.
  • the S7 specifically includes the following process: defining a clockwise direction in the time roulette from the end of the team to the head of the team, and a counterclockwise direction from the head to the end of the team. After the timeout period, the active user set in the first unit slot of the time roulette is removed, and the active user sets in each of the remaining unit slots are moved clockwise to the next unit slot (at the end of the queue) of The cell slot is empty). The updated active user set fragment in S6 is added to the unit slot at the end of the time roulette, and the pointer is moved clockwise to the next unit slot.
  • the time roulette (active user set) in S7 is exposed to other applications through the Restful interface or RPC interface. Based on this active user set, the users participating in the interactive activity can be guaranteed to be currently active users in a plurality of important scenarios.
  • the time-based roulette and page heartbeat-based active user set maintenance system for implementing the foregoing method in the embodiment of the present invention includes a video heartbeat information generating module located on each terminal device, and a cache pre-location on the server.
  • a processing module a data slice component module located on the server, a number of real-time computing modules located on the server, and an active user set function module located on the server.
  • the video heartbeat information generating module is configured to: generate video heartbeat information according to the live video viewed by the user, where the video heartbeat information includes a plurality of heartbeat information identification identifiers, and the video heartbeat information is submitted to the buffer preprocessing module.
  • the heartbeat information identification identifier includes a user ID and an identification code, and the identification code is a fixed length, and is encrypted after being generated; the generation rule of the identification code is: a timestamp, a terminal device ID used by the user, and a random number.
  • the buffer pre-processing module is configured to: determine, according to the heartbeat information identification identifier, the video heartbeat information that meets the requirements, cache and pre-process the video heartbeat information that meets the requirements, obtain the page heartbeat pre-processing data, and periodically send the data slice to the data slice component module. Composition of the signal.
  • the heartbeat information identification identifier in the video heartbeat information that meets the requirements must meet the following conditions: the user ID is not empty, the user ID matches the data field type, the timestamp format is correct, and the user terminal type identifier is legal.
  • the data slice forming module is configured to: after receiving the data slice forming signal, the page heartbeat preprocessing data is formed into a plurality of data pieces, each piece of data piece includes at least one page heartbeat preprocessing data; and all current cached data pieces are periodically timed according to
  • the hash policy is assigned to each real-time computing module.
  • the specific process is: define the total number of groups as N, and allocate each piece of data. A unique ID number UUID; each UUID and N are modulo-operated, and all data pieces with the same remainder obtained by the modulo operation are the same group.
  • the real-time computing module is configured to: verify all the page heartbeat pre-processing data in the data piece allocated by the data piece forming module, and the specific process is: decrypting the identification code of the page heartbeat pre-processing data in all the allocated data pieces, and obtaining Timestamp and terminal device ID. Determining whether the timestamp is within a reasonable range, and the terminal device ID conforms to the specification.
  • determining that the current page heartbeat pre-processing data verification fails discarding the current page heartbeat pre-processing data; if yes, determining that the current page heartbeat pre-processing data is verified,
  • the user ID corresponding to the page heartbeat pre-processing data of all the verifications is updated to the active user set fragment corresponding to the current time; the active user set fragmentation means that the active user set is divided according to the specified active calculation time period in advance. A number of fragments.
  • the active user set function module is used to: periodically add the updated user set fragment of the real-time calculation module to the pre-created time wheel.
  • the time roulette includes a circular data structure buffering circular queue connected end to end.
  • the circular data structure buffering circular queue is divided into a plurality of unit slots, each unit slot is filled with an active user set fragmentation; the ring data structure buffering loop queue is set. There is a pointer to the slot unit slot.
  • the active user set function module is specifically used to: after the timeout period, the active user set in the first unit slot of the time roulette squad is removed, and the active user sets in each of the other unit slots are respectively segmented according to Move clockwise to the next unit slot, clockwise from the end of the team to the head of the team, counterclockwise from the head to the end of the team; add the updated active user set slice of the real-time calculation module to the time roulette team
  • the tail unit slot moves the pointer clockwise to the next unit slot.

Abstract

Disclosed are a method and system for maintaining an active user set based on a time roulette and a page heartbeat, which relate to the technical field of the maintenance of an active user set during live video broadcast. The method involves the steps of: generating video heartbeat information according to a live broadcast video viewed by a user; buffering and pre-processing video heartbeat information meeting a specification to obtain pre-processed page heartbeat data; and updating user IDs, corresponding to all the pre-processed page heartbeat data passing verification, to an active user set fragment corresponding to the current time, and adding the updated active user set fragment to a pre-created time roulette. The present invention can update an active user set by utilizing a time roulette so as to accomplish the timely maintenance of an active user set. Not only is the operation efficiency higher, but a larger load is also not created for the system; moreover, the participation of inactive users can be effectively restricted in certain interactive activities, thereby ensuring that the interactive activities are carried out efficiently.

Description

基于时间轮盘和页面心跳的活跃用户集维护方法及系统Active user set maintenance method and system based on time roulette and page heartbeat 技术领域Technical field
本发明涉及视频直播中活跃用户集的维护技术领域,具体涉及一种基于时间轮盘和页面心跳的活跃用户集维护方法及系统。The present invention relates to the field of maintenance technology for active user sets in live video broadcasts, and in particular, to a method and system for maintaining active user sets based on time roulette and page heartbeat.
背景技术Background technique
随着互联网技术的迅速发展,越来越多的用户可以使用电脑、手机等终端通过网络观看在线视频直播。在线视频直播是指利用互联网网络资源进行的现场视频直播服务,通过现场的视频拍摄同步发布到网络上,用户可以同一时间在网络上看到实时的现场情况。With the rapid development of Internet technology, more and more users can watch online live video broadcasts through the Internet using terminals such as computers and mobile phones. Online live video broadcast refers to live video live broadcast service using Internet network resources. It is simultaneously posted to the network through live video capture. Users can see the real-time situation on the network at the same time.
在视频直播网站的业务场景中,很多直播间主播在发起互动活动或者网站在发起专题活动时,需要只针对观看当前直播间的活跃用户或者在网站上活跃的用户进行互动,这时就需要通过一个活跃用户集来对活跃用户进行实时记录和更新。In the business scene of the live video website, many live broadcast anchors need to only interact with active users who are watching live broadcasts or active users on the website when launching interactive activities or when the website launches a special event. An active set of users to record and update live users in real time.
目前,在视频直播领域中,维护活跃用户集的通常思路为:当服务器连续一段时间内(通常需要自定义该时间,该时间即为超时时长Timeout)没有收到页面心跳事件数据,就把该用户剔除出活跃用户集。具体来说,通常分为以下两种方法:Currently, in the live video field, the general idea of maintaining an active user set is: when the server does not receive the page heartbeat event data for a period of time (usually it needs to customize the time, the timeout is Timeout), The user culls the active user set. Specifically, it is usually divided into the following two methods:
(1)针对每个用户,保存相应的lastReceiveTime(最后收到页面心跳事件数据的时间);然后通过一个定时器,每秒钟遍历一遍所有用户会话,剔除满足以下公式的用户会话:(1) For each user, save the corresponding lastReceiveTime (the time when the page heartbeat event data was last received); then, through a timer, traverse all user sessions every second, and eliminate the user session that satisfies the following formula:
now-lastReceiveTime>Timeout,其中now为当前时间。now-lastReceiveTime>Timeout, where now is the current time.
方法(1)为的缺点为:方法(1)全局只设有一个repeated timer (重复定时器),当用户数量较多时(例如同时保持上万个用户),repeated timer每次遍历所有用户会话的工作量较大,而且耗时较长,工作效率低下。The disadvantage of the method (1) is that the method (1) has only one repeated timer globally. (Repetition timer), when the number of users is large (for example, tens of thousands of users are maintained at the same time), the repeated timer traverses all user sessions each time, and the workload is long and the work efficiency is low.
(2)与方法(1)趋近于相同,区别仅在于方法(2)是为每个用户会话设置一个one-shot timer(一次性定时器),每个one-shot timer在收到相应的页面心跳事件数据的时间时自动更新,每个one-shot timer若发现超时,则剔除对应的用户会话。(2) is similar to method (1), the only difference is that method (2) is to set a one-shot timer for each user session, and each one-shot timer receives the corresponding one. When the time of the page heartbeat event data is automatically updated, if each one-shot timer finds a timeout, the corresponding user session is culled.
方法(2)虽然一定程度上提高了检查的效率,但是依旧存在缺点:即方法(2)需要设置的one-shot timer的数量较多,且one-shot timer的更次频率较快。当用户数量较多时,用户会话的连接数目较大,进而会“待更新计时器队列”造成压力,严重时还会造成系统拥塞甚至崩溃。Although the method (2) improves the efficiency of the check to some extent, there are still disadvantages: the method (2) needs to set a larger number of one-shot timers, and the one-shot timer has a faster frequency. When the number of users is large, the number of connections in the user session is large, which may cause pressure on the "waiting to update the timer queue". In severe cases, the system may be congested or even collapsed.
发明内容Summary of the invention
针对现有技术中存在的缺陷,本发明解决的技术问题为:提供一种基于时间轮盘和页面心跳的活跃用户集维护方法及系统。本发明能够利用时间轮盘对活跃用户集进行更新,完成对活跃用户集的及时维护;不仅工作效率较高,而且不会对系统造成较大负荷,能在某些互动活动中,有效限制非活跃用户的参与,保证互动活动的有效进行。In view of the deficiencies in the prior art, the technical problem solved by the present invention is to provide an active user set maintenance method and system based on time roulette and page heartbeat. The invention can use the time roulette to update the active user set and complete the timely maintenance of the active user set; not only the work efficiency is high, but also does not cause a large load on the system, and can effectively limit the non-active activities in some interactive activities. The participation of active users ensures the effective implementation of interactive activities.
为达到以上目的,本发明提供的基于时间轮盘和页面心跳的活跃用户集维护方法,包括以下步骤:To achieve the above objective, the method for maintaining an active user set based on time roulette and page heartbeat provided by the present invention comprises the following steps:
A、根据用户观看的直播视频生成视频心跳信息,视频心跳信息中包括若干心跳信息识别标识,转到步骤B;A, generating video heartbeat information according to the live video watched by the user, the video heartbeat information includes a plurality of heartbeat information identification identifiers, and proceeds to step B;
B、根据心跳信息识别标识确定符合规定的视频心跳信息,对符合规定的视频心跳信息进行缓存和预处理后,得到页面心跳预处理数据,转到步骤C; B, determining the video heartbeat information according to the specified heartbeat information according to the heartbeat information identification, buffering and pre-processing the video heartbeat information that meets the requirements, and obtaining the page heartbeat pre-processing data, and proceeding to step C;
C、将页面心跳预处理数据组成若干数据片,每片数据片包括至少1条页面心跳预处理数据;定时将当前所有缓存的数据片,按照哈希策略分配为若干组,转到步骤D;C, the page heartbeat pre-processing data is composed into a plurality of data pieces, each piece of data piece includes at least one page heartbeat pre-processing data; periodically all the currently cached pieces of data are allocated into groups according to a hashing policy, and the process proceeds to step D;
D、确定每组数据片中所有验证通过的页面心跳预处理数据;将所有验证通过的页面心跳预处理数据对应的用户ID,更新至与当前时间对应的活跃用户集分片中,转到步骤E;所述活跃用户集分片是指:预先将活跃用户集按照指定的活跃计算时间段划分成的若干分片;D. Determine the page heartbeat pre-processing data of all the verifications in each group of data slices; update the user ID corresponding to the page heartbeat pre-processing data of all the verifications to the active user set fragment corresponding to the current time, and go to the step E; the active user set fragmentation refers to: a plurality of fragments that are divided into active user sets in advance according to a specified active calculation time period;
E、定时将更新后的活跃用户集分片添加至预先创建的时间轮盘中。E. Timing adds the updated active user set fragment to the pre-created time wheel.
本发明提供的实现上述方法的基于时间轮盘和页面心跳的活跃用户集维护系统,该系统包括位于每个终端设备上的视频心跳信息生成模块、位于服务器上的缓存预处理模块、位于服务器上的数据片组成模块、位于服务器上的若干实时计算模块、以及位于服务器上的活跃用户集功能模块;The present invention provides a time-based roulette and page heartbeat-based active user set maintenance system for implementing the above method, the system comprising a video heartbeat information generating module located on each terminal device, a cache pre-processing module located on the server, and located on the server. Data slice component module, several real-time computing modules located on the server, and active user set function modules located on the server;
视频心跳信息生成模块用于:根据用户观看的直播视频生成视频心跳信息,视频心跳信息中包括若干心跳信息识别标识,将视频心跳信息提交至缓存预处理模块;The video heartbeat information generating module is configured to: generate video heartbeat information according to the live video viewed by the user, where the video heartbeat information includes a plurality of heartbeat information identification identifiers, and the video heartbeat information is submitted to the buffer preprocessing module;
缓存预处理模块用于:根据心跳信息识别标识确定符合规定的视频心跳信息;对符合规定的视频心跳信息进行缓存和预处理后,得到页面心跳预处理数据,定时向数据片组成模块发送数据片组成信号;The buffer pre-processing module is configured to: determine, according to the heartbeat information identification identifier, the video heartbeat information that meets the requirements; and after buffering and pre-processing the video heartbeat information that meets the requirements, obtain the page heartbeat pre-processing data, and periodically send the data piece to the data slice component module. Composition signal
数据片组成模块用于:收到数据片组成信号后,将页面心跳预处理数据组成若干数据片,每片数据片包括至少1条页面心跳预处理数据;定时将当前所有缓存的数据片,按照哈希策略分配至每个实时计算模块; The data slice forming module is configured to: after receiving the data slice forming signal, the page heartbeat preprocessing data is formed into a plurality of data pieces, each piece of data piece includes at least one page heartbeat preprocessing data; and all current cached data pieces are periodically timed according to A hashing policy is assigned to each real-time computing module;
实时计算模块用于:对数据片组成模块分配的数据片中的所有页面心跳预处理数据进行验证,确定所有验证通过的页面心跳预处理数据;将所有验证通过的页面心跳预处理数据对应的用户ID,更新至与当前时间对应的活跃用户集分片中;活跃用户集分片是指:预先将活跃用户集按照指定的活跃计算时间段划分成的若干分片;The real-time computing module is configured to: verify all page heartbeat pre-processing data in the data piece allocated by the data piece forming module, determine all the page heartbeat pre-processing data passed by the verification; and all the users corresponding to the page heartbeat pre-processing data passed through the verification The ID is updated to the active user set fragment corresponding to the current time; the active user set fragment refers to: a plurality of fragments into which the active user set is divided into the specified active computing time period in advance;
活跃用户集功能模块用于:定时将实时计算模块更新后的活跃用户集分片添加至预先创建的时间轮盘中。The active user set function module is used to: periodically add the updated user set fragment of the real-time calculation module to the pre-created time wheel.
与现有技术相比,本发明的优点在于:The advantages of the present invention over the prior art are:
(1)本发明根据用户观看的直播视频生成视频心跳信息、并将验证通过的视频心跳信息作为活跃用户更新至对应的活跃用户集分片。有鉴于此,与现有技术相比,本发明并不是采用重复定时器或一次性定时器,而是定期将活跃用户集分片添加到已创建的时间轮盘中,以此利用时间轮盘来对活跃用户集进行更新,完成对活跃用户集的及时维护;不仅工作效率较高,而且不会对系统造成较大负荷,能在某些互动活动中,有效限制非活跃用户的参与,保证互动活动的有效进行。(1) The present invention generates video heartbeat information according to the live video viewed by the user, and updates the video heartbeat information that is verified as an active user to the corresponding active user set fragment. In view of this, compared with the prior art, the present invention does not use a repeating timer or a one-time timer, but periodically adds an active user set fragment to the created time wheel to utilize the time roulette. To update the active user set and complete the timely maintenance of the active user set; not only work efficiency is high, but also does not cause a heavy load on the system, and can effectively limit the participation of inactive users in certain interactive activities, and ensure The interactive activities are carried out effectively.
(2)本发明的活跃用户集分片的划分时间、以及将活跃用户集分片添加至时间轮盘的定时周期,均能够根据具体使用情形自行设置和调整;进而使得活跃用户集分片的数量、活跃用户的统计颗粒度(即可按小时活跃度、分钟活跃度或其他活跃度来统计计算)、以及时间轮盘的维护周期(维护周期与定时周期相同,可按1小时维护、1分钟维护或其他周期来维护)均能够进行对应调整。因此,本发明的灵活性较强,适用性较高。(2) The division time of the active user set fragment of the present invention and the timing period of adding the active user set fragment to the time wheel can be set and adjusted according to the specific use situation; thereby making the active user set fragmented. Quantity, statistical granularity of active users (that is, statistics by hourly activity, minute activity, or other activity), and maintenance schedule of time roulette (maintenance cycle is the same as the timing cycle, can be maintained for 1 hour, 1 Minute maintenance or other cycles to maintain) can be adjusted accordingly. Therefore, the present invention is more flexible and has higher applicability.
(3)本发明的系统包括多个用于处理数据片的实时计算模块,多个实时计算模块能同时处理多个数据片,进一步提高了工作效率实 时性。(3) The system of the present invention includes a plurality of real-time computing modules for processing data pieces, and the plurality of real-time computing modules can simultaneously process a plurality of data pieces, thereby further improving work efficiency. Timeliness.
附图说明DRAWINGS
图1为本发明实施例中基于时间轮盘和页面心跳的活跃用户集维护方法的流程图;1 is a flowchart of a method for maintaining an active user set based on a time roulette and a page heartbeat according to an embodiment of the present invention;
图2为本发明实施例中时间轮盘的结构示意图;2 is a schematic structural diagram of a time wheel in an embodiment of the present invention;
图3为基于时间轮盘和页面心跳的活跃用户集维护系统的结构框图。FIG. 3 is a structural block diagram of an active user set maintenance system based on time roulette and page heartbeat.
具体实施方式detailed description
以下结合附图及实施例对本发明作进一步详细说明。The present invention will be further described in detail below with reference to the accompanying drawings and embodiments.
参见图1所示,本发明实施例中的基于时间轮盘和页面心跳的活跃用户集维护方法,包括以下步骤:Referring to FIG. 1 , a method for maintaining an active user set based on time roulette and page heartbeat in the embodiment of the present invention includes the following steps:
S1:每个用户使用的终端设备,根据用户观看的直播视频生成视频心跳信息,视频心跳信息中包括若干心跳信息识别标识,转到S2。S1: The terminal device used by each user generates video heartbeat information according to the live video viewed by the user, and the video heartbeat information includes a plurality of heartbeat information identification identifiers, and goes to S2.
心跳信息识别标识包括用户ID(即用户唯一性的ID)和识别码。识别码为固定长度,生成后会进行加密;识别码的生成规则为:由时间戳、用户使用的终端设备ID和随机数排列而成,其中用户使用的终端设备ID根据终端设备的API(Application Programming Interface,应用程序编程接口)获取。The heartbeat information identification identifier includes a user ID (ie, an ID of the user uniqueness) and an identification code. The identification code is a fixed length, and is encrypted after being generated. The generation rule of the identification code is: a timestamp, a terminal device ID used by the user, and a random number, wherein the terminal device ID used by the user is based on the API of the terminal device (Application Programming Interface, application programming interface).
S2:根据心跳信息识别标识确定符合规定的视频心跳信息(丢弃不符合规定的视频心跳信息),对符合规定的视频心跳信息进行缓存和预处理后(即统一数据格式),得到页面心跳预处理数据,转到S3。S2: Determine, according to the heartbeat information identification identifier, the video heartbeat information that meets the requirements (discard the video heartbeat information that does not meet the requirements), cache and pre-process the video heartbeat information that meets the requirements (that is, the unified data format), and obtain the page heartbeat preprocessing. Data, go to S3.
S2中符合规定的视频心跳信息中的心跳信息识别标识需要同时满足以下条件:用户ID不为空(为空则不符合规定)、用户ID符合数据字段类型(不符合数据字段类型则不符合规定)、时间戳格式正 确(错误则不符合规定)、用户终端类型标识合法(非法则不符合规定)。The heartbeat information identification identifier in the video heartbeat information that meets the requirements in S2 needs to meet the following conditions: the user ID is not empty (it is not compliant if it is empty), and the user ID conforms to the data field type (the data field type does not meet the requirements) ), the timestamp format is positive Indeed (the error is not in compliance with the regulations), the user terminal type identification is legal (illegal does not meet the requirements).
S2中的页面心跳预处理数据格式为:The page heartbeat preprocessing data format in S2 is:
Figure PCTCN2017080776-appb-000001
Figure PCTCN2017080776-appb-000001
S3:将页面心跳预处理数据组成若干数据片,每片数据片的容量小于等于1MB,每片数据片包括至少1条完整的页面心跳预处理数据,转到S4。S3: The page heartbeat pre-processing data is formed into a plurality of data pieces, each piece of data piece has a capacity of less than or equal to 1 MB, and each piece of data piece includes at least one complete page heartbeat pre-processing data, and is transferred to S4.
S3的具体流程举例如下:当前缓存的页面心跳预处理数据为3条,其大小分别为0.3M、0.4M和0.5M,此时S3的流程为:将0.3M、0.4M的两条预处理数据组成一片数据片,再将0.5M的预处理数据组成另一片数据片,依次类推。The specific process of S3 is as follows: The current cached page heartbeat preprocessing data is 3, and their sizes are 0.3M, 0.4M, and 0.5M respectively. The process of S3 is: preprocessing two presets of 0.3M and 0.4M. The data constitutes a piece of data, and then the 0.5M preprocessed data is formed into another piece of data, and so on.
S4:定时将当前所有缓存的数据片,按照哈希策略分配为至少3组,转到S5。S4的具体流程为:定义若干组的总数量为N,为每片数据片分配一个唯一的ID号UUID,将每个UUID和N进行取模运算(UUID mod N),取模运算得到的余数相同的所有数据片为相同组。S4: Timing all current cached data pieces according to a hash policy to be at least 3 groups, and going to S5. The specific process of S4 is: defining a total number of groups of N, assigning a unique ID number UUID to each piece of data, performing a modulo operation (UUID mod N) for each UUID and N, and obtaining a remainder of the modulo operation All the same pieces of data are in the same group.
S4中对数据片按哈希策略分组的目的在于:分组时可以根据数据片的数量对N进行增减,进而提高后续计算每组数据片的水平扩展能力。The purpose of grouping the data slices according to the hash strategy in S4 is to increase or decrease N according to the number of data slices in the grouping, thereby improving the horizontal expansion capability of each group of data slices.
S5:分别对每组数据片中所有的页面心跳预处理数据进行验证,若验证通过,转到S6;若验证未通过,丢弃验证未通过的页面心跳 预处理数据,结束。S5: Verifying all the page heartbeat pre-processing data in each group of data pieces respectively, if the verification is passed, go to S6; if the verification fails, discard the page heartbeat of the failed verification page Preprocess the data and end.
S5的具体流程为:分别对每组数据片中所有的页面心跳预处理数据的识别码进行解密,得到时间戳和终端设备ID;判断时间戳是否在合理范围内(即时间戳与当前服务器的时差是否在一分钟内)、且终端设备ID符合规范(终端设备ID满足识别码的生成规则视为符合规范),若是,则确定当前页面心跳预处理数据验证通过,否则确定当前页面心跳预处理数据验证未通过。The specific process of S5 is: decrypting the identification codes of all the page heartbeat preprocessing data in each group of data pieces to obtain a timestamp and a terminal device ID; determining whether the timestamp is within a reasonable range (ie, the timestamp and the current server) Whether the time difference is within one minute), and the terminal device ID conforms to the specification (the terminal device ID satisfies the generation rule of the identification code as conforming to the specification), and if so, determines that the current page heartbeat pre-processing data is verified, otherwise the current page heartbeat pre-processing is determined. Data verification failed.
S6:将所有验证通过的页面心跳预处理数据对应的用户ID,更新至与当前时间(即验证通过的时间)对应的活跃用户集分片中,转到S7。活跃用户集分片是指:预先将活跃用户集按照指定的活跃计算时间段划分成的若干分片。S6: Update the user ID corresponding to the page heartbeat preprocessing data of all the verifications to the active user set fragment corresponding to the current time (that is, the time when the verification passes), and go to S7. Active user set fragmentation refers to a number of fragments in which an active user set is divided into a specified active computing time period in advance.
S6中的活跃用户集分片举例如下:若指定的活跃计算时间段为1小时,则活跃用户集对应一天24小时,就有24个相应的活跃用户集分片;若指定的活跃计算时间段为1分钟,则活跃用户集对应一天24*60=1440分钟,就有1440个相应的活跃用户集分片。An example of the active user set fragmentation in S6 is as follows: if the specified active computing time period is 1 hour, the active user set corresponds to 24 hours a day, and there are 24 corresponding active user set fragments; if the specified active computing time period is specified For 1 minute, the active user set corresponds to 24*60=1440 minutes, and there are 1440 corresponding active user set fragments.
S7:定时(定时周期可以自行设置,一般为1分钟)将更新后的活跃用户集分片添加至预先创建的时间轮盘中,结束。S7: Timing (the timing period can be set by itself, usually 1 minute) Add the updated active user set fragment to the pre-created time wheel and end.
参见图2所示,S7中的时间轮盘包括1个首尾相连的环形数据结构缓冲循环队列(即circular buffer),环形数据结构缓冲循环队列分为若干单元槽,每个单元槽中填充有一片活跃用户集分片;环形数据结构缓冲循环队列中设置有1个指向队尾单元槽的指针。Referring to FIG. 2, the time wheel in S7 includes a circular data structure buffer loop queue (ie, circular buffer) connected end to end, and the ring data structure buffer loop queue is divided into several unit slots, and each unit slot is filled with one piece. The active user set is fragmented; the circular data structure buffering loop queue is provided with a pointer to the tail unit slot.
S7具体包括以下流程:定义时间轮盘中的顺时针方向为队尾至队首方向,逆时针方向为队首至队尾方向。定时周期过后,将时间轮盘中队首单元槽内的活跃用户集分片移出,其余每个单元槽内的活跃用户集分片,分别按照顺时针方向移动至下一个单元槽(此时队尾的 单元槽为空)。将S6中更新后的活跃用户集分片添加至时间轮盘队尾的单元槽,将指针按照顺时针方向移动至下一个单元槽。The S7 specifically includes the following process: defining a clockwise direction in the time roulette from the end of the team to the head of the team, and a counterclockwise direction from the head to the end of the team. After the timeout period, the active user set in the first unit slot of the time roulette is removed, and the active user sets in each of the remaining unit slots are moved clockwise to the next unit slot (at the end of the queue) of The cell slot is empty). The updated active user set fragment in S6 is added to the unit slot at the end of the time roulette, and the pointer is moved clockwise to the next unit slot.
S7中的时间轮盘(活跃用户集)会通过Restful接口或者RPC接口形式,暴露给其他应用使用。基于此活跃用户集,可以在多个重要场景中保证参与互动活动的用户均为当前活跃用户。The time roulette (active user set) in S7 is exposed to other applications through the Restful interface or RPC interface. Based on this active user set, the users participating in the interactive activity can be guaranteed to be currently active users in a plurality of important scenarios.
参见图3所示,本发明实施例中的实现上述方法的基于时间轮盘和页面心跳的活跃用户集维护系统,包括位于每个终端设备上的视频心跳信息生成模块、位于服务器上的缓存预处理模块、位于服务器上的数据片组成模块、位于服务器上的若干实时计算模块、以及位于服务器上的活跃用户集功能模块。As shown in FIG. 3, the time-based roulette and page heartbeat-based active user set maintenance system for implementing the foregoing method in the embodiment of the present invention includes a video heartbeat information generating module located on each terminal device, and a cache pre-location on the server. A processing module, a data slice component module located on the server, a number of real-time computing modules located on the server, and an active user set function module located on the server.
视频心跳信息生成模块用于:根据用户观看的直播视频生成视频心跳信息,视频心跳信息中包括若干心跳信息识别标识,将视频心跳信息提交至缓存预处理模块。心跳信息识别标识包括用户ID和识别码,识别码为固定长度,生成后会进行加密;识别码的生成规则为:由时间戳、用户使用的终端设备ID和随机数排列而成。The video heartbeat information generating module is configured to: generate video heartbeat information according to the live video viewed by the user, where the video heartbeat information includes a plurality of heartbeat information identification identifiers, and the video heartbeat information is submitted to the buffer preprocessing module. The heartbeat information identification identifier includes a user ID and an identification code, and the identification code is a fixed length, and is encrypted after being generated; the generation rule of the identification code is: a timestamp, a terminal device ID used by the user, and a random number.
缓存预处理模块用于:根据心跳信息识别标识确定符合规定的视频心跳信息,对符合规定的视频心跳信息进行缓存和预处理后,得到页面心跳预处理数据,定时向数据片组成模块发送数据片组成信号。符合规定的视频心跳信息中的心跳信息识别标识需要同时满足以下条件:用户ID不为空、用户ID符合数据字段类型、时间戳格式正确、用户终端类型标识合法。The buffer pre-processing module is configured to: determine, according to the heartbeat information identification identifier, the video heartbeat information that meets the requirements, cache and pre-process the video heartbeat information that meets the requirements, obtain the page heartbeat pre-processing data, and periodically send the data slice to the data slice component module. Composition of the signal. The heartbeat information identification identifier in the video heartbeat information that meets the requirements must meet the following conditions: the user ID is not empty, the user ID matches the data field type, the timestamp format is correct, and the user terminal type identifier is legal.
数据片组成模块用于:收到数据片组成信号后,将页面心跳预处理数据组成若干数据片,每片数据片包括至少1条页面心跳预处理数据;定时将当前所有缓存的数据片,按照哈希策略分配至每个实时计算模块,具体流程为:定义若干组的总数量为N,为每片数据片分配 一个唯一的ID号UUID;将每个UUID和N进行取模运算,取模运算得到的余数相同的所有数据片为相同组。The data slice forming module is configured to: after receiving the data slice forming signal, the page heartbeat preprocessing data is formed into a plurality of data pieces, each piece of data piece includes at least one page heartbeat preprocessing data; and all current cached data pieces are periodically timed according to The hash policy is assigned to each real-time computing module. The specific process is: define the total number of groups as N, and allocate each piece of data. A unique ID number UUID; each UUID and N are modulo-operated, and all data pieces with the same remainder obtained by the modulo operation are the same group.
实时计算模块用于:对数据片组成模块分配的数据片中的所有页面心跳预处理数据进行验证,具体流程为:对分配的所有数据片中的页面心跳预处理数据的识别码进行解密,得到时间戳和终端设备ID。判断时间戳是否在合理范围内、且终端设备ID符合规范,若不是,确定当前页面心跳预处理数据验证未通过,丢弃当前页面心跳预处理数据;若是,确定当前页面心跳预处理数据验证通过,将所有验证通过的页面心跳预处理数据对应的用户ID,更新至与当前时间对应的活跃用户集分片中;活跃用户集分片是指:预先将活跃用户集按照指定的活跃计算时间段划分成的若干分片。The real-time computing module is configured to: verify all the page heartbeat pre-processing data in the data piece allocated by the data piece forming module, and the specific process is: decrypting the identification code of the page heartbeat pre-processing data in all the allocated data pieces, and obtaining Timestamp and terminal device ID. Determining whether the timestamp is within a reasonable range, and the terminal device ID conforms to the specification. If not, determining that the current page heartbeat pre-processing data verification fails, discarding the current page heartbeat pre-processing data; if yes, determining that the current page heartbeat pre-processing data is verified, The user ID corresponding to the page heartbeat pre-processing data of all the verifications is updated to the active user set fragment corresponding to the current time; the active user set fragmentation means that the active user set is divided according to the specified active calculation time period in advance. A number of fragments.
活跃用户集功能模块用于:定时将实时计算模块更新后的活跃用户集分片添加至预先创建的时间轮盘中。时间轮盘包括1个首尾相连的环形数据结构缓冲循环队列,环形数据结构缓冲循环队列分为若干单元槽,每个单元槽中填充有一片活跃用户集分片;环形数据结构缓冲循环队列中设置有1个指向队尾单元槽的指针。The active user set function module is used to: periodically add the updated user set fragment of the real-time calculation module to the pre-created time wheel. The time roulette includes a circular data structure buffering circular queue connected end to end. The circular data structure buffering circular queue is divided into a plurality of unit slots, each unit slot is filled with an active user set fragmentation; the ring data structure buffering loop queue is set. There is a pointer to the slot unit slot.
在此基础上,活跃用户集功能模块具体用于:定时周期过后,将时间轮盘中队首单元槽内的活跃用户集分片移出,其余每个单元槽内的活跃用户集分片,分别按照顺时针方向移动至下一个单元槽,顺时针方向为队尾至队首方向,逆时针方向为队首至队尾方向;将实时计算模块更新后的活跃用户集分片添加至时间轮盘队尾的单元槽,将指针按照顺时针方向移动至下一个单元槽。On this basis, the active user set function module is specifically used to: after the timeout period, the active user set in the first unit slot of the time roulette squad is removed, and the active user sets in each of the other unit slots are respectively segmented according to Move clockwise to the next unit slot, clockwise from the end of the team to the head of the team, counterclockwise from the head to the end of the team; add the updated active user set slice of the real-time calculation module to the time roulette team The tail unit slot moves the pointer clockwise to the next unit slot.
本发明不局限于上述实施方式,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围之内。本说明书中未作详细 描述的内容属于本领域专业技术人员公知的现有技术。 The present invention is not limited to the above embodiments, and those skilled in the art can also make several improvements and retouchings without departing from the principles of the present invention. These improvements and retouchings are also considered as protection of the present invention. Within the scope. Not detailed in this manual The description is of the prior art known to those skilled in the art.

Claims (10)

  1. 一种基于时间轮盘和页面心跳的活跃用户集维护方法,其特征在于,该方法包括以下步骤:An active user set maintenance method based on time roulette and page heartbeat, characterized in that the method comprises the following steps:
    A、根据用户观看的直播视频生成视频心跳信息,视频心跳信息中包括若干心跳信息识别标识,转到步骤B;A, generating video heartbeat information according to the live video watched by the user, the video heartbeat information includes a plurality of heartbeat information identification identifiers, and proceeds to step B;
    B、根据心跳信息识别标识确定符合规定的视频心跳信息,对符合规定的视频心跳信息进行缓存和预处理后,得到页面心跳预处理数据,转到步骤C;B, determining the video heartbeat information according to the specified heartbeat information according to the heartbeat information identification, buffering and pre-processing the video heartbeat information that meets the requirements, and obtaining the page heartbeat pre-processing data, and proceeding to step C;
    C、将页面心跳预处理数据组成若干数据片,每片数据片包括至少1条页面心跳预处理数据;定时将当前所有缓存的数据片,按照哈希策略分配为若干组,转到步骤D;C, the page heartbeat pre-processing data is composed into a plurality of data pieces, each piece of data piece includes at least one page heartbeat pre-processing data; periodically all the currently cached pieces of data are allocated into groups according to a hashing policy, and the process proceeds to step D;
    D、确定每组数据片中所有验证通过的页面心跳预处理数据;将所有验证通过的页面心跳预处理数据对应的用户ID,更新至与当前时间对应的活跃用户集分片中,转到步骤E;所述活跃用户集分片是指:预先将活跃用户集按照指定的活跃计算时间段划分成的若干分片;D. Determine the page heartbeat pre-processing data of all the verifications in each group of data slices; update the user ID corresponding to the page heartbeat pre-processing data of all the verifications to the active user set fragment corresponding to the current time, and go to the step E; the active user set fragmentation refers to: a plurality of fragments that are divided into active user sets in advance according to a specified active calculation time period;
    E、定时将更新后的活跃用户集分片添加至预先创建的时间轮盘中。E. Timing adds the updated active user set fragment to the pre-created time wheel.
  2. 如权利要求1所述的基于时间轮盘和页面心跳的活跃用户集维护方法,其特征在于:步骤A中所述心跳信息识别标识包括用户ID和识别码,识别码为固定长度,生成后会进行加密;识别码的生成规则为:由时间戳、用户使用的终端设备ID和随机数排列而成;The method for maintaining an active user set based on time roulette and page heartbeat according to claim 1, wherein the heartbeat information identification identifier in step A comprises a user ID and an identification code, and the identification code is a fixed length. Encryption is performed; the generation rule of the identification code is: the time stamp, the terminal device ID used by the user, and the random number are arranged;
    在此基础上,步骤B中所述符合规定的视频心跳信息中的心跳信息识别标识需要同时满足以下条件:用户ID不为空、用户ID符合数据字段类型、时间戳格式正确、用户终端类型标识合法。On the basis of this, the heartbeat information identification identifier in the video heartbeat information that meets the requirements in step B needs to satisfy the following conditions: the user ID is not empty, the user ID conforms to the data field type, the timestamp format is correct, and the user terminal type identifier legitimate.
  3. 如权利要求2所述的基于时间轮盘和页面心跳的活跃用户集 维护方法,其特征在于:步骤D中所述确定每组数据片中所有验证通过的页面心跳预处理数据,具体包括以下流程:分别对每组数据片中所有的页面心跳预处理数据的识别码进行解密,得到时间戳和终端设备ID;判断时间戳是否在合理范围内、且终端设备ID符合规范,若是,确定当前页面心跳预处理数据验证通过,否则确定当前页面心跳预处理数据验证未通过,丢弃当前页面心跳预处理数据。Time-based roulette and page heartbeat based active user set as claimed in claim The maintenance method is characterized in that: determining the page heartbeat pre-processing data of all the verifications in each group of data pieces in the step D, specifically comprising the following process: respectively identifying the identification code of the heartbeat pre-processing data of all the pages in each group of data pieces Decrypting, obtaining a timestamp and a terminal device ID; determining whether the timestamp is within a reasonable range, and the terminal device ID conforms to the specification; if yes, determining that the current page heartbeat preprocessing data is verified, otherwise determining that the current page heartbeat preprocessing data verification fails , discard the current page heartbeat preprocessing data.
  4. 如权利要求1至3任一项所述的基于时间轮盘和页面心跳的活跃用户集维护方法,其特征在于:步骤C中所述将当前所有缓存的数据片,按照哈希策略分配为若干组的具体流程为:定义若干组的总数量为N,为每片数据片分配一个唯一的ID号UUID;将每个UUID和N进行取模运算,取模运算得到的余数相同的所有数据片为相同组。The time roulette and page heartbeat based active user set maintenance method according to any one of claims 1 to 3, wherein in step C, all currently cached data pieces are allocated according to a hash policy. The specific process of the group is as follows: the total number of groups is defined as N, and each piece of data is assigned a unique ID number UUID; each UUID and N are subjected to modulo operation, and all pieces of data with the same remainder are obtained by modulo operation For the same group.
  5. 如权利要求1至3任一项所述的基于时间轮盘和页面心跳的活跃用户集维护方法,其特征在于:步骤E中所述时间轮盘包括1个首尾相连的环形数据结构缓冲循环队列,环形数据结构缓冲循环队列分为若干单元槽,每个单元槽中填充有一片活跃用户集分片;环形数据结构缓冲循环队列中设置有1个指向队尾单元槽的指针;The time-based roulette and page heartbeat-based active user set maintenance method according to any one of claims 1 to 3, wherein the time wheel in step E comprises a ring-shaped data structure buffering circular queue connected end to end. The ring data structure buffering loop queue is divided into a plurality of unit slots, each unit slot is filled with an active user set fragment; and the ring data structure buffering loop queue is provided with a pointer to the tail unit slot;
    在此基础上,步骤E具体包括以下流程:定义时间轮盘中的顺时针方向为队尾至队首方向,逆时针方向为队首至队尾方向;定时周期过后,将时间轮盘中队首单元槽内的活跃用户集分片移出,其余每个单元槽内的活跃用户集分片,分别按照顺时针方向移动至下一个单元槽;将步骤D中更新后的活跃用户集分片添加至时间轮盘队尾的单元槽,将指针按照顺时针方向移动至下一个单元槽。On this basis, step E specifically includes the following process: defining a clockwise direction in the time roulette from the end of the team to the head of the team, and a counterclockwise direction from the head to the end of the team; after the timeout period, the first of the time roulette squadrons The active user set fragments in the unit slot are removed, and the active user set fragments in each of the remaining unit slots are moved clockwise to the next unit slot; the updated active user set fragments in step D are added to The unit slot at the end of the time roulette moves the pointer clockwise to the next unit slot.
  6. 一种实现权利要求1至5任一项所述方法的基于时间轮盘和页面心跳的活跃用户集维护系统,其特征在于,该系统包括位于每个 终端设备上的视频心跳信息生成模块、位于服务器上的缓存预处理模块、位于服务器上的数据片组成模块、位于服务器上的若干实时计算模块、以及位于服务器上的活跃用户集功能模块;A time roulette and page heartbeat based active user set maintenance system implementing the method of any one of claims 1 to 5, characterized in that the system comprises a video heartbeat information generating module on the terminal device, a cache preprocessing module located on the server, a data slice forming module located on the server, a plurality of real-time computing modules located on the server, and an active user set function module located on the server;
    视频心跳信息生成模块用于:根据用户观看的直播视频生成视频心跳信息,视频心跳信息中包括若干心跳信息识别标识,将视频心跳信息提交至缓存预处理模块;The video heartbeat information generating module is configured to: generate video heartbeat information according to the live video viewed by the user, where the video heartbeat information includes a plurality of heartbeat information identification identifiers, and the video heartbeat information is submitted to the buffer preprocessing module;
    缓存预处理模块用于:根据心跳信息识别标识确定符合规定的视频心跳信息,对符合规定的视频心跳信息进行缓存和预处理后,得到页面心跳预处理数据,定时向数据片组成模块发送数据片组成信号;The buffer pre-processing module is configured to: determine, according to the heartbeat information identification identifier, the video heartbeat information that meets the requirements, cache and pre-process the video heartbeat information that meets the requirements, obtain the page heartbeat pre-processing data, and periodically send the data slice to the data slice component module. Composition signal
    数据片组成模块用于:收到数据片组成信号后,将页面心跳预处理数据组成若干数据片,每片数据片包括至少1条页面心跳预处理数据;定时将当前所有缓存的数据片,按照哈希策略分配至每个实时计算模块;The data slice forming module is configured to: after receiving the data slice forming signal, the page heartbeat preprocessing data is formed into a plurality of data pieces, each piece of data piece includes at least one page heartbeat preprocessing data; and all current cached data pieces are periodically timed according to A hashing policy is assigned to each real-time computing module;
    实时计算模块用于:对数据片组成模块分配的数据片中的所有页面心跳预处理数据进行验证,确定所有验证通过的页面心跳预处理数据;将所有验证通过的页面心跳预处理数据对应的用户ID,更新至与当前时间对应的活跃用户集分片中;活跃用户集分片是指:预先将活跃用户集按照指定的活跃计算时间段划分成的若干分片;The real-time computing module is configured to: verify all page heartbeat pre-processing data in the data piece allocated by the data piece forming module, determine all the page heartbeat pre-processing data passed by the verification; and all the users corresponding to the page heartbeat pre-processing data passed through the verification The ID is updated to the active user set fragment corresponding to the current time; the active user set fragment refers to: a plurality of fragments into which the active user set is divided into the specified active computing time period in advance;
    活跃用户集功能模块用于:定时将实时计算模块更新后的活跃用户集分片添加至预先创建的时间轮盘中。The active user set function module is used to: periodically add the updated user set fragment of the real-time calculation module to the pre-created time wheel.
  7. 如权利要求6所述的基于时间轮盘和页面心跳的活跃用户集维护系统,其特征在于:所述视频心跳信息生成模块得到的视频心跳信息中的心跳信息识别标识包括用户ID和识别码,识别码为固定长度,生成后会进行加密;识别码的生成规则为:由时间戳、用户使用的终端设备ID和随机数排列而成; The time-based roulette and page heartbeat-based active user set maintenance system according to claim 6, wherein the heartbeat information identification identifier in the video heartbeat information obtained by the video heartbeat information generating module includes a user ID and an identification code. The identification code is a fixed length, and is encrypted after being generated; the generation rule of the identification code is: a timestamp, a terminal device ID used by the user, and a random number;
    在此基础上,所述缓存预处理模块确定的符合规定的视频心跳信息中的心跳信息识别标识需要同时满足以下条件:用户ID不为空、用户ID符合数据字段类型、时间戳格式正确、用户终端类型标识合法。On the basis of the above, the heartbeat information identification identifier in the compliant video heartbeat information determined by the buffer pre-processing module needs to satisfy the following conditions: the user ID is not empty, the user ID conforms to the data field type, the timestamp format is correct, and the user The terminal type identifier is legal.
  8. 如权利要求7所述的基于时间轮盘和页面心跳的活跃用户集维护系统,其特征在于:所述实时计算模块对数据片组成模块分配的数据片中的所有页面心跳预处理数据进行验证时的具体流程为:对分配的所有数据片中的页面心跳预处理数据的识别码进行解密,得到时间戳和终端设备ID,判断时间戳是否在合理范围内、且终端设备ID符合规范,若是,确定当前页面心跳预处理数据验证通过,否则确定当前页面心跳预处理数据验证未通过,丢弃当前页面心跳预处理数据。The time-based roulette and page heartbeat-based active user set maintenance system according to claim 7, wherein the real-time computing module verifies all page heartbeat pre-processing data in the data slice allocated by the data piece composition module. The specific process is: decrypting the identification code of the page heartbeat preprocessing data in all the allocated data pieces, obtaining the timestamp and the terminal device ID, determining whether the timestamp is within a reasonable range, and the terminal device ID conforms to the specification, and if so, It is determined that the current page heartbeat pre-processing data is verified, otherwise it is determined that the current page heartbeat pre-processing data verification fails, and the current page heartbeat pre-processing data is discarded.
  9. 如权利要求6至8所述的基于时间轮盘和页面心跳的活跃用户集维护系统,其特征在于:所述数据片组成模块将当前所有缓存的数据片,按照哈希策略分配为若干组的具体流程为:定义若干组的总数量为N,为每片数据片分配一个唯一的ID号UUID;将每个UUID和N进行取模运算,取模运算得到的余数相同的所有数据片为相同组。The time-based roulette and page heartbeat-based active user set maintenance system according to any one of claims 6 to 8, wherein the data slice component module allocates all currently cached data pieces into groups according to a hash policy. The specific process is as follows: the total number of groups is defined as N, and each piece of data is assigned a unique ID number UUID; each UUID and N are subjected to modulo operation, and all data pieces with the same remainder obtained by modulo operation are the same. group.
  10. 如权利要求6至8所述的基于时间轮盘和页面心跳的活跃用户集维护系统,其特征在于:所述活跃用户集功能模块中的时间轮盘包括1个首尾相连的环形数据结构缓冲循环队列,环形数据结构缓冲循环队列分为若干单元槽,每个单元槽中填充有一片活跃用户集分片;环形数据结构缓冲循环队列中设置有1个指向队尾单元槽的指针;The time-based roulette and page heartbeat-based active user set maintenance system according to any one of claims 6 to 8, wherein the time roulette in the active user set function module comprises a ring-shaped data structure buffer loop connected end to end. Queue, ring data structure buffer loop queue is divided into several unit slots, each unit slot is filled with an active user set fragment; a circular data structure buffer loop queue is set with a pointer to the tail unit slot;
    在此基础上,活跃用户集功能模块具体用于:定时周期过后,将时间轮盘中队首单元槽内的活跃用户集分片移出,其余每个单元槽内的活跃用户集分片,分别按照顺时针方向移动至下一个单元槽,顺时 针方向为队尾至队首方向,逆时针方向为队首至队尾方向;将实时计算模块更新后的活跃用户集分片添加至时间轮盘队尾的单元槽,将指针按照顺时针方向移动至下一个单元槽。 On this basis, the active user set function module is specifically used to: after the timeout period, the active user set in the first unit slot of the time roulette squad is removed, and the active user sets in each of the other unit slots are respectively segmented according to Move clockwise to the next unit slot, in time The direction of the needle is from the end of the team to the head of the team, and the counterclockwise direction is from the head to the end of the team; the active user set fragment updated by the real-time calculation module is added to the unit slot at the end of the time roulette, and the pointer is clockwise. Move to the next unit slot.
PCT/CN2017/080776 2016-06-24 2017-04-17 Method and system for maintaining active user set based on time roulette and page heartbeat WO2017219740A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610478377.7 2016-06-24
CN201610478377.7A CN106162247B (en) 2016-06-24 2016-06-24 Any active ues collection maintaining method and system based on time wheel disc and page heartbeat

Publications (1)

Publication Number Publication Date
WO2017219740A1 true WO2017219740A1 (en) 2017-12-28

Family

ID=57349390

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/080776 WO2017219740A1 (en) 2016-06-24 2017-04-17 Method and system for maintaining active user set based on time roulette and page heartbeat

Country Status (2)

Country Link
CN (1) CN106162247B (en)
WO (1) WO2017219740A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113127239A (en) * 2019-12-31 2021-07-16 深圳云天励飞技术有限公司 Page state monitoring method, device, terminal and storage medium
CN113949894A (en) * 2021-10-18 2022-01-18 上海哔哩哔哩科技有限公司 Live broadcast related duration recording method and device

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106162247B (en) * 2016-06-24 2019-03-05 武汉斗鱼网络科技有限公司 Any active ues collection maintaining method and system based on time wheel disc and page heartbeat
CN106792209A (en) * 2016-11-24 2017-05-31 武汉斗鱼网络科技有限公司 Video preference information processing method, apparatus and system
CN113365084B (en) * 2021-05-12 2022-06-10 烽火通信科技股份有限公司 Method and device for controlling sending speed by using time wheel
CN113411237B (en) * 2021-08-18 2021-11-30 成都丰硕智能数字科技有限公司 Method, storage medium and system for detecting terminal state with low delay
CN115270036B (en) * 2022-07-27 2024-01-30 北京道达天际科技股份有限公司 Webpage browsing duration calculation method based on liveness continuous time service

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103051635A (en) * 2012-12-28 2013-04-17 宁波新然电子信息科技发展有限公司 Method of communication between streaming media server and terminal
CN103348758A (en) * 2010-11-15 2013-10-09 捷讯研究有限公司 Managing wireless communication
CN105979299A (en) * 2016-06-24 2016-09-28 武汉斗鱼网络科技有限公司 Active user set maintenance system and method based on time wheel and player heartbeat
CN106162247A (en) * 2016-06-24 2016-11-23 武汉斗鱼网络科技有限公司 Any active ues collection maintaining method based on time wheel disc and page heart beating and system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003150716A (en) * 2001-11-12 2003-05-23 Allied Tereshisu Kk Sport information monitoring system using radio-relay system, radio-relay system for sport information monitoring system, and individual information obtaining device for sport information monitoring system
CN102158740A (en) * 2011-03-22 2011-08-17 北京九华互联科技有限公司 Method for locally monitoring multimedia playing
CN104639436B (en) * 2013-11-07 2018-06-22 中兴通讯股份有限公司 Remaining life span ageing method and device
CN103778254B (en) * 2014-02-24 2017-08-01 北京国双科技有限公司 The processing method of page access data, apparatus and system
CN105681872B (en) * 2016-01-29 2019-03-29 广州酷狗计算机科技有限公司 Information interacting method and device during live streaming

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103348758A (en) * 2010-11-15 2013-10-09 捷讯研究有限公司 Managing wireless communication
CN103051635A (en) * 2012-12-28 2013-04-17 宁波新然电子信息科技发展有限公司 Method of communication between streaming media server and terminal
CN105979299A (en) * 2016-06-24 2016-09-28 武汉斗鱼网络科技有限公司 Active user set maintenance system and method based on time wheel and player heartbeat
CN106162247A (en) * 2016-06-24 2016-11-23 武汉斗鱼网络科技有限公司 Any active ues collection maintaining method based on time wheel disc and page heart beating and system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113127239A (en) * 2019-12-31 2021-07-16 深圳云天励飞技术有限公司 Page state monitoring method, device, terminal and storage medium
CN113949894A (en) * 2021-10-18 2022-01-18 上海哔哩哔哩科技有限公司 Live broadcast related duration recording method and device
CN113949894B (en) * 2021-10-18 2023-06-20 上海哔哩哔哩科技有限公司 Live broadcast related duration recording method and device

Also Published As

Publication number Publication date
CN106162247B (en) 2019-03-05
CN106162247A (en) 2016-11-23

Similar Documents

Publication Publication Date Title
WO2017219740A1 (en) Method and system for maintaining active user set based on time roulette and page heartbeat
US10901905B2 (en) System and method for creating time-accurate event streams
WO2018076760A1 (en) Block chain-based transaction processing method, system, electronic device, and storage medium
CN111625593B (en) Block chain-based data processing method and device and computer equipment
TW202011329A (en) Blockchain-based transaction consensus processing method and apparatus, and electrical device
US20180323974A1 (en) Optimal data storage configuration in a blockchain
CN112685796A (en) Block chain-based block consensus method and related equipment
CN112118315A (en) Data processing system, method, device, electronic equipment and storage medium
CN106162365B (en) Any active ues collection maintaining method and system based on time wheel disc and barrage behavior
CN106210792B (en) Any active ues collection maintaining method and system based on time wheel disc and page behavior
CN105979299B (en) Any active ues collection maintenance system and method based on time wheel disc and player heartbeat
CN113888164A (en) Block chain transaction pool implementation method and device, computer equipment and storage medium
CN116455559A (en) Implementation method and device of soft and hard collaboration high-speed password equipment and electronic equipment
CN114338040A (en) Grouping multi-chain three-time consensus method for block link points
US11803562B2 (en) Method and system for querying streaming data
WO2012155702A1 (en) Method, system, service processing server for updating service key
CN112767151A (en) Transaction processing method and device applied to verification node in block chain
CN111090818B (en) Resource management method, resource management system, server and computer storage medium
CN111866106A (en) Consensus method, consensus device, electronic equipment and readable storage medium
CN114584326B (en) Block chain data processing method and device, electronic equipment and storage medium
CN106060594A (en) White list generation system and white list generation method based on player heartbeat
US20130283293A1 (en) System and method for Intelligently distributing a plurality of transactions for parallel processing
CN113824689A (en) Edge computing network, data transmission method, device, equipment and storage medium
US11290259B2 (en) Data distribution platform
TWI839323B (en) Distributed computing system, writer device, and method of creating an event stream

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: 17814479

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: 17814479

Country of ref document: EP

Kind code of ref document: A1