Real-time synchronization method, device and electronic device for online relationship between user friends in high-concurrency scenarios

By creating a user friend online center and maintaining the friend status, the problem of time-consuming query of user friend online list in high concurrency scenarios is solved, real-time synchronization and low service pressure are achieved.

CN113256439BActive Publication Date: 2025-04-11WALANWALAN COM
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202110589396.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-28
Publication Date
2025-04-11
Estimated Expiration
2041-05-28

AI Technical Summary

Technical Problem

In high concurrency scenarios, the query and update of user friends' online lists takes a long time, resulting in high service pressure and may even lead to service crash.

Method used

By creating a user friend online center, maintaining the friend status, thereby avoiding direct querying of the friend online list to obtain the online status of all friends, reducing the number of queries and service pressure.

Benefits of technology

Real-time synchronization of online relationships between user friends in high concurrency scenarios is achieved, the query takes short time and service pressure is small, avoiding the risk of service crash.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113256439B_ABST
    Figure CN113256439B_ABST
Patent Text Reader

Abstract

The present application relates to a method, device and electronic device for real-time synchronization of online relationships of user friends in a high-concurrency scenario. The method for real-time synchronization of online relationships of user friends in a high-concurrency scenario includes: creating a user friend online center for the user, the user friend online center having an online list of friends of the user; when the user is online, the user friend online center receives a user online message from the user online center service and performs a user online operation to update the online list of friends; when the user is offline, the user friend online center receives a user offline message from the user online center service and performs a user offline operation to update the online list of friends. In this way, by creating a user friend online center to maintain the friend status, there is no need to directly query the friend online list to obtain the online status of all friends, and the query takes a short time and the service pressure is small.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of user data management, and more specifically, to a method, device and electronic device for real-time synchronization of online relationships between users and friends in a high-concurrency scenario. Background Art

[0002] In social scenarios, when a user comes online, he needs to see the online status of his friends, and his online friends also need to know that the user is online, so that they can chat, make appointments to play, and interact with each other in other scenarios.

[0003] However, currently when querying the online list of a user's friends, the friend service is called first each time to obtain the user's friend list, and then the user's online center service is called to obtain the user's online status. If the user has a large number of friends, each friend needs to be verified once to see if they are online, which takes a long time.

[0004] In addition, when the user refreshes, the user's friend online list needs to be queried every time the user refreshes. If the number of users triggering the query is m, and the average number of friends is n, the number of friend list queries is n, and the number of user online status queries is m*n. The query data volume is too large, which may cause the service to crash and become unavailable.

[0005] Therefore, it is desired to provide a new real-time synchronization solution for user friend online relationships in high-concurrency scenarios. Summary of the invention

[0006] In order to solve the above technical problems, this application is proposed. The embodiments of this application provide a method, device and electronic device for real-time synchronization of user friend online relationships in a high-concurrency scenario, which creates a user friend online center to maintain the friend status, thereby eliminating the need to directly query the friend online list to obtain the online status of all friends, shortening the query time and reducing service pressure.

[0007] According to one aspect of the present application, a method for real-time synchronization of user friend online relationships in a high-concurrency scenario is provided, including: creating a user friend online center for the user, the user friend online center having an online list of the user's friends; when the user is online, the user friend online center receives a user online message from the user online center service and performs a user online operation; when the user is offline, the user friend online center receives a user offline message from the user online center service and performs a user offline operation.

[0008] In the above-mentioned real-time synchronization method of user-friend online relationships in high-concurrency scenarios, it further includes: when a user deletes a friend, the user-friend online center receives a friend deletion message from a friend service and executes a friend deletion operation.

[0009] In the above-mentioned real-time synchronization method of user-friend online relationships in high-concurrency scenarios, it further includes: when a user adds a friend, the user friend online center receives a friend adding message from a friend service and performs a friend adding operation.

[0010] In the above-mentioned real-time synchronization method of user friend online relationships in the high-concurrency scenario, the user online operation includes a friend online list query operation, and the friend online list query operation includes: querying the friend online list by the user friend online center; and, in response to querying the user online list, directly returning the friend online list.

[0011] In the above-mentioned real-time synchronization method of user friend online relationships in the high-concurrency scenario, the friend online list query operation further includes: in response to the user online list not being queried, adding a distributed lock through the user; obtaining the user friend list from the friend service, and querying the user online center through the user friend list to obtain the friend online list; saving the friend online list to the user friend online center; and, releasing the distributed lock and returning the friend online list.

[0012] In the real-time synchronization method of user-friend online relationships in the above-mentioned high-concurrency scenario, when a user goes online, the user-friend online center receives a user online message from a user online center service of a user application and performs a user online operation including: obtaining an online frequency control parameter to determine whether the user is repeatedly online; in response to the user repeatedly going online, not performing a user online operation and maintaining the user's existing status; in response to the user not being online again, obtaining the user's friend online list; and, asynchronously notifying the user's friend online list that the user is online, and modifying the user's status among friends to be online.

[0013] In the real-time synchronization method of user friend online relationships in the above-mentioned high-concurrency scenario, when a user goes offline, the user friend online center receives a user offline message from a user online center service of the user application and performs a user offline operation including: obtaining an offline frequency control parameter to determine whether the user goes offline again; in response to the user repeatedly going offline, not performing the user offline operation and maintaining the user's existing status; and, in response to the user not going offline again, sending a delay message with the same duration as the offline frequency control parameter to the user online center service.

[0014] In the above-mentioned method for real-time synchronization of online relationships of user friends in high-concurrency scenarios, the method further includes: querying the user online center service to verify whether the user has gone offline; in response to the user not being offline, not performing an operation; in response to the user being offline, obtaining the online list of the user's friends; resetting the online frequency control parameter of the user; and asynchronously notifying the online list of the user's friends that the user has gone offline, and modifying the status of the user in the friends to be offline.

[0015] In the real-time synchronization method of user-friend online relationships in the above-mentioned high-concurrency scenario, when a user deletes a friend, the user friend online center receives a friend deletion message from a friend service and performs a friend deletion operation including: deleting each other from the friend online lists of the user and the deleted friend; and, in response to the user being online, asynchronously delaying the deletion of the online status of both friends.

[0016] In the real-time synchronization method of user-friend online relationships in the above-mentioned high-concurrency scenario, when a user adds a friend, the user's friend online center receives a friend adding message from a friend service and performs a friend adding operation including: determining whether the user's friend online list exists; in response to the user's friend online list existing, adding the added person; determining whether the added person's friend online list exists; and, in response to the added person's friend online list existing, adding the user.

[0017] According to another aspect of the present application, a real-time synchronization device for user-friend online relationships in a high-concurrency scenario is provided, comprising: a creation unit, for creating a user-friend online center for the user, the user-friend online center having an online list of the user's friends; an online unit, for receiving a user online message from a user online center service and executing a user online operation when the user is online; and an offline unit, for receiving a user offline message from a user online center service and executing a user offline operation when the user is offline.

[0018] According to another aspect of the present application, an electronic device is provided, including: a processor; and a memory, in which computer program instructions are stored, and when the computer program instructions are executed by the processor, the processor executes the real-time synchronization method for online relationships of users and friends in a high-concurrency scenario as described above.

[0019] According to another aspect of the present application, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a computing device, the method for real-time synchronization of online relationships between users and friends in a high-concurrency scenario as described above is operable.

[0020] The method, device and electronic device for real-time synchronization of user friend online relationships in high-concurrency scenarios provided in the present application can maintain the friend status by creating a user friend online center, without the need to directly query the friend online list to obtain the online status of all friends, resulting in short query time and low service pressure.

[0021] In addition, the method, device and electronic device for real-time synchronization of user-friend online relationships in high-concurrency scenarios provided in the present application can prevent abnormal execution of online and offline logic by controlling the online and offline frequency. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] By reading the detailed description of the preferred specific embodiments below, various other advantages and benefits of the present application will become clear to those of ordinary skill in the art. The drawings in the specification are only used for the purpose of illustrating the preferred embodiments and are not considered to be limitations of the present application. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative work. Moreover, the same reference numerals are used to represent the same components throughout the drawings.

[0023] Figure 1 A flowchart of a method for real-time synchronization of user friend online relationships in a high-concurrency scenario according to an embodiment of the present application;

[0024] Figure 2 This is an application example of the method for real-time synchronization of user friend online relationships in a high-concurrency scenario according to an embodiment of the present application;

[0025] Figure 3 A block diagram of a device for real-time synchronization of user-friend online relationships in a high-concurrency scenario according to an embodiment of the present application;

[0026] Figure 4 is a block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0027] Below, the exemplary embodiments according to the present application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application, and it should be understood that the present application is not limited to the exemplary embodiments described here.

[0028] Exemplary Alignment Detection Methods

[0029] Figure 1 The present invention is a flowchart of a method for real-time synchronization of user friend online relationships in a high-concurrency scenario according to an embodiment of the present application.

[0030] like Figure 1 As shown, according to the method for real-time synchronization of user friend online relationships in a high-concurrency scenario according to an embodiment of the present application, the following steps are included.

[0031] Step S110, creating a user friend online center of the user, wherein the user friend online center has the user's friend online list. That is, in the embodiment of the present application, in order to solve the problem caused by the need to query the friend list and the online status of all friends every time a query is made, a user friend online center is created. In this way, in each query, the user's friend online list can be directly obtained through the user friend online center, and the friend list and the online status of all friends are no longer directly queried, and the online status of friends is maintained through the friend online center.

[0032] Step S120, when the user is online, the user friend online center receives a user online message from the user online center service and performs a user online operation to update the friend online list. Here, the user online center service is used to maintain the user's online status, so that the user can obtain information about whether the user is online from the user online center service, that is, receive a user online message.

[0033] As described above, in the embodiment of the present application, when a user goes online, the user's friend online center queries the friend online list. Specifically, the friend online list query logic of the user's friend online center is as follows:

[0034] 1. Query the online friend list, and return directly if found. That is, if the online friend list of the user already exists, it means that the user is already online, that is, it can be returned directly.

[0035] 2. If the friend online list is not found, the friend online list needs to be initialized. At this time, all query operations of the user are blocked and locked by adding a distributed lock to the user, waiting for the initialization of the friend online list to be completed. At this time, the friend online list can also be queried again to prevent the subsequent logic from being executed repeatedly concurrently.

[0036] 3. Obtain the user's friend list from the friend service. Here, the friend service is used to maintain the friend relationship between users, and query the user online center service through the friend list to obtain the friend online list and save it to the user friend online center.

[0037] 4. Release the distributed lock, end the above query logic and return the friend online list.

[0038] Therefore, in the real-time synchronization method of user friend online relationships in a high-concurrency scenario according to an embodiment of the present application, the user online operation includes a friend online list query operation, and the friend online list query operation includes: the user friend online center queries the friend online list; and, in response to querying the user online list, directly returns the friend online list.

[0039] Furthermore, in the above-mentioned method for real-time synchronization of user friend online relationships in a high-concurrency scenario, the friend online list query operation further includes: in response to not finding the user online list, adding a distributed lock through the user; obtaining the user friend list from the friend service, and querying the user online center through the user friend list to obtain the friend online list; saving the friend online list to the user friend online center; and, releasing the distributed lock and returning the friend online list.

[0040] In addition, in the embodiment of the present application, it is possible to determine whether the user is repeatedly online by obtaining the online frequency control parameter. If the user is repeatedly online in a short period of time, no operation is performed and the user's existing status is maintained. If the user is truly online again, the user's friend online list is obtained through the friend online list query logic as described above, and the friends in the user's friend online list are asynchronously notified that the user is online, thereby modifying the user's status in the friends list to online;

[0041] That is, in the real-time synchronization method of user friend online relationships in a concurrent scenario according to an embodiment of the present application, when a user is online, the user friend online center receives a user online message from a user online center service of a user application and performs a user online operation including: obtaining an online frequency control parameter to determine whether the user is repeatedly online; in response to the user being repeatedly online, not performing the user online operation and maintaining the user's existing status; in response to the user not being online again, obtaining the user's friend online list; and, asynchronously notifying the user's friend online list that the user is online, and modifying the user's status among friends to be online.

