CN114222153B - Online user quantity counting method and device, electronic equipment and storage medium - Google Patents

Online user quantity counting method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114222153B
CN114222153B CN202111493894.9A CN202111493894A CN114222153B CN 114222153 B CN114222153 B CN 114222153B CN 202111493894 A CN202111493894 A CN 202111493894A CN 114222153 B CN114222153 B CN 114222153B
Authority
CN
China
Prior art keywords
user
server
type
user terminal
online
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111493894.9A
Other languages
Chinese (zh)
Other versions
CN114222153A (en
Inventor
袁在平
薄志浩
许丹仙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202111493894.9A priority Critical patent/CN114222153B/en
Publication of CN114222153A publication Critical patent/CN114222153A/en
Application granted granted Critical
Publication of CN114222153B publication Critical patent/CN114222153B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed
    • 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/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/24Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Computer Graphics (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The disclosure provides an online user quantity counting method, an online user quantity counting device, electronic equipment and a storage medium, and relates to the technical field of Internet, in particular to the live broadcast field. The specific implementation scheme is as follows: acquiring a user side type of a user side connected with a server; and counting the number of current online users connected with the server according to the type of the user terminal. The method and the device can improve the accuracy and the instantaneity of the online user quantity statistics.

Description

Online user quantity counting method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the technical field of internet, in particular to the live broadcast field, and especially relates to an online user quantity counting method, an online user quantity counting device, electronic equipment and a storage medium.
Background
With the development of the internet, more and more service scenes need to be live.
For a host, the number of online people in a live broadcasting room is a key index, and the host needs to know how many people are in the current live broadcasting room in real time, so as to determine some interactions and strategies of the interactions. Meanwhile, the number of people on line in the live broadcasting room is an important index for service research personnel, and is very critical for data statistics, activity operation and the like.
Disclosure of Invention
The disclosure provides an online user quantity counting method, an online user quantity counting device, electronic equipment and a storage medium.
According to an aspect of the present disclosure, there is provided an online user number counting method, including:
acquiring a user side type of a user side connected with a server;
and counting the number of current online users connected with the server according to the type of the user terminal.
According to an aspect of the present disclosure, there is provided an online user number counting apparatus, including:
the client type acquisition module is used for acquiring the client type of the client connected with the server;
and the real-time user quantity counting module is used for counting the current online user quantity connected with the server according to the user terminal type.
According to another aspect of the present disclosure, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the online user quantity counting method of any one embodiment of the present disclosure.
According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the online user quantity counting method of any one of the embodiments of the present disclosure.
According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the online user quantity counting method of any embodiment of the present disclosure.
The method and the device can improve the accuracy and the instantaneity of the online user quantity statistics.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a schematic diagram of an online user quantity counting method provided in accordance with an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of an online user quantity counting method provided in accordance with an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of an online user quantity counting method provided in accordance with an embodiment of the present disclosure;
FIG. 4 is a scenario diagram of an online user quantity statistics method provided according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of an online user quantity counting apparatus provided in accordance with an embodiment of the present disclosure;
fig. 6 is a block diagram of an electronic device for implementing an online user quantity counting method of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a flowchart of an online user number counting method according to an embodiment of the present disclosure, which may be suitable for a case of counting the number of online users connected to a server in real time. The method of the embodiment can be executed by an online user quantity counting device, the device can be realized in a software and/or hardware mode, and the device is specifically configured in an electronic device with a certain data operation capability, wherein the electronic device can be a client device or a server device, and the client device can be a mobile phone, a tablet computer, a vehicle-mounted terminal, a desktop computer and the like.
S101, obtaining the type of the user terminal connected with the server.
The user terminal is connected with the server. The server may provide services to the client. In an exemplary live broadcast scenario, the server provides information of a live broadcast room, a video stream of the live broadcast room, and the like for the user side, and the user side can display an interface of the live broadcast room and play the video stream. In another example, in the communication scenario, the server provides the collected audio and video data for the user terminal, the user terminal may display the audio and video data, or the server provides the message data for the user terminal, and the user terminal may display the message data and feed back the message data. In another example, in the monitoring scene, the server provides the collected monitoring audio and video data for the user terminal, and the user terminal can display the monitoring audio and video data.
The user terminal type is used for determining a connection mode, a data transmission mode and the like between the user terminal and the server. The different connection modes generally have different modes for counting the number of online users. The client type may refer to a classification of the client, and illustratively, the client type may be distinguished from the development architecture, for example, the client type may include a web client type or a client type, and the like. The client side refers to the downloading and installing of the corresponding application program by the electronic equipment. The webpage end can refer to a browser, and the electronic equipment can directly display the webpage of the target content through the browser.
S102, counting the number of current online users connected with the server according to the type of the user terminal.
The current number of online users may refer to the number of real-time online users connected to the server. The data transmission and connection modes of different user terminal types and the server can be different, so that the corresponding statistical mode can be selected according to the user terminal types, the number of online users connected with the server under each user terminal type can be counted respectively, and the current number of online users can be determined. Illustratively, the number of online users under one user side type may be counted through a long connection or a heartbeat packet.
In a specific example, the number of online users under all user end types may be accumulated and determined as the current number of online users. In addition, part of the user terminal types in all the user terminal types can be selected, and the number of online users in at least one user terminal type is accumulated and is determined as the current number of online users.
Existing data statistics for the number of viewers in a live room are typically calculated from the bandwidth generated by pushing and/or pulling live video streams: direct-room viewer = downstream bandwidth/upstream bandwidth. The uplink/downlink is relative to the server, and the downlink refers to pushing the live broadcast picture of the anchor terminal to the server after the anchor starts to broadcast; the uplink refers to that after the audience enters a live broadcast room, the audience terminal pulls the direct broadcast video stream. However, the mode of counting the audience number in the live broadcasting room through the video stream bandwidth can only achieve quasi-real time, at least has minute-level delay, and can only count the approximate audience number, and cannot achieve accurate statistics. For example, when a user frequently enters and exits the live broadcast room, the downlink bandwidth is increased, i.e. the user is counted repeatedly. Errors can be particularly noticeable in large live room scenes.
According to the technical scheme, the user number statistics is carried out by acquiring the user type of the user terminal connected with the server and adopting the corresponding statistics mode, so that the current online user number connected with the server can be accurately counted in real time, and the detection accuracy and the detection instantaneity of the online user number can be improved.
Fig. 2 is a flowchart of another online user quantity counting method disclosed in an embodiment of the present disclosure, which is further optimized and expanded based on the above technical solution, and may be combined with the above various alternative embodiments. And counting the number of current online users connected with the server according to the type of the user terminal, wherein the counting is embodied as follows: acquiring the number of the user terminals connected with the server under the same user terminal type; and counting the number of the user terminals under the user terminal types, and determining the number of the current online users connected with the server.
S201, obtaining the type of the user terminal connected with the server.
S202, the number of the user terminals connected with the server under the same user terminal type is obtained.
Different user terminal types adopt different statistical modes to count the number of the user terminals. The user terminals can be distinguished according to the user terminal types, and the number of online user terminals of the user terminal types can be counted for each user terminal type. By way of example, the client type may include a client type or a web page type, etc. The number of clients connected to the server may be counted for the client type, and the number of web clients connected to the server may be counted for the web client type, and determined as the number of clients.
S203, counting the number of the user terminals under the user terminal types, and determining the current online user number connected with the server.
And determining the current online user quantity according to the user quantity of different user terminal types. The number of the user terminals of all the user terminal types can be accumulated, the total number of the user terminals is determined, and the current online user number is determined by processing. In practice, the number of clients is not equivalent to the number of online users. Illustratively, frequent disconnection of one user may result in a greater number of statistical clients than actual online users. For another example, a user may connect to the server through multiple clients of the client type at the same time, which may also result in a greater number of counted clients than online users. The number of the user terminals can be processed, the number of repeated user terminals is removed, and the number of the current online users is determined.
Optionally, the client type includes a client type; and under the condition of acquiring the same user terminal type, acquiring the number of the user terminals connected with the server, wherein the method comprises the following steps: and acquiring the number of the user terminals establishing long connection with the server.
The long connection means that both connected parties always keep connected. Typically the server establishes a long connection with the client. Through long connection, the client can continuously transmit data with the server. Thus, the client establishing the long connection is always in a real-time online state with respect to the server. In practice, the client end which establishes long connection with the server is the user end used by the online user. The number of clients establishing long connection with the server may be counted and determined as the number of clients connected with the server under the client type.
In addition, the number of the user terminals for establishing the long connection may be updated, for example, in the case where the newly added long connection client terminal is detected, the number of the user terminals for the long connection is updated according to the newly added number, for example, the newly added number is accumulated in the number of the user terminals for connecting with the server; in case of detecting a disconnected long connected client, the number of long connected clients is updated according to the number of disconnects, for example, the number of disconnects is reduced in the number of clients connected to the server.
The number of clients connected to each long connection interface module can be determined through at least one long connection interface module of the server, and the number of clients connected to all long connection interface modules is accumulated to determine the number of clients for establishing long connection for the server. In addition, scene classification can be performed on the user terminals for establishing long connection, and the number of the user terminals with different scene types is counted. Illustratively, in the live broadcast scene, sorting is carried out according to live broadcast rooms, and the number of user ends for watching different live broadcast rooms is counted for different live broadcast rooms respectively; in the monitoring scene, the user terminals can be classified according to different monitoring areas, and the number of the user terminals playing the audio and video of the different monitoring areas is counted according to the different monitoring areas.
In a specific example, the client is a Native App (NA) end. A user watches live broadcasting at the NA end, establishes long connection with a Server (Server), a long connection interface module (access-layer, al) stores a user end list of a live broadcasting room, and an instant messaging module (Instant Messenger, IM) can calculate the total number of audience watched by the NA end in the live broadcasting room by inquiring the number of user ends in each al, determine the total number of audience watched by the NA end as the current number of online users, and then store the number of audience in the live broadcasting room in live broadcasting, for example store the number of audience in a distributed storage system such as references.
The number of the user terminals in the current connection state can be accurately detected aiming at the scene of the user terminal type of establishing long connection with the server by acquiring the number of the user terminals in the long connection with the server and determining the number of the user terminals in the connection with the server under the client terminal type, so that the number of the current online users is determined, the number of real-time online users can be accurately counted aiming at the long connection client terminals, and the detection accuracy of the number of the real-time online users is improved.
Optionally, the counting the number of current online users connected with the server according to the type of the user terminal includes: according to the type of the user terminal, the number of the user terminals connected with the server is obtained; and classifying the live broadcasting rooms on each connected user terminal, and determining the current online user quantity of at least one live broadcasting room.
In the application scene of the live broadcasting room, the number of the user terminals of different live broadcasting rooms under the user terminal type is counted. In general, in an application scenario of a live broadcast room, a live broadcast room where a user terminal is located is identified. Therefore, the user terminals can be classified according to the identification information of the live broadcasting rooms corresponding to the user terminals, and the user terminals corresponding to different live broadcasting rooms can be obtained. The number of the corresponding user terminals can be counted for each live broadcasting room, and accordingly the number of the current online users of each live broadcasting room is determined. The live broadcasting room can be screened, for example, the live broadcasting room of the open broadcasting is screened, the number of the user ends corresponding to the live broadcasting room of the open broadcasting is counted, and the current online user number of the live broadcasting room of the open broadcasting is determined; for another example, screening out the live broadcasting room of the related broadcasting, counting the number of the user ends corresponding to the live broadcasting room of the related broadcasting, and determining the current online user number of the live broadcasting room of the related broadcasting. Whether the live broadcasting room is on or off can be detected according to whether a video stream pushed by a host broadcasting exists in the live broadcasting room.
By aiming at the live broadcast scene, the current online user quantity is counted in a live broadcast room classification mode, the application scene of the real-time online user quantity can be enriched, and the real-time detection performance and accuracy of the online user quantity in the live broadcast scene are improved.
Optionally, the online user quantity counting method further includes: according to the current online user quantity under each user type, determining display data corresponding to each user type; and sending the display data corresponding to the user terminal type to the user terminal of the user terminal type for display.
The number of current online users can be classified according to the type of the user terminal. For example, the number of current online users at the web site may be counted, as well as the number of current online users at the client site. The display data is used for the server to send to the user terminal so that the user terminal can display. Different presentation data can be correspondingly configured according to the number of current online users of different user end types.
The weight of each user terminal type can be determined according to the number of the current online users, the comparison and the comparison result of the number, and the display data corresponding to each user terminal type is determined according to the corresponding relation between the preset weight and the display data. Therefore, different display data can be configured for different user terminals according to the service requirements, the scene requirements and the like and the current number of online users.
The number of the current online users under the user terminal type is obtained, and the display data corresponding to each user terminal type is determined so as to display different display data in different user terminal types, so that the diversity of the display content can be increased, different user terminal types are adapted, the display style and the content are increased, and the richness of content display is improved.
According to the technical scheme, the number of the user terminals of each user terminal type can be counted by respectively counting the number of the user terminals of different user terminal types connected with the server and determining the current online user number according to the number of the user terminals of each user terminal type, so that the user terminal type adaptation mode can be selected, the number of the user terminals of each user terminal type is counted, the number of the user terminals is detected in a targeted manner, the number of the user terminals of the user terminal type is detected accurately, the detection accuracy of the number of the user terminals of different types is improved, the current online user number is determined according to the number of the user terminals of each type, and the accuracy of the user number statistics can be improved.
Fig. 3 is a flowchart of another online user quantity counting method disclosed in an embodiment of the present disclosure, which is further optimized and expanded based on the above technical solution, and may be combined with the above various alternative embodiments. The user terminal type comprises a webpage terminal type; and under the condition that the same user terminal type is obtained, the number of the user terminals connected with the server is specified as follows: and acquiring the user end uploading the heartbeat packet in the current time period, and determining the number of the user ends connected with the server.
S301, obtaining the type of the user terminal connected with the server.
S302, obtaining user ends uploading heartbeat packages in a current time period, and determining the number of the user ends connected with the server, wherein the user end types comprise webpage end types.
The web page end typically does not establish a stable long connection with the server, e.g., the web page end may establish a long connection with the server for some period of time and a short connection with the server for another period of time. Therefore, counting the number of web page ends through long connection can lead to missing counted web page ends, and the counted number of the web page ends is inaccurate.
The heartbeat packet may be referred to as a heartbeat packet because a self-defined command word for notifying the opposite party of its own status is transmitted at regular intervals between the two parties of communication, similarly to the heartbeat. The heartbeat packet is used for the server to detect whether the webpage end is online or not, or whether the connection between the server and the webpage end is valid or not is verified by the server. The server may instruct the web page end to send heartbeat packets in a specified period. The server receives the heartbeat packet, determines that the webpage end for sending the heartbeat packet is effectively connected with the server, namely determines that the webpage end for sending the heartbeat packet is online.
The current time period may refer to a time period in which the server counts the number of current online users. And the current time period is used for counting the number of the current online users by the server. In practice, the webpage end periodically sends heartbeat packets, and the time for sending the heartbeat packets can be different from the webpage end. The server generally determines the web page end corresponding to the heartbeat packet received in a time period as the web page end connected with the server in the time period and is used as the web page end effectively connected in the time period, so that the number of current online users of the time period and the server under the web page end type can be determined. For example, the current time period may be a time obtained by subtracting a preset time period from the current time, and the determined time period is, for example, 10 seconds. And aiming at the heartbeat packet received by the server at the time before the obtained time, the server determines that the webpage end corresponding to the heartbeat packet does not belong to the statistical range of the current online user quantity.
In addition, the user switches to a page which is not served by the server for browsing at the webpage end, at this time, the webpage end and the server are not effectively connected, and the webpage end cannot be used as a connected user end for counting the quantity. The method can be configured in a webpage end, and the webpage end periodically generates a heartbeat package and sends the server under the condition that the webpage for providing the service by the server is detected to be in an activated state. The page processing activation state may be that the page is set on top, or that the page is in the running process.
Optionally, the repeated entry and exit of the user into and from the live broadcast room can lead to the repeated uploading of the heartbeat packet by the webpage end in the current time period, and the server needs to de-duplicate the counted number of the user ends according to the user identification information or the user end identification information, so that the detection accuracy of the number is improved. In addition, the user identification information and the user side identification information are recorded, and the identification information needs to be encoded so as to encrypt the user information and protect the privacy of the user.
In one specific example, the web page is a personal computer (Personal Computer, PC). When the user watches live broadcast at the PC end, the PC end can poll every 30s to send heartbeat to the Server end for reporting. Polling is stopped when the user is out of focus to access the page (switches to the background, other browser window or closes the page, etc.). The Server side inquires whether the live broadcasting room is opened or not, and under the condition that the live broadcasting is not opened, statistics is not carried out; under the condition of open broadcasting, the Server end determines the number of the webpage ends according to the reported heartbeat package, and performs duplication elimination according to the user identification information of the webpage ends, and determines the current online user number under the webpage end type, namely the audience number of the live broadcasting room. The number of live house viewers in the live is then stored, for example in a distributed storage system, tracks.
S303, counting the number of the user terminals under each user terminal type, and determining the current online user number connected with the server.
Optionally, the online user quantity counting method further includes: receiving a heartbeat packet uploaded by a user side and correspondingly storing uploading time; and deleting the user end with the uploading time outside the current time period and the corresponding uploading time.
The uploading time is the time when the server receives the heartbeat packet. The uploading time is used for detecting whether the heartbeat packet belongs to the current time period, namely, whether the webpage end for sending the heartbeat packet is used as the statistical range of the current online user quantity. In practice, the webpage end corresponding to the heartbeat packet with the uploading time in the current time period is used as the user end connected with the server to count the number. And the webpage end corresponding to the heartbeat packet with the uploading time outside the current time period is not used as the user end connected with the server to count the number. The user end which is not used as the user end connected with the server for counting the number and the corresponding uploading time can be deleted, the data redundancy is reduced, and the storage resource is released.
Before the heartbeat packet, the uploading time and the identification information of the user side are correspondingly stored, duplication removal can be performed, repeated data storage is avoided, repeated statistics of the number is caused, and the detection accuracy of the number is improved.
For example, the server sets the current time period to the current time, and the time period determined 30 seconds before. I.e. the server counts the number of web page ends connected once every 30 seconds. And correspondingly storing the heartbeat package, the identification information of the webpage end and the current time stamp (namely uploading time). And deleting the heartbeat packet, the identification information of the webpage end and the current timestamp stored before 30 seconds. The server does not keep the information stored in the historical time period, so that the server can determine the number of the web page terminals connected with the server in the current time period by only counting the number of the stored identification information of the web page terminals each time.
For example, the heartbeat packet, the identification information of the web page end and the current timestamp can be sequentially stored according to the uploading time, the minimum time endpoint of the current time period is determined, all the heartbeat packets before the minimum time endpoint, the identification information of the web page end and the current timestamp are deleted, and the deletion efficiency is improved.
By recording the uploading time of the heartbeat packet when the webpage end is received and uploaded to the heartbeat packet, the heartbeat packet in the current time period can be accurately screened, so that the webpage end connected with the server in the current time period can be accurately counted, the detection accuracy of the number of user segments is improved, the user end with the uploading time outside the current time period and the corresponding uploading time are deleted, the data associated with the user end which is not used as the user end connected with the server for counting the number can be deleted, the stored data can be reduced, redundant data is reduced, and storage resources are released.
According to the technical scheme, the number of the webpage ends connected with the server is determined by acquiring the webpage ends and uploading the webpage ends to the heartbeat package, and the number of the user ends in the connection state can be accurately detected according to the scene of the webpage end type, so that the number of the current online users is determined, the number of real-time online users can be accurately counted according to the webpage, and the detection accuracy of the number of the real-time online users is improved.
Fig. 4 is a scene graph of an online user quantity counting method disclosed in accordance with an embodiment of the present disclosure.
In a live broadcast application scene, a viewer can enter a live broadcast room through a client and a webpage end and browse video streams played in the live broadcast room. The server can respectively count the number of online users according to different user terminal types. The client establishes a long connection with the server through the long connection interface module. The server can count the number of clients connected by the long connection interface module through the instant communication module, classify the live broadcasting rooms, and count the number of the clients of each live broadcasting room under the client type, so that the current online user number of each live broadcasting room under the client type is determined. And the webpage end periodically uploads the heartbeat package to the server under the condition that the webpage of the live broadcasting room is detected to be in an activated state. The server inquires whether a live broadcasting room which is accessed by a webpage end of the uploaded heartbeat packet is opened, under the condition of opening, codes and de-duplicates user identification information corresponding to the heartbeat packet, protects user privacy, avoids repeated statistics quantity, and counts the quantity of the user ends under the webpage end type, so that the current online user quantity under the webpage end type is determined. Accumulating the current online user quantity of the live broadcasting room under the client type and the current online user quantity of the webpage type, determining the current online user quantity of the live broadcasting room, and storing the current online user quantity in a storage system.
The client side is the NA side: the user watches live broadcast at NA end, establishes long connection with Server end, al (long connection interface module) stores audience list, IM (instant communication module) can calculate total number of audience in NA end by inquiring number of audience in each al, then obtains list of live broadcast room of open broadcast from storage system, screens out user of live broadcast room of open broadcast, and stores number of screened user into storage system tracks. The live broadcast room that is on the air, i.e., the live broadcast room that is on the air.
Webpage end, namely PC end: when the user watches live broadcast at the PC end, the PC end can poll every 30s to send a heartbeat packet to the Server end for reporting. When the PC side detects that the user is out of focus to access the page (switching to the background, other browser windows or closing the page, and the like), the polling is stopped. The Server side obtains a list of live broadcasting rooms in the live broadcasting from the storage system, and queries the live broadcasting rooms in the list, namely, determines the live broadcasting rooms in the live broadcasting. Discarding the statistics if the live broadcasting room is not in the play list; if the live broadcasting room is in the play list, the live broadcasting room gathers, codes and de-duplicates according to the reported user identification information (Identity Document, ID) in seconds, and is used for filtering repeated calculation scenes caused by repeated refreshing of live broadcasting pages by single users. Each example at the Server end classifies the received heartbeat packets according to the live broadcast room, then writes the heartbeat packets into the Redis ordered set together with the current time stamp, de-duplicated again, and initiates a request to delete the audience written 30s before in the Redis. Therefore, the data cached by the Redis are equivalent to the audience watching by all PC ends in the live broadcasting rooms, and the number of real-time audience can be obtained by only counting the size of the ordered set of each live broadcasting room in the Redis. The code is used for encrypting the user identification information, so that the user identification information is prevented from being stored, the privacy of the user is exposed, and the safety of the user information is improved.
Server end: and acquiring a list of the live broadcasting room in all current broadcasting, storing the list in a storage system, traversing to acquire the number of the current online users counted by the NA end and the number of the current online users counted by the PC end in the Redis, adding the obtained current online users and the obtained current online users, and storing the added current online users and the obtained current online users into the Redis, namely, all audience of the live broadcasting room, namely, all current online users of the live broadcasting room.
According to the embodiment of the disclosure, the second-level real-time people number inquiry can be realized, the counted live broadcasting room online people number is more accurate, repeated calculation scenes caused by frequent entry and exit of a user can be filtered, repeated entry and duplication of the same user are performed on the live broadcasting room, and the like, particularly in a large-scale live broadcasting room scene, when the audience number of the live broadcasting room reaches the 10w level, the audience entry and exit frequency is very high, if the audience number is calculated by using the bandwidth generated by push stream or pull stream, the calculated value is much higher than the real data, significant errors are generated, the live broadcasting room numbers of the webpage end and the client are counted respectively, finer data analysis can be performed, in addition, after each instance of the server encodes and de-duplicates heart-beat report data locally, the heart-beat report data and the current time stamp are uniformly written into an ordered set of Redis, and the audience which is written into the Redis 30s before deletion is requested is initiated, excessive pressure on the Redis cluster can be effectively avoided, wherein the second inquiry rate (QueryPerSecond, QPS) =x2 is large, and the mass load of the system can be ensured.
Fig. 5 is a block diagram of an online user number statistics apparatus in an embodiment of the present disclosure, which is applicable to a case of counting the number of real-time online users connected to a server, according to an embodiment of the present disclosure. The device is realized by software and/or hardware, and is specifically configured in the electronic equipment with certain data operation capability.
An online user quantity counting apparatus 500 as shown in fig. 5, comprising: a user side type acquisition module 501 and a user number real-time statistics module 502; wherein,
a client type obtaining module 501, configured to obtain a client type of a client connected to a server;
and the real-time user number counting module 502 is used for counting the current online user number connected with the server according to the user terminal type.
According to the technical scheme, the user number statistics is carried out by acquiring the user type of the user terminal connected with the server and adopting the corresponding statistics mode, so that the current online user number connected with the server can be accurately counted in real time, and the detection accuracy and the detection instantaneity of the online user number can be improved.
Further, the real-time statistics module 502 for the number of users includes: the connection end quantity counting unit is used for acquiring the quantity of the user ends connected with the server under the same user end type; and the online user quantity counting unit is used for counting the quantity of the user terminals under the user terminal types and determining the current online user quantity connected with the server.
Further, the client type comprises a client type; the connection end quantity counting unit comprises: and the long connection user statistics subunit is used for acquiring the number of the user terminals establishing long connection with the server.
Further, the user terminal type comprises a webpage terminal type; the connection end quantity counting unit comprises: and the heartbeat packet counting subunit is used for acquiring the user end uploading the heartbeat packet in the current time period and determining the number of the user ends connected with the server.
Further, the online user quantity counting device further includes: the heartbeat packet time determining module is used for receiving the heartbeat packet uploaded by the user terminal and correspondingly storing the uploading time; and the heartbeat package expiration deleting module is used for deleting the user end with the uploading time outside the current time period and the corresponding uploading time.
Further, the real-time statistics module 502 for the number of users includes: the user terminal connection determining unit is used for acquiring the number of the user terminals connected with the server according to the user terminal type; and the live broadcast room classification unit is used for classifying the live broadcast rooms of the connected user terminals and determining the current online user quantity of at least one live broadcast room.
Further, the online user quantity counting device further includes: the user terminal display selection module is used for determining display data corresponding to each user terminal type according to the current online user quantity under each user terminal type; and the display data sending module is used for sending the display data corresponding to the user terminal type to the user terminal of the user terminal type for display.
The online user quantity counting device can execute the online user quantity counting method provided by any embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of executing the online user quantity counting method.
In the technical scheme of the disclosure, the related processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of the personal information of the user accord with the regulations of related laws and regulations, and the public order colloquial is not violated.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
Fig. 6 shows a schematic area diagram of an example electronic device 600 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the apparatus 600 includes a computing unit 601 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 602 or a computer program loaded from a storage unit 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 may also be stored. The computing unit 601, ROM 602, and RAM 603 are connected to each other by a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Various components in the device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, mouse, etc.; an output unit 607 such as various types of displays, speakers, and the like; a storage unit 608, such as a magnetic disk, optical disk, or the like; and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The computing unit 601 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 601 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as an online user number statistics method. For example, in some embodiments, the online user quantity statistics method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM 602 and/or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the online user quantity counting method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the online user number statistics method in any other suitable way (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or region diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel or sequentially or in a different order, provided that the desired results of the technical solutions of the present disclosure are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (12)

1. An online user quantity counting method, comprising:
acquiring a user side type of a user side connected with a server; different user terminal types are different from the data transmission and connection modes of the server;
selecting a corresponding statistical mode according to the user terminal type, and acquiring the number of user terminals connected with the server under the same user terminal type;
according to the user terminal types, counting the number of the user terminals under each user terminal type, and determining the current online user number connected with the server;
And counting the number of current online users connected with the server according to the type of the user terminal, wherein the method comprises the following steps:
according to the type of the user terminal, the number of the user terminals connected with the server is obtained; the user terminal type comprises a client terminal type or a webpage terminal type; the server provides video streams of a live broadcasting room for the user;
and classifying the live broadcasting rooms on each connected user terminal, and determining the current online user quantity of at least one live broadcasting room.
2. The method of claim 1, wherein the client type comprises a client type;
and under the condition of acquiring the same user terminal type, acquiring the number of the user terminals connected with the server, wherein the method comprises the following steps:
and acquiring the number of the user terminals establishing long connection with the server.
3. The method of claim 1, wherein the client type comprises a web page type;
and under the condition of acquiring the same user terminal type, acquiring the number of the user terminals connected with the server, wherein the method comprises the following steps:
and acquiring the user end uploading the heartbeat packet in the current time period, and determining the number of the user ends connected with the server.
4. A method according to claim 3, further comprising:
Receiving a heartbeat packet uploaded by a user side and correspondingly storing uploading time;
and deleting the user end with the uploading time outside the current time period and the corresponding uploading time.
5. The method of claim 1, further comprising:
according to the current online user quantity under each user type, determining display data corresponding to each user type;
and sending the display data corresponding to the user terminal type to the user terminal of the user terminal type for display.
6. An online user quantity counting apparatus, comprising:
the client type acquisition module is used for acquiring the client type of the client connected with the server; different user terminal types are different from the data transmission and connection modes of the server;
the real-time user quantity counting module is used for counting the current online user quantity connected with the server according to the user terminal type;
the real-time statistics module of the user quantity comprises:
the connection end quantity counting unit is used for selecting a corresponding counting mode according to the user end type and obtaining the quantity of the user ends connected with the server under the same user end type;
the online user quantity counting unit is used for counting the quantity of the user terminals under the user terminal types and determining the current online user quantity connected with the server;
The real-time statistics module of the user quantity comprises:
the user terminal connection determining unit is used for acquiring the number of the user terminals connected with the server according to the user terminal type; the user terminal type comprises a client terminal type or a webpage terminal type; the server provides video streams of a live broadcasting room for the user;
and the live broadcast room classification unit is used for classifying the live broadcast rooms of the connected user terminals and determining the current online user quantity of at least one live broadcast room.
7. The apparatus of claim 6, wherein the client type comprises a client type;
the connection end quantity counting unit comprises:
and the long connection user statistics subunit is used for acquiring the number of the user terminals establishing long connection with the server.
8. The apparatus of claim 6, wherein the client type comprises a web page type;
the connection end quantity counting unit comprises:
and the heartbeat packet counting subunit is used for acquiring the user end uploading the heartbeat packet in the current time period and determining the number of the user ends connected with the server.
9. The apparatus of claim 8, further comprising:
The heartbeat packet time determining module is used for receiving the heartbeat packet uploaded by the user terminal and correspondingly storing the uploading time;
and the heartbeat package expiration deleting module is used for deleting the user end with the uploading time outside the current time period and the corresponding uploading time.
10. The apparatus of claim 6, further comprising:
the user terminal display selection module is used for determining display data corresponding to each user terminal type according to the current online user quantity under each user terminal type;
and the display data sending module is used for sending the display data corresponding to the user terminal type to the user terminal of the user terminal type for display.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the online user quantity statistics method of any of claims 1-5.
12. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the online user count method of any of claims 1-5.
CN202111493894.9A 2021-12-08 2021-12-08 Online user quantity counting method and device, electronic equipment and storage medium Active CN114222153B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111493894.9A CN114222153B (en) 2021-12-08 2021-12-08 Online user quantity counting method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111493894.9A CN114222153B (en) 2021-12-08 2021-12-08 Online user quantity counting method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114222153A CN114222153A (en) 2022-03-22
CN114222153B true CN114222153B (en) 2024-03-12

Family

ID=80700346

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111493894.9A Active CN114222153B (en) 2021-12-08 2021-12-08 Online user quantity counting method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114222153B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101394307A (en) * 2008-11-07 2009-03-25 阿里巴巴集团控股有限公司 Method, apparatus and system for on-line user amount statistic
CN105761119A (en) * 2016-03-30 2016-07-13 广州华多网络科技有限公司 On-line number of people distribution calculation method and device
WO2018177404A1 (en) * 2017-03-31 2018-10-04 武汉斗鱼网络科技有限公司 Method and system for updating user count in live broadcast
CN111339495A (en) * 2020-02-18 2020-06-26 北京字节跳动网络技术有限公司 Method and device for counting number of people online in live broadcast room, electronic equipment and storage medium
CN111988198A (en) * 2020-07-31 2020-11-24 中移(杭州)信息技术有限公司 Online user number counting method and device, electronic equipment and computer medium
CN112738547A (en) * 2020-12-31 2021-04-30 杭州当虹科技股份有限公司 System for real-time statistics live online number of people

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9734485B2 (en) * 2014-07-31 2017-08-15 Adobe Systems Incorporated Method and apparatus for providing a contextual timeline of an online interaction for use in assessing effectiveness

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101394307A (en) * 2008-11-07 2009-03-25 阿里巴巴集团控股有限公司 Method, apparatus and system for on-line user amount statistic
CN105761119A (en) * 2016-03-30 2016-07-13 广州华多网络科技有限公司 On-line number of people distribution calculation method and device
WO2018177404A1 (en) * 2017-03-31 2018-10-04 武汉斗鱼网络科技有限公司 Method and system for updating user count in live broadcast
CN111339495A (en) * 2020-02-18 2020-06-26 北京字节跳动网络技术有限公司 Method and device for counting number of people online in live broadcast room, electronic equipment and storage medium
CN111988198A (en) * 2020-07-31 2020-11-24 中移(杭州)信息技术有限公司 Online user number counting method and device, electronic equipment and computer medium
CN112738547A (en) * 2020-12-31 2021-04-30 杭州当虹科技股份有限公司 System for real-time statistics live online number of people

Also Published As

Publication number Publication date
CN114222153A (en) 2022-03-22

Similar Documents

Publication Publication Date Title
US10560350B2 (en) Systems and methods for monitoring globally distributed remote storage devices
JP2022552986A (en) Information transmission method, device, readable storage medium and electronic device
CN111135569A (en) Cloud game processing method and device, storage medium and electronic equipment
US9521178B1 (en) Dynamic bandwidth thresholds
CN106998485B (en) Video live broadcasting method and device
CN113220715B (en) Data processing method, system, computer and readable storage medium
CN109862377B (en) Video transmission method, device, system and computer readable storage medium
US11146606B2 (en) Data buffering method, network device, and storage medium
CN109561320B (en) Server switching method, device, equipment and medium
CN110620699B (en) Message arrival rate determination method, device, equipment and computer readable storage medium
CN111432248A (en) Quality monitoring method and device for live video stream
CN112738538B (en) Live broadcasting room on-hook behavior detection method and device, electronic equipment and computer readable storage medium
WO2022057362A1 (en) Image processing method and apparatus, cloud real machine system, storage medium, and electronic device
CN114189705A (en) Live broadcast card pause processing method and system
CN113490055A (en) Data processing method and device
CN112135119A (en) Method and system for automatically monitoring and alarming network condition in real-time audio and video communication
JP5962117B2 (en) Video selection method in an environment with multiple image compression methods
EP3641222A1 (en) Method, apparatus and system for monitoring data traffic
CN112565016B (en) Positioning method, system and device for abnormal time delay, electronic equipment and storage medium
CN114222153B (en) Online user quantity counting method and device, electronic equipment and storage medium
WO2024066938A1 (en) Livestreaming screenshotting method, apparatus and device, and storage medium
CN109729314A (en) A kind of method for processing video frequency, device, electronic equipment and storage medium
US9437205B2 (en) Method, application, and device for audio signal transmission
CN111314350A (en) Image storage system, storage method, calling system and calling method
CN110798700B (en) Video processing method, video processing device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant