Metadata caching method and device
By filtering the target data of the video, obtaining and updating the latest metadata of popular videos to the cache database, the storage and cache stability problems caused by the surge in the number of video manuscripts are solved, and resource conservation and system stability are improved.
Patent Information
- Application Number
- CN202411928402.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-03-18
AI Technical Summary
As the number of video manuscripts surges, the resources required to store all video metadata are huge. If they die naturally at a fixed time, it may trigger cache penetration, affecting system stability and availability.
By obtaining the target data of the video, filtering out popular videos, obtaining their latest metadata, and updating them to the cache database in a sliding window to ensure that the popular video metadata does not fail and save storage resources.
It effectively solves the problem of the expired cache of popular video metadata, saves storage resources, and improves the stability and availability of the system.
Smart Images

Figure CN119646257A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of storage technology, and in particular, to a metadata caching method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] With the rapid development of the Internet and the continuous advancement of multimedia technology, video platforms have become an important channel for people to obtain information, entertainment and social interaction. Hundreds of millions of video manuscripts are uploaded, watched and shared, and these video manuscripts carry a large amount of metadata.
[0003] However, with the rapid increase in the number of video manuscripts, if the metadata of all video manuscripts is stored, huge storage resources will be required. If the metadata of all video manuscripts is naturally destroyed at a fixed time, although storage resources can be saved, it may cause a large amount of cache penetration, affecting the stability and availability of the system.
[0004] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention
[0005] Embodiments of the present application provide a metadata caching method, apparatus, computer device, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems raised above.
[0006] One aspect of an embodiment of the present application provides a metadata caching method, the method comprising: Obtain target data for each of the multiple videos; Filtering out a plurality of target videos from the plurality of videos according to the target data of each of the videos; Obtain the latest metadata of each of the target videos; The latest metadata of each of the target videos is updated into the first cache database.
[0007] Optionally, the target data of each of the multiple videos is stored in a Redis database; According to the target data of each of the videos, a plurality of target videos are selected from the plurality of videos, including: In response to the metadata update task, reading target data of each of the videos from the Redis database; The target data of each of the videos are sorted from high to low, and a preset number of videos with top sorting are selected as the multiple target videos.
[0008] Optionally, updating the latest metadata of each of the target videos into the first cache database includes: In response to the metadata update task, obtaining a smoothed QPS maximum value corresponding to the first cache database in the current time period; Determining a target speed according to the smoothed QPS maximum value; The latest metadata of each of the target videos is updated to the first cache database at the target speed in a sliding window manner.
[0009] Optionally, the metadata caching method further includes: In response to a metadata acquisition request of a target video, acquiring first metadata from the first cache database and acquiring second metadata from the second cache database; comparing the first metadata and the second metadata; When the first metadata and the second metadata are inconsistent, the first metadata is selected to be used.
[0010] Optionally, the metadata caching method further includes: In response to a metadata acquisition request of a target video, acquiring first metadata from the first cache database; In the case that the first metadata does not exist, the second metadata is selected to be used.
[0011] Optionally, the metadata caching method further includes: If the first metadata does not exist, acquiring the first metadata from a metadata database; and The first metadata is transmitted to a first cache database.
[0012] Optionally, the metadata caching method further includes: When the latest metadata of each of the target videos has been updated to the first cache database, the Reset interface corresponding to the playback scheduling service is notified to read the latest metadata from the first cache database.
[0013] Another aspect of an embodiment of the present application provides a metadata cache device, the device comprising: A first acquisition module is used to acquire target data of each of the multiple videos; A screening module, used for screening out a plurality of target videos from the plurality of videos according to the target data of each of the videos; A second acquisition module is used to acquire the latest metadata of each of the target videos; The updating module is used to update the latest metadata of each of the target videos into the first cache database.
[0014] Another aspect of an embodiment of the present application provides a computer device, including: at least one processor; and a memory communicatively coupled to the at least one processor; Wherein: the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.
[0015] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.
[0016] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the method described above when executed by a processor.
[0017] The above technical solution adopted in the embodiment of the present application may have the following advantages: By obtaining the target data (e.g., video playback volume, etc.) of each of the multiple videos (e.g., on-demand videos). Then, based on the target data of each video, multiple target videos (e.g., popular videos) are screened out from the multiple videos. Then, the latest metadata of each target video is obtained. The latest metadata of each target video is updated to the first cache database. It can be seen that in the embodiment of the present application, in the process of deleting the metadata corresponding to each video in the first cache database based on time, it is possible to ensure that the latest metadata of multiple popular videos can still be stored in the first cache database. This not only saves storage resources, but also effectively solves the problem of metadata invalidation of some popular videos due to cache expiration. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0019] Figure 1 The following schematically shows an operating environment diagram of the metadata caching method according to the first embodiment of the present application; Figure 2 The flowchart of the metadata caching method according to the first embodiment of the present application is schematically shown; Figure 3 Schematically shows Figure 2 Flow chart of sub-steps of step S202; Figure 4 Schematically shows Figure 2Flow chart of sub-steps of step S206; Figure 5 The newly added flow chart of the metadata caching method according to the first embodiment of the present application is schematically shown; Figure 6 The newly added flow chart of the metadata caching method according to the first embodiment of the present application is schematically shown; Fig. 7A and 7B The following schematically shows an exemplary application flow chart of the present application; Figure 8 The overall flow chart according to the embodiment of the present application is schematically shown; Fig. 9 A block diagram of a metadata cache device according to Embodiment 2 of the present application is schematically shown; and Fig.10 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0021] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0022] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.
[0023] First, the following terms are explained: QPS (Queries Per Second): is an indicator to measure server performance, indicating the number of queries a server can respond to per second.
[0024] Cache penetration: When the cache is expired, a large number of requests will be sent to the next-level database, causing database performance overload, resulting in database timeout, and the upper-level service cannot work normally.
[0025] Secondly, to facilitate those skilled in the art to understand the technical solution provided by the embodiment of the present application, the following is an explanation of the relevant technology: the current daily playback times of video manuscripts (for example, on-demand video manuscripts) reach 4.8 billion times. If the metadata of all video manuscripts needs to be stored, it requires a large amount of storage resources. If they die naturally at a fixed time, it may cause a large amount of cache penetration during the evening peak, resulting in a large number of database read and write operations, thereby affecting the overall stability and availability.
[0026] To this end, the embodiment of the present application provides a metadata cache technical solution. In this technical solution, the above-mentioned problems are overcome. See below for details.
[0027] Finally, for ease of understanding, an exemplary operating environment is provided below.
[0028] like Figure 1 As shown, the operating environment diagram includes: a service platform 2, and clients (4A, 4B, ..., 4N).
[0029] The service platform 2 can be connected to the client terminals ( 4A, 4B, ..., 4N) via the network.
[0030] The service platform 2 may be a single server, a server cluster or a cloud computing service center.
[0031] The service platform 2 can provide storage metadata services, transmission metadata services, etc. to the client.
[0032] The service platform 2 may be located in a data center such as a single location, or distributed in different geographical locations (e.g., in multiple locations). The service platform 2 may provide services via a network. The network includes various network devices such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or the like. The network may include physical links such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof, and the like, or wireless links such as cellular links, satellite links, Wi-Fi links, and the like.
[0033] The client (4A, 4B, ..., 4N) may be configured to access the content and services of the service platform 2. The client (4A, 4B, ..., 4N) may include an electronic device carrying or externally connected to a display panel, such as a mobile device, a tablet device, a laptop computer, a workstation, a virtual reality device, a gaming device, a digital streaming device, a vehicle terminal, a smart TV, a set-top box, etc., and may also include a virtualized computing instance. The virtualized computing instance may include a virtual machine, such as a simulation of a computer system, an operating system, a server, etc. The computing device may load a virtual machine based on a virtual image and / or other data defining specific software (e.g., an operating system, a dedicated application, a server) for simulation. As the demand for different types of processing services changes, different virtual machines may be loaded and / or terminated on one or more computing devices.
[0034] The client (4A, 4B, ..., 4N) may be associated with one or more users. A single user may also use one or more of the clients (4A, 4B, ..., 4N) to access the service platform 2. The client (4A, 4B, ..., 4N) may travel to various locations and use different networks to access the service platform 2.
[0035] The client (4A, 4B, ..., 4N) may include an interface. The interface may include a touch pad, a touch screen, a mouse, a keyboard, or other sensing elements. For example, the input element may be configured to receive user instructions, and the user instructions may enable the client (4A, 4B, ..., 4N) to perform various operations, such as playing a video, uploading a video, etc.
[0036] It should be noted that the above devices are exemplary, and the number and type of devices are adjustable in different scenarios or according to different needs.
[0037] The following uses a server as the execution subject to introduce the technical solution of the present application through multiple embodiments. It should be noted that these embodiments can be implemented in a variety of different forms and should not be interpreted as being limited to the embodiments described here.
[0038] Embodiment 1 Figure 2 The flowchart of the metadata caching method according to the first embodiment of the present application is schematically shown.
[0039] like Figure 2 As shown, the metadata caching method may include steps S200 to S206, wherein: Step S200, obtaining target data of each of the multiple videos; Step S202, screening out a plurality of target videos from the plurality of videos according to the target data of each of the videos; Step S204, obtaining the latest metadata of each of the target videos; Step S206: updating the latest metadata of each of the target videos into the first cache database.
[0040] The metadata caching method provided in this embodiment obtains the target data (e.g., video playback volume, etc.) of each of multiple videos (e.g., on-demand videos). Then, based on the target data of each video, multiple target videos (e.g., popular videos) are screened out from the multiple videos. The latest metadata of each target video is then obtained. The latest metadata of each target video is updated to the first cache database. It can be seen that in the embodiment of the present application, in the process of deleting the metadata corresponding to each video in the first cache database based on time, it is possible to ensure that the latest metadata of multiple popular videos can still be stored in the first cache database. This not only saves storage resources, but also effectively solves the problem of metadata invalidation of some popular videos due to cache expiration.
[0041] The following combination Figure 2 , each step in steps S200~SS206 and other optional steps are described in detail.
[0042] Step S200 , obtain the target data of multiple videos respectively.
[0043] Exemplarily, the video may be any video content on an online video platform, such as on-demand video, movies, TV series, short films, documentaries, UGC (User Generated Content), PGC (Professional Generated Content), etc.
[0044] The target data may refer to data that can reflect certain key features or attributes of the video. The target data may include one or more of the following: video playback volume, number of likes, number of comments, number of shares, viewing time, viewing completion rate, user rating, etc.
[0045] Step S202 , based on the target data of each of the videos, a plurality of target videos are screened out from the plurality of videos.
[0046] In some embodiments, the target data may be preprocessed, for example, by cleaning the data and removing duplicate, invalid or outdated data.
[0047] In some embodiments, conditions for filtering videos can be set according to business needs, such as selecting videos with a viewing count exceeding a certain threshold, selecting videos with a like rate higher than the average, selecting videos with high comment activity, selecting videos published within a certain time period (for example, within the last seven days), selecting videos that meet specific category tags, etc.
[0048] In an optional embodiment, the target data of each of the multiple videos is stored in a Redis database; Figure 3 As shown, step S202 may include: Step S300, in response to the metadata update task, reading the target data of each of the videos from the Redis database; Step S302 , sorting the target data of each of the videos from high to low, and selecting a preset number of videos with top rankings as the multiple target videos.
[0049] Exemplarily, the metadata update task can be triggered in a variety of ways, such as a scheduled task (for example, at 2 a.m. every day), an event trigger (such as a new video upload, a video data change), a user request (such as a user request to update a recommendation list), etc.
[0050] The target video may be determined based on a combination and weight of multiple target data. For example, the target data such as video playback volume, interactive data, user feedback, etc. may be added according to certain weights to obtain a comprehensive score for each video. Then, the comprehensive scores are sorted from high to low, and a preset number of videos with high ranking in the comprehensive scores are selected as multiple target videos. The target video may also be determined based on a single target data. For example, the video playback volume corresponding to each of the multiple videos may be sorted from high to low, and a preset number of videos with high ranking in the video playback volume are selected as multiple target videos. In some embodiments, in order to more accurately reflect the real-time performance of the video and the changes in user interests, a time decay function may be set so that the influence of older target data on the comprehensive score gradually decreases.
[0051] In this embodiment, in response to the metadata update task, the target data (for example, the number of video views) is read and sorted from the Redis database, and the video corresponding to the target data with the highest sorting is selected as the target video (for example, a popular video), so that the latest metadata of the target video can be stored in the first cache database later, so that the popular videos will not become invalid, the total storage capacity can be controlled, and the update will not cause additional performance problems.
[0052] Step S204 , obtain the latest metadata of each of the target videos.
[0053] Metadata is descriptive information of data. In this embodiment, metadata may include video resolution, definition, video format, encoding method, etc.
[0054] Step S206 , updating the latest metadata of each of the target videos into the first cache database.
[0055] It can be seen that, on the one hand, if the metadata of videos (for example, on-demand videos) are stored, a large amount of storage resources are required. However, if a large amount of metadata disappears naturally at a fixed time, it may cause a large amount of cache penetration during the evening peak, thus affecting the stability and availability of the system. On the other hand, the popularity of videos also conforms to the 80 / 20 principle. That is, 80% of the playback volume is brought by 20% of the videos, and the popularity of the videos will last for many days. Therefore, it is necessary to ensure that the metadata corresponding to these 20% of videos does not expire (that is, it is necessary to ensure that the playback scheduling service can obtain the metadata corresponding to these 20% of videos from the cache database).
[0056] It can be seen that, through this embodiment, the latest metadata of the target video (for example, a popular video) is cached in the first cache database, so that the playback scheduling service can adjust the target video according to the latest metadata of the target video to allow the latest resolution bit rate option information to be scheduled. The resolution bit rate option information may include resolution (for example, standard definition, high definition, ultra-high definition, etc.), bit rate (for example, low bit rate, standard bit rate, high bit rate, etc.), frame rate (for example, 24FPS, 30FPS and 60FPS, etc.), etc.
[0057] In an optional embodiment, if Figure 4 As shown, step S206 may include: Step S400, in response to the metadata update task, obtaining the maximum smoothed QPS value corresponding to the first cache database in the current time period; Step S402, determining a target speed according to the maximum smoothed QPS value; Step S404: updating the latest metadata of each of the target videos into the first cache database at the target speed in a sliding window manner.
[0058] Exemplarily, the maximum smoothed QPS value reflects the maximum query rate that the first cache database can support. The maximum smoothed QPS value can be obtained by obtaining the QPS data of the first cache database in the past specified time period and performing weighted averaging or other smoothing algorithms. Then, the refresh rate (i.e., target rate) of the token bucket is set according to the maximum smoothed QPS value. The refresh rate of the token bucket needs to be lower than the maximum smoothed QPS value. For example, if the maximum smoothed QPS value is 10K, the refresh rate of the token bucket can be set to 9K. The latest metadata of the target video is obtained from the metadata database or other data source, and then the sliding window updates the latest metadata of each target video to the first cache database at the target rate (i.e., the refresh rate of the bucket card). In some embodiments, the target rate can be determined based on a certain proportion of the maximum smoothed QPS value. For example, it is set to 80% of the maximum smoothed QPS value to ensure that the first cache database has sufficient processing power to respond to other requests. The target rate can also be dynamically adjusted according to the load of the first cache database. For example, when the load of the first cache database decreases, the target rate can be appropriately increased to speed up the metadata update. When the load of the first cache database increases, the target rate can be appropriately reduced to reduce the possibility of overload.
[0059] In some embodiments, if the latest metadata corresponding to each of the multiple target videos is not updated to the first cache database in the first preset time period (for example, 2:00 to 5:00), the latest metadata corresponding to each of the multiple target videos that are not updated to the first cache database in the first preset time period can be updated to the first cache database in the second preset time period (for example, 5:00 to 8:00). In some embodiments, in order to ensure the stability of the service, if the latest metadata corresponding to each of the multiple target videos is still not updated to the first cache database in the second preset time period, the latest metadata corresponding to each of the multiple target videos that are still not updated to the first cache database in the second preset time period are discarded.
[0060] In this embodiment, the update speed of the metadata corresponding to the target video is determined by obtaining the maximum smoothed QPS value of the current time period of the first cache database, and the latest metadata corresponding to the target video is updated to the first cache database at this target speed in a sliding window manner, thereby effectively balancing the update speed of the first cache database and improving system performance and stability.
[0061] In an optional embodiment, if Figure 5 As shown, the metadata caching method may further include: Step S500, in response to a metadata acquisition request of a target video, acquiring first metadata from the first cache database and acquiring second metadata from the second cache database; Step S502, comparing the first metadata and the second metadata; Step S504: when the first metadata and the second metadata are inconsistent, the first metadata is selected to be used.
[0062] It should be noted that for ease of understanding, Figure 8 (The red line in the figure is the old link, and the black line is the new link). In the embodiment of the present application, the first cache database (i.e., the new cache database) obtains the first metadata from the metadata database through the first link (i.e., the new link). The second cache database obtains the second metadata from the metadata database through the second link. The second cache database and its corresponding second link are the old cache database and old link that are to be gradually eliminated in the subsequent plan.
[0063] For example, for ease of understanding, Figure 8 In response to the playback scheduling service receiving the metadata acquisition request of the target video, the playback scheduling service double-reads the first cache database and the second cache database, and simultaneously obtains the first metadata from the first cache database and the second metadata from the second cache database (it should be noted that the first metadata and the second metadata are both metadata corresponding to the target video, but the first metadata and the second metadata may be the same or different, and it is necessary to determine later whether the first metadata or the second metadata is used as the final metadata corresponding to the target video). Compare whether the quantity and content of the first metadata and the second metadata are consistent. Among them, the compared content may include key information such as the resolution, clarity, and encoding format of the video. Because the first cache database is more reliable than the first link. Therefore, if the first metadata and the second metadata are inconsistent, the first metadata can be preferentially selected as the final metadata corresponding to the target video (the latest resolution bit rate option information that is finally allowed to be scheduled for the target video is determined later based on the first metadata).
[0064] In some embodiments, if the metadata cannot be obtained from any cache database (eg, network timeout, cache database error, etc.), the metadata can be obtained from another cache database.
[0065] In this embodiment, in response to a metadata acquisition request for a target video, first metadata corresponding to the target video is acquired from a first cache database and second metadata corresponding to the target video is acquired from a second cache database. Since the first cache database is more reliable than the second cache database, when the first metadata and the second metadata are inconsistent, the first metadata is preferentially used as the final metadata corresponding to the target video, thereby improving the reliability and accuracy of the final metadata corresponding to the target video.
[0066] In an optional embodiment, the metadata caching method may further include: In the case that the first metadata does not exist, the second metadata is selected to be used.
[0067] Exemplarily, when the playback scheduling service simultaneously obtains the first metadata from the first cache database and the second metadata from the second cache database, if the first metadata exists and is valid, the first metadata is directly used as the final metadata corresponding to the target video. If the first metadata does not exist, has expired, is in an incorrect format, or does not match the target video, the playback scheduling service may choose to use the second metadata as the final metadata corresponding to the target video.
[0068] In some embodiments, the acquisition priority of the metadata corresponding to the target video can be set. Specifically, the first metadata can be first acquired from the first cache database as the final metadata corresponding to the target video. In the case where the first metadata does not exist, has expired, is in an incorrect format, or does not match the target video, the second metadata is acquired from the second cache database as the final metadata corresponding to the target video.
[0069] In this embodiment, in response to a metadata acquisition request for a target video, the playback scheduling service simultaneously reads the metadata of the first cache database and the second cache database. If the metadata corresponding to the target video (i.e., the first metadata) does not exist in the first cache database, the second metadata is selected as the final metadata corresponding to the target video, thereby improving the success rate of the playback scheduling service in acquiring the final metadata corresponding to the target video.
[0070] In an optional embodiment, if Figure 6 As shown, the metadata caching method may further include: Step S600: if the first metadata does not exist, obtain the first metadata from a metadata database; and Step S602: transmitting the first metadata to a first cache database.
[0071] For ease of understanding, it should be noted that, in response to a metadata acquisition request for a target video, if the metadata corresponding to the target video (i.e., the first metadata) does not exist in the first cache database, while selecting the second metadata as the final metadata corresponding to the target video, the first metadata corresponding to the target video will also be retrieved from the metadata database and stored in the first cache database, so that when the metadata of the target video is requested again subsequently, the corresponding first metadata exists in the first cache database.
[0072] In this embodiment, for ease of understanding, Figure 8By ensuring that the new system (the first cache database and the first link corresponding to the first cache database) can obtain and store complete metadata as much as possible, the reliance on the old system (the second cache database and the second link corresponding to the first cache database) can be gradually reduced, so that the old system can be completely replaced in the future. It should be noted that the old system stores metadata of multiple videos in the second cache database based on time, while the new system determines which videos' metadata are stored in the first cache database based on data such as time and video playback volume.
[0073] In an optional embodiment, the metadata caching method may further include: When the latest metadata of each of the target videos has been updated to the first cache database, the Reset interface corresponding to the playback scheduling service is notified to read the latest metadata from the first cache database.
[0074] For example, for ease of understanding, Figure 8 When the latest metadata of each target video has been updated to the first cache database, the corresponding Reset interface of the playback scheduling service will be notified and the manuscript information synchronization service will also be notified to avoid repeatedly updating the latest metadata to the first cache database.
[0075] In order to make this application easier to understand, the following Fig. 7A , Figure 7B and Figure 8 An exemplary application is provided.
[0076] Step S700: The manuscript process management service obtains metadata corresponding to each of the multiple on-demand video manuscripts uploaded by the client.
[0077] Step S702: transmitting metadata corresponding to each of the plurality of on-demand video manuscripts to a manuscript information synchronization service.
[0078] Step S704: the manuscript information synchronization service writes metadata corresponding to each of the plurality of on-demand video manuscripts into a metadata database.
[0079] Step S706, when the manuscript information synchronization service receives the metadata corresponding to each of the multiple on-demand video manuscripts, it notifies the update metadata service through the message queue, so that the update metadata service queries the metadata database for the metadata corresponding to each of these on-demand video manuscripts through the manuscript information synchronization service.
[0080] Step S708, updating the meta-information service to synchronize the metadata corresponding to each of the plurality of on-demand video manuscripts to the new cache database (ie, the first cache database).
[0081] Step S710, in response to a request to obtain multiple on-demand videos, the playback scheduling service double-reads and compares the metadata corresponding to each of the multiple on-demand video manuscripts in the new cache database and the old cache database (ie, the second cache database) to determine the final metadata corresponding to the multiple on-demand videos.
[0082] Step S711, based on the final metadata corresponding to the multiple on-demand videos, determine the latest resolution bit rate option information that these on-demand video manuscripts are allowed to schedule.
[0083] Step S712, the playback scheduling service counts the on-demand data (for example, video playback volume, etc.) of multiple on-demand video manuscripts by instance, and then stores these on-demand data in the Redis database.
[0084] Step S714, when the meta-interest service is updated at a preset time point (for example, 2:00), a scheduled task is started to read a preset number (the first 80 million) of on-demand video manuscripts with the highest number of views from the Redis database (for ease of understanding, the preset number of on-demand video manuscripts with the highest number of views will be referred to as multiple popular on-demand video manuscripts in subsequent steps).
[0085] Step S716: The maximum smoothed QPS value of the cache database is tested.
[0086] Step S718, update the meta information service to obtain the latest metadata corresponding to each of the multiple popular on-demand video manuscripts.
[0087] Step S720: Update the meta information service to set the token bucket refresh rate (eg, 9k) according to the smoothed QPS maximum value (eg, 10k). It should be noted that the refresh rate is lower than the smoothed QPS maximum value.
[0088] Step S722, smoothly updating the latest metadata corresponding to multiple popular on-demand video manuscripts into the cache database through a sliding window according to the refresh rate of the set token bucket.
[0089] Step S724, if the latest metadata corresponding to the multiple popular on-demand video manuscripts are not all updated to the cache database within the first preset time period (for example, 2:00 to 5:00), then repeat the process once more within the second preset time period (5:00 to 8:00) to update the latest metadata corresponding to the remaining multiple popular on-demand video manuscripts to the cache database.
[0090] Step S726, in response to the acquisition request of multiple popular on-demand videos, the playback scheduling service reads the metadata corresponding to each of the multiple popular on-demand video manuscripts in the cache database to update the resolution and bit rate option information allowed to be scheduled for these popular on-demand video manuscripts.
[0091] Embodiment 2 Fig. 9 The block diagram of the metadata cache device according to the second embodiment of the present application is schematically shown. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig. 9 As shown, the device 1000 may include: a first acquisition module 1100, a screening module 1200, a second acquisition module 1300, and an updating module 1400, wherein: A first acquisition module 1100 is used to acquire target data of each of the multiple videos; A screening module 1200, configured to screen out a plurality of target videos from the plurality of videos according to target data of each of the videos; The second acquisition module 1300 is used to acquire the latest metadata of each target video; The updating module 1400 is used to update the latest metadata of each of the target videos into the first cache database.
[0092] In an optional embodiment, the target data of each of the plurality of videos is stored in a Redis database; According to the target data of each of the videos, a plurality of target videos are selected from the plurality of videos, including: In response to the metadata update task, reading target data of each of the videos from the Redis database; The target data of each of the videos are sorted from high to low, and a preset number of videos with top sorting are selected as the multiple target videos.
[0093] In an optional embodiment, updating the latest metadata of each of the target videos into the first cache database includes: In response to the metadata update task, obtaining a smoothed QPS maximum value corresponding to the first cache database in the current time period; Determining a target speed according to the smoothed QPS maximum value; The latest metadata of each of the target videos is updated to the first cache database at the target speed in a sliding window manner.
[0094] In an optional embodiment, the device further comprises: In response to a metadata acquisition request of a target video, acquiring first metadata from the first cache database and acquiring second metadata from the second cache database; comparing the first metadata and the second metadata; When the first metadata and the second metadata are inconsistent, the first metadata is selected to be used.
[0095] In an optional embodiment, the device further comprises: In the case that the first metadata does not exist, the second metadata is selected to be used.
[0096] In an optional embodiment, the device further comprises: If the first metadata does not exist, acquiring the first metadata from a metadata database; and The first metadata is transmitted to a first cache database.
[0097] In an optional embodiment, the device further comprises: When the latest metadata of each of the target videos has been updated to the first cache database, the Reset interface corresponding to the playback scheduling service is notified to read the latest metadata from the first cache database.
[0098] Embodiment 3 Fig.10 The schematic diagram of the hardware architecture of a computer device 10000 suitable for implementing the metadata caching method according to the third embodiment of the present application is shown schematically. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig.10 As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them: The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10010 can be an internal storage module of the computer device 10000, such as a hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 can also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 can also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computer device 10000, such as program code of the metadata caching method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.
[0099] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.
[0100] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0101] It should be pointed out that Fig.10 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0102] In this embodiment, the metadata caching method stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.
[0103] Embodiment 4 An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the metadata caching method in the embodiment are implemented.
[0104] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium may also be an external storage device of a computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Of course, the computer-readable storage medium may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on the computer device, such as the program code of the metadata caching method in the embodiment. In addition, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
[0105] Embodiment 5 An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.
[0106] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0107] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A metadata caching method, characterized in that: The method comprises: Obtain target data for each of the multiple videos; Filtering out a plurality of target videos from the plurality of videos according to the target data of each of the videos; Obtain the latest metadata of each of the target videos; The latest metadata of each of the target videos is updated into the first cache database.
2. The method according to claim 1, characterized in that The target data of each of the multiple videos is stored in a Redis database; According to the target data of each of the videos, a plurality of target videos are selected from the plurality of videos, including: In response to the metadata update task, reading target data of each of the videos from the Redis database; The target data of each of the videos are sorted from high to low, and a preset number of videos with top sorting are selected as the multiple target videos.
3. The method according to claim 1, characterized in that Updating the latest metadata of each of the target videos into the first cache database includes: In response to the metadata update task, obtaining a smoothed QPS maximum value corresponding to the first cache database in the current time period; Determining a target speed according to the smoothed QPS maximum value; The latest metadata of each of the target videos is updated to the first cache database at the target speed in a sliding window manner.
4. The method according to claim 1, characterized in that The method further comprises: In response to a metadata acquisition request of a target video, acquiring first metadata from the first cache database and acquiring second metadata from the second cache database; comparing the first metadata and the second metadata; When the first metadata and the second metadata are inconsistent, the first metadata is selected to be used.
5. The method according to claim 4, characterized in that The method further comprises: If the first metadata does not exist, the second metadata is selected.
6. The method according to claim 5, characterized in that The method further comprises: If the first metadata does not exist, acquiring the first metadata from a metadata database; and The first metadata is transmitted to a first cache database.
7. The method according to claim 1, characterized in that The method further comprises: When the latest metadata of each of the target videos has been updated to the first cache database, the Reset interface corresponding to the playback scheduling service is notified to read the latest metadata from the first cache database.
8. A metadata cache device, characterized in that: The device comprises: A first acquisition module is used to acquire target data of each of the multiple videos; A screening module, used for screening out a plurality of target videos from the plurality of videos according to the target data of each of the videos; A second acquisition module is used to acquire the latest metadata of each of the target videos; The updating module is used to update the latest metadata of each of the target videos into the first cache database.
9. A computer device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to claims 1 to 7 are implemented.