[0042] Step S130, when the user is offline, the user friend online center receives the user offline message from the user online center service and performs the user offline operation. Similar to the case where the user is online as described above, the user online center service maintains the user's online status, so that the user offline message can be obtained from the user online center service.

[0043] Furthermore, since the user's online friend list only exists during the user's current online life cycle, the user's online friend list is destroyed after the user goes offline.

[0044] However, in order to avoid the friend online list query logic and abnormal execution of the online and offline logic caused by the user's repeated online and offline operations in a short period of time, for example, due to network fluctuations causing repeated online and offline operations in a short period of time, and the user's active multiple online and offline operations in a short period of time, the user offline logic is also set accordingly in the embodiments of the present application.

[0045] That is, in the embodiment of the present application, it is possible to determine whether the user is repeatedly offline by obtaining the offline frequency control parameter. If the user is repeatedly offline in a short period of time, no operation is performed and the user's existing status is maintained. If the user is truly offline, the user's friends in the online friend list are asynchronously notified that the user is offline, thereby modifying the user's status in the friends list to offline, and destroying the user's online friend list.

[0046] In addition, as described above, even if the user repeatedly goes online and offline in a short period of time, if the user is offline for the first time, in order to avoid the user not really going offline, for example, going online quickly due to a short network interruption, a delay message with the same length as the offline frequency control parameter can be first sent to the user online center service, and the following delayed offline message logic is executed, including:

[0047] 1. Query the online center service of the user to verify whether the user is really offline. If the user is still online, no action will be taken;

[0048] 2. Obtain the online list of the user's friends;

[0049] 3. Reset the online frequency control parameters of the user so that the user can go online again; and this operation can also ensure that the user has not been online for a period of time and can be regarded as truly offline;

[0050] 4. Asynchronously notify the online list of the user's friends that the user has gone offline, and modify the status of the user in the friends list to offline.

[0051] That is, in the real-time synchronization method of user friend online relationships in a high-concurrency scenario according to an embodiment of the present application, when a user goes offline, the user friend online center receives a user offline message from a user online center service of the user application and performs a user offline operation including: obtaining an offline frequency control parameter to determine whether the user goes offline again; in response to the user repeatedly going offline, not performing the user offline operation and maintaining the user's existing status; and, in response to the user not going offline again, sending a delay message with the same duration as the offline frequency control parameter to the user online center service.

[0052] Furthermore, in the above-mentioned method for real-time synchronization of online relationships of users' friends in high-concurrency scenarios, it further includes: querying the user's online center service to verify whether the user has gone offline; in response to the user being online, not performing any operation; in response to the user being offline, obtaining the online list of the user's friends; resetting the user's online frequency control parameters; and asynchronously notifying the user's online list of friends that the user has gone offline, and modifying the status of the user among the friends to be offline.

[0053] In addition, according to the real-time synchronization method of user friend online relationships in a high-concurrency scenario in accordance with an embodiment of the present application, in addition to the user friend online center executing user online operations and user offline operations to query the friend online list and destroy the friend online list, the logic of adding and deleting friends can also be executed.

[0054] That is, in the real-time synchronization method of user-friend online relationships in a high-concurrency scenario according to an embodiment of the present application, it further includes: when a user deletes a friend, the user friend online center receives a friend deletion message from the friend service and performs a friend deletion operation.

[0055] Furthermore, in the real-time synchronization method of user friend online relationships in a high-concurrency scenario according to an embodiment of the present application, it further includes: when a user adds a friend, the user friend online center receives a friend adding message from a friend service and performs a friend adding operation.

[0056] Here, when adding a friend, first determine whether the adding person, that is, the user's friend online list, exists, and if so, add the added person. In addition, the user's friend online center can also determine whether the added person's friend online list exists, and if so, add the adding person, that is, the user.

[0057] Therefore, in the real-time synchronization method of user friend online relationships in a high-concurrency scenario according to an embodiment of the present application, when a user adds a friend, the user friend online center receives a friend adding message from the friend service of the user application and performs a friend adding operation including: determining whether the user's friend online list exists; in response to the existence of the user's friend online list, adding the added person; determining whether the added person's friend online list exists; and, in response to the existence of the added person's friend online list, adding the user.

