Source returning service updating method and device based on disk cache and computing equipment
By starting a new service when the old service is running, and detecting and handling disk occupation in the new service, the interruption problem during the source service is solved, and efficient and accurate service updates are achieved.
Patent Information
- Application Number
- CN202411475510.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-02-18
AI Technical Summary
The prior art, due to the exclusiveness of the disk when the source service is updated, interruption occurs when switching between new and old services, reducing the user experience.
Start a new service when the old service is running, and direct new requests to the new service. When the old service bears the request amount to drop to the preset threshold, the old service will be offline. The new service detects whether the target disk is occupied by the old service, and if it is occupied, the data is cached to memory, otherwise the memory data is synchronized to disk.
It realizes smooth switching between old and new services, avoids service interruption, improves the update efficiency of source services, reduces the generation of dirty data, and improves update accuracy.
Smart Images

Figure CN119473133A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a disk cache-based back-to-source service update method, device, computing equipment, computer storage medium, and computer program product. Background Art
[0002] Content Delivery Network (CDN) is a network that places service nodes in multiple locations, with one or more service nodes processing user requests. In application scenarios such as live broadcast and on-demand, the content delivery network will go back to the source when processing user requests, that is, transmit the resources requested by the user to the user end through one or more nodes in the content delivery network.
[0003] In order to improve the efficiency of back-to-source and reduce the load on the back-end service nodes or source stations, a back-to-source strategy based on disk cache is often used. That is, the service node caches the back-to-source data returned from the source station or the previous node on the disk, and then directly reads the back-to-source data in the cache when processing the back-to-source request.
[0004] In actual back-to-source scenarios, in order to improve user experience, it is usually necessary to update and iterate some back-to-source services based on disk cache. However, due to the exclusivity of disks, existing technologies usually start new services after the old services are exited, which causes the back-to-source service to be interrupted when switching between the old and new services, reducing user experience. Summary of the invention
[0005] In view of the above problems, the present application is proposed to provide a method, apparatus, computing device, computer storage medium and computer program product that overcome the above problems or at least partially solve the above problems.
[0006] According to a first aspect of the present application, a method for updating a back-to-source service based on a disk cache is provided, comprising:
[0007] During the operation of the old service, the new service is started, and new requests are directed to the new service. When the number of requests received by the old service is lower than a preset threshold, the old service is taken offline; wherein the old service and the new service belong to the same back-to-source service;
[0008] The new service detects whether the associated target disk is occupied by the old service;
[0009] If yes, the new service caches the source data in memory;
[0010] If not, the new service transfers the back-to-source data in the memory to the target disk.
[0011] In an optional implementation manner, the new service detecting whether the associated target disk is occupied by the old service comprises: the new service detecting whether there is a service occupation mark of the old service in the associated target disk;
[0012] If so, the new service executes a step of caching the source data into the memory;
[0013] If not, the step of transferring the back-to-source data in the memory to the target disk is executed.
[0014] In an optional implementation manner, when the number of requests received by the old service is lower than a preset threshold, the old service is offlined including:
[0015] When the number of requests received by the old service is lower than a preset threshold, the old service is offlined and the service occupation mark of the old service in the target disk is deleted.
[0016] In an optional implementation manner, if not, the new service transferring the back-to-source data in the memory to the target disk includes:
[0017] If not, the new service transfers the source data in the memory to the target disk, and adds a service occupation mark of the new service in the target disk.
[0018] In an optional implementation manner, the new service transferring the back-to-source data in the memory to the target disk includes:
[0019] The new service identifies the first category of data and / or the second category of data from the return-to-source data; wherein the data identifier of the first category of data exists in the target disk, and the data identifier of the second category of data does not exist in the target disk;
[0020] Determine the service type of the back-to-source service;
[0021] If the service type is a video-on-demand type, the new service overwrites the data content of the corresponding data identifier in the target disk with the data content of the first type of data;
[0022] If the service type is a live broadcast type, the new service determines, for any first-category data, whether the memory write time of the first-category data is later than the disk write time of the disk data with the same data identifier in the target disk; if so, overwrite the data content of the corresponding data identifier in the target disk with the data content of the first-category data; if not, discard the first-category data;
[0023] The second type of data in the memory returning to the source data is written to the target disk.
[0024] In an optional implementation manner, the new service detecting whether the associated target disk is occupied by the old service includes: the new service detecting whether there is a running process of the old service;
[0025] If so, the new service executes a step of caching the source data into the memory;
[0026] If not, the step of transferring the back-to-source data in the memory to the target disk is executed.
[0027] In an optional implementation manner, the new service detecting whether the associated target disk is occupied by the old service includes:
[0028] The new service detects whether there is a service occupation identifier of the old service in the associated target disk;
[0029] If so, the new service detects whether there is a running process of the old service; if so, the new service executes a step of caching the back-to-source data in the memory; if not, the service occupation mark of the old service in the target disk is deleted, and the new service executes a step of transferring the back-to-source data in the memory to the target disk;
[0030] If not, the step of transferring the back-to-source data in the memory to the target disk is executed.
[0031] According to a second aspect of the present application, a back-to-source service update device based on disk cache is provided, comprising:
[0032] The new service module starts a new service while the old service is running, and directs new requests to the new service; the new service detects whether the associated target disk is occupied by the old service; if so, the new service caches the back-to-source data in the memory; if not, the new service transfers the back-to-source data in the memory to the target disk;
[0033] The old service module is used for offline processing when the number of requests received by the old service is lower than a preset threshold; wherein the old service and the new service belong to the same back-to-source service.
[0034] In an optional implementation manner, the new service module is used for: the new service detecting whether there is a service occupation mark of the old service in the associated target disk;
[0035] If so, the new service executes a step of caching the source data into the memory;
[0036] If not, the step of transferring the back-to-source data in the memory to the target disk is executed.
[0037] In an optional implementation manner, the old service module is used to: when the number of requests received by the old service is lower than a preset threshold, perform offline processing and delete the service occupation mark of the old service in the target disk.
[0038] In an optional implementation manner, the new service module is used for: if not, the new service transfers the back-to-source data in the memory to the target disk, and adds a service occupation identifier of the new service in the target disk.
[0039] In an optional implementation, the new service module is used for: the new service identifies the first category of data and / or the second category of data from the source data; wherein the data identifier of the first category of data exists in the target disk, and the data identifier of the second category of data does not exist in the target disk;
[0040] Determine the service type of the back-to-source service;
[0041] If the service type is a video-on-demand type, the new service overwrites the data content of the corresponding data identifier in the target disk with the data content of the first type of data;
[0042] If the service type is a live broadcast type, the new service determines, for any first-category data, whether the memory write time of the first-category data is later than the disk write time of the disk data with the same data identifier in the target disk; if so, overwrite the data content of the corresponding data identifier in the target disk with the data content of the first-category data; if not, discard the first-category data;
[0043] The second type of data in the memory returning to the source data is written to the target disk.
[0044] In an optional implementation, the new service module is used for: the new service detecting whether there is a running process of the old service;
[0045] If so, the new service executes a step of caching the source data into the memory;
[0046] If not, the step of transferring the back-to-source data in the memory to the target disk is executed.
[0047] In an optional implementation manner, the new service module is used for: the new service detecting whether there is a service occupation mark of the old service in the associated target disk;
[0048] If so, the new service detects whether there is a running process of the old service; if so, the new service executes a step of caching the back-to-source data in the memory; if not, the service occupation mark of the old service in the target disk is deleted, and the new service executes a step of transferring the back-to-source data in the memory to the target disk;
[0049] If not, the step of transferring the back-to-source data in the memory to the target disk is executed.
[0050] According to a third aspect of the present application, there is provided a computing device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;
[0051] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned disk cache-based back-to-source service update method.
[0052] According to a fourth aspect of the present application, a computer storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to perform operations corresponding to the above-mentioned disk cache-based back-to-source service update method.
[0053] According to a fifth aspect of the present application, a computer program product is provided, comprising at least one executable instruction, wherein the executable instruction enables a processor to perform operations corresponding to the above-mentioned disk cache-based back-to-source service update method.
[0054] In an embodiment of the present application, a new service is started while the old service is running, and new requests are directed to the new service. When the number of requests carried by the old service drops to a corresponding value, the old service is taken offline, thereby achieving smooth switching between the old and new services, avoiding service interruptions, and improving the update efficiency of the back-to-source service. In addition, the present application detects by the new service whether the target disk associated with the back-to-source service is occupied by the old service, caches the back-to-source data in the memory when the target disk is occupied by the old service, and synchronizes the data in the memory to the target disk when the target disk is not occupied by the old service, thereby avoiding competition between the new and old services for the target disk, reducing the generation of dirty data, and improving the accuracy of the back-to-source service update.
[0055] In the embodiment of the present application, when the old service is not offline, a service occupation mark is added to the target disk. The new service can accurately determine whether the target disk is occupied by detecting the service occupation mark in the target disk, further avoiding disk competition between the new and old services and improving the disk cache accuracy.
[0056] The embodiment of the present application deletes the service occupation mark of the old service in the target disk after the old service goes offline, releases the occupation of the target disk by the old service in time, and improves the service update efficiency.
[0057] In the embodiment of the present application, after the new service determines that the old service has released the occupation of the target disk, a service occupation identifier of the new service is added to the target disk to facilitate accurate iteration of subsequent services.
[0058] The embodiment of the present application adopts a matching data transfer method according to different service types to improve the accuracy of data transfer and ensure the accuracy of cached data.
[0059] The new service in the embodiment of the present application can accurately determine whether the target disk is occupied by detecting the running process of the old service, further avoiding disk competition between the new and old services and improving the disk cache accuracy; moreover, detecting the disk occupancy of the old service will not intrude into the original logic and code of the old service, thereby ensuring service accuracy.
[0060] The embodiment of the present application combines the service occupancy identification and the running process to comprehensively determine whether the target disk is occupied by the old service, thereby improving the accuracy of disk occupancy identification; and according to the different situations of normal exit and abnormal exit of the old service, a matching data transfer method is adopted to improve data accuracy.
[0061] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0063] Figure 1 A schematic diagram of an operating environment provided for implementing at least one embodiment of the present application is shown;
[0064] Figure 2 A flowchart of a disk cache-based back-to-source service update method provided in Embodiment 1 of the present application is shown;
[0065] Figure 3 A flowchart of a disk cache-based back-to-source service update method provided in Embodiment 2 of the present application is shown;
[0066] Figure 4 A flow chart of a data transfer method provided in Embodiment 2 of the present application is shown;
[0067] Figure 5 A flowchart of a method for updating a back-to-source service based on disk cache provided in Embodiment 3 of the present application is shown;
[0068] Figure 6 A flowchart of a disk cache-based back-to-source service update method provided in Embodiment 4 of the present application is shown;
[0069] Figure 7 A schematic diagram of the structure of a back-to-source service update device based on disk cache provided in Embodiment 5 of the present application is shown;
[0070] Figure 8 A structural schematic diagram of a computing device provided in Example 6 of the present application is shown. DETAILED DESCRIPTION
[0071] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0072] Figure 1 A schematic diagram of an operating environment provided for implementing at least one embodiment of the present application is shown. The operating environment is applied to a client and a content distribution network.
[0073] The client can be running Windows, Android TM ) or IOS and other operating systems, such as smart phones, tablet devices, laptops, virtual reality devices, gaming devices, set-top boxes, car terminals, smart TVs. Based on the above operating systems, various applications can be run, such as browsers, live broadcast / on-demand software, etc.
[0074] The content distribution network includes at least one CDN node and an origin station. The CDN node that is usually close to the client side is called an edge node. The node that provides and stores the original data source in the content distribution network is called an origin station, and the node between the origin station and the edge node is called an intermediate node. The nodes in the content distribution network can be composed of a single or multiple computing devices. The computing device may 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 that defines 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. A hypervisor may be implemented to manage the use of different virtual machines on the same computing device.
[0075] Nodes in a content delivery network may be configured to communicate with clients or other nodes 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.
[0076] Embodiment 1
[0077] Figure 2 A flowchart of a disk cache-based back-to-source service update method provided in Embodiment 1 of the present application is shown. The method embodiment can be executed at a CDN node in the above-mentioned content distribution network to achieve smooth switching of new and old back-to-source services based on disk cache.
[0078] Specifically, Figure 2 As shown, the method comprises the following steps:
[0079] Step S201, start a new service while the old service is running, and direct new requests to the new service. The old service is taken offline when the number of requests it receives is lower than a preset threshold. The old service and the new service belong to the same back-to-source service.
[0080] The back-to-source service refers to a service used to provide back-to-source resources to the client. The old service and the new service described in this application belong to the same back-to-source service. The old service is the service before the back-to-source service is updated, and the new service is the service after the back-to-source service is updated. For example, the old service and the new service can be two different versions of the same back-to-source service, and the old service and the new service have version numbers that match them.
[0081] In the prior art, when updating an old service to a new service, the old service is first taken offline, and then the new service is launched. However, this method may cause service interruption between the time when the old service is taken offline and the time when the new service is launched, thereby affecting the user experience and reducing the efficiency of service update. To solve this technical problem, the present application starts the new service while the old service is running, so that the new service and the old service are online at the same time to avoid service interruption.
[0082] Furthermore, after the new service is started, the requests generated after the new service is started will be treated as new requests, and the new requests will be directed to the new service, and the new service will handle the new requests. After the new service is started, the requests originally handled by the old service (called original requests) will still be handled by the old service. As the old service continues to process the original requests, the number of requests accepted by the old service will continue to decrease. When the current number of requests accepted by the old service is lower than the preset threshold (such as 1 request, etc.), for example, when the current number of requests accepted by the old service is 0, the old service will be taken offline to achieve the switch from the old service to the new service.
[0083] In an optional implementation, after the new service is started, the old service and the new service can simultaneously listen to the same request port of the back-to-source service, and the new service pulls the requests distributed by the request port; or, the old service listens to the first request port, and the new service listens to the second request port, and the old service forwards the requests from the first request port to the second request port, so that the new service pulls the requests from the second request port for processing.
[0084] Since the new service and the old service in this application may be online at the same time, and the disk is often exclusive, in order to ensure the accuracy of service updates, this application solves the disk competition problem between the new and old services through subsequent steps S202-S204, reduces the generation of dirty data, and ensures accurate updates of services.
[0085] Step S202, the new service detects whether the associated target disk is occupied by the old service; if so, execute step S203; if not, execute step S204.
[0086] The back-to-source service in the embodiment of the present application is a back-to-source service based on disk cache, so the back-to-source service will have an associated disk, that is, the back-to-source service needs to cache the acquired back-to-source resources to the disk, and the disk is the target disk, which is also the target disk associated with the new service and / or the old service. The target disk can be one or more.
[0087] The new service detects whether the current target disk is occupied by the old service, and if so, executes step S203; if not, executes step S204. This step may adopt execution strategies such as periodic execution.
[0088] Step S203: The new service caches the source data in memory.
[0089] If the new service detects that the target disk is currently occupied by the old service, the new service temporarily abandons the operation on the target disk and stores the data to be written to the disk in the memory to avoid competition between the new and old services for the target disk. Then, step S202 is further executed to perform the next detection.
[0090] Step S204: The new service transfers the source data in the memory to the target disk.
[0091] If the new service detects that the target disk is not currently occupied by the old service, indicating that the new and old services are not competing for the target disk, the new service will transfer the back-to-source data in the memory to the target disk. This completes the switch between the new and old services, and the new service will subsequently provide back-to-source services according to the existing method.
[0092] It can be seen that the back-to-source service update method based on disk cache provided in the embodiment of the present application starts a new service when the old service is running, and directs new requests to the new service. When the number of requests carried by the old service drops to a corresponding value, the old service is taken offline to achieve smooth switching between the new and old services, avoid service interruptions, and improve the update efficiency of the back-to-source service; and the present application detects by the new service whether the target disk associated with the back-to-source service is occupied by the old service, caches the back-to-source data in the memory when the target disk is occupied by the old service, and synchronizes the data in the memory to the target disk when the target disk is not occupied by the old service, thereby avoiding competition between the new and old services for the target disk, reducing the generation of dirty data, and improving the accuracy of the back-to-source service update.
[0093] Embodiment 2
[0094] Figure 3 The flowchart of a disk cache-based back-to-source service update method provided in the second embodiment of the present application is shown. The method embodiment can be executed at a CDN node in the above-mentioned content distribution network.
[0095] Specifically, Figure 3 As shown, the method comprises the following steps:
[0096] Step S301, starting a new service while the old service is running, and directing new requests to the new service.
[0097] Step S302: When the number of requests received by the old service is lower than a preset threshold, the old service is taken offline, and the service occupation mark of the old service in the target disk is deleted.
[0098] In the embodiment of the present application, when a service occupies a disk, a service occupation mark of the service occupying the disk will be written into the disk. The service occupation mark is identification information that can uniquely locate the service, for example, the service occupation mark can include a service process mark + version number, or it can be a service mark + version number, etc. Among them, the embodiment of the present application does not limit the specific writing location, for example, the service occupation mark can be written into a location such as a flag file of the disk.
[0099] When the old service goes offline, the service occupation flag of the old service will be deleted from the disk associated with it (ie, the target disk), thereby releasing the occupation of the target disk by the old service.
[0100] Step S303, the new service detects whether there is a service occupation mark of the old service in the associated target disk; if so, execute step S304; if not, execute step S305.
[0101] The new service can detect whether there is a service occupation mark of the old service in the target disk by periodicity or other methods. For example, the new service can query whether there is a service occupation mark in the corresponding area of the target disk (such as a flag file, etc.). If the service corresponding to the service occupation mark belongs to the same back-to-source service as the new service, but the service occupation mark is not the service occupation mark of the new service, it is determined that there is a service occupation mark of the old service in the target disk, and step S304 is executed; if there is no service occupation mark on the target disk, or there is a service occupation mark on the target disk but the service pointed to by the service occupation mark belongs to a different back-to-source service from the new service, or there is a service occupation mark on the target disk but the service occupation mark is the service occupation mark of the new service, then in this case it is determined that there is no service occupation mark of the old service on the target disk, and step S305 is executed. In this way, the new service can accurately detect whether the old service occupies the disk without invading the old service.
[0102] Step S304: The new service caches the source data in memory.
[0103] If the new service detects that there is a service occupation mark of the old service in the target disk, indicating that the current target disk is still occupied by the old service, the new service will cache the received return-to-source data that has not yet been entered into the disk into the memory, and execute step S303 again when the next detection cycle is reached or the next detection condition is met (such as receiving a detection instruction, etc.).
[0104] Step S305: The new service transfers the source data in the memory to the target disk, and adds a service occupation mark of the new service in the target disk.
[0105] If the new service detects that the service occupation mark of the old service does not exist in the target disk, indicating that the current target disk is not occupied by the old service, the new service will transfer the back-to-source data in the memory to the target disk and add the service occupation mark of the new service in the target disk. The service occupation mark can be: the process mark of the new service + version number, or the service mark of the new service + version number, etc.
[0106] In an optional implementation, in order to improve the accuracy of transferring the source data in the memory to the target disk, this implementation adopts a matching transfer method according to the type of the source service. Figure 4 As shown in steps S3051-S3055:
[0107] S3051, identifying the first category of data and / or the second category of data from the returned source data; wherein the data identifier of the first category of data exists in the target disk, and the data identifier of the second category of data does not exist in the target disk.
[0108] When transferring data, the source data stored in the memory can be divided into the first category of data and / or the second category of data. The data identifier of the first category of data already exists in the target disk, that is, the target disk already stores the disk data corresponding to the data identifier of the first category of data; the data identifier of the second category of data does not exist in the target disk, that is, the target disk does not store the disk data corresponding to the data identifier of the first category of data. Among them, the data identifier is used to determine the uniqueness of the data, for example, the data identifier can be a data key, etc.
[0109] In the specific identification process, the index data of the target disk can be obtained, and the index data includes the data identifier of each piece of data stored in the target disk. By comparing the data identifier of each piece of data in the source data with the index data of the target disk, the first category of data and / or the second category of data can be quickly and accurately determined.
[0110] S3052, determine the service type of the back-to-source service; if it is a video-on-demand type, execute S3053; if it is a live broadcast type, execute S3054.
[0111] Determine the service type of the back-to-source service to which the new service and the old service belong, which includes on-demand type and live type. Different transfer methods are used according to different service types.
[0112] S3053: Use the data content of the first type of data to overwrite the data content of the corresponding data identifier in the target disk.
[0113] If the service type is on-demand type, the new service uses the data content of the first-class data to overwrite the data content of the corresponding data identifier in the target disk, and replaces the data content of the data identifier in the target disk with the data memory of the first-class data in the memory. That is, for the data identifier that appears in both the memory and the disk, the disk data is replaced with the memory data. For example, if the data identifier k1 appears in both the memory back to the source data and the disk, the memory data corresponding to the data identifier k1 is called the first-class data. The disk originally stores the data content v1 corresponding to k1, and the data content v2 corresponding to the first-class data k1 is used to replace v1. After the replacement, the data content corresponding to k1 in the disk is v2. Further optionally, before overwriting, the first hash value (such as MD5 value) of the first-class data and the second hash value of the disk data with the same data identifier can be calculated respectively. If the first hash value is the same as the second hash value, it indicates that the memory data and the disk data of the data identifier are the same, and the overwriting of the first-class data is abandoned; if the first hash value is different from the second hash value, it indicates that the memory data and the disk data of the data identifier are different, and the overwriting of the first-class data is performed.
[0114] S3054, for any first-category data, determine whether the memory write time of the first-category data is later than the disk write time of the disk data with the same data identifier in the target disk; if so, use the data content of the first-category data to overwrite the data content of the corresponding data identifier in the target disk; if not, discard the first-category data.
[0115] If the service type is a live broadcast type, for data identifiers that exist in both memory and disk, compare the memory write time of the first category of data of the data identifier in memory with the disk write time of the disk data of the data identifier in disk. If the memory write time is later than the disk write time, use the first category of data to overwrite the data in the target disk; otherwise, discard the first category of data and do not write it to disk.
[0116] Specifically, for each first-category data, the memory write time T1 of the first-category data being written into the memory is extracted, and the disk write time T2 of the disk data having the same data identifier as the first-category data is determined. If T1>T2, indicating that the memory write time is later than the disk write time, the first-category data in the memory is new data, and the data content of the corresponding data identifier in the target disk is overwritten with the data content of the first-category data, that is, the data corresponding to the data identifier in the disk is replaced by the disk data with the first-category data in the memory; if T1≤T2, indicating that the memory write time is earlier than or equal to the disk write time, the first-category data in the memory is old data, and the data in the disk is new data, and the first-category data is not processed into the disk, and the data corresponding to the data identifier in the disk is still the original disk data. Further optionally, before overwriting, the first hash value (such as MD5 value) of the first category data and the second hash value of the disk data with the same data identifier can be calculated respectively. If the first hash value is the same as the second hash value, indicating that the in-memory data and the disk data identified by the data are the same, the overwriting of the first category data is discarded; if the first hash value is different from the second hash value, indicating that the in-memory data and the disk data identified by the data are different, the first category data is overwritten.
[0117] S3055, write the second type of data of the return source data in the memory into the target disk.
[0118] Since there is no data identifier of the second type of data in the disk, the second type of data can be directly written into the target disk.
[0119] After transferring the source data in the memory to the target disk, the target disk index data after the data transfer is updated, and the updated target disk index data is loaded so that the new service can operate the target disk according to the index data.
[0120] It can be seen that the disk cache-based back-to-source service update method provided in the embodiment of the present application adds a service occupation flag in the target disk when the old service is not offline. The new service can accurately determine whether the target disk is occupied by detecting the service occupation flag in the target disk, thereby further avoiding disk competition between the new and old services and improving the disk cache accuracy.
[0121] Embodiment 3
[0122] Figure 5 The flowchart of a disk cache-based back-to-source service update method provided in the third embodiment of the present application is shown. The method embodiment can be executed at a CDN node in the above-mentioned content distribution network.
[0123] Specifically, Figure 5 As shown, the method comprises the following steps:
[0124] Step S501, starting a new service while the old service is running, and directing new requests to the new service. The old service is taken offline when the number of requests it receives is lower than a preset threshold.
[0125] Step S502, the new service detects whether there is a running process of the old service; if so, execute step S503; if not, execute step S504.
[0126] When the old service is running normally, there is usually a running process of the old service. In this embodiment, the running process of the old service is detected to determine whether the current old service occupies the target disk. Among them, the new service can use periodic methods to detect whether there is a running process of the old service.
[0127] Specifically, the new service detects the process information of the currently running running process. If it is detected that the back-to-source service corresponding to a running process is the same as the back-to-source service corresponding to the new service, and the running process is not the running process of the new service, then the running process is determined to be the running process of the old service, and step S503 is executed; otherwise, step S504 is executed. Thus, the new service can accurately detect whether the old service occupies the disk without intruding into the old service.
[0128] Step S503: The new service caches the source data in memory.
[0129] If the new service detects the existence of a running process of the old service, indicating that the current target disk is still occupied by the old service, the new service will cache the received return-to-source data that has not yet been entered into the disk into the memory, and execute step S502 again when the next detection cycle is reached or the next detection condition is met (such as receiving a detection instruction, etc.).
[0130] Step S504: The new service transfers the source data in the memory to the target disk.
[0131] If the new service does not detect the running process of the old service, indicating that the current target disk is not occupied by the old service, the new service transfers the back-to-source data in the memory to the target disk. The specific transfer process can refer to the description in other embodiments, which will not be repeated here.
[0132] It can be seen that the disk cache-based back-to-source service update method provided in the embodiment of the present application is that the new service can accurately determine whether the target disk is occupied by detecting the running process of the old service, thereby further avoiding disk competition between the new and old services and improving the disk cache accuracy; and, detecting the disk occupancy of the old service will not intrude into the original logic and code of the old service, thereby ensuring service accuracy.
[0133] Embodiment 4
[0134] Figure 6A flowchart of a disk cache-based back-to-source service update method provided in Embodiment 4 of the present application is shown. This method embodiment can be executed at a CDN node in the above-mentioned content distribution network to achieve smooth switching of new and old back-to-source services based on disk cache.
[0135] Specifically, Figure 6 As shown, the method comprises the following steps:
[0136] Step S601, start a new service while the old service is running, and direct new requests to the new service. When the number of requests received by the old service is lower than a preset threshold, the old service is taken offline, and the service occupation mark of the old service in the target disk is deleted.
[0137] In the embodiment of the present application, the service occupation identifier and the running process are combined to comprehensively determine whether the target disk is occupied by the old service.
[0138] Step S602, the new service detects whether there is a service occupation mark of the old service in the associated target disk; if so, execute step S603; if not, execute step S606.
[0139] Step S603, the new service detects whether there is a running process of the old service; if so, execute step S604; if not, execute step S605.
[0140] After detecting that there is a service occupation mark of the old service in the target disk, the new service further detects whether there is a running process of the old service. If so, step S604 is executed; if not, step S605 is executed.
[0141] Step S604: The new service caches the source data in memory.
[0142] If the target disk has a service occupation mark of the old service and there is currently a running process of the old service, indicating that the old service is still occupying the target disk, the new service will cache the source data in the memory.
[0143] Step S605: the new service deletes the service occupation mark of the old service in the target disk, transfers the back-to-source data in the memory to the target disk, and adds the service occupation mark of the new service in the target disk.
[0144] If the target disk has the service occupation mark of the old service, but there is no running process of the old service, it indicates that the old service has been abnormally offline. At this time, in addition to transferring the back-to-source data in the memory to the target disk, the new service also deletes the service occupation mark of the old service in the target disk and adds the service occupation mark of the new service in the target disk.
[0145] In this case, if the old service exits abnormally, the credibility of the data in the disk is lower than that in the memory. Therefore, when transferring the source data in the memory to the target disk, the second transfer method is used. The second transfer method is: identifying the first type of data and / or the second type of data from the source data, the data identifier of the first type of data exists in the target disk, and the data identifier of the second type of data does not exist in the target disk. The new service uses the data content of the first type of data to overwrite the data content of the corresponding data identifier in the target disk, and writes the second type of data of the source data in the memory to the target disk, thereby ensuring the final data accuracy.
[0146] Step S606: The new service transfers the source data in the memory to the target disk.
[0147] If the target disk does not contain the service occupation mark of the old service, it indicates that the old service has been exited normally and no longer occupies the target disk. In this case, the new service will transfer the back-to-source data in the memory to the target disk.
[0148] Among them, the data transfer method of this step S606 is different from the data transfer method of step S605. The data transfer method of this step S606 can be called the first transfer method. The first transfer method is: identify the first category data and / or the second category data from the return source data; determine the service type of the source service; if the service type is on-demand type, the new service uses the data content of the first category data to overwrite the data content of the corresponding data identifier in the target disk; if the service type is live type, the new service is for any first category data, and determines whether the memory write time of the first category data is later than the disk write time of the disk data with the same data identifier in the target disk; if so, use the data content of the first category data to overwrite the data content of the corresponding data identifier in the target disk; if not, discard the first category data; write the second category data of the return source data in the memory to the target disk. The specific implementation process of the first transfer method can be referred to. Figure 4 The steps shown and the related description in Example 2 are not repeated here.
[0149] It can be seen that the disk cache-based back-to-source service update method provided in the embodiment of the present application combines the service occupancy identification and the running process to comprehensively determine whether the target disk is occupied by the old service, thereby improving the disk occupancy identification accuracy; and according to the different situations of normal exit and abnormal exit of the old service, a matching data transfer method is adopted to improve data accuracy.
[0150] Embodiment 5
[0151] Figure 7 The schematic diagram of the structure of a disk cache-based back-to-source service update device provided in the fifth embodiment of the present application is shown. Figure 7As shown, the device 700 includes: a new service module 710 and an old service module 720 .
[0152] The new service module 710 starts a new service during the operation of the old service and directs the new request to the new service; the new service detects whether the associated target disk is occupied by the old service; if so, the new service caches the back-to-source data in the memory; if not, the new service transfers the back-to-source data in the memory to the target disk;
[0153] The old service module 720 is used to perform offline processing when the number of requests received by the old service is lower than a preset threshold; wherein the old service and the new service belong to the same back-to-source service.
[0154] In an optional implementation, the new service module 710 is used for: the new service detecting whether there is a service occupation mark of the old service in the associated target disk;
[0155] If so, the new service executes a step of caching the source data into the memory;
[0156] If not, the step of transferring the back-to-source data in the memory to the target disk is executed.
[0157] In an optional implementation, the old service module 720 is used to: when the number of requests received by the old service is lower than a preset threshold, perform offline processing and delete the service occupation mark of the old service in the target disk.
[0158] In an optional implementation, the new service module 710 is used for: if not, the new service transfers the back-to-source data in the memory to the target disk, and adds a service occupation mark of the new service in the target disk.
[0159] In an optional implementation, the new service module 710 is used to: the new service identifies the first category of data and / or the second category of data from the source data; wherein the data identifier of the first category of data exists in the target disk, and the data identifier of the second category of data does not exist in the target disk;
[0160] Determine the service type of the back-to-source service;
[0161] If the service type is a video-on-demand type, the new service overwrites the data content of the corresponding data identifier in the target disk with the data content of the first type of data;
[0162] If the service type is a live broadcast type, the new service determines, for any first-category data, whether the memory write time of the first-category data is later than the disk write time of the disk data with the same data identifier in the target disk; if so, overwrite the data content of the corresponding data identifier in the target disk with the data content of the first-category data; if not, discard the first-category data;
[0163] The second type of data in the memory returning to the source data is written to the target disk.
[0164] In an optional implementation, the new service module 710 is used for: the new service to detect whether there is a running process of the old service;
[0165] If so, the new service executes a step of caching the source data into the memory;
[0166] If not, the step of transferring the back-to-source data in the memory to the target disk is executed.
[0167] In an optional implementation, the new service module 710 is used for: the new service detecting whether there is a service occupation mark of the old service in the associated target disk;
[0168] If so, the new service detects whether there is a running process of the old service; if so, the new service executes a step of caching the back-to-source data in the memory; if not, the service occupation mark of the old service in the target disk is deleted, and the new service executes a step of transferring the back-to-source data in the memory to the target disk;
[0169] If not, the step of transferring the back-to-source data in the memory to the target disk is executed.
[0170] It can be seen that the back-to-source service update device based on disk cache provided in the embodiment of the present application starts a new service when the old service is running, and directs new requests to the new service. When the number of requests carried by the old service drops to a corresponding value, the old service is taken offline, thereby achieving smooth switching between the new and old services, avoiding service interruptions, and improving the update efficiency of the back-to-source service. In addition, the present application detects by the new service whether the target disk associated with the back-to-source service is occupied by the old service, and caches the back-to-source data in the memory when the target disk is occupied by the old service, and synchronizes the data in the memory to the target disk when the target disk is not occupied by the old service, thereby avoiding competition between the new and old services for the target disk, reducing the generation of dirty data, and improving the accuracy of the back-to-source service update.
[0171] Embodiment 6
[0172] Figure 8The schematic diagram of the structure of a computing device provided in Embodiment 6 of the present application is shown. The specific embodiments of the present application do not limit the specific implementation of the computing device.
[0173] like Figure 8 As shown, the computing device may include: a processor (processor) 802 , a communication interface (Communications Interface) 804 , a memory (memory) 806 , and a communication bus 808 .
[0174] Wherein: the processor 802, the communication interface 804, and the memory 806 communicate with each other through the communication bus 808. The communication interface 804 is used to communicate with other devices such as a client or other server network elements. The processor 802 is used to execute the program 810, which can specifically execute the relevant steps in the above-mentioned disk cache-based back-to-source service update method embodiment for a computing device.
[0175] Specifically, the program 810 may include program codes, which include computer operation instructions.
[0176] The processor 802 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the computing device may be processors of the same type, such as one or more CPUs; or may be processors of different types, such as one or more CPUs and one or more ASICs.
[0177] The memory 806 is used to store the program 810. The memory 806 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. The program 810 can be specifically used to enable the processor 802 to perform the operations in the above method embodiment.
[0178] Embodiment 7
[0179] Embodiment 7 of the present application provides a non-volatile computer storage medium, which stores at least one executable instruction or computer program, and the executable instruction or computer program enables the processor to perform operations corresponding to the disk cache-based back-to-source service update method in any of the above method embodiments.
[0180] Embodiment 8
[0181] Embodiment 8 of the present application provides a computer program product, which includes at least one executable instruction or computer program, which enables a processor to perform operations corresponding to the disk cache-based back-to-source service update method in any of the above method embodiments.
[0182] To summarize, according to the computing device, computer storage medium and computer program product provided by this embodiment, a new service is started when the old service is running, and new requests are directed to the new service. When the number of requests carried by the old service drops to a corresponding value, the old service is taken offline to achieve smooth switching between the old and new services, avoid service interruptions, and improve the update efficiency of the back-to-source service. In addition, the new service detects whether the target disk associated with the back-to-source service is occupied by the old service, and caches the back-to-source data in the memory when the target disk is occupied by the old service. When the target disk is not occupied by the old service, the data in the memory is synchronized to the target disk, thereby avoiding competition between the new and old services for the target disk, reducing the generation of dirty data, and improving the accuracy of the back-to-source service update.
[0183] The algorithm or display provided here are not inherently related to any specific computer, virtual system or other equipment. Various general systems can also be used together with the teaching based on this. According to the above description, it is obvious to construct the structure required for this type of system. In addition, the present application embodiment is not directed to any specific programming language yet. It should be understood that various programming languages can be utilized to realize the content of the present application described here, and the above description of specific languages is to disclose the best mode of implementation of the present application.
[0184] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0185] Similarly, it should be understood that in order to streamline the present application and help understand one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the embodiments of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be interpreted as reflecting the following intention: the claimed application requires more features than the features clearly stated in each claim. More specifically, as reflected in the claims below, the inventive aspects are less than all the features of the single embodiment disclosed above. Therefore, the claims following the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present application.
[0186] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0187] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present application and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0188] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components according to the embodiments of the present application. The application can also be implemented as a device or apparatus program (e.g., computer program and computer program product) for executing a part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0189] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and that those skilled in the art may design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be constructed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of multiple such elements. The present application may be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim that lists several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.
Claims
1. A disk cache-based back-to-source service update method, characterized in that: include: During the operation of the old service, the new service is started, and new requests are directed to the new service. When the number of requests received by the old service is lower than a preset threshold, the old service is taken offline; wherein the old service and the new service belong to the same back-to-source service; The new service detects whether the associated target disk is occupied by the old service; If so, the new service caches the source data in memory; If not, the new service transfers the back-to-source data in the memory to the target disk.
2. The method according to claim 1, characterized in that The new service detecting whether the associated target disk is occupied by the old service includes: the new service detecting whether there is a service occupation mark of the old service in the associated target disk; If so, the new service executes a step of caching the source data into the memory; If not, the step of transferring the back-to-source data in the memory to the target disk is executed.
3. The method according to claim 2, characterized in that When the number of requests received by the old service is lower than a preset threshold, the old service is offlined including: When the number of requests received by the old service is lower than a preset threshold, the old service is offlined and the service occupation mark of the old service in the target disk is deleted.
4. The method according to claim 2 or 3, characterized in that: If not, the new service transfers the source data in the memory to the target disk, including: If not, the new service transfers the source data in the memory to the target disk, and adds a service occupation mark of the new service in the target disk.
5. The method according to any one of claims 2 to 4, characterized in that: The new service transfers the source data in the memory to the target disk including: The new service identifies the first category of data and / or the second category of data from the return-to-source data; wherein the data identifier of the first category of data exists in the target disk, and the data identifier of the second category of data does not exist in the target disk; Determine the service type of the back-to-source service; If the service type is a video-on-demand type, the new service overwrites the data content of the corresponding data identifier in the target disk with the data content of the first type of data; If the service type is a live broadcast type, the new service determines, for any first-category data, whether the memory write time of the first-category data is later than the disk write time of the disk data with the same data identifier in the target disk; if so, overwrite the data content of the corresponding data identifier in the target disk with the data content of the first-category data; if not, discard the first-category data; The second type of data in the memory returning to the source data is written to the target disk.
6. The method according to any one of claims 1 to 5, characterized in that The new service detecting whether the associated target disk is occupied by the old service includes: the new service detecting whether there is a running process of the old service; If so, the new service executes a step of caching the source data into the memory; If not, the step of transferring the back-to-source data in the memory to the target disk is executed.
7. The method according to any one of claims 1 to 6, characterized in that The new service detects whether the associated target disk is occupied by the old service, including: The new service detects whether there is a service occupation identifier of the old service in the associated target disk; If so, the new service detects whether there is a running process of the old service; if so, the new service executes a step of caching the back-to-source data in the memory; if not, the service occupation mark of the old service in the target disk is deleted, and the new service executes a step of transferring the back-to-source data in the memory to the target disk; If not, the step of transferring the back-to-source data in the memory to the target disk is executed.
8. A back-to-source service update device based on disk cache, characterized in that: include: A new service module, which starts a new service while the old service is running and directs new requests to the new service; The new service detects whether the associated target disk is occupied by the old service; if so, the new service caches the back-to-source data in the memory; if not, the new service transfers the back-to-source data in the memory to the target disk; The old service module is used for offline processing when the number of requests received by the old service is lower than a preset threshold; wherein the old service and the new service belong to the same back-to-source service.
9. A computing device, characterized in that include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the disk cache-based back-to-source service update method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The storage medium stores at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the disk cache-based back-to-source service update method according to any one of claims 1 to 7.
11. A computer program product, characterized in that It includes at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the disk cache-based back-to-source service update method as described in any one of claims 1-7.