Data processing method and device based on chat room
By determining the number of online users in the chat room and adopting multiple message data processing strategies, the problem of insufficient stability and correctness of message processing in large-scale online number chat rooms is solved, and high stability and real-time message data processing is achieved, improving user experience.
Patent Information
- Application Number
- CN202411575530.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-27
- Publication Date
- 2025-03-18
AI Technical Summary
The stability and correctness of message processing capabilities in chat rooms with large-scale online users are insufficient, which affects the user experience.
By determining the number of current online users in the chat room, responding to the user's message communication instructions, and issuing and/or receiving message data based on preset message data processing strategies and users of different roles. Specific measures include dividing multiple chat rooms and message channels, adopting read diffusion mechanism, long polling, NoCache policy, message list hierarchy and isolating VIP message servers.
It realizes high stability and real-timeness of chat room message data, improves the stability and correctness of message processing in large-scale online chat rooms, and improves user experience.
Smart Images

Figure CN119653186A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer software, and in particular to a chat room-based data processing method and device. Background Art
[0002] With the growth of live broadcast and quasi-live broadcast scenarios, related businesses have an increasing demand for real-time messaging while online, which needs to be accomplished through live broadcast chat rooms.
[0003] When the number of users in a chat room reaches a certain amount, the stability of messages in the chat room cannot be supported and the correctness processing capability is reduced, thus affecting the user experience.
[0004] Currently, no effective solution has been proposed to address the problem of insufficient message processing stability and correctness in chat rooms with a large number of online users in related technologies. Summary of the invention
[0005] The main purpose of the present application is to provide a chat room-based data processing method and device to solve the problem of insufficient message processing stability and correctness in chat rooms with a large number of online users.
[0006] In order to achieve the above objective, according to one aspect of the present application, a chat room-based data processing method is provided.
[0007] The chat room-based data processing method according to the present application includes: determining the number of current online users in the chat room; responding to the message communication instruction of the user who currently initiates the network request; based on the message communication instruction, a preset message data processing strategy of the number of online users, and users of different roles in the chat room, sending and / or receiving message data, the message data is generated when users of different chat roles interact through the chat room, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from users of different roles when there are new messages.
[0008] Furthermore, the method also includes: dividing the chat room into at least a first chat room and a second chat room according to the service access traffic estimation result; obtaining a first chat room message channel and a second chat room message channel according to the first chat room and the second chat room and different preset message isolation channels; sending first message data through the first chat room message channel, wherein the first message data is used to be sent through the specified first chat room message channel; sending second message data through the second chat room message channel, wherein the second message data is used to be sent through the second chat room message channel or the third chat room message channel.
[0009] Further, sending first message data through the first chat room message channel, wherein the first message data is used for sending through the designated first chat room message channel, including: receiving message data in the first chat room through the first chat room message channel; sending second message data through the second chat room message channel, wherein the second message data is used for sending through the second chat room message channel or the third chat room message channel, including: receiving message data in the second chat room and / or the third chat room through the second chat room message channel.
[0010] Furthermore, the message communication instructions in response to the user who currently initiates the network request also include: users with different roles in the chat room include: a first role user, the first role user is used to facilitate transactions in the chat room; receiving new messages written by the first role user and storing message data; based on the subscribers to the first role user, in response to the message communication instructions of the subscribed user who currently initiates the network request, sending the message data.
[0011] Furthermore, based on the message communication instructions, the preset message data processing strategy and the users with different roles in the chat room, the message data is sent and / or received, and the message data is generated when the users with different chat roles interact through the chat room. Each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from the users with different roles when there are new messages, including: receiving a network request from the client for pulling message data; based on a long polling mechanism, if there are no new messages at present, maintaining a long link with the client until a new message is generated; within a preset period, receiving the network request from the client for pulling message data again; based on the message communication instructions with the first role user, the long connection message data processing strategy and the first role user in the chat room, sending the message data to the client, and / or receiving message data.
[0012] Furthermore, based on the message communication instructions, the preset message data processing strategy and the users with different roles in the chat room, the message data is sent and / or received, and the message data is generated when the users with different chat roles interact through the chat room. Each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from the users with different roles when there are new messages, including: when an abnormality occurs in the real-time message in the online state in the chat room, the message data is sent to the client through an asynchronous thread task; based on the abnormal message communication instructions, the NoCache message data processing strategy and the users with different roles in the chat room, the message data is sent to the client at least once, and / or the message data is received.
[0013] Furthermore, based on the message communication instructions, the preset message data processing strategy and the users with different roles in the chat room, the message data is sent and / or received, the message data is generated when the users with different chat roles interact through the chat room, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from the users with different roles when there are new messages, including: marking the messages based on the message communication instructions to distinguish different message lists when the client obtains the message data; according to the preset message priority message data processing strategy in the message list, the message data is sent to the clients of the users with different roles in the chat room, and / or the message data is received.
[0014] Furthermore, based on the message communication instructions, the preset message data processing strategy and the users of different roles in the chat room, the message data is sent and / or received, the message data is generated when the users of different chat roles interact through the chat room, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from the users of different roles when there are new messages, including: deduplicating messages based on the message communication instructions, so as to deduplicate the messages in advance when the client obtains the message data; according to the preset deduplication message data processing strategy, the deduplicated message data is sent to the clients of the users of different roles in the chat room, and / or the message data is received.
[0015] Furthermore, the preset message data processing strategy based on the message communication instruction, the number of online users, and users of different roles in the chat room sends and / or receives message data, the message data is generated when users of different chat roles interact through the chat room, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from users of different roles when there is a new message, including: determining the transaction instruction in the message communication instruction through the application scenario in the chat room, wherein the application scenario includes an auction business; determining the corresponding preset message data processing strategy based on the number of online users; sending and / or receiving message data to the client participating in the auction business based on the message communication instruction, the preset message data processing strategy of the number of online users, and users of different roles in the chat room, wherein the preset message data processing strategy of the number of online users includes at least one of the following: read diffusion mechanism, longpolling strategy, NoCache strategy, message list classification strategy, hyperloglog-based statistics strategy, and VIP message server isolation strategy.
[0016] In order to achieve the above objective, according to another aspect of the present application, a data processing device for a chat room is provided.
[0017] The data processing device for a chat room according to the present application includes: a determination module, used to determine the number of current online users in the chat room; a response module, used to respond to the message communication instruction of the user who currently initiates the network request; a message processing module, used to send and / or receive message data based on the message communication instruction, the preset message data processing strategy of the number of online users, and users of different roles in the chat room, wherein the message data is generated when users of different chat roles interact through the chat room, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from users of different roles when there are new messages.
[0018] In the embodiment of the present application, the data processing method and device based on the chat room adopt a method of determining the number of current online users in the chat room, and by responding to the message communication instruction of the user who currently initiates the network request, the purpose of sending and / or receiving message data based on the message communication instruction, the preset message data processing strategy of the number of online users and users of different roles in the chat room is achieved, thereby achieving the technical effect of high stability and real-time performance of message data based on the chat room, and further solving the technical problem of insufficient message processing stability and correctness processing capability in chat rooms with a large number of online people. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings constituting a part of this application are used to provide a further understanding of this application, so that other features, purposes and advantages of this application become more obvious. The schematic embodiment drawings and their descriptions of this application are used to explain this application and do not constitute an improper limitation on this application. In the drawings:
[0020] Figure 1 is a schematic diagram of the system architecture of a chat room-based data processing method according to an embodiment of the present application;
[0021] Figure 2 is a flow chart of a chat room-based data processing method according to an embodiment of the present application;
[0022] Figure 3 is a structural diagram of a chat room-based data processing device according to an embodiment of the present application;
[0023] Figure 4 It is a flow chart of a chat room-based data processing method according to a preferred embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0026] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0027] like Figure 1As shown, it is a schematic diagram of the system architecture of the chat room-based data processing method according to an embodiment of the present application, which includes a client 100, a business background 200, and a chat room background 300. It can be understood that the business background 200 and the chat room background 300 are on the server side, and are used to respond to the network request of the client 100. The data processing method in the embodiment of the present application is mainly concentrated in the chat room background 300. While receiving and sending the user's chat information data through the chat room background 300, the pressure on the background server is relieved as much as possible.
[0028] like Figure 2 As shown, the method includes the following steps S201 to S203:
[0029] Step S201, determining the number of current online users in the chat room;
[0030] Step S202, responding to a message communication instruction of the user who currently initiates the network request;
[0031] Step S203, based on the message communication instruction, the preset message data processing strategy of the number of online users and the users of different roles in the chat room, send and / or receive message data, the message data is generated when the users of different chat roles interact through the chat room, each of the users enters the chat room through the user terminal, and the preset message data processing strategy is used to obtain message data from the users of different roles when there is a new message.
[0032] In the above step S201, the server side needs to count the number of online users in the current chat room. For different levels of the number of online users, the server side can process the message data in a corresponding manner.
[0033] As an optional implementation, the server may count the number of historical online users.
[0034] As a preferred implementation, the number of online users can be estimated in advance on the server side.
[0035] In the above step S202, the server responds to the message communication instruction of the user who currently initiates the network request. When the user needs to chat in the chat room, the corresponding communication instruction will be sent. When the user has a need to send chat information data, the communication instruction will be sent accordingly.
[0036] As an optional implementation, the communication instruction carries a user ID.
[0037] As a preferred implementation, the communication instructions include but are not limited to: chat information data based on different scenarios.
[0038] In the above step S203, based on the message communication instruction, the preset message data processing strategy of the number of online users, and the users of different roles in the chat room, the server side implements sending and / or receiving message data. The server side responds to the message communication instruction, and at the same time, the book search server side combines the preset message data processing strategy of the number of online users and the users of different roles in the chat room to send message data to users of different roles. And, at the same time, receive the message data sent by users of different roles through the message communication instruction.
[0039] As an optional implementation, the message data is generated when the users with different chat roles interact through the chat room. The scenario in which the users interact through the chat room may be the auction behavior of commodities by users with different roles, such as auctioneers, customers, buyers, etc. These users may chat and conduct auctions through the chat room.
[0040] As a preferred embodiment, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from the users of different roles when there is a new message. Each user can enter the chat room through the user terminal. In addition, it should be noted that the preset message data processing strategy is used to obtain message data from the users of different roles when there is a new message. When a new message is generated, the user of the user terminal can pull the message data.
[0041] From the above description, it can be seen that the present application achieves the following technical effects:
[0042] By adopting a method of determining the number of current online users in the chat room, and responding to the message communication instruction of the user who currently initiates the network request, the purpose of sending and / or receiving message data based on the message communication instruction, the preset message data processing strategy of the number of online users and users of different roles in the chat room is achieved, thereby achieving the technical effect of high stability and real-time performance of message data based on the chat room, and further solving the technical problem of insufficient message processing stability and correctness processing capability in chat rooms with a large number of online users.
[0043] As a preferred embodiment of the present embodiment, it also includes: dividing the chat room into at least a first chat room and a second chat room according to a result of business access traffic estimation; obtaining a first chat room message channel and a second chat room message channel according to the first chat room and the second chat room and different preset message isolation channels; sending first message data through the first chat room message channel, wherein the first message data is used to be sent through the designated first chat room message channel; sending second message data through the second chat room message channel, wherein the second message data is used to be sent through the second chat room message channel or the third chat room message channel.
[0044] If a large number of live broadcast rooms occur, it will bring an explosive amount of requests, so the failure caused by the large number of live broadcast rooms cannot be allowed to affect the majority of small live broadcast rooms. In the specific implementation, according to the estimated results of the business access traffic, for example, obtained through operational estimates or historical data. According to the estimated results of the business access traffic, the chat room is divided into at least a first chat room and a second chat room; according to the first chat room and the second chat room and different preset message isolation channels, the first chat room message channel and the second chat room message channel are obtained; and the first message data is sent through the first chat room message channel, wherein the first message data is used to be sent through the specified first chat room message channel; the second message data is sent through the second chat room message channel, wherein the second message data is used to be sent through the second chat room message channel or the third chat room message channel.
[0045] The first chat room message channel is used to isolate VIP message servers, such as the separation of popular chat rooms and ordinary chat room servers. In response to the difference in occupied resources and the impact of problems, the hardware server and traffic requests are isolated. For example, through business operation prediction, the popular auction is set to the VIP message server, and other message servers cannot be used, reducing the pressure of the system on the server. The second chat room message channel is used as a normal message channel.
[0046] Preferably, the VIP message server is isolated to artificially separate the hot and ordinary auction chat rooms by physical servers, which can effectively prevent the hot and ordinary auction chat room servers from affecting each other when an abnormality occurs.
[0047] As a preference in this embodiment, sending first message data through the first chat room message channel, wherein the first message data is used for sending through the designated first chat room message channel, comprising: receiving message data in the first chat room through the first chat room message channel; sending second message data through the second chat room message channel, wherein the second message data is used for sending through the second chat room message channel or the third chat room message channel, comprising: receiving message data in the second chat room and / or the third chat room through the second chat room message channel.
[0048] In specific implementation, if a large number of live broadcast rooms occur, it will bring an explosive amount of requests, so the failure caused by the large number of live broadcast rooms cannot affect the majority of small live broadcast rooms. In specific implementation, the message data in the first chat room is received through the first chat room message channel; the second message data is sent through the second chat room message channel, wherein the second message data is used to be sent through the second chat room message channel or the third chat room message channel, including: receiving the message data in the second chat room and / or the third chat room through the second chat room message channel.
[0049] As a preference in this embodiment, the message communication instructions in response to the user who currently initiates the network request also include: users with different roles in the chat room include: a first role user, the first role user is used to facilitate transactions in the chat room; receiving new messages written by the first role user and storing message data; based on the subscribers to the first role user, in response to the message communication instructions of the subscribed user who currently initiates the network request, sending the message data.
[0050] The first role user is used to facilitate transactions in the chat room. For example, the first role may be an auctioneer.
[0051] In specific implementation, for the first role user among the users with different roles in the chat room, the background server receives the new message written by the first role user and stores the message data; based on the subscribers to the first role user, in response to the message communication instruction of the subscriber who currently initiates the network request, the message data is sent down. The above method is a read diffusion mechanism, which makes it very convenient to write data and stores a relatively small amount of data.
[0052] As a preference in this embodiment, based on the message communication instructions, the preset message data processing strategy and users of different roles in the chat room, message data is sent and / or received, and the message data is generated when users of different chat roles interact through the chat room. Each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from users of different roles when there are new messages, including: receiving a network request from a client for pulling message data; based on a long polling mechanism, if there are no new messages at present, maintaining a long link with the client until a new message is generated; within a preset period, receiving the network request from the client for pulling message data again; based on the message communication instructions with the first role user, the long connection message data processing strategy and the first role user in the chat room, sending the message data to the client, and / or receiving message data.
[0053] During specific implementation, through the longpolling mechanism, when the client actively sends a request to the server, relevant data can be pulled. When the client initiates a Long Polling request, if the server does not have relevant data at this time, it will hold the request until the server has relevant data, or waits for a certain period of time before returning. After returning, the client will immediately initiate the next Long Polling again. Based on the long polling mechanism, if there is no new message on the server side, a long link is maintained with the client until a new message is generated; within a preset period, the server side receives the network request from the client for pulling message data again; based on the message communication instructions with the first role user, the long connection message data processing strategy and the first role user in the chat room, the message data is sent to the client through the server side, and / or message data is received.
[0054] As a preferred embodiment of the present embodiment, based on the message communication instruction, the preset message data processing strategy and users of different roles in the chat room, the message data is sent and / or received, the message data is generated when the users of different chat roles interact through the chat room, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from users of different roles when there is a new message, including: when an abnormality occurs in the real-time message in the online state in the chat room, the message data is sent to the client through an asynchronous thread task; based on the abnormal message communication instruction, the NoCache message data processing strategy and users of different roles in the chat room, the message data is sent to the client at least once, and / or the message data is received.
[0055] In specific implementation, NoCache means stateless cache. Stateless cache can be implemented including but not limited to real-time notification: write to the list after sending the message, and send notification to the message server cluster. Asynchronous pull: After the message server receives the message notification, it triggers asynchronous thread pull. Bottom polling: When the message server receives a chat room request, it triggers polling to ensure that the chat room has accessed the message list at least once within 1 second. Lock-free reading: Lock-free reading is achieved through read-write table separation and atomic switching. The message can be read smoothly by each client.
[0056] When an exception occurs to a real-time message in the online state in the chat room, the server sends message data to the client through an asynchronous thread task, and at the same time sends message data to the client through an asynchronous thread task; based on the abnormal message communication instruction, the NoCache message data processing strategy and users of different roles in the chat room, the message data is sent to the client at least once.
[0057] As a preference in this embodiment, based on the message communication instruction, the preset message data processing strategy and users of different roles in the chat room, the message data is sent and / or received, the message data is generated when the users of different chat roles interact through the chat room, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from users of different roles when there is a new message, including: marking the message based on the message communication instruction to distinguish different message lists when the client obtains the message data; according to the preset message priority message data processing strategy in the message list, the message data is sent to the client of the user of different roles in the chat room, and / or the message data is received.
[0058] In the specific implementation, a hierarchical design of message lists is adopted. In the case of message explosion, the message server list will only save about 1,000 messages at most. There is a possibility that messages may be overwritten or eliminated before they are received. By marking the messages, they are divided into ordinary and important lists when pulling messages, and important messages are received first, and ordinary messages are received later, so as to avoid the loss of messages.
[0059] The server marks the message based on the message communication instruction to distinguish different message lists when the client obtains message data; according to the preset message priority message data processing strategy in the message list, the message data is sent to the clients of users with different roles in the chat room, and / or message data is received.
[0060] As a preference in this embodiment, based on the message communication instructions, the preset message data processing strategy and users of different roles in the chat room, message data is sent and / or received, the message data is generated when users of different chat roles interact through the chat room, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from users of different roles when there are new messages, including: deduplicating messages based on the message communication instructions, so as to deduplicate messages in advance when the client obtains the message data; according to the preset deduplication message data processing strategy, the deduplicated message data is sent to the clients of users of different roles in the chat room, and / or message data is received.
[0061] In specific implementation, the preset deduplication message data processing strategy is based on the hyperloglog statistical method, which uses a probabilistic algorithm to count the approximate cardinality of the set, that is, the most fundamental source of the algorithm is the Bernoulli process.
[0062] The server side performs deduplication statistics on the messages based on the message communication instructions, so as to perform deduplication on the server side in advance when the client obtains the message data; according to the preset deduplication message data processing strategy, the deduplication message data is sent to the clients of users of different roles in the chat room, and / or the message data is received.
[0063] As a preferred embodiment of the present embodiment, the preset message data processing strategy based on the message communication instruction, the number of online users, and users of different roles in the chat room sends and / or receives message data, the message data is generated when users of different chat roles interact through the chat room, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from users of different roles when there is a new message, including: determining the transaction instruction in the message communication instruction through the application scenario in the chat room, wherein the application scenario includes an auction business; determining the corresponding preset message data processing strategy based on the number of online users; sending and / or receiving message data to the client participating in the auction business based on the message communication instruction, the preset message data processing strategy of the number of online users, and users of different roles in the chat room, wherein the preset message data processing strategy of the number of online users includes at least one of the following: a read diffusion mechanism, a longpolling strategy, a NoCache strategy, a message list classification strategy, a hyperloglog-based statistics strategy, and an isolation VIP message server strategy.
[0064] In a specific implementation, the transaction instruction in the message communication instruction is determined through the application scenario in the chat room, wherein the application scenario includes an auction business.
[0065] Based on the above business scenarios, and according to the characteristics of the chat room, we need to support a high number of online users. Using the read diffusion mechanism is a reasonable way. And adopt other reasonable mechanisms and measures to combine into a reasonable and effective technical architecture solution, which needs to include the read diffusion mechanism, longpolling mechanism, NoCache design, message list classification, hyperloglog-based statistical method, and isolated VIP message server.
[0066] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0067] According to an embodiment of the present application, a data processing device for a chat room for implementing the above method is also provided. Figure 3 As shown, the device comprises:
[0068] Determination module 301, used to determine the number of current online users in the chat room;
[0069] A response module 302 is used to respond to the message communication instruction of the user who currently initiates the network request;
[0070] The message processing module 303 is used to send and / or receive message data based on the message communication instruction, the preset message data processing strategy of the number of online users, and the users of different roles in the chat room. The message data is generated when the users of different chat roles interact through the chat room. Each user enters the chat room through a user terminal. The preset message data processing strategy is used to obtain message data from the users of different roles when there is a new message.
[0071] In the determination module 301 in the embodiment of the present application, the server side needs to count the number of current online users in the current chat room. For different levels of the number of online users, the server side can process the message data in a corresponding manner.
[0072] As an optional implementation, the server may count the number of historical online users.
[0073] As a preferred implementation, the number of online users can be estimated in advance on the server side.
[0074] The response module 302 in the embodiment of the present application responds to the message communication instruction of the user who currently initiates the network request on the server side. When the user side needs to chat through the chat room, the corresponding communication instruction will be sent. When the user side has a need to send chat information data, the communication instruction will be sent accordingly.
[0075] As an optional implementation, the communication instruction carries a user ID.
[0076] As a preferred implementation, the communication instructions include but are not limited to: chat information data based on different scenarios.
[0077] In the message processing module 303 in the embodiment of the present application, based on the message communication instruction, the preset message data processing strategy of the number of online users, and the users of different roles in the chat room, the server side implements sending and / or receiving message data. The server side responds to the message communication instruction, and at the same time, the book search server side combines the preset message data processing strategy of the number of online users and the users of different roles in the chat room to send message data to users of different roles. And, at the same time, receive the message data sent by users of different roles through the message communication instruction.
[0078] As an optional implementation, the message data is generated when the users with different chat roles interact through the chat room. The scenario in which the users interact through the chat room may be the auction behavior of commodities by users with different roles, such as auctioneers, customers, buyers, etc. These users may chat and conduct auctions through the chat room.
[0079] As a preferred embodiment, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from the users of different roles when there is a new message. Each user can enter the chat room through the user terminal. In addition, it should be noted that the preset message data processing strategy is used to obtain message data from the users of different roles when there is a new message. When a new message is generated, the user of the user terminal can pull the message data.
[0080] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the present application is not limited to any specific combination of hardware and software.
[0081] In order to better understand the above-mentioned chat room-based data processing method flow, the above-mentioned technical solution is explained below in conjunction with a preferred embodiment, but it is not used to limit the technical solution of the embodiment of the present invention.
[0082] The chat room-based data processing method in the embodiment of the present application adopts a method of determining the number of current online users in the chat room, and by responding to the message communication instruction of the user who currently initiates the network request, achieves the purpose of sending and / or receiving message data based on the message communication instruction, the preset message data processing strategy of the number of online users, and users of different roles in the chat room, thereby achieving high stability and real-time performance of chat room-based message data.
[0083] like Figure 4 FIG. 1 is a flow chart of a data processing method based on a chat room in an embodiment of the present application. The specific process of the implementation includes the following steps:
[0084] Step S401: according to the service access flow estimation result, the chat room is divided into at least a first chat room and a second chat room.
[0085] Step S402: obtaining a first chat room message channel and a second chat room message channel according to the first chat room, the second chat room and different preset message isolation channels.
[0086] Step S403: sending first message data through the first chat room message channel, wherein the first message data is used to be sent through the designated first chat room message channel.
[0087] Step S404: Send the second message data through the second chat room message channel, wherein the second message data is used to be sent through the second chat room message channel or the third chat room message channel.
[0088] The first chat room message channel is used to isolate VIP message servers, such as the separation of popular chat rooms and ordinary chat room servers. In response to the difference in occupied resources and the impact of problems, the hardware server and traffic requests are isolated. For example, through business operation prediction, the popular auction is set to the VIP message server, and other message servers cannot be used, reducing the pressure of the system on the server. The second chat room message channel or the third chat room message channel is used as an ordinary message channel.
[0089] Preferably, the VIP message server is isolated to artificially separate the hot and ordinary auction chat rooms by physical servers, which can effectively prevent the hot and ordinary auction chat room servers from affecting each other when an abnormality occurs.
[0090] Step S405: receiving message data in the second chat room and / or the third chat room through the second chat room message channel.
[0091] Step S406, determining whether to send the first message data through the first chat room message channel.
[0092] Step S407: receiving message data in the first chat room through the first chat room message channel.
[0093] In specific implementation, if a large number of live broadcast rooms occur, it will bring an explosive amount of requests, so the failure caused by the large number of live broadcast rooms cannot affect the majority of small live broadcast rooms. In specific implementation, the message data in the first chat room is received through the first chat room message channel; the second message data is sent through the second chat room message channel, wherein the second message data is used to be sent through the second chat room message channel or the third chat room message channel, including: receiving the message data in the second chat room and / or the third chat room through the second chat room message channel.
[0094] Step S408: receiving message data in the second chat room and / or the third chat room through the second chat room message channel.
[0095] The server side needs to count the number of online users in the current chat room. For different levels of online user numbers, the server side can process the message data in a corresponding manner.
[0096] Step S409: receiving message data in the second chat room and / or the third chat room through the second chat room message channel.
[0097] The server responds to the message communication instruction of the user who currently initiates the network request. When the user needs to chat through the chat room, the corresponding communication instruction will be sent. When the user has a need to send chat information data, the communication instruction will be sent accordingly.
[0098] Step S410: receiving message data in the second chat room and / or the third chat room through the second chat room message channel.
[0099] Based on the message communication instruction, the preset message data processing strategy of the number of online users, and the users of different roles in the chat room, the server side implements sending and / or receiving message data. The server side responds to the message communication instruction, and at the same time, the book search server side combines the preset message data processing strategy of the number of online users and the users of different roles in the chat room to send message data to users of different roles. And, at the same time, receive the message data sent by users of different roles through the message communication instruction.
[0100] As an optional implementation, the message data is generated when the users with different chat roles interact through the chat room. The scenario in which the users interact through the chat room may be the auction behavior of commodities by users with different roles, such as auctioneers, customers, buyers, etc. These users may chat and conduct auctions through the chat room.
[0101] As a preferred embodiment, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from the users of different roles when there is a new message. Each user can enter the chat room through the user terminal. In addition, it should be noted that the preset message data processing strategy is used to obtain message data from the users of different roles when there is a new message. When a new message is generated, the user of the user terminal can pull the message data.
[0102] The transaction instruction in the message communication instruction is determined through the application scenario in the chat room, wherein the application scenario includes an auction business.
[0103] Based on the above business scenarios, and according to the characteristics of the chat room, the adoption of the read diffusion mechanism is a better and more reasonable way to achieve the goal of supporting a high number of online users. And adopt other reasonable mechanisms and measures to combine into a reasonable and effective technical architecture solution, which needs to include the read diffusion mechanism, longpolling mechanism, NoCache design, message list classification, hyperloglog-based statistical methods, and isolated VIP message servers. The read diffusion mechanism is very convenient for writing data and stores relatively little data.
[0104] The longpolling mechanism is used to pull messages through the client to reduce the pressure on the server and ensure that messages are not lost even when the number of online users is high.
[0105] The NoCache design uses asynchronous message diffusion and in case of abnormal circumstances, a fallback measure will be taken to ensure that the message is pulled at least once.
[0106] Hyperloglog uses probability-based statistical methods to minimize the cost of deduplication and reduce costs from the perspectives of time and space.
[0107] The message list is hierarchical and designed to separate important messages from common messages.
[0108] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A data processing method based on a chat room, characterized in that: include: Determine the number of users currently online in the chat room; Responding to the message communication instruction of the user who currently initiates the network request; Based on the message communication instruction, the preset message data processing strategy of the number of online users and the users with different roles in the chat room, the message data is sent and / or received, wherein the message data is generated when the users with different chat roles interact through the chat room, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from the users with different roles when there is a new message; The sending and / or receiving of message data based on the message communication instruction, the preset message data processing strategy of the number of online users and the users with different roles in the chat room includes: when an abnormality occurs in the real-time message in the online state in the chat room, sending the message data to the client through an asynchronous thread task; based on the abnormal message communication instruction, the NoCache message data processing strategy and the users with different roles in the chat room, sending the message data to the client at least once, and / or receiving the message data.
2. The method according to claim 1, characterized in that Also includes: According to the service access traffic estimation result, the chat room is divided into at least a first chat room and a second chat room; According to the first chat room, the second chat room and different preset message isolation channels, obtaining a first chat room message channel and a second chat room message channel; Sending first message data through the first chat room message channel, wherein the first message data is used to be sent through the designated first chat room message channel; The second message data is sent through the second chat room message channel, wherein the second message data is used to be sent through the second chat room message channel or the third chat room message channel.
3. The method according to claim 2, characterized in that: Sending the first message data through the first chat room message channel, wherein the first message data is used to send through the designated first chat room message channel, comprises: Receiving message data in the first chat room through the first chat room message channel; Sending the second message data through the second chat room message channel, wherein the second message data is used to be sent through the second chat room message channel or the third chat room message channel, comprising: Message data in the second chat room and / or the third chat room is received through the second chat room message channel.
4. The method according to claim 1, characterized in that: The message communication instruction in response to the user who currently initiates the network request also includes: The users with different roles in the chat room include: a first role user, the first role user is used to facilitate transactions in the chat room; Receive a new message written by the first role user and store the message data; Based on the subscribers of the first role user, the message data is sent in response to the message communication instruction of the subscriber who currently initiates the network request.
5. The method according to claim 4, characterized in that The sending and / or receiving of message data based on the message communication instruction, the preset message data processing strategy and the users with different roles in the chat room, wherein the message data is generated when the users with different chat roles interact through the chat room, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from the users with different roles when there is a new message, including: Receive network requests from clients to retrieve message data; Based on the long polling mechanism, if there is no new message at present, a long connection is maintained with the client until a new message is generated; Within a preset period, receiving again a network request from the client for pulling message data; Based on the message communication instruction with the first role user, the long connection message data processing strategy and the first role user in the chat room, the message data is sent to the client and / or the message data is received.
6. The method according to claim 1, characterized in that The NoCache message data processing strategy is used for real-time notification, including: writing into a list after sending the message data, and sending a notification to a message server cluster.
7. The method according to claim 1, characterized in that The NoCache message data processing strategy is also used for asynchronous pulling, including: after the message server receives the message notification, triggering asynchronous thread pulling.
8. The method according to claim 1, characterized in that The NoCache message data processing strategy is also used for bottom-up polling, including: when the message server receives a chat room request, triggering polling to ensure that the chat room has accessed the message list at least once within 1 second.
9. The method according to claim 1, characterized in that: The NoCache message data processing strategy is also used for lock-free reading, including: achieving lock-free reading through read-write table separation and atomic switching, so that the message data can be read by the clients of users with different roles.
10. A data processing device for a chat room, characterized in that: include: A determination module, used to determine the number of current online users in the chat room; A response module, used to respond to the message communication instruction of the user who currently initiates the network request; A message processing module, configured to send and / or receive message data based on the message communication instruction, the preset message data processing strategy for the number of online users, and users of different roles in the chat room, wherein the message data is generated when users of different chat roles interact through the chat room, each of the users enters the chat room through a user terminal, and the preset message data processing strategy is used to obtain message data from users of different roles when there is a new message; The sending and / or receiving of message data based on the message communication instruction, the preset message data processing strategy of the number of online users and the users with different roles in the chat room includes: when an abnormality occurs in the real-time message in the online state in the chat room, sending the message data to the client through an asynchronous thread task; based on the abnormal message communication instruction, the NoCache message data processing strategy and the users with different roles in the chat room, sending the message data to the client at least once, and / or receiving the message data.