[0058] In addition, when deleting a friend, the other party is deleted from the online friend list of both parties. However, because deleting a friend will cause concurrent anomalies with going online and offline: if you delete a friend online, in a concurrent situation, after the online operation queries the online friend list, the friend is just deleted, and the processing logic of the online friend list will add the friend again, resulting in the friend still being able to see the other party online in the online friend list. Therefore, it is necessary to add an asynchronous delay to delete the online status of both friends.

[0059] Therefore, in the real-time synchronization method of user friend online relationships in a high-concurrency scenario according to an embodiment of the present application, when a user deletes a friend, the user friend online center receives a friend deletion message from the friend service of the user application and performs a friend deletion operation including: deleting each other from the online friend lists of the user and the deleted friend; and, in response to the user being online, asynchronously delaying the deletion of the online status of both friends.

[0060] Application Examples

[0061] Figure 2 This is an application example of the method for real-time synchronization of online relationships of user friends in a high-concurrency scenario according to an embodiment of the present application. Here, the method for real-time synchronization of online relationships of user friends in a high-concurrency scenario according to an embodiment of the present application is applied to a backend server, which maintains communication with the client through a user service.

[0062] like Figure 2 As shown, the full name of Kafka is Apache Kafka, which is an open source messaging system that can play the role of "filling valleys with peaks" in the system, and can also be used for asynchronous processing of massive data in heterogeneous and distributed systems.

[0063] When a user opens an application, the application service reads the information that the user is using the application, and sends a "user online" message to the user online center service through Kafka. The user's friend online center reads this "user online" message from the user online center service in real time and performs the user online operation as described above.

[0064] When the user no longer uses the application, the user application is closed, and the application service sends a "user offline" message to the user online center service through Kafka, and the user friend online center reads this "user offline" message from the user online center service in real time and performs the user online operation as described above.

[0065] Since Kafka has the advantages of low latency, high performance, and high throughput, the logical processing of friends going online and offline can be made asynchronous through Kafka.

[0066] In addition, in the embodiment of the present application, due to various reasons such as network delays and service freezes, the "user offline" message may arrive before the "user online" message in the online and offline messages transmitted through Kafka, resulting in data anomalies. In addition, since the network conditions of each user are different, users may repeatedly go online and offline in a short period of time due to network problems, greatly increasing the number of Kafka messages and service pressure.

[0067] Therefore, in the embodiment of the present application, the Kafka message can be further screened by the delayed message of RocketMQ. Here, RocketMQ is a distributed message middleware with the advantages of low latency, high reliability, scalability, ease of use, etc., and supports delayed messages.

[0068] In this way, RocketMQ can delay the processing of "user offline" messages to prevent the data confusion mentioned in the first point above. Specifically, when Kafka processes messages, it determines whether it is necessary to send delayed offline messages through the offline frequency control parameters. In addition, through the online and offline frequency control parameters and delayed messages, the repeated messages caused by network jitter in a short period of time can be turned into one online message and one delayed offline message. In this way, the message volume is changed from N to 2, so that it can carry higher concurrent processing capabilities.

[0069] Of course, those skilled in the art will understand that although Kafka and RocketMQ are used as examples in this application example, in the embodiments of the present application, other message mechanisms that can implement the functions of the real-time synchronization method of user friend online relationships in the high concurrency scenario as described above can also be used.

[0070] Exemplary Devices

[0071] Figure 3 The present invention is a block diagram of a device for real-time synchronization of online relationships between users and friends in a high-concurrency scenario according to an embodiment of the present application.

[0072] like Figure 3 As shown, according to the real-time synchronization device 200 of user friend online relationships in a high-concurrency scenario according to an embodiment of the present application, it includes: a creation unit 210, used to create a user friend online center for the user, and the user friend online center has a friend online list; an online unit 220, used to receive a user online message from the user online center service and perform a user online operation when the user is online; and, an offline unit 230, used to receive a user offline message from the user online center service and perform a user offline operation when the user is offline.

[0073] In one example, the user-friend online relationship real-time synchronization device 200 in the above-mentioned high-concurrency scenario further includes: a deletion unit, which is used for receiving a friend deletion message from the friend service and performing a friend deletion operation by the user friend online center when the user deletes a friend.

