Method, apparatus, medium and computer device for improving data recovery efficiency
By identifying and separating hot data and cold data in the live broadcast platform, and using the Protobuf serialization function for hot updates, the problem of slow data recovery during server restart is solved, and data recovery efficiency and fluency of the live broadcast platform are improved.
Patent Information
- Application Number
- CN202110081238.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-21
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2041-01-21
AI Technical Summary
In the prior art, data recovery is slow and takes a long time when the server is restarted, resulting in the data recovery efficiency not being ensured.
By obtaining user data in the live broadcast platform, identifying hot and cold data based on preset data identification strategies, and using the Protobuf serialization function to convert the hot data into a binary data stream for hot updates when the server restarts, reducing the amount of data that needs to be updated.
Improve data recovery efficiency, shorten data recovery time, and ensure the smoothness of the live broadcast platform.
Smart Images

Figure CN114816838B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of live broadcast platform data processing, and in particular relates to a method, device, medium and computer equipment for improving data recovery efficiency. Background Art
[0002] Servers typically use memory as their data storage medium. Memory storage offers the advantages of fast data read and write speeds and high performance. However, memory data cannot be persisted and is lost if the server is restarted.
[0003] To prevent data loss after a server restart, data recovery strategies are often used to restore data when the server restarts. This ensures that cached data in memory can be restored upon server startup. However, these data recovery strategies are slow and time-consuming, resulting in inefficient data recovery. Summary of the Invention
[0004] In response to the problems existing in the prior art, embodiments of the present invention provide a method, apparatus, medium and computer equipment for improving data recovery efficiency, which is used to solve the technical problem in the prior art that data recovery is slow and time-consuming when the server is restarted to recover data, resulting in the inability to ensure data recovery efficiency.
[0005] A first aspect of the present invention provides a method for improving data recovery efficiency, which is applied in a live broadcast platform. The method comprises:
[0006] Get user data for all users;
[0007] Identifying hot data and cold data in the user data based on a preset data identification strategy;
[0008] When the server is restarted, the identified hot data is hot updated based on a preset hot update strategy.
[0009] Optionally, the identifying hot data and cold data in the user data based on a preset data identification strategy includes:
[0010] For the current user, identify the formula based on the data Determine the data identification value p of the current user data i ;
[0011] Based on the data identification value, the hot data and cold data in the user data are identified; wherein, i is the current user data of the current user; the C i is the number of times the current user data is used; now is the time of data hot update; Ti is the last usage time of the current piece of user data; N is the initial base value of the hot update data; S is the total amount of user data of all users; j is any piece of data in the total amount of user data; w is the weight coefficient corresponding to the average value of the total amount of user data; e is the exponential e; C j is the usage times of any piece of data in the total amount of user data, and T j is the last usage time of any piece of data in the total amount of user data.
[0012] Optionally, the identifying the hot data and cold data in the user data based on the data identification value includes:
[0013] When it is determined that the data identification value of the user data is greater than 0, it is determined that the user data is hot data;
[0014] When it is determined that the data identification value of the user data is less than or equal to 0, it is determined that the user data is cold data.
[0015] Optionally, the method further includes:
[0016] Obtaining a preset target hot update duration;
[0017] Determining the initial base value of the hot update data based on the target hot update duration.
[0018] Optionally, the determining the initial base value of the hot update data based on the target hot update duration includes:
[0019] Obtaining the initial base value of the hot update data from a mapping table based on the target hot update duration; the mapping table stores the corresponding relationship between each hot update duration and the initial base value of the hot update data.
[0020] Optionally, the hot-updating the identified hot data based on a preset hot update strategy includes:
[0021] Converting the hot data into a binary data stream based on the Protobuf serialization function;
[0022] Writing the binary data stream into a preset file;
[0023] When the server is started, extracting the binary data stream from the file;
[0024] Parsing and restoring the binary data stream based on the Protobuf deserialization function to complete the hot update process of the hot data.
[0025] In a second aspect of the present invention, there is provided a device for improving data recovery efficiency, which is applied in a live streaming platform. The device includes:
[0026] An acquisition unit for acquiring user data of all users;
[0027] An identification unit for identifying hot data and cold data in the user data based on a preset data identification strategy;
[0028] An update unit for, when the server restarts, performing hot update on the identified hot data based on a preset hot update strategy.
[0029] Optionally, the identification unit is specifically configured to:
[0030] For the current user, according to the data identification formula determine the data identification value p of the current piece of user data i ;
[0031] Based on the data identification value, identify hot data and cold data in the user data; where i is the current piece of user data of the current user; C i is the number of times the current piece of user data is used; now is the data hot update time; T i is the last use time of the current piece of user data; N is the initial base value of hot update data; S is the total amount of user data of all users; j is any piece of data in the total amount of user data; w is the weight coefficient corresponding to the average value of the total amount of user data; e is the exponential e; C j is the number of times any piece of data in the total amount of user data is used, and T j is the last use time of any piece of data in the total amount of user data.
[0032] In a third aspect of the present invention, there is provided a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the method described in any item of the first aspect is implemented.
[0033] In a third aspect of the present invention, there is provided a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the method described in any item of the first aspect is implemented.
[0034] The present invention provides a method, apparatus, medium and computer device for improving data recovery efficiency. The method includes: obtaining user data of all users; identifying hot data and cold data in the user data based on a preset data identification strategy; when the server restarts, performing hot update on the identified hot data based on a preset hot update strategy. In this way, after identifying the cold data and hot data in the user data and determining the hot data in the user data, only the hot data can be updated based on the hot update strategy, without updating the cold data. This can greatly reduce the amount of data that needs to be hot updated, so as to improve the data hot update efficiency, shorten the data recovery duration, and thus improve the data recovery efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] By reading the following detailed description of the preferred embodiments, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of the present invention. Moreover, throughout the drawings, the same reference numerals are used to represent the same components. In the drawings:
[0036] Figure 1 It is a schematic flowchart of the method for improving data recovery efficiency provided by an embodiment of the present invention;
[0037] Figure 2 It is a schematic structural diagram of the apparatus for improving data recovery efficiency provided by an embodiment of the present invention;
[0038] Figure 3 It is a schematic structural diagram of the computer device for improving data recovery efficiency provided by an embodiment of the present invention;
[0039] Figure 4 It is a schematic structural diagram of the computer-readable storage medium for improving data recovery efficiency provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0040] In order to better understand the above technical solutions, the technical solutions of the embodiments of the present specification will be described in detail below through the drawings and specific embodiments. It should be understood that the specific features in the embodiments of the present specification and the embodiments are detailed descriptions of the technical solutions of the embodiments of the present specification, rather than limitations on the technical solutions of the present specification. Without conflict, the technical features in the embodiments of the present specification and the embodiments can be combined with each other.
[0041] Embodiment 1
[0042] This embodiment provides a method for improving data recovery efficiency, as shown in Figure 1 The following, the method includes the following steps:
[0043] S110, obtaining user data of all users;
[0044] The method for data recovery efficiency provided by the embodiments of the present invention can be applied in a live broadcast platform or other scenarios, and is not limited herein.
[0045] Taking the live broadcast platform as an example, users can conduct live broadcasts, browse pages, etc. on the live broadcast platform. Therefore, corresponding user data will be generated for each user. The user data may include: live broadcast data, browsing data, etc.
[0046] Here, after the corresponding user data is generated by the user, the user data of all users can be obtained.
[0047] S111, identifying hot data and cold data in the user data based on a preset data identification strategy;
[0048] However, in actual applications, within a certain period of time, some users may be more active on the live broadcast platform, frequently log in to the live broadcast platform and perform various behavior operations on the live broadcast platform. The user data generated by these users can be called hot data. And some users have low activity on the live broadcast platform. After logging in to the live broadcast platform once in a short period of time, they will not use or use the live broadcast platform less frequently for a long time afterwards. Then the user data generated by these users can be called cold data.
[0049] In the embodiments of the present invention, the inventor found in actual applications that if all data of all users are restored during the restart of the server, it will cause the data restoration to take a long time, about 2 minutes. However, because the live broadcast platform is an instant interactive platform, it is necessary to ensure the smoothness of the live broadcast process. However, this time-consuming will seriously affect the smoothness of the live broadcast for the live broadcast platform.
[0050] Based on this, after the embodiments of the present invention obtain the user data of the user, they identify the hot data and cold data in the user data based on a preset data identification strategy to separate the hot data and cold data.
[0051] In the embodiments of the present invention, it is considered that the more times a certain data is used, the more likely it is to be hot data. On the contrary, the less times a data is used, the more likely it is to be cold data.
[0052] Considering that if a certain data has been used recently, it is very likely to be used again. Therefore, this data may be hot data; on the contrary, if a certain data has not been used for a long time, it is very likely not to be used again. So this data may be cold data.
[0053] Considering that the purpose of separating cold data from hot data is to reduce the amount of data that needs to be hot-updated, it is also necessary to adjust the amount of hot data according to the total amount of data of all users. For example, if the total amount of data is only 100,000, then all the total data can be adjusted to hot data; if the total amount of data is 100 million, then the amount of hot data needs to be adjusted.
[0054] Based on this, in the embodiments of the present invention, hot data and cold data in user data are identified based on a preset data identification strategy, including:
[0055] For the current user, according to the data identification formula determine the data identification value p of the current piece of user data i ; the current user is any one of all users;
[0056] Identify hot data and cold data in user data based on the data identification value; where i is the current piece of user data of the current user; C i is the number of times the current piece of user data is used; now is the data hot update time; T i is the last use time of the current piece of user data; N is the initial base value of hot update data; S is the total amount of user data of all users; j is any piece of data in the total amount of user data; w is the weight coefficient corresponding to the average value of the total amount of user data; e is the exponential e, generally taking the value of 2.71828; C j is the number of times any piece of data in the total amount of user data is used, T j is the last use time of any piece of data in the total amount of user data.
[0057] It can be seen that the above formula includes a first part and a second part The second part includes: a first sub-part and a second sub-part
[0058] The first part is mainly used to determine the ratio between the number of times the current piece of user data is used and the time difference between the last use time of the current piece of user data and the hot update time; the larger this ratio is, the greater the possibility that the data is hot data.
[0059] In the second part, the first sub-part It is mainly used to determine the exponential change trend presented by the total amount of user data when it changes with the initial base value of the hot update data. This exponential variable trend is an "S" curve. At the intersection of the "S" curve and the vertical line, the total amount of user data S is equal to the initial base value of the hot update data; if the total amount of user data S deviates from the initial base value N of the hot update data, the final amount of hot data will change accordingly. The advantage of this design is that when the total amount of user data S deviates from the initial base value N of the hot update data, it can quickly affect the quantity of hot data that needs to be hot updated, thereby ensuring the determination accuracy of the quantity of hot data.
[0060] Specifically, if the value of S deviates in the direction greater than N (which can be understood as S > N, and S is getting larger and larger than N), the proportion of hot data will rapidly decrease. On the contrary, if the value of S deviates in the direction less than N (which can be understood as S < N, and S is getting smaller and smaller than N), the proportion of hot data will rapidly increase. When S is far from N (for example, S is twice that of N), the total amount of hot data has basically stabilized and there will be no obvious change, so the change trend will gradually slow down. And This indicates that this change is determined based on the multiple of N, which shows that the total amount of user data S and the initial base value N of the hot update data will not have an obvious change trend under extremely small errors, preventing the quantity of hot data from changing violently when there is a slight deviation, thereby ensuring the determination accuracy of the hot data.
[0061] Here, when determining the initial base value of the hot update data, the method includes:
[0062] Obtain the preset target hot update duration;
[0063] Determine the initial base value of the hot update data based on the target hot update duration.
[0064] Further, determining the initial base value of the hot update data based on the target hot update duration includes:
[0065] Obtain the initial base value of the hot update data from the mapping table based on the target hot update duration; the mapping table stores the corresponding relationship between each hot update duration and the initial base value of the hot update data.
[0066] For example, if the target hot update duration is 10s, the corresponding initial base value of the hot update data in the mapping table can be 100,000; if the target hot update duration is 20s, the corresponding initial base value of the hot update data in the mapping table can be 200,000.
[0067] Further, if the data identification value p of the current user data i After it is determined, based on the data identification value, identify the hot data and cold data in the user data, including:
[0068] When it is determined that the data identification value of the user data is greater than 0, it is determined that the user data is hot data;
[0069] When it is determined that the data identification value of the user data is less than or equal to 0, it is determined that the user data is cold data.
[0070] In this step, hot data is identified using a data identification strategy. During subsequent hot updates, only the hot data is updated, reducing the number of data recoveries and improving the data recovery efficiency. Also, when determining the data identification strategy in this step, the usage times, usage duration, total amount of user data, and initial base value of hot update data are considered. Therefore, when identifying cold and hot data in user data, the identification accuracy of hot data can be ensured, an appropriate quantity of hot data can be obtained, and when updating the hot data, the speed of data recovery can be ensured and the time consumption of data recovery can be reduced.
[0071] S112. When the server restarts, perform a hot update on the identified hot data based on a preset hot update strategy.
[0072] After determining the hot data, when the server restarts, perform a hot update on the identified hot data based on a preset hot update strategy.
[0073] In the embodiments of the present invention, the inventor found in actual applications that directly persisting data to a file in text form and then reading from the file and recovering the data by parsing the text during data recovery also has many problems, resulting in a relatively long data recovery time.
[0074] Based on this, the embodiments of the present invention perform a hot update on the identified hot data based on a preset hot update strategy, including:
[0075] Convert the hot data into a binary data stream based on the Protobuf serialization function;
[0076] Write the binary data stream into a preset file;
[0077] When the server starts, extract the binary data stream from the file;
[0078] Parse and recover the binary data stream based on the Protobuf deserialization function to complete the hot update process of the hot data.
[0079] In this step, since the Protobuf serialization function is used to persist the hot data to the disk file in binary format, the serialization speed is faster and the space occupied in the file is smaller. When deserializing the binary data stream, since it is binary data, the parsing rate will also be accelerated, thereby reducing the time consumption of data recovery.
[0080] Based on the same inventive concept, an embodiment of the present invention further provides a device for improving data recovery efficiency, as detailed in Embodiment 2.
[0081] Embodiment 2
[0082] This embodiment provides a device for improving data recovery efficiency. As Figure 2 shown, the device includes:
[0083] An acquisition unit 21, configured to acquire user data of all users;
[0084] An identification unit 22, configured to identify hot data and cold data in the user data based on a preset data identification strategy;
[0085] An update unit 23, configured to perform hot update on the identified hot data based on a preset hot update strategy when the server restarts.
[0086] The method for improving data recovery efficiency provided by the embodiment of the present invention can be applied in a live broadcast platform or other scenarios, and is not limited herein.
[0087] Taking the live broadcast platform as an example, users can perform operations such as live broadcast and page browsing on the live broadcast platform. Therefore, each user will generate corresponding user data. The user data may include: live broadcast data, browsing data, etc.
[0088] Here, after the user generates the corresponding user data, the acquisition unit 21 can acquire the user data of all users.
[0089] However, in actual applications, within a certain period of time, some users may be more active on the live broadcast platform, frequently log in to the live broadcast platform and perform various behavior operations on the live broadcast platform. The user data generated by these users can be called hot data. And some users have low activity on the live broadcast platform. After logging in to the live broadcast platform once in a short period, they will not use or use the live broadcast platform less frequently for a long time afterwards. Then the user data generated by these users can be called cold data.
[0090] In the embodiment of the present invention, the inventor found in actual applications that if all data of all users are recovered during the server restart process, it will cause a long data recovery time, about 2 minutes. However, because the live broadcast platform is an instant interactive platform, it is necessary to ensure the smoothness of the live broadcast process. However, this time-consuming will seriously affect the smoothness of the live broadcast for the live broadcast platform.
[0091] Based on this, after the embodiment of the present invention acquires the user data of the user, it identifies the hot data and cold data in the user data based on a preset data identification strategy to separate the hot data and cold data.
[0092] In an embodiment of the present invention, it is considered that the more times a certain piece of data is used, the more likely it is to be hot data. Conversely, the less frequently used the data is, the more likely it is to be cold data.
[0093] Considering that if a certain piece of data has been used recently, it is very likely to be used again, so this data may be hot data; conversely, if a certain piece of data has not been used for a long time, it is very likely not to be used anymore, so this data may be cold data.
[0094] Considering that the purpose of separating cold data from hot data is to reduce the amount of data that needs to be hot-updated, it is also necessary to adjust the amount of hot data according to the total amount of data of all users. For example, if the total amount of data is only 100,000, then all the total amount of data can be adjusted to hot data; if the total amount of data is 100 million, then the amount of hot data needs to be adjusted.
[0095] Based on this, in an embodiment of the present invention, the identification unit 22 identifies hot data and cold data in user data based on a preset data identification strategy, including:
[0096] For the current user, according to the data identification formula Determine the data identification value p of the current piece of user data i ; the current user is any one of all users;
[0097] Identify hot data and cold data in user data based on the data identification value; where i is the current piece of user data of the current user; C i Is the number of times the current piece of user data is used; now is the data hot update time; T i Is the last use time of the current piece of user data; N is the initial base value of hot update data; S is the total amount of user data of all users; j is any piece of data in the total amount of user data; w is the weight coefficient corresponding to the average value of the total amount of user data; the e is the exponential e, generally taking the value of 2.71828; C j Is the number of times any piece of data in the total amount of user data is used, T j Is the last use time of any piece of data in the total amount of user data.
[0098] It can be seen that the above formula includes a first part And a second part The second part includes: a first sub-part And a second sub-part
[0099] The first part is mainly used to determine the ratio between the usage times of the current user data entry and the time difference between the last usage time of the current user data entry and the hot update time; the larger this ratio, the greater the possibility that the data is hot data.
[0100] The first sub - part in the second part is mainly used to determine the exponential change trend presented by the total amount of user data when it changes with the initial base value of the hot update data. This exponential variable trend is an "S" curve. At the intersection of the "S" curve and the vertical line, the total amount of user data S is equal to the initial base value of the hot update data. If the total amount of user data S deviates from the initial base value N of the hot update data, the final amount of hot data will change accordingly. The advantage of this design is that when the total amount of user data S deviates from the initial base value N of the hot update data, it can quickly affect the quantity of data that needs to be hot - updated, thereby ensuring the determination accuracy of the quantity of hot data.
[0101] Specifically, if the value of S deviates in the direction greater than N (which can be understood as S > N, and S is getting larger than N), the proportion of hot data will rapidly decrease. On the contrary, if the value of S deviates in the direction less than N (which can be understood as S < N, and S is getting smaller than N), the proportion of hot data will rapidly increase. And when S is far from N (for example, S is twice N), the total amount of hot data has basically stabilized and will not show obvious changes anymore, so the change trend will gradually slow down. And indicating that this change is determined based on the multiple of N shows that the total amount of user data S and the initial base value N of the hot update data will not have an obvious change trend under extremely small errors, preventing the quantity of hot data from changing violently when there are slight deviations, thereby ensuring the determination accuracy of hot data.
[0102] Here, when determining the initial base value of the hot update data, the recognition unit 22 is also used for:
[0103] Obtaining a preset target hot update duration;
[0104] Determining the initial base value of the hot update data based on the target hot update duration.
[0105] Furthermore, determining the initial base value of the hot update data based on the target hot update duration includes:
[0106] Obtaining the initial base value of the hot update data from the mapping table based on the target hot update duration; the mapping table stores the corresponding relationship between each hot update duration and the initial base value of the hot update data.
[0107] For example, if the target hot update duration is 10s, the initial base value of the corresponding hot update data in the mapping table can be 100,000; if the target hot update duration is 20s, the initial base value of the corresponding hot update data in the mapping table can be 200,000.
[0108] Further, if the data identification value p of the current user data i After being determined, the recognition unit 22 recognizes hot data and cold data in the user data based on the data identification value, including:
[0109] When it is determined that the data identification value of the user data is greater than 0, it is determined that the user data is hot data;
[0110] When it is determined that the data identification value of the user data is less than or equal to 0, it is determined that the user data is cold data.
[0111] In this step, hot data is recognized using the data recognition strategy. During subsequent hot updates, only the hot data is updated, reducing the number of data recoveries and improving the data recovery efficiency. And when determining the data recognition strategy in this step, considering the number of data uses, usage duration, total amount of user data, and the initial base value of hot update data, it is possible to ensure the recognition accuracy of hot data when recognizing cold data and hot data in user data, obtain an appropriate quantity of hot data, and ensure the speed of data recovery and reduce the time-consuming of data recovery when updating the hot data.
[0112] After determining the hot data, when the server restarts, the update unit 23 is used to perform a hot update on the recognized hot data based on a preset hot update strategy.
[0113] In the embodiment of the present invention, the inventor found in actual applications that directly persisting data in text form to a file and then reading the data from the file and recovering the data by parsing the text during data recovery also has many problems, resulting in a relatively long data recovery time.
[0114] Based on this, the update unit 23 of the embodiment of the present invention performs a hot update on the recognized hot data based on a preset hot update strategy, including:
[0115] Converting the hot data into a binary data stream based on the Protobuf serialization function;
[0116] Writing the binary data stream into a preset file;
[0117] When the server starts, extracting the binary data stream from the file;
[0118] Parsing and recovering the binary data stream based on the Protobuf deserialization function to complete the hot update process of the hot data.
[0119] In this step, since the Protobuf serialization function is used to persist the hot data to the disk file in binary format, the serialization speed is faster and the space occupied in the file is smaller. When deserializing the binary data stream, since it is binary data, the parsing rate will also be accelerated, thereby reducing the time-consuming of data recovery.
[0120] The beneficial effects that at least one or several embodiments provided by the embodiments of the present invention can bring are at least:
[0121] An embodiment of the present invention provides a method, device, medium and computer device for improving data recovery efficiency. The method includes: obtaining user data of all users; identifying hot data and cold data in the user data based on a preset data identification strategy; when the server restarts, performing hot update on the identified hot data based on a preset hot update strategy; thus, by first identifying the cold data and hot data in the user data and determining the hot data in the user data, only the hot data can be updated based on the hot update strategy without updating the cold data; this can greatly reduce the amount of data that needs to be hot updated, so the data hot update efficiency can be improved, the data recovery duration can be shortened, and thus the data recovery efficiency can be improved; and, in the embodiments of the present invention, since the Protobuf serialization function is used to persist the hot data to the disk file in binary format, the serialization speed is faster and the space occupied in the file is smaller. When deserializing the binary data stream, since it is binary data, the parsing rate will also be accelerated, thereby reducing the time-consuming of data recovery.
[0122] Embodiment III
[0123] This embodiment provides a computer device 300, as Figure 3 shown, including a memory 310, a processor 320, and a computer program 311 stored on the memory 310 and executable on the processor 320. When the processor 320 executes the computer program 311, the following steps are implemented:
[0124] Obtain user data of all users;
[0125] Identify hot data and cold data in the user data based on a preset data identification strategy;
[0126] When the server restarts, perform hot update on the identified hot data based on a preset hot update strategy.
[0127] In the specific implementation process, when the processor 320 executes the computer program 311, any implementation manner in Embodiment II can be implemented.
[0128] Since the computer device introduced in this embodiment is the device adopted for implementing a method for improving data recovery efficiency in an embodiment of the present application, based on the method introduced in Embodiment 1 of the present application, those skilled in the art can understand the specific implementation manners and various variations of the computer device in this embodiment. Therefore, the implementation of how this server realizes the method in the embodiment of the present application will not be described in detail herein. As long as the device adopted by those skilled in the art to implement the method in the embodiment of the present application belongs to the scope protected by the present application.
[0129] Based on the same inventive concept, the present application provides a storage medium corresponding to Embodiment 1, as detailed in Embodiment 4.
[0130] Embodiment 4
[0131] This embodiment provides a computer-readable storage medium 400, as Figure 4 shown, on which a computer program 411 is stored. When the computer program 411 is executed by a processor, the following steps are implemented:
[0132] Obtain the user data of all users;
[0133] Identify the hot data and cold data in the user data based on a preset data identification strategy;
[0134] When the server restarts, perform hot update on the identified hot data based on a preset hot update strategy.
[0135] In the specific implementation process, when the computer program 411 is executed by a processor, any implementation manner in Embodiment 2 can be realized.
[0136] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0137] This application is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing device produce a means for implementing the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or a means for implementing the functions specified in one or more of the blocks.
[0138] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction means that implements the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or a means for implementing the functions specified in one or more of the blocks.
[0139] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operational steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or a means for implementing the functions specified in one or more of the blocks.
[0140] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments and all changes and modifications that fall within the scope of the present application.
[0141] As described above, it is only the preferred embodiments of the present invention, and is not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for improving data recovery efficiency, characterized in that Applied in a live streaming platform, the method includes: Obtain the user data of all users; Identify hot data and cold data in the user data based on a preset data identification strategy; When the server restarts, perform hot update on the identified hot data based on a preset hot update strategy; The identifying the hot data and cold data in the user data based on a preset data identification strategy includes: For the current user, according to the data recognition formula Determine the data identification value p of the current user data item i ; Identify hot data and cold data in the user data based on the data identification value; where i is the current piece of user data of the current user; C i is the number of times the current piece of user data is used; now is the data hot update time; T i is the last use time of the current piece of user data; N is the initial base value of hot update data; S is the total amount of user data of all users; j is any piece of data in the total amount of user data; w is the weight coefficient corresponding to the average value of the total amount of user data; e is the exponential e; C j is the number of times any piece of data in the total amount of user data is used, and T j is the last use time of any piece of data in the total amount of user data.
2. The method according to claim 1, wherein The identifying the hot data and cold data in the user data based on the data identification value includes: When it is determined that the data identification value of the user data is greater than 0, determine that the user data is hot data; When it is determined that the data identification value of the user data is less than or equal to 0, determine that the user data is cold data.
3. The method according to claim 1, wherein The method further includes: Obtain a preset target hot update duration; Determine the initial base value of the hot update data based on the target hot update duration.
4. The method according to claim 3, wherein The determining the initial base value of the hot update data based on the target hot update duration includes: Obtain the initial base value of the hot update data from a mapping table based on the target hot update duration; the mapping table stores the corresponding relationship between each hot update duration and the initial base value of the hot update data.
5. The method according to claim 1, characterized in that, The performing hot update on the identified hot data based on a preset hot update strategy includes: Convert the hot data into a binary data stream based on the Protobuf serialization function; Write the binary data stream into a preset file; When the server starts, extract the binary data stream from the file; Parse and restore the binary data stream based on the Protobuf deserialization function to complete the hot update process of the hot data.
6. A device for improving data recovery efficiency, characterized in that, Applied in a live streaming platform, the device includes: An obtaining unit, configured to obtain the user data of all users; An identifying unit, configured to identify hot data and cold data in the user data based on a preset data identification strategy; An updating unit, configured to perform hot update on the identified hot data based on a preset hot update strategy when the server restarts; The identifying unit is specifically configured to: For the current user, according to the data recognition formula Determine the data identification value p of the current user data item i ; Identify hot data and cold data in the user data based on the data identification value; where i is the current piece of user data of the current user; C i is the number of times the current piece of user data is used; now is the data hot update time; T i is the last use time of the current piece of user data; N is the initial base value of hot update data; S is the total amount of user data of all users; j is any piece of data in the total amount of user data; w is the weight coefficient corresponding to the average value of the total amount of user data; e is the exponential e; C j is the number of times any piece of data in the total amount of user data is used, and T j is the last use time of any piece of data in the total amount of user data.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, implement the method according to any one of claims 1 to 5.
8. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, implement the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Cold and hot data storage method and device and electronic device
CN109857737A
Online thermal repair method, device and equipment and computer readable storage medium
CN110471786A