Disclosure of Invention
The invention aims to provide a new network structure for streaming media and a data storage method, so as to reduce the burden of a network.
According to an aspect of the present invention, there is provided a network structure for streaming media, comprising:
an SLB (local load balancer) layer including at least one SLB, the SLB storing content state information and load information of the content stored in the network structure, the SLB receiving user access, scheduling the user access according to the content state information and the load information, and controlling downloading of the content;
a CACHE layer comprising a plurality of CACHEs, wherein one CACHE is defined as a primary CACHE, and the plurality of CACHEs are connected with each of the at least one SLB; the main CACHE and other CAHCEs establish a communication link, receive content information currently processed by other CACHEs and generate state information of all the contents; the main CACHE also establishes a communication link with the SLB and reports the content state information and the load information of each CACHE to the SLB, and the SLB updates the load information of the original content state information by using the content state information and the load information reported by the main CACHE and schedules user access according to the content state information and the load information; the main CACHE controls the downloading of contents by other CACHEs;
the memory layer comprises at least one memory, the memory is connected with the CACHEs, and all contents in the network structure are uniformly stored in the memory;
the main CACHE issues announcements to other CACHEs through a broadcasting mechanism, identifies the main CACHE as the main CACHE, and scans and records all contents stored on a current memory; if the main CACHE exits the network structure, one of the other CACHEs issues an announcement through a broadcast mechanism to become a new main CACHE.
In the above network structure, communication links are established between the plurality of CACHE and SLB to maintain communication.
In the above network structure, when the SLB receives the user access, the SLB schedules the user access to a proper CACHE according to the content status information and the load information; if the content needs to be downloaded, the SLB informs the main CACHE to download the content, and then the main CACHE selects a proper CAHCE to download through communication with other CACHEs; when a certain CACHE receives a downloading command of the main CACHE, the content is immediately downloaded, and the state of the task execution is reported to the main CACHE, so that the main CACHE can master the content downloading condition of other CACHEs at present.
According to a second aspect of the present invention, there is provided a method for storing streaming media data, which is used in a network structure in which all CACHE use a common memory, the network structure further including an SLB, the method including the steps of:
a1) when a CACHE starts to be started, firstly detecting whether a main CACHE already exists in the current network structure by using a broadcast communication mechanism, if so, performing step a2), and if not, performing step a 5);
a2) the CACHE immediately establishes communication with other existing CACHEs in a network structure, continuously detects whether the work of the main CACHE is normal by using a broadcasting mechanism, and prepares to receive a content downloading management instruction of the main CACHE;
a3) the CACHE and the SLB establish communication;
a4) after the communication between the CACHE and the SLB is established, immediately reporting the health condition and the load and preparing to provide service;
a5) if the main CACHE detected in the step a1 does not exist, the CACHE is immediately switched to the main CACHE, and simultaneously, a broadcast mechanism is used for issuing announcements to other CACHEs in the network structure to identify the CACHE as the main CACHE;
a6) the CACHE scans all the contents stored in the current storage and records the contents in the memory;
a7) the CACHE and other CAHCEs in the network structure establish a communication link and receive content information which is processed by other CACHEs at present; through the report of the CACHEs, content state information of all contents in the current network structure is generated;
a8) the CACHE is used as a main CACHE to establish connection with the SLB, the content state information and the load information of each CACHE are reported through the connection with the SLB, the SLB uses the reported content state information and load information to update the original content state information and load information, and the SLB schedules user access according to the content state information and the load information;
a9) when the user access reaches the SLB, the SLB can schedule the user access to a proper CACHE according to the content state information and the load information, and if the content needs to be downloaded, the SLB controls the downloading of the content;
a10) the CACHE in the network structure performs the downloading of the content;
if the main CACHE exits the service, one of the other CACHEs will issue an announcement through a broadcasting mechanism to take over the main CACHE to continue working, and the steps a5-a10 are repeated.
Wherein, a communication link is established between the CACHE and the SLB to maintain communication; wherein the step a9 in which the SLB controls the downloading of the content further comprises: SLB will schedule users to visit the appropriate CACHE according to content status information and load information, if needing to download the content, SLB will notify the main CACHE to download the content first, then the main CACHE chooses the appropriate CAHCE to download through communicating with other CACHEs; the CACHE performing the downloading of the content in the step a10 further comprises: when a non-main CACHE in the network receives a downloading command of the main CACHE, the non-main CACHE immediately starts to download contents and reports the state of the task execution to the main CACHE, so that the main CACHE can master the content downloading condition of other CACHEs at present.
According to a third aspect of the present invention, there is provided a network structure for streaming media, comprising:
an SLB layer including at least one SLB, the SLB storing content state information and load information of the content stored in the network structure, the SLB receiving user access and scheduling the user access according to the content state information and the load information, the SLB further including a CCM controlling downloading of the content;
a CACHE layer comprising a plurality of CACHEs connected to each of the at least one SLB; establishing communication links among the CACHEs, receiving content information currently processed by other CACHEs, storing content state information of all contents stored in the network structure in the CCM in the SLB, and controlling the CACHEs to download the contents;
the network structure also comprises memories, the number of which is equal to that of the CACHEs, the memories are connected with the CACHEs in a one-to-one correspondence manner, and each memory is specially used for storing the content of one CACHE.
In the above network architecture, the memories are incorporated in CACHEs, each of which includes a dedicated memory.
In the above network structure, communication links are established between the plurality of CACHE and the SLB to maintain communication.
According to the fourth aspect of the present invention, there is provided a method for storing streaming media data, which is used in a network structure including an SLB, a plurality of CACHE memories and a memory, wherein the SLB includes a CCM for controlling content downloading by the CACHE memories, the number of the memory memories is equivalent to the number of the CACHE memories, and the memory memories are connected to the CACHE memories in a one-to-one correspondence manner, each memory exclusively stores the content of one CACHE memory, the method includes the following steps:
b1) when a CACHE device starts to join the network structure for service, firstly establishing communication with the SLB in the network structure;
b2) if the SLB is in an inactive state or a work not ready state at the moment, the CACHE can continue to start, record the current state of the SLB and the state of the SLB which are not successfully communicated, and then try to establish communication with the SLB at intervals in the background;
b3) after the CACHE is started, scanning all contents in a memory corresponding to the current CACHE, recording the size, actually occupied storage space and storage directory of each content, and calculating a service domain to which the content belongs according to the directory stored by the content and original configuration information;
b4) after the CACHE scans all the content information in the memory, the current state of the SLB is checked, and if the SLB is found to be in a normal communication state, all the content information on the memory corresponding to the CACHE is reported to the SLB immediately;
b5) after the SLB obtains the content storage condition on each CACHE, the SLB sorts the content on all CACHEs in the whole network structure, and schedules the user in turn according to the content, when the user access request reaches the SLB, the SLB queries a CCM module to obtain a CAHCE for storing the content, judges whether the working state and the load capacity of the current CACHE are enough, and schedules the user to the CACHE for receiving the service if the conditions are met;
b6) when CACHE needs to download a content, firstly CACHE sends a request for requesting content download to SLB, and starts downloading after SLB responds;
b7) after receiving the download request of the CACHE device, the SLB first checks whether the content already exists on the memories of other CACHEs currently active, and if so, rejects the content download request of the CACHE. If all CACHEs do not store the content file, and the memory space of the CACHE requested to be downloaded is remained and meets the service condition, the SLB will agree with the content downloading request of the CACHE;
b8) after SLB returns the response of the content download request, CACHE will carry on the corresponding treatment, if SLB has returned and refused the response, CACHE will not download any more, if answer permit, CACHE will start the task downloaded to the content, after the task is started successfully, CACHE will report SLB is in the download process at present, the content data is incomplete at this moment, still can not provide the service for users, and SLB knows the message, will not redistribute users to the CACHE;
b9) when CACHE downloads the content, if the downloading fails, CACHE performs corresponding processing and reports to SLB in time, and SLB deletes the content from the content information list of CCM after receiving the downloading failure message;
b10) if CACHE exits the network structure in the process of downloading a certain content, SLB will not continue to receive the communication state of CACHE, if SLB finds that the CACHE state is not in the working state, SLB will mark the content information on the CACHE as invalid state immediately;
b11) when a user access request reaches the network structure, the SLB is accessed firstly, the SLB can be scheduled firstly according to the distribution situation of the current content, meanwhile, if the content which the user requests to access does not exist in the network structure, a CCM module of the SLB determines whether the content needs to be downloaded, if the content needs to be downloaded, the CCM module can select a CACHE suitable for downloading the content according to the distribution situation of the current content on a plurality of CACHEs and the resources and loads on the CACHEs, and sends a content downloading request.
Wherein, the CACHE and the SLB establish a communication link to maintain communication; the CACHE in step b4 reports to the SLB all the content information on the memory corresponding to the CACHE, including the name of each content file, the service domain to which the file belongs, the actual size of the file, and the size of the occupied storage space, and converts the information into description information unrelated to the local disk, and sends the description information to the SLB, and the description information is synchronized with the SLB.
The technical scheme of the invention is adopted to provide a new network structure for the streaming media and a data storage method, so as to reduce the burden of the network and realize a cluster cache service system.
Detailed Description
The technical scheme of the invention is further explained by combining specific examples.
First, the present invention provides a technology for preventing repeated downloading and storing of the same content between different CACHEs, thereby saving network resources.
Referring to fig. 1, the present invention provides a network architecture 100 for streaming media, comprising:
an SLB layer including at least one SLB 102, the SLB 102 storing content status information and load information of the content stored in the network structure 100, the SLB 102 receiving the user access and scheduling the user access according to the content status information and the load information, the SLB 102 further including a CCM 103 controlling the downloading of the content;
a CACHE layer comprising a plurality of CACHEs 104a, 104b, 104c connected to each of the at least one SLB 102; communication links are established among the CACHEs, content information which is processed by other CACHEs at present is received, the CCM 103 in the SLB 102 stores content state information of all contents stored in the network structure and controls the CACHEs to download the contents;
network architecture 100 also includes memories 106, equal in number to the number of CACHEs 104, connected to CACHEs 104 in a one-to-one correspondence, each memory storing the contents of a single CACHE exclusively.
Fig. 2 shows a variation of the above network architecture, in which the memory 106 is incorporated in the CACHE 104, each CACHE 104 comprising a dedicated memory 106. The embodiment shown in fig. 1 and 2 is the same in terms of operating principle.
In the network structure shown in fig. 1 or fig. 2, communication links are established between several CACHE 104 and SLB 102 to maintain communication.
In the above network structure, the following data storage method can be implemented:
a storage method of stream media data is used in network structure including SLB, several CACHEs and memory, SLB includes a CCM to control CACHE to download content, the number of memory is equal to the number of CACHE, and one-to-one correspondence is connected with CACHE, each memory specially stores the content of a CACHE, the method includes following steps:
b1) when a CACHE device starts to join the network structure for service, firstly establishing communication with the SLB in the network structure;
b2) if the SLB is in an inactive state or a work not ready state at the moment, the CACHE can continue to start, record the current state of the SLB and the state of the SLB which are not successfully communicated, and then try to establish communication with the SLB at intervals in the background;
b3) after the CACHE is started, scanning all contents in a memory corresponding to the current CACHE, recording the size, actually occupied storage space and storage directory of each content, and calculating a service domain to which the content belongs according to the directory stored by the content and original configuration information;
b4) after the CACHE scans all the content information in the memory, the current state of the SLB is checked, and if the SLB is found to be in a normal communication state, all the content information on the memory corresponding to the CACHE is reported to the SLB immediately;
b5) after the SLB obtains the content storage condition on each CACHE, the SLB sorts the content on all CACHEs in the whole network structure, and schedules the user in turn according to the content, when the user access request reaches the SLB, the SLB queries a CCM module to obtain a CAHCE for storing the content, judges whether the working state and the load capacity of the current CACHE are enough, and schedules the user to the CACHE for receiving the service if the conditions are met;
b6) when CACHE needs to download a content, firstly CACHE sends a request for requesting content download to SLB, and starts downloading after SLB responds;
b7) after receiving the download request of the CACHE device, the SLB first checks whether the content already exists on the memories of other CACHEs currently active, and if so, rejects the content download request of the CACHE. If all CACHEs do not store the content file, and the memory space of the CACHE requested to be downloaded is remained and meets the service condition, the SLB will agree with the content downloading request of the CACHE;
b8) after SLB returns the response of the content download request, CACHE will carry on the corresponding treatment, if SLB has returned and refused the response, CACHE will not download any more, if answer permit, CACHE will start the task downloaded to the content, after the task is started successfully, CACHE will report SLB is in the download process at present, the content data is incomplete at this moment, still can not provide the service for users, and SLB knows the message, will not redistribute users to the CACHE;
b9) when CACHE downloads the content, if the downloading fails, CACHE performs corresponding processing and reports to SLB in time, and SLB deletes the content from the content information list of CCM after receiving the downloading failure message;
b10) if CACHE exits the network structure in the process of downloading a certain content, SLB will not continue to receive the communication state of CACHE, if SLB finds that the CACHE state is not in the working state, SLB will mark the content information on the CACHE as invalid state immediately;
b11) when a user access request reaches the network structure, the SLB is accessed firstly, the SLB can be scheduled firstly according to the distribution situation of the current content, meanwhile, if the content which the user requests to access does not exist in the network structure, a CCM module of the SLB determines whether the content needs to be downloaded, if the content needs to be downloaded, the CCM module can select a CACHE suitable for downloading the content according to the distribution situation of the current content on a plurality of CACHEs and the resources and loads on the CACHEs, and sends a content downloading request.
In the above method, the CACHE and the SLB establish a communication link; wherein,
the CACHE in step b4 reports to the SLB all the content information on the memory corresponding to the CACHE, including the name of each content file, the service domain to which it belongs, the actual size of the file, and the size of the occupied storage space, and converts it into description information unrelated to the local disk, and sends it to the SLB, and keeps synchronization with the SLB.
Fig. 3 shows a flow chart of a specific embodiment of the method, which is used in a network structure including an SLB and a plurality of CACHE, each having a respective storage space for CACHE service. In order to realize the non-repeated downloading and storage of the contents in the node, a Content Control Module (CCM) is added on the SLB, and the CCM is responsible for the unified Control of the contents on a plurality of CACHEs in the network structure, thereby realizing the function of the non-repeated downloading and storage of the contents in the node.
In order to realize the function of content non-repeated downloading and storage, and realize the content unified management and distribution of CCM to a plurality of CACHEs, firstly, the content control communication between the CACHE and the SLB is needed to be realized. The content control communication between CCM and CACHE adopts IMP (interactive management protocol) protocol. The embodiment shown in fig. 3 comprises the following steps:
301. when the CACHE starts to join the network structure for service, the CACHE first communicates with the SLB in the network structure and establishes connection with the SLB. The process is characterized in that the CACHE immediately communicates with the SLB when being started, and the state change of the CAHCE by the SLB is ensured to be known in time.
302. If the SLB is in an inactive state or work-not-ready state at the moment, the CACHE will continue to start, record the current status of the SLB and the status of the SLB as unsuccessful communication, and then try to establish communication with the SLB at intervals in the background. The process is characterized in that CACHE can process various SLB abnormal conditions and prevent SLB from influencing the work of CACHE under abnormal working state.
And 303, after the CACHE equipment is started, scanning all the stored contents in the current memory space, recording the size of each content in detail, actually occupying the memory space, storing a catalogue, and calculating the service domain to which the content belongs according to the catalogue stored by the content and the original configuration information. The process is characterized in that when the CACHE is started, the CACHE can immediately scan, the stored actual content and the control information are immediately ensured to be consistent, and the service failure caused by the difference between the actually stored content and the control information is well avoided through the mechanism. The method has the other characteristic that the real-time performance of the content control information is greatly improved, the content information is not stored by using a database and a file, but is actually scanned during starting, and the asynchronism of the actual content and the control information is avoided.
And 304, after the CACHE finishes scanning all the content information, checking the current state of the SLB, if the SLB is found to be in a normal communication state, immediately reporting all the content information on the CACHE to the SLB, including the name of each content file, the service domain to which the content file belongs, the actual size of the file and the size of the occupied storage space, converting the content information into description information irrelevant to the local disk, and sending the description information to the SLB to keep synchronization with the SLB. The process is characterized in that after the communication between CACHE and SLB is recovered to normal, the content information on CACHE and SLB can be synchronously updated, the content information on SLB is ensured to be the same as the content actually stored by CACHE, and the content change can not influence the unified management of the content in the time when SLB and CAHCE can not communicate. Meanwhile, in the process, the multiple CACHEs report the time content distribution condition and the disk resource occupation condition of the multiple CACHEs to the SLB, and if the SLB is restarted or communication is recovered, the actual content information on the current CACHEs can be obtained in time, so that the content in the whole node is controlled uniformly.
And 305, after the SLB obtains the content storage condition on each CACHE, the SLB sorts the content on all CACHEs in the whole node, and schedules the user in turn according to the content, when the user access request reaches the SLB, the SLB queries a CCM module to obtain the CAHCE of the content, judges whether the working state and the load capacity of the current CACHE are enough, and schedules the user to the CACHE storing the content to receive the service if the conditions are met.
306. When the CACHE device needs to download a certain content due to some event (the reason for the occurrence is not within the scope of the discussion herein), the CACHE device first sends a request for downloading the content to the SLB, and starts downloading after waiting for the response from the SLB. The process is characterized in that the content downloading of CACHE equipment is strictly under the control of SLB, even if the CACHE generates a reason for downloading, the CACHE still cannot download the content without the permission of SLB, and thus the centralized control of SLB on all the content in the node can be ensured.
After receiving the download request of the CACHE device, the SLB first checks whether the content already exists on other currently active CACHEs, and if so, rejects the content download request of the CACHE. If all CACHEs do not CACHE the content file, and the requested CACHE space for downloading is left, and the service condition is met, the SLB will grant the content downloading request of CACHE. The process is characterized in that the SLB CCM module can check whether the contents on all other CACHEs are repeated with the contents in the downloading request while receiving the content downloading request from the CACHE, thereby ensuring that one content file has only one copy in the same network structure.
308. After SLB returns response of content download request, CACHE will process correspondingly, if SLB returns reject response, CACHE will not download, if answer is allowed, CACHE will start task of downloading the content. After the task is successfully started, the CACHE device will report the SLB, and the content is currently in the process of downloading, at this time, the content data is still incomplete, and the user cannot be provided with service, and after the SLB knows the message, the user is not reallocated to the CACHE. The characteristic of this process is that when the CACHE performs the content downloading process, the downloading state of the content will also be reported to the SLB, and the SLB will perform the corresponding process according to the downloading state, so as to ensure the correct process of the intermediate state of the content downloading.
When the CACHE downloads the content, the downloading may fail due to the network or other reasons, and when the downloading fails, the CACHE also performs corresponding processing and reports to the SLB in time, and the SLB deletes the content from the content information list of the CCM after receiving the downloading failure message. The process is characterized in that when the content downloading process of the CACHE is abnormal, the SLB can be reported at the same time, and the synchronization of the SLB and the content information on the CACHE is ensured.
310. If the CACHE exits the service for some reason in the process of downloading a certain content, the SLB will not continue to receive the communication state of the CACHE, and if the SLB finds that the CACHE state is not in the working state, the SLB immediately marks the content information on the CACHE as an invalid state. The SLB can process the abnormal working state of CACHE equipment to ensure the reliability of service under various conditions.
311. When a certain user access request reaches the node, the user should access the SLB first, the SLB can schedule according to the distribution condition of the current content, meanwhile, if the content which the user requests to access does not exist in the node, the CCM module of the SLB can determine whether the content needs to be downloaded according to some strategies, if the content needs to be downloaded, the CCM module can select a CACHE suitable for downloading the content according to the distribution condition of the current content on a plurality of CACHEs and the resources and loads on the CACHEs, and the content downloading request is sent. The process is characterized in that whether each CACHE needs to be downloaded or not is determined by the CCM of the SLB, so that the condition that a plurality of CACHEs download one content is avoided, and the load condition can be uniformly judged according to the resource use condition of the plurality of CACHEs.
It should be noted that each block in the flowchart shown in fig. 3 does not correspond to one step in the above-mentioned steps, there are several blocks that represent the same step, and there are several steps that are collectively represented by the same block, but it would be obvious to those skilled in the art that the above-mentioned expression does not affect the understanding of the process of the present invention.
With the continuous development of network technology, a comprehensive cluster system including multiple service components, such as CACHE, OCC and the above network structure, is more widely applied, and in the comprehensive cluster system, a shared storage mode can be used for working, in this mode, multiple service components share the same physical storage, and the content downloaded by one CACHE component and other CACHEs can also be accessed, which greatly improves the utilization rate of a disk.
Meanwhile, when the system works in a shared storage mode, conditions are created for network reconstruction and smooth capacity upgrade, and in the shared storage mode, if the flow service capacity is insufficient, the service capacity can be improved directly by adding a server without adding a storage mode, the original storage division is not required to be redeployed, and the existing service content is not influenced.
In the traditional CACHEs, each CACHE is provided with a special storage for storing contents needing CAHCE, the contents of the CACHEs are independent from each other and have no other relation, and the storage owned by each CACHE is planned in advance, the later adjustment can be carried out aiming at each CACHE, with the rapid development of the streaming media service, a plurality of servers use the same physical storage, the plurality of servers form a form similar to a cluster service system, currently, in the telecommunications, internet, industry, short connection based cluster service systems are common, such as web clusters, radius clusters, while a plurality of streaming server cluster systems in the streaming media field have not been precedent, when the servers can also be used as CACHEs, the whole cluster system not only provides only the service, but also encapsulates the caching and management of the content into a whole cluster system for carrying out the function.
Thus, the present invention provides a network architecture 400 for streaming media, comprising:
an SLB layer including at least one SLB 402, where the SLB 402 stores content state information and load information of content stored in the network structure 400, and the SLB 402 receives user access, schedules the user access according to the content state information and the load information, and also controls downloading of the content;
a CACHE layer comprising a plurality of CACHEs 404a, 404b, 404c, wherein one CACHE is defined as a primary CACHE, and the plurality of CACHEs 404 are connected to each of the at least one SLB 402; the main CACHE and other CAHCEs establish a communication link, receive content information currently processed by the other CACHEs and generate state information of all the contents; the main CACHE also establishes a communication link with the SLB 402 and reports the content state information and the load information of each CACHE 404 to the SLB 402, the SLB 402 updates the load information of the original content state information by using the content state information and the load information reported by the main CACHE and schedules user access according to the content state information and the load information; the main CACHE controls the downloading of contents by other CACHEs;
a memory layer including at least one memory 406, wherein the memory 406 is connected to a plurality of CACHE 404, and all contents in the network structure 400 are stored in the memory 406;
the main CACHE issues announcements to other CACHEs through a broadcasting mechanism, identifies itself as the main CACHE, and scans and records all the contents stored in the current memory 406; if the primary CACHE exits network fabric 400, one of the other CACHEs may issue an advertisement through a broadcast mechanism to become the new primary CACHE.
In the above configuration 400, a plurality of CACHE 404 and SLB 402 establish communication links to maintain communication.
In the above structure 400, when the SLB 402 receives the user access, the SLB 402 schedules the user access to the appropriate CACHE according to the content status information and the load information; if the content needs to be downloaded, SLB 402 will inform the main CACHE to download the content, and then the main CACHE will select a proper CAHCE to download through the communication with other CACHEs; when a certain CACHE receives a downloading command of the main CACHE, the content is immediately downloaded, and the state of the task execution is reported to the main CACHE, so that the main CACHE can master the content downloading condition of other CACHEs at present.
According to the network structure, the whole cluster system can be divided into three layers, the first layer is an SLB layer, the second layer is a CACHE service layer, and the third layer is a storage layer, wherein each CACHE in the service layer is directly connected with the SLB and directly connected with storage, a logic area and storage content on the storage are visible for each CACHE, read-write data can be stored in a readable and writable mode, and a plurality of CACHEs are also connected with each other to establish a communication link.
The advantage of this design is that when the capacity of the server is insufficient, the server can be dynamically expanded, and the newly expanded server can immediately use all the content stored in the original storage, rather than needing to download the content again to provide the service, and also does not need to divide a part of the logic area on the original storage to be used by the server again, and the original storage division is not destroyed. If the storage needs to be expanded, all the servers can use the expanded part, and the expansion and the adjustment are very convenient. The SLB is added, so that external access can be averagely shared on all CACHE servers, load balance is realized, the whole organization forms a complete cluster service system, and more importantly, the cluster system is established on the basis of an application layer and can process service information of various application layers.
The invention also provides a storage method of streaming media data, which is characterized in that the method is used in a network structure in which all CACHEs use a common memory, the network structure also comprises an SLB, and the method comprises the following steps:
a1) when a CACHE starts to be started, firstly detecting whether a main CACHE already exists in the current network structure by using a broadcast communication mechanism, if so, performing step a2), and if not, performing step a 5);
a2) the CACHE immediately establishes communication with other existing CACHEs in a network structure, continuously detects whether the work of the main CACHE is normal by using a broadcasting mechanism, and prepares to receive a content downloading management instruction of the main CACHE;
a3) the CACHE and the SLB establish communication;
a4) after the communication between the CACHE and the SLB is established, immediately reporting the health condition and the load and preparing to provide service;
a5) if the main CACHE detected in the step a1 does not exist, the CACHE is immediately switched to the main CACHE, and simultaneously, a broadcast mechanism is used for issuing announcements to other CACHEs in the network structure to identify the CACHE as the main CACHE;
a6) the CACHE scans all the contents stored in the current storage and records the contents in the memory;
a7) the CACHE and other CAHCEs in the network structure establish a communication link and receive content information which is processed by other CACHEs at present; through the report of the CACHEs, content state information of all contents in the current network structure is generated;
a8) the CACHE is used as a main CACHE to establish connection with the SLB, the content state information and the load information of each CACHE are reported through the connection with the SLB, the SLB uses the reported content state information and load information to update the original content state information and load information, and the SLB schedules user access according to the content state information and the load information;
a9) when the user access reaches the SLB, the SLB can schedule the user access to a proper CACHE according to the content state information and the load information, and if the content needs to be downloaded, the SLB controls the downloading of the content;
a10) the CACHE in the network structure performs the downloading of the content;
if the main CACHE exits the service, one of the other CACHEs will issue an announcement through a broadcasting mechanism to take over the main CACHE to continue working, and the steps a5-a10 are repeated.
In the method, a communication link is established between CACHE and SLB to maintain communication;
wherein the step a9 in which the SLB controls the downloading of the content further comprises: SLB will schedule users to visit the appropriate CACHE according to content status information and load information, if needing to download the content, SLB will notify the main CACHE to download the content first, then the main CACHE chooses the appropriate CAHCE to download through communicating with other CACHEs;
the CACHE in step a10 performing the downloading of the content further comprises: when a non-main CACHE in the network receives a downloading command of the main CACHE, the non-main CACHE immediately starts to download contents and reports the state of the task execution to the main CACHE, so that the main CACHE can master the content downloading condition of other CACHEs at present.
Referring to fig. 5, a flow of a data saving method according to an embodiment of the present invention is described below with reference to fig. 5, where the method includes:
501. when the CACHE starts, firstly, a broadcast communication mechanism is used to detect whether a main CACHE exists in the current cluster service system, and if so, step 2 is performed.
502. The CACHE immediately establishes communication with other CACHE devices, and continues to use the broadcast mechanism to detect whether the main CACHE is working properly and to prepare to receive content download management instructions for the main CACHE.
CACHE and SLB establish communication, and SLB module establishes connection.
504. When the communication between CACHE and SLB is established, the health condition and load are reported immediately and the service is ready to be provided.
505. If the detected main CACHE server does not exist in step 501, the system immediately starts to switch to the main CACHE, and simultaneously uses a broadcast mechanism to issue an announcement to the outside to identify the system as the main CACHE state.
506. All the content stored in the current storage is immediately scanned and recorded in the memory, and some content files which are in a downloading state or are not downloaded completely may be scanned.
507. And establishing communication links with other CAHCEs, and receiving content information currently processed by other CACHEs, such as information that a certain content is being downloaded, the downloading is completed and the like. Through the report of the CACHE, all the content state information in the current cluster system is consolidated and combined again.
508. The main CACHE then establishes connection with the SLB and reports content information through the connection with the SLB, the SLB immediately updates the original content data information after encountering the content information reported by the main SLB, and schedules user access according to the content data information, and reports the service load information on the CACHE to the SLB.
509. When the user access reaches the SLB, the SLB will schedule the user access to the appropriate server according to the distribution of the content and the load of each CACHE. If the content needs to be downloaded, the SLB will first inform the main CACHE to download the content, and then the main CACHE selects an appropriate CAHCE to actually download through communication with other CACHEs.
510. When a certain CACHE receives a downloading command of the main CACHE, the content is immediately downloaded, and the state of the task execution is reported to the main CACHE, so that the main CACHE can master the content downloading condition of other CACHEs at present.
511. During the operation of the whole system, if the main CACHE exits the service, other CACHEs will take over the main CACHE to continue working, and step 505 and step 511 are repeated. If other non-CACHEs exit the service, the system is not affected.
It should also be noted that each block in the flowchart shown in fig. 5 does not correspond to one step in the above-mentioned steps, and there are many possible blocks that represent the same step, and there are many possible steps that are represented by the same block, but those skilled in the art will understand that the above-mentioned expression does not affect the understanding of the process of the present invention.
By adopting the technical scheme of the invention, conditions are created for the reconstruction and the smooth upgrade of the capability of the network, and under the mode of using the shared storage, if the streaming service capability is not enough, the service capability can be improved directly by adding the server without adding the storage mode, the original storage division does not need to be redeployed, and the existing service content is not influenced.
In summary, the present invention provides a new network structure and data storage method for streaming media, and a complete cluster cache service system is constructed, which can be used to implement systems that need to smoothly improve service performance and storage capacity.
Although the above embodiments have been described by taking a streaming media service system as an example, the scope to which the present invention can be applied is not limited to only a system in which a streaming media service is used as content.
The embodiments described above are provided to enable persons skilled in the art to make or use the invention and that modifications or variations can be made to the embodiments described above by persons skilled in the art without departing from the inventive concept of the present invention, so that the scope of protection of the present invention is not limited by the embodiments described above but should be accorded the widest scope consistent with the innovative features set forth in the claims.