[0074] In one example, the user-friend online relationship real-time synchronization device 200 in the above-mentioned high-concurrency scenario further includes: an adding unit, which is used for receiving a friend adding message from a friend service and performing a friend adding operation by the user friend online center when a user adds a friend.

[0075] In one example, in the real-time synchronization device 200 for online relationships of users' friends in the above-mentioned high-concurrency scenario, the user online operation includes a friend online list query operation, and the friend online list query operation includes: querying the friend online list by the user friend online center; and, in response to querying the user online list, directly returning the friend online list.

[0076] In one example, in the real-time synchronization device 200 for online relationships of users' friends in the above-mentioned high-concurrency scenario, the online friend list query operation further includes: in response to not finding the online user list, adding a distributed lock through the user; obtaining the user's friend list from the friend service, and querying the user's online center through the user's friend list to obtain the online friend list; saving the online friend list to the user's friend online center; and, releasing the distributed lock and returning the online friend list.

[0077] In one example, in the real-time synchronization device 200 for online relationships between users and friends in the above-mentioned high-concurrency scenario, the online unit 220 is used to: obtain an online frequency control parameter to determine whether the user is repeatedly online; in response to the user repeatedly going online, not perform the user online operation and maintain the user's existing status; in response to the user not coming online again, obtain the user's friend online list; and, asynchronously notify the user's friend online list that the user is online, and modify the user's status among friends to be online.

[0078] In one example, in the real-time synchronization device 200 for online relationships between users and friends in the above-mentioned high-concurrency scenario, the offline unit 230 is used to: obtain an offline frequency control parameter to determine whether the user has gone offline again; in response to the user repeatedly going offline, not executing the user offline operation and maintaining the user's existing status; and, in response to the user not going offline again, sending a delay message with the same duration as the offline frequency control parameter to the user's online center service.

[0079] In one example, in the above-mentioned user-friend online relationship real-time synchronization device 200 in the high-concurrency scenario, the offline unit 230 is further used to: query the user online center service to verify whether the user has been offline; in response to the user not being offline, not perform an operation; in response to the user being offline, obtain the user's friend online list; reset the user's online frequency control parameter; and asynchronously notify the user's friend online list that the user has been offline, and modify the user's status in the friend list to be offline.

[0080] In one example, in the real-time synchronization device 200 for online relationships between users and friends in the above-mentioned high-concurrency scenario, the deletion unit is used to: delete each other from the online friend lists of the user and the deleted friend; and, in response to the user being online, asynchronously and delayedly delete the online status of both friends.

[0081] In one example, in the real-time synchronization device 200 for online relationships of users' friends in the above-mentioned high-concurrency scenario, the adding unit is used to: determine whether the online friend list of the user exists; in response to the existence of the online friend list of the user, add the added person; determine whether the online friend list of the added person exists; and, in response to the existence of the online friend list of the added person, add the user.

[0082] Here, those skilled in the art can understand that the specific functions and operations of the various units and modules in the above-mentioned user friend online relationship real-time synchronization device 200 in the high concurrency scenario have been referred to above. Figure 1 to Figure 2 The real-time synchronization method of user friend online relationships in a high concurrency scenario described in detail is described in detail, and therefore, its repeated description will be omitted.

[0083] As described above, the real-time synchronization device 200 for online relationships of user friends in a high-concurrency scenario according to an embodiment of the present application can be implemented in various terminal devices, such as the server of the operator of a game application or the provider of other social applications. In one example, the real-time synchronization device 200 for online relationships of user friends in a high-concurrency scenario according to an embodiment of the present application can be integrated into the terminal device as a software module and / or a hardware module. For example, the real-time synchronization device 200 for online relationships of user friends in a high-concurrency scenario can be a software module in the operating system of the terminal device, or can be an application developed for the terminal device; of course, the real-time synchronization device 200 for online relationships of user friends in a high-concurrency scenario can also be one of the many hardware modules of the terminal device.

[0084] Alternatively, in another example, the real-time synchronization device 200 for online relationships of users and friends in the high-concurrency scenario and the terminal device may be separate devices, and the real-time synchronization device 200 for online relationships of users and friends in the high-concurrency scenario may be connected to the terminal device via a wired and / or wireless network, and transmit interactive information in accordance with an agreed data format.

[0085] Exemplary Electronic Devices

[0086] Below, reference Figure 4 To describe an electronic device according to an embodiment of the present application.

[0087] Figure 4 is a block diagram of an electronic device according to an embodiment of the present application.

[0088] like Figure 4 As shown, the electronic device 10 includes one or more processors 11 and a memory 12 .

[0089] The processor 11 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 10 to perform desired functions.

[0090] The memory 12 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 11 may run the program instructions to implement the user friend online relationship real-time synchronization method and / or other desired functions in the high concurrency scenario of each embodiment of the present application described above. Various contents such as a friend online list may also be stored in the computer-readable storage medium.

[0091] In one example, the electronic device 10 may further include: an input device 13 and an output device 14, and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0092] For example, the input device 13 may be a keyboard, a mouse, etc.

[0093] The output device 14 can output various information to the outside, such as online and offline results, etc. The output device 14 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.

[0094] Of course, to simplify, Figure 4 Only some of the components related to the present application in the electronic device 10 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 10 may also include any other appropriate components.

[0095] Exemplary computer program products and computer-readable storage media

[0096] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the real-time synchronization method of user friend online relationships in high-concurrency scenarios according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.

[0097] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0098] In addition, an embodiment of the present application may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps of the real-time synchronization method of user friend online relationships in high-concurrency scenarios according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.

[0099] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0100] The basic principles of the present application are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present application are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present application. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, not for limitation, and the above details do not limit the present application to being implemented by adopting the above specific details.

[0101] The block diagrams of the devices, apparatuses, equipment, and systems involved in this application are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The words "such as" used here refer to the phrase "such as but not limited to", and can be used interchangeably with them.

[0102] It should also be noted that in the apparatus, device and method of the present application, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present application.

[0103] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0104] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present application to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. A method for real-time synchronization of online relationships of user friends in a high-concurrency scenario, characterized in that: include: Creating a user's online friend center, wherein the user's online friend center has a list of the user's online friends, and the online status of the friends is maintained through the user's online friend center; When the user is online, the user's friend online center receives a user online message from the user online center service and performs a user online operation to update the friend online list; as well as In the case of a user going offline, the user friend online center receives a user offline message from the user online center service and executes a user offline operation, determines whether the user is repeatedly offline by obtaining an offline frequency control parameter, and in response to the user repeatedly going offline, does not execute the user offline operation and maintains the user's existing status; and, in response to the user not going offline again, sends a delay message with the same duration as the offline frequency control parameter to the user online center service; The user online operation includes a friend online list query operation, and the friend online list query operation of the user friend online center includes: The user's friend online center queries the friend online list; and In response to querying the online friend list, directly returning the online friend list; The friend online list query operation further includes: In response to the failure to find the online friend list, the online friend list needs to be initialized; all query operations of the user are blocked and locked by adding a distributed lock to the user, waiting for the initialization of the online friend list to be completed, and the online friend list of the user's friends is queried again by the online friend center; The user's online friend center obtains the user's friend list from the friend service, and queries the user's online friend center through the user's friend list to obtain the online friend list; the friend service is used to maintain the friend relationship between users, and queries the user's online center service through the friend list to obtain the online friend list; Saving the online friend list to the user's online friend center; and The distributed lock is released, the query operation is ended, and the friend online list is returned.

2. The method for real-time synchronization of online relationships of user friends in a high-concurrency scenario as claimed in claim 1, characterized in that: Further including: When a user deletes a friend, the user's friend online center receives a friend deletion message from the friend service and performs a friend deletion operation.

3. The method for real-time synchronization of user friend online relationships in a high-concurrency scenario as claimed in claim 1, characterized in that: Further including: When a user adds a friend, the user's friend online center receives a friend adding message from a friend service and performs a friend adding operation.

4. The method for real-time synchronization of user friend online relationships in a high-concurrency scenario as claimed in claim 1, characterized in that: in, When the user is online, the user friend online center receives a user online message from the user online center service of the user application and performs a user online operation, including: Obtaining an online frequency control parameter to determine whether the user is repeatedly online; In response to the user repeatedly going online, not performing the user online operation and maintaining the user's existing status; In response to the user not being back online, obtaining an online list of friends of the user; and Asynchronously notifying the online list of the user's friends that the user has come online, and modifying the status of the user in the friends list to be online.

5. The method for real-time synchronization of user friend online relationships in a high-concurrency scenario as claimed in claim 1, characterized in that: in, When the user goes offline, the user friend online center receives a user offline message from the user online center service of the user application and performs a user offline operation, including: Obtain offline frequency control parameters to determine whether the user has gone offline again; In response to the user repeatedly logging off, not executing the user offline operation and maintaining the user's existing status; and In response to the user not going offline again, a delay message having a duration equal to the offline frequency control parameter is sent to the user online center service.

6. The method for real-time synchronization of user friend online relationships in a high-concurrency scenario as claimed in claim 5, characterized in that: Further including: Querying the user online center service to verify whether the user has gone offline; In response to the user not being offline, not performing the operation; In response to the user being offline, obtaining an online list of friends of the user; Resetting the online frequency control parameters of the user; as well as Asynchronously notify the user's friends online list that the user has gone offline, and modify the user's status in the friends list The status is offline.

7. The method for real-time synchronization of user friend online relationships in a high-concurrency scenario as claimed in claim 2, characterized in that: in, In the case where a user deletes a friend, the user friend online center receives a friend deletion message from a friend service and performs a friend deletion operation, including: Deleting each other from the online friend lists of the user and the deleted friend; and In response to the user being online, asynchronously and delayedly deleting the online status of both friends.

8. The method for real-time synchronization of user friend online relationships in a high-concurrency scenario as claimed in claim 2, characterized in that: in, In the case where a user adds a friend, the user friend online center receives a friend adding message from a friend service and performs a friend adding operation, including: Determine whether the user's friend online list exists; In response to the user's online friend list existing, adding an added person; Determine whether the friend list of the person being added exists; and In response to the existence of the friend online list of the person to be added, the user is added.

9. A real-time synchronization device for online relationships between users and friends in a high-concurrency scenario, characterized in that: include: A creating unit, configured to create a user friend online center of the user, wherein the user friend online center has an online list of friends of the user, and maintains the online status of friends through the user friend online center; An online unit, configured to receive a user online message from the user online center service and perform a user online operation when the user is online, so as to update the friend online list; as well as an offline unit, configured to, when a user goes offline, receive a user offline message from a user online center service by the user friend online center and execute a user offline operation, determine whether the user is repeatedly offline by acquiring an offline frequency control parameter, and in response to the user repeatedly going offline, not execute the user offline operation and maintain the user's existing status; and, in response to the user not going offline again, send a delay message with the same duration as the offline frequency control parameter to the user online center service; The user online operation includes a friend online list query operation, and the friend online list query operation of the user friend online center includes: The user's friend online center queries the friend online list; and In response to querying the online friend list, directly returning the online friend list; The friend online list query operation further includes: In response to the failure to find the online friend list, the online friend list needs to be initialized; all query operations of the user are blocked and locked by adding a distributed lock to the user, waiting for the initialization of the online friend list to be completed, and the online friend list of the user's friends is queried again by the online friend center; The user's online friend center obtains the user's friend list from the friend service, and queries the user's online friend center through the user's friend list to obtain the online friend list; the friend service is used to maintain the friend relationship between users, and queries the user's online center service through the friend list to obtain the online friend list; Saving the online friend list to the user's online friend center; and The distributed lock is released, the query operation is ended, and the friend online list is returned.

10. An electronic device, characterized in that: include: processor; as well as A memory, in which computer program instructions are stored, and when the computer program instructions are executed by the processor, the processor executes the method for real-time synchronization of online relationships between users and friends in a high-concurrency scenario as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which, when executed by a computing device, can be operated to execute the method for real-time synchronization of online relationships between users and friends in a high-concurrency scenario as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Method and system for only displaying on-line users in instant communication

    CN101247371A

  • Method and system for displaying friend login states in instant messaging tool

    CN106453067A