Main-standby switching method and equipment based on EPG (Electronic Program Guide) service, and computer storage medium
By receiving the main service failure signal in the EPG service system, obtaining and predicting user behavior data, and building switching instructions, seamless switching of main and backup services is achieved, the problems of service interruption and data loss are solved, and system stability and user experience are improved.
Patent Information
- Application Number
- CN202411793661.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-28
AI Technical Summary
The existing EPG service system lacks backup service to take over when the main service fails, resulting in service interruption, users cannot obtain program information normally, and may cause business data to be lost, reducing system stability.
After receiving the main service failure signal, the current session data of the front-end interface is obtained, converted into feature data and inputted to the prediction model, the expected target behavior data in the prediction results are obtained, the switching instructions are constructed and sent to the front-end interface, so that it preloads the expected target behavior data and establishes a connection with the backup service.
It realizes a seamless transition when switching between main and standby services, avoids user waiting time and experience gaps, and improves service continuity and fluency.
Smart Images

Figure CN119729025A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of television broadcasting technology, and in particular to a method, device and computer storage medium for switching between a primary and a secondary device based on an EPG service. Background Art
[0002] The current EPG service system usually adopts a single server architecture, that is, a main EPG service instance is responsible for providing all program information. This architecture can meet user needs under normal circumstances, but once the main EPG service fails, such as sudden damage to server hardware, software crash or network connection interruption, the service will be interrupted because there is no backup service to take over in time, and users will not be able to obtain program information normally. At the same time, it may also cause business data loss and reduce the stability of the entire system. Summary of the invention
[0003] The main purpose of this application is to provide a primary-backup switching method, device and computer storage medium based on EPG service, aiming to solve the technical problem of how to achieve seamless switching of primary and backup services in EPG service.
[0004] To achieve the above object, an embodiment of the present application provides a primary-standby switching method based on an EPG service, and the primary-standby switching method based on an EPG service includes: After receiving the fault signal from the main service, obtain the current session data of the front-end interface; Converting the session data into feature data and inputting the feature data into a prediction model to obtain a prediction result of the feature data; According to the prediction result, obtaining the expected target behavior data corresponding to the prediction result; A switching instruction including the expected target behavior data is constructed, and the switching instruction is sent to the front-end interface, so that the front-end interface is preloaded with the expected target behavior data and establishes a connection with the backup service.
[0005] In one embodiment, after receiving the fault signal of the primary service, before the step of obtaining the current session data of the front-end interface, the step includes: Send a heartbeat request to the main service according to a preset sending cycle, and when the sending operation of the heartbeat request is triggered within a single preset sending cycle, construct a heartbeat request data packet; After sending the heartbeat request data packet to the primary service, monitoring the network interface of the primary service; If the heartbeat response data packet of the primary service is not received within the preset response period or the heartbeat response data packet is abnormal, it is determined that the primary service is faulty.
[0006] In one embodiment, after sending the heartbeat request data packet to the primary service, the step of monitoring the network interface of the primary service includes: When sending a heartbeat request data packet to the primary service, synchronously start a timer to record a starting timestamp when sending the heartbeat request data packet; Monitor the data packet inflow of the network interface of the primary service, extract the response identifier of each data packet, and match it with the request identifier in the heartbeat request data packet to identify whether the data packet is a heartbeat response data packet of the primary service; If the heartbeat response data packet is not matched within the preset response period, the timer stops after running to the preset response period; If the heartbeat response data packet is matched within the preset response period, stop the timer and record the termination timestamp when the heartbeat response data packet is received; Based on the start timestamp and the end timestamp, a response time of the heartbeat request is calculated.
[0007] In one embodiment, before the step of converting the session data into feature data and inputting the feature data into a prediction model to obtain a prediction result of the feature data, the following steps are included: Traverse the program browsing records in the historical behavior data, count the browsing time of each program type, and calculate the program type preference characteristics; Calculate the number of operations of the conversation interaction in each preset time interval in the historical behavior data to obtain a historical active time period, wherein the historical active time period includes the preset time interval in which the number of operations exceeds the average active threshold; Acquire the operation sequence of the current session interaction, and match the operation sequence with a preset operation path pattern to obtain a matching result; Based on at least one of the program type preference feature, the historical active time period, and the matching result, feature data of the session data is constructed.
[0008] In one embodiment, the step of acquiring the expected target behavior data corresponding to the prediction result according to the prediction result further includes: Analyze the prediction results and extract the operation behavior category with the highest probability in the prediction results; Based on the operation behavior category, generating expected target behavior data, the expected target behavior data including user operation or program selection; The step of generating the expected target behavior data includes at least one of the following: Determining the user operation or the program selection according to the same operation behavior category in the historical behavior data; According to a preset user behavior pattern, the operation behavior category is mapped to the corresponding expected target behavior data.
[0009] In one embodiment, the step of constructing a switching instruction including the expected target behavior data and sending the switching instruction to the front-end interface so that the front-end interface preloads the expected target behavior data and establishes a connection with the backup service includes: Obtaining mission-critical parameters in the target behavior data; Constructing a task list according to the task key parameters, wherein the task list includes at least one subtask item; For each of the subtask items, generating a corresponding preloading instruction, and integrating the preloading instruction into the switching instruction; The switching instruction is sent to the front-end interface, so that the front-end interface performs a preloading operation according to the order of the task list, and synchronously establishes a connection with the backup service when performing the preloading operation.
[0010] In one embodiment, the step of constructing a switching instruction including the expected target behavior data and sending the switching instruction to the front-end interface so that the front-end interface preloads the expected target behavior data and establishes a connection with the backup service also includes: Locate the session data storage area of the main service through a memory mapping mechanism; Serializing the session state information stored in the session data storage area; A transmission data packet including serialized session state information is constructed according to the network configuration information of the standby service, and the transmission data packet is synchronized to the standby service.
[0011] In one embodiment, after the step of constructing a transmission data packet including serialized session state information according to the network configuration information of the standby service and synchronizing the transmission data packet to the standby service, the step further includes: Restoring the serialized session state information contained in the transmission data packet into a session data structure; Determining an expected resumption point of the session interaction according to the interaction sequence identifier and the expected target behavior data in the session data structure; The session data corresponding to the expected recovery point and the expected target behavior data are packaged into a recovery request and sent to the backup service to recover and continue the user's current session state.
[0012] An embodiment of the present application also provides a master-standby switching device based on EPG service, and the master-standby switching device based on EPG service includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the master-standby switching method based on EPG service as described above.
[0013] An embodiment of the present application also provides a computer storage medium, which is a computer-readable storage medium. A computer program is stored on the computer storage medium. When the computer program is executed by a processor, the steps of the master-slave switching method based on the EPG service as described above are implemented.
[0014] The embodiment of the present application discloses a method for switching between primary and standby services based on EPG services. After receiving a fault signal from the primary service, the current session data of the front-end interface is obtained; the session data is converted into feature data and input into a prediction model to obtain a prediction result of the feature data; based on the prediction result, the expected target behavior data corresponding to the prediction result is obtained; a switching instruction including the expected target behavior data is constructed, and the switching instruction is sent to the front-end interface so that the front-end interface preloads the expected target behavior data and establishes a connection with the standby service. The present application predicts the behavior of the user's current session and preloads the predicted content when switching between primary and standby services, thereby avoiding the user's waiting time and experience gap during the service switching process and improving the continuity and fluency of the service. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a flowchart of a first embodiment of a method for switching between a primary and a secondary device based on an EPG service according to an embodiment of the present application; Figure 2 This is a flow chart of a second embodiment of a method for switching between a primary and a secondary device based on an EPG service according to an embodiment of the present application; Figure 3 This is a flow chart of a third embodiment of a method for switching between a primary and a secondary device based on an EPG service according to an embodiment of the present application; Figure 4 Another flowchart diagram of the fourth embodiment of the active / standby switching method based on the EPG service involved in the embodiment of the present application; Figure 5 This is a flow chart of a fifth embodiment of a method for switching between a primary and a secondary device based on an EPG service according to an embodiment of the present application; Figure 6 This is a flow chart of a sixth embodiment of a method for switching between a primary and a secondary device based on an EPG service according to an embodiment of the present application; Figure 7 This is a structural diagram of the master-slave switching device based on the EPG service in this application.
[0016] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0017] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0018] The current EPG service system usually adopts a single server architecture, that is, a main EPG service instance is responsible for providing all program information. This architecture can meet user needs under normal circumstances, but once the main EPG service fails, such as sudden damage to server hardware, software crash or network connection interruption, the service will be interrupted because there is no backup service to take over in time, and users will not be able to obtain program information normally. At the same time, it may also cause business data loss and reduce the stability of the entire system.
[0019] In order to solve the above-mentioned defects existing in the related art, the embodiment of the present application proposes a primary-backup switching method based on EPG service, which obtains the current session data of the front-end interface after receiving the fault signal of the main service; converts the session data into feature data and inputs it into the prediction model to obtain the prediction result of the feature data; obtains the expected target behavior data corresponding to the prediction result according to the prediction result; constructs a switching instruction including the expected target behavior data, and sends the switching instruction to the front-end interface, so that the front-end interface preloads the expected target behavior data and establishes a connection with the backup service. The present application predicts the behavior of the user's current session, and when the primary and backup services are switched, the predicted content is preloaded, thereby avoiding the user's waiting time and experience gap during the service switching process, and improving the continuity and fluency of the service.
[0020] It should be noted that the execution subject of this embodiment can be a master-slave switching system based on EPG services, or a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or a master-slave switching device or a real-time monitoring module based on EPG services that can realize the above functions. The following takes the master-slave switching system based on EPG services as an example (hereinafter referred to as the "system") as an example to illustrate this embodiment and the following embodiments.
[0021] The primary and standby switching method based on EPG service of the first embodiment proposed in this application can be referred to Figure 1 The method comprises steps S10 to S40: Step S10: After receiving the fault signal of the main service, the current session data of the front-end interface is obtained.
[0022] In the EPG (Electronic Program Guide) service, in order to ensure the stability of the system, it is necessary to monitor the operating status of the main EPG service (hereinafter referred to as the "main service") in real time. When the main service fails, the system will obtain the details of the program that the current user is browsing on the front-end interface from the session data storage area of the main service. Then, the structure corresponding to the user ID (i.e., session data) is obtained through key-value lookup, and the program name, program type, current playback progress, session operation sequence, etc. are extracted from it. These session data will be used to predict the user's expected target behavior data in the future, so that when switching to the backup service, the user's session status can be maintained or restored as much as possible to reduce the gap of service interruption.
[0023] Before receiving the fault signal of the main service, a timed polling mechanism can be used to monitor the status of the main service. By setting a fixed time interval, periodically sending status query requests to the main service, and monitoring the status response returned by the main service to determine whether the main service is running normally.
[0024] If the system does not receive a status response within the preset time, or the received status response is abnormal, the system will send a fault signal and start the switching process of the backup service.
[0025] Optionally, you can write an automated script to periodically check the running status of the primary service. The script will execute health check commands, such as sending HTTP requests or performing service check operations, and determine whether the service is available based on the returned results. Once a service failure is detected in the primary service, the script will automatically send a failure signal and execute a predefined command sequence, including updating DNS (Domain Name System) records, modifying load balancer configuration, or directly modifying network routing to redirect network traffic to the backup service.
[0026] Optionally, you can also collect key indicator data during the operation of the main service, such as system resource usage (such as CPU usage, memory usage, etc.), network transmission indicators (such as bandwidth utilization, network latency, etc.), and service response time. Set thresholds for key indicator data in advance. When the key indicator data exceeds the corresponding threshold, the system will determine that the main service has failed and send a fault signal. At this time, the main and backup service switching operation is automatically triggered, the connection between the front-end interface and the main service is cut off, and the connection with the backup service is established.
[0027] Optionally, you can also deploy a log analysis tool to monitor the log files of the primary service in real time, and use regular expressions or machine learning algorithms to identify abnormal patterns in the log files. Once fault content is found, the system will send a fault signal and manually or automatically switch to the backup service according to the preset primary-backup switching process.
[0028] Step S20: converting the session data into feature data and inputting the feature data into a prediction model to obtain a prediction result of the feature data.
[0029] In this embodiment, the system analyzes the user's current session behavior and converts the acquired user's current session data into feature data. The feature data is then used as an input parameter of the prediction model to predict the user's possible operation behavior in the future. The prediction process is intended to ensure that the user's viewing experience and service continuity are maintained when the primary and backup services are switched. Through predictive analysis, the system can preload or prepare corresponding resources, thereby achieving seamless connection of user sessions during the service switching process and avoiding the impact of service interruption on user experience.
[0030] It should be noted that session data refers to the information related to user operations and program playback recorded on the front-end interface during the EPG service process, including the user's current operations, such as channel switching and program selection, as well as the current playback progress of the program.
[0031] Feature data is a set of quantified data forms that can be processed and analyzed by predictive models. They can represent user behavior patterns and usage habits.
[0032] The prediction result refers to the result of the prediction model analyzing and calculating the input data after the converted feature data is input into the prediction model, which describes the user's possible operation behavior in the future, such as whether to switch channels, whether to pause the program, etc.
[0033] It should be noted that the prediction model can be a supervised learning algorithm, such as a support vector machine (SVM); or a deep learning model, such as a convolutional neural network (CNN), a recurrent neural network (RNN), etc.
[0034] Specifically, the user's historical behavior data is first obtained, including program browsing history, search history and other behavior information. Then the historical behavior data is cleaned and missing values and outliers are processed. For missing values, such as missing program browsing time, it can be filled according to the average browsing time of users of the same type or the average browsing time of programs of the same type. For outliers, such as data points with too long browsing time or too high operation frequency, data exceeding the time threshold can be regarded as outliers and corrected or deleted according to the program type and the set time threshold.
[0035] After data cleaning, feature extraction and conversion are performed on the historical behavior data to obtain a feature data set. The feature extraction process involves identifying and selecting the variables that have the greatest influence on predicting user behavior, such as user behavior patterns, timestamps, program attributes, etc. Feature conversion is to convert variables into numerical form so that the prediction model can process them. The converted feature data set will be used to train the prediction model.
[0036] After feature extraction and conversion, the processed feature data set is divided into training set and test set according to the preset ratio. Using the random sampling function, data points in the historical behavior data are randomly selected according to the data index and put into the training set and test set lists respectively.
[0037] For example, the total number of feature data sets N is obtained, and the ratio of the training set to the test set is 7:3, then the number of training sets N1=N×0.7. A random index list containing 0 to N-1 is generated using a random sampling function, and the sample data corresponding to the first N1 indexes are taken from the list as the training set, and the remaining samples are taken as the test set.
[0038] In the prediction model training phase, the training set is input into the prediction model, and the prediction model will learn how to identify the user's behavior pattern from the feature data and predict the user's future operation behavior. In order to improve the prediction ability of the model, it is necessary to train the model multiple times and adjust the model parameters to optimize the prediction results.
[0039] After the prediction model training is completed, the performance of the prediction model is verified using the test set to ensure that the model has good generalization ability. The verification process includes calculating the accuracy, recall, F1 score and other indicators of the prediction results, as well as performing error analysis to identify deviations and errors in the model prediction.
[0040] Step S30: According to the prediction result, the expected target behavior data corresponding to the prediction result is obtained.
[0041] The system interprets the probability distribution or classification labels output by the prediction model into specific actions that the user may take, such as continuing to watch the current program, switching to another channel, etc. This process involves mapping the prediction results to actual operation behaviors. The system generates operation instructions through this mapping relationship and prepares corresponding service resources.
[0042] For example, if the prediction model indicates that the user has a high probability of switching to a specific channel, the system will generate a channel switching instruction based on the prediction result and preload the content of the switched channel so that it can respond immediately when the user actually performs the switching operation. In this way, it is ensured that when the main service fails, the system can quickly adjust according to the user's expected behavior, reduce the impact of service interruptions on user experience, and achieve seamless connection of user sessions.
[0043] Specifically, since the prediction results are presented in a certain probability form or category form, the system will adopt corresponding processing methods for different types of prediction results: For the prediction results in the form of probability, the probability threshold is set to determine the possibility of user behavior, and the behavior exceeding the threshold is regarded as the expected target behavior. The user's current session status and historical behavior data are combined to refine the expected behavior, such as determining the specific channel that the user may switch to.
[0044] For prediction results in the form of categories, the system determines the specific details of the expected target behavior based on the predicted behavior category, combined with the user's current session status and historical behavior data. For example, if it is predicted that the user will "pause playback", the system will infer the specific pause time point based on the program progress and user habits.
[0045] By processing different types of prediction results, the system can effectively convert them into specific expected target behavior data, so that when the primary and backup services are switched, resources can be prepared in advance according to the user's expected behavior, ensuring service continuity and a smooth transition of user experience.
[0046] Step S40: construct a switching instruction including the expected target behavior data, and send the switching instruction to the front-end interface, so that the front-end interface preloads the expected target behavior data and establishes a connection with the backup service.
[0047] In this embodiment, the system first constructs a switching instruction based on the acquired expected target behavior data. The switching instruction includes but is not limited to channel switching, preloading of program content, restoration of user session status, etc. Next, the system encapsulates the switching instruction into a data format suitable for front-end interface processing, such as JSON (JavaScript Object Notation) or XML (eXtensible Markup Language) format, and sends it to the front-end interface through a network protocol.
[0048] After receiving the switching instruction, the front-end interface will perform corresponding operations according to the content of the switching instruction, such as preloading the channel content that the user may switch to, or adjusting the display of the front-end interface to reflect the user's possible pause playback behavior. When the front-end interface performs the preloading operation, it will simultaneously establish a connection with the backup service. At the same time, the system synchronizes the user's current session status information to the backup server to take over the user's session interaction after the interruption of the main service, ensuring that subsequent user requests can be correctly routed to the backup service.
[0049] When the system detects that the main service fails, it sends a switching command to the front-end interface. When the front-end interface receives the switching command, it immediately disconnects from the main service. At the same time, the front-end interface tries to establish a new connection with the backup service. During the service switching process, the synchronization operation of the session state information can be performed synchronously with the switching command, that is, while the front-end interface disconnects from the main service, it is already preparing to connect to the backup service, and the user's current session state information with the main service is also synchronized to the backup service during this process, thereby achieving fast and smooth service switching.
[0050] Specifically, the switching instruction includes the mark of disconnecting the primary service, the network configuration parameters for establishing a connection with the backup service, etc. The system uses the front-end and back-end communication mechanism to send the generated switching instruction to the designated port of the front-end page. After sending the switching instruction, the system needs to monitor the connection status changes of the front-end interface to ensure that the front-end interface can successfully disconnect from the primary service and establish a connection with the backup service.
[0051] It should be noted that the front-end and back-end can communicate in real time through protocols such as HTTP (Hypertext Transfer Protocol), HTTPS (Hypertext Transfer Protocol Secure) or WebSocket (a protocol for full-duplex communication on a single TCP connection) to ensure the immediacy and accuracy of information transmission.
[0052] Optionally, in order to ensure that the session interaction can be accurately and smoothly restored after the service is switched, the system can set up a verification and adjustment mechanism. When the front-end interface re-establishes the session interaction with the backup service, the key session state information is verified to ensure its integrity and accuracy. If the session state information is inconsistent or data is missing, the relevant data is retrieved from the backup database for supplementation or correction.
[0053] Optionally, during the recovery process of the session interaction, the status of the session interaction is continuously monitored, and the communication feedback mechanism between the front-end and the back-end, such as periodically sending status confirmation data packets, is used to ensure that the execution of the session interaction by both parties is consistent. Once an abnormal situation is found, such as data transmission error, operation execution failure, etc., the system resends the request to reconnect the front-end interface with the backup service, so that users can hardly feel the service interruption or interaction abnormality after the main service fails and switches to the backup service, thus achieving high availability and continuity of the service.
[0054] Please refer to Figure 2 The active / standby switching method based on EPG service of the second embodiment proposed in the present application includes steps S101 to S103 before step S10: Step S101, sending a heartbeat request to a primary service according to a preset sending cycle, and constructing a heartbeat request data packet when a sending operation of the heartbeat request is triggered within a single preset sending cycle.
[0055] In this embodiment, the system can trigger the sending operation of the heartbeat request according to a preset sending cycle by configuring a timer or a scheduler. When the timer is triggered, the system will construct a heartbeat request data packet. The heartbeat request data packet includes necessary identification information, such as a heartbeat request identifier, a heartbeat request ID, a sending timestamp, etc.
[0056] The timer can be implemented using the timer task function provided by the system, or the timer library in the programming language.
[0057] It should be noted that the preset sending period refers to a fixed time interval set by the system, and the system will automatically send a heartbeat request every fixed time interval.
[0058] Optionally, a network programming library is used to construct a heartbeat request data packet. Taking Python as an example, the struct module is used to define the format of the heartbeat request data packet, and each field in the heartbeat request data packet, such as the source IP address, the destination IP address, the request type identifier, etc., is filled in according to the byte order specified by the network protocol. The IP address of the local host is obtained as the source address through the relevant functions of the network socket, and the IP address and port number of the main service are filled in as the destination address. At the same time, the system time function is used to obtain the current timestamp, generate a unique request identifier, and write the information of each field and the request identifier into the heartbeat request data packet in a determined format.
[0059] It should be noted that the request identifier may be a character string or number based on a random number generator combined with a timestamp, which is not limited in this embodiment.
[0060] Step S102: After sending the heartbeat request data packet to the primary service, monitor the network interface of the primary service.
[0061] After constructing the heartbeat request data packet, the system sends the heartbeat request data packet to the predetermined port of the primary service through a network protocol (such as TCP / IP, Transmission Control Protocol / Internet Protocol). After the system sends the heartbeat request data packet to the primary service, it then enters a waiting state and monitors the network interface of the primary service to determine whether the primary service returns a heartbeat response.
[0062] Step S103: If the heartbeat response data packet of the primary service is not received within the preset response period or the heartbeat response data packet is abnormal, it is determined that the primary service fails.
[0063] In order to ensure timely response or avoid occupying too many system resources for a long time, a timeout mechanism or a preset response cycle can be set during the monitoring process. For example, multiple network events can be monitored at the same time and a timeout can be set. When the timeout is reached, the monitoring loop is exited and it is determined that no heartbeat response has been received.
[0064] It should be noted that the preset response period refers to the time window in which the system waits for a response from the primary service. If no heartbeat response is received during this time or the received heartbeat response is abnormal, it is determined that the primary service has a fault.
[0065] Exemplarily, the system first configures the sending cycle of the heartbeat request to 5 seconds during initialization, and sets the preset response cycle to 3 seconds. The timer is used to ensure that a heartbeat request is sent to the main service every 5 seconds, and a 3-second timer is started to wait for the response of the main service. When sending a heartbeat request, the system constructs a heartbeat request data packet and sends the heartbeat request data packet to the predetermined port of the main service through the network protocol. While waiting for the response of the main service, the system monitors the network interface of the main service. If a normal status response of the main service is received within 3 seconds, the heartbeat request sending of the next sending cycle will continue.
[0066] In this embodiment, it is preferred to use a method of sending a heartbeat request to monitor the status of the main service. Compared with the traditional periodic polling monitoring method, the heartbeat request can monitor the abnormal status of the main service earlier. Once a main service failure is detected, the system will start the main-backup service switching process to reduce the potential interruption time of the EPG service. By sending a heartbeat request, the main service is continuously and regularly checked for communication, ensuring rapid response and seamless switching when the main service fails, thereby improving the reliability of the overall service and user experience.
[0067] In a feasible implementation manner, step S102 includes steps S1021 to S1025: Step S1021: When sending the heartbeat request data packet to the primary service, synchronously start the timer to record the starting timestamp when sending the heartbeat request data packet.
[0068] After the system sends a heartbeat request packet, during the waiting process, a timer can be used to monitor the time to ensure that it does not wait indefinitely. If a heartbeat response packet from the primary service is received within the preset response cycle, the system stops the timer and continues to send heartbeat requests in the next sending cycle. If no heartbeat response is received or the heartbeat response is abnormal, the system records the current time and prepares to perform subsequent primary and backup service switching steps.
[0069] It should be noted that the timer is used to record the time from sending a heartbeat request data packet to receiving a heartbeat response data packet, or reaching a preset response period without receiving a heartbeat response data packet, so as to calculate the response time of the heartbeat request.
[0070] Step S1022: monitor the data packet inflow of the network interface of the primary service, extract the response identifier of each data packet, and match it with the request identifier in the heartbeat request data packet to identify whether the data packet is a heartbeat response data packet of the primary service.
[0071] After sending the heartbeat response packet, the system starts monitoring the network interface of the primary service to detect whether there are any packets flowing in. When a packet arrives, the system parses the packet header according to the network protocol format, extracts the response identifier in the packet, and compares the response identifier with the request identifier in the previously sent heartbeat request packet. If the response identifier matches the request identifier, the packet is considered to be the heartbeat response of the primary service to the heartbeat request.
[0072] It should be noted that the response identifier is a specific tag included in the data packet, which is used to uniquely identify the data packet as a response to the heartbeat request.
[0073] Step S1023: If the heartbeat response data packet is not matched within the preset response period, the timer runs to the preset response period and then stops.
[0074] If within the preset response cycle, after matching the response identifiers of the continuously captured data packets, no data packet matching the request identifier in the heartbeat request data packet is found, then it means that no heartbeat response data packet of the primary service is received within this preset response cycle.
[0075] At this time, the timer started synchronously when the heartbeat request data packet is sent will automatically end after reaching the preset response cycle. The preset response cycle is a time interval preset by the system to determine the maximum time to wait for the heartbeat response of the main service. If no valid heartbeat response is received after this time interval, it is determined that the main service has failed.
[0076] Step S1024: If the heartbeat response data packet is matched within the preset response period, stop the timer and record the termination timestamp when the heartbeat response data packet is received.
[0077] If within the preset response cycle, a packet matching the request identifier in the heartbeat request packet is found by matching the response identifier of the captured data packet. This means that the heartbeat response packet of the main service has been received within the preset response cycle. At this time, the timer is stopped immediately, and the current time is obtained as the end timestamp when the heartbeat response packet is received by calling the system time function, and it is recorded and stored in the corresponding variable.
[0078] Step S1025: Calculate the response time of the heartbeat request based on the start timestamp and the end timestamp.
[0079] Based on the recorded start timestamp and end timestamp, the difference is the response time from the sending of the heartbeat request to the receiving of the heartbeat response.
[0080] Further, after step S1024, after the system matches the heartbeat response data packet, it will parse it according to the data structure of the heartbeat response data packet, check each field in the heartbeat response data packet, including the status code, format, status code and any other necessary information, to determine the validity of the heartbeat response. If the heartbeat response data packet does not conform to the expected format or the return code indicates an abnormality, the system will determine that the heartbeat response data packet is abnormal, which means that the main service is abnormal. At this time, the system will start the main and standby service switching process to ensure the continuity and stability of the EPG service.
[0081] Exemplarily, the system stipulates that in the heartbeat response data packet after the heartbeat request is processed normally, the return code should be between 100-200 to indicate success. If the corresponding return code in the obtained heartbeat response data packet is 300, it means that the return code is abnormal.
[0082] Please refer to Figure 3 The active / standby switching method based on EPG service in the third embodiment proposed in the present application includes steps S201 to S204 before step S20: Step S201: traverse the program browsing records in the historical behavior data, count the browsing time of each program type, and calculate the program type preference characteristics.
[0083] In this embodiment, the program browsing records in the historical behavior data are checked in sequence, and the program type and the corresponding browsing time and other information are extracted therefrom. The identification of the program type can be determined according to the classification mark of the program itself.
[0084] Specifically, set the program type set for: , for each program type , the total browsing time is , total browsing time is , then the feature vector of program type preference feature is It can be expressed as: .
[0085] Step S202: Calculate the number of operations of the conversation interaction in each preset time interval in the historical behavior data to obtain a historical active time period, wherein the historical active time period includes the preset time interval in which the number of operations exceeds the average active threshold.
[0086] Session interaction refers to the information exchange and operation behaviors between the front-end interface and the main service or backup service. For example, a user browses programs on the front-end interface, sends a request to the server to obtain program details, and the server responds and returns relevant data. These back-and-forth information communication and operation processes constitute session interaction.
[0087] Specifically, a day is divided into multiple time intervals, and the number of time intervals can be set. The number of operations in each time interval in the historical behavior data is counted to form an array A of length 24, where A[i] represents the number of operations of the conversation interaction in the i-th time interval. The average number of operations is calculated to determine the relationship between the number of operations in the time interval to which the current time belongs and the average number of operations. If the number of operations in the time interval to which the current time belongs is greater than the average number of operations, the historical active time feature value is 1, otherwise it is 0.
[0088] Step S203: Acquire the operation sequence of the current session interaction, and match the operation sequence with a preset operation path pattern to obtain a matching result.
[0089] It should be noted that the operation sequence of the session interaction refers to the user's click path, operation timestamp and other information in the front-end interface.
[0090] In this embodiment, a common operation path mode set is defined , where each operation path mode It includes a series of interactive operations that users may perform, such as "program list - details page - play page - recommendation page".
[0091] The system analyzes each operation record in the user's current session and constructs an operation sequence according to the order in which the operations occurred. Then, it uses pattern matching algorithms, such as the longest common subsequence or edit distance, to match the operation sequence with the operation path pattern set to identify the user's current behavior pattern.
[0092] The matching result can be represented by a vector, where each element in the vector corresponds to a matching score of an operation path pattern or a Boolean value indicating whether the pattern matches.
[0093] Step S204: constructing feature data of the session data based on the program type preference feature, the historical active time period, and at least one of the matching results.
[0094] In this embodiment, feature data of the session data may be constructed based on at least one of the program type preference feature, the historical active time period, and the matching result.
[0095] When constructing the feature data of the session data, if only a certain feature information is considered, it can be used as the feature data of one dimension, for example, the preference degree of each program type can be added to the feature data in the form of a numerical value (such as a decimal between 0 and 1, indicating the degree of preference). If multiple feature information is considered, the program type preference feature, the historical active time period, and multiple features in the matching results can be arranged and combined in a certain order, so as to construct feature data that comprehensively reflects the characteristics of the session data from multiple angles, and input it into the prediction model for prediction analysis.
[0096] Please refer to Figure 4 In the fourth embodiment of the EPG service-based active / standby switching method proposed in the present application, step S30 further includes steps S310 to S320: Step S310: Analyze the prediction results and extract the operation behavior category with the highest probability in the prediction results.
[0097] The operation behavior category is a classification summary of various operation behaviors that users may perform, such as switching channels, searching for new programs, and other different behavior types. Each operation category has a corresponding probability value in the prediction results to indicate the possibility of its occurrence.
[0098] First, the prediction results are parsed to determine the data results of the prediction results. The prediction results are output by the prediction model in a specific data format. Therefore, the prediction results may be a dictionary structure containing multiple key-value pairs, where the key represents the operation behavior category and the value represents the probability corresponding to the category; or an array structure, where each element contains information such as the operation behavior category and probability.
[0099] For example, taking a dictionary structure as an example, the operation behavior category and the corresponding probability are accessed by traversing the key-value pairs of the dictionary. For an array structure, the relevant information can be obtained by traversing each element in the array through an index.
[0100] Next, after parsing the data structure and obtaining all the operation behavior categories and their corresponding probabilities, set a variable to record the current maximum probability value. Initialize the variable to a smaller value (such as 0), then traverse all the operation behavior categories and their corresponding probabilities. When the probability of a certain operation behavior category is found to be greater than the current maximum probability value, update the maximum probability value and the corresponding operation behavior category. After traversing all the operation behavior categories and their corresponding probabilities, finally determine the operation behavior category with the highest probability.
[0101] Step S320: Based on the operation behavior category, generate expected target behavior data, the expected target behavior data including user operation or program selection.
[0102] Different operation behavior categories correspond to different specific behavior performances. Therefore, it is necessary to determine the specific content of the expected target behavior data based on the extracted operation behavior category.
[0103] For example, if the operation behavior category is "switch channel", the expected target behavior data includes the specific channel information to be switched to. By querying the user's historical behavior data, such as checking the channels that the user often switched to when watching similar programs in the past, and combining the type of program the user is currently watching, the specific channel information to be switched to is determined; or the specific channel information to be switched to is determined by recommending related channels based on the current program type, etc., so as to generate complete expected target behavior data, which includes specific user operations (such as switching channel operations) and program selections (such as programs played on the switched channel).
[0104] Furthermore, the step of generating the expected target behavior data in step S320 includes at least one of the following: (1) Determining the user operation or the program selection based on the same operation behavior category in the historical behavior data.
[0105] The system will find historical instances that match the currently predicted action category based on the user's historical behavior data, and then infer the specific actions that the user may take in the current session based on the historical instances. For example, if the predicted action category is "watch a movie", the system will look up the user's past movie watching history to recommend movies that the user may be interested in.
[0106] (2) Mapping the operation behavior category to the corresponding expected target behavior data according to a preset user behavior pattern.
[0107] User behavior patterns refer to a set of rules or templates predefined by the system, which describe the possible behavior paths of users in different scenarios. By combining user behavior patterns with operation behavior categories, the system can infer the possible choices of users under the operation behavior category. For example, if the user behavior pattern indicates that the probability of watching news programs at 8 pm is high, when the predicted behavior is at 8 pm and the operation behavior category is predicted to be "watching news", the system will use the news program at 8 pm as the expected target behavior data.
[0108] Optionally, the expected target behavior data corresponding to the operation behavior category can also be determined based on the context information of the user's current session. This requires real-time monitoring of the current user's various operations and program playback in the current session interaction, such as the name of the currently playing program, program type, playback progress, user's current operation, and other information.
[0109] Then, the expected target behavior data is determined based on the context information of the current session and the determined operation behavior category. For example, if the currently extracted operation behavior category is "switch channel", and the currently playing program is a certain type of variety show, and the playing progress is nearing the end, according to the historical records, the user may switch to a channel that plays similar variety shows. In this way, the expected target behavior data in terms of user operation (channel switching operation) and program selection (program played on the switched channel) is determined.
[0110] Please refer to Figure 5 In the fifth embodiment of the present application, the active / standby switching method based on the EPG service, step S40 further includes steps S410 to S440: Step S410: Acquire mission-critical parameters in the target behavior data.
[0111] After the system obtains the target behavior data, it determines the corresponding key parameters of the preloaded task according to the operation behavior category corresponding to the target behavior data. For example, if the operation behavior category is search behavior, the search interface layout template, the number of preloaded keywords and other parameters can be obtained. If the target behavior is to watch a certain type of popular program, the key parameters of the task include the number of programs to be obtained, the rules for sorting the popularity of the programs, and whether it is necessary to obtain the identification of related recommended programs.
[0112] Step S420: constructing a task list according to the key task parameters, wherein the task list includes at least one subtask item.
[0113] A task list is a collection of detailed descriptions and arrangements of tasks to be completed. It presents all the tasks that need to be performed in a structured form. Subtask items are the basic components of a task list. Each subtask item corresponds to a specific, independently executable task. For example, based on the target behavior of watching popular programs, the task list includes subtask items for obtaining popular program resources and subtask items for obtaining related recommended program resources.
[0114] When building a task list, the specific operation details of each subtask item can be determined based on the specific content of the key parameters of the task. For example, to obtain popular program resources, it is necessary to determine which program database to obtain program data from, what query statement to use to obtain program resources that meet the popularity sorting requirements, etc., based on key parameters such as the number of programs and popularity sorting rules, and then encapsulate these specific operation details into corresponding subtask items and add them to the task list. In this way, a task list containing multiple subtask items can be constructed.
[0115] Step S430: Generate a corresponding preloading instruction for each of the subtask items, and integrate the preloading instruction into the switching instruction.
[0116] The preloading instructions are a specific set of instructions generated for each subtask item to guide the front-end interface to perform preloading operations. The preloading instructions describe the specific steps that each subtask item needs to perform during the preloading process, the source of data acquisition, the method of data processing, etc.
[0117] Step S440: Send the switching instruction to the front-end interface, so that the front-end interface performs the preloading operation according to the order of the task list, and synchronously establishes a connection with the backup service when performing the preloading operation.
[0118] In this embodiment, a switching instruction containing information such as preloading instructions is passed to the front-end interface, allowing the front-end interface to perform the preloading operation in an orderly manner according to the planned task list sequence, while ensuring that a connection can be established with the backup service during the preloading process, thereby achieving smooth switching of the primary and backup services.
[0119] Specifically, the switching instruction is sent to the front-end interface through a communication protocol such as WebSocket, HTTP, HTTPS, etc. After receiving the switching instruction, the front-end interface will first parse out information such as the task list and the preloading instruction, and then perform the preloading operation on each subtask item in sequence according to the order of the task list. During the preloading process, the front-end interface will obtain and process data according to the specific content in the preloading instruction.
[0120] While executing the preloading operation, the front-end interface will use network connection technology, such as establishing a TCP / IP connection, to establish a connection with the backup service, thereby ensuring that users can smoothly transition from the primary service to the backup service during the primary-backup switching process, and reducing the interruption gap of service switching through preloading.
[0121] Please refer to Figure 6 In the sixth embodiment of the active / standby switching method based on EPG service proposed in the present application, step S40 further includes steps S460 to S480: Step S460: Locate the session data storage area of the main service through a memory mapping mechanism.
[0122] When the heartbeat response data packet is not received within the preset response period, or the heartbeat response data packet is abnormal, the system determines that the primary service has failed and sends a fault signal. While the system obtains the preloaded target behavior data to build a switching instruction, the system will also synchronize the current user's session data to the backup service. At this time, the system will provide the corresponding system call or library function to implement the memory mapping function. For example, in the Linux system, the mmap function can be used to create a memory mapping. Then the session data storage area of the primary service is located through the memory mapping mechanism.
[0123] Exemplarily, when the system detects a failure in the primary service, it immediately triggers a synchronization operation of the session state information. The system extracts the session state information from the memory of the primary service and serializes it by calling the relevant API (Application Programming Interface) or function. Subsequently, the system sends the serialized session state information through the pre-established backup service communication channel. After receiving the serialized session state information, the backup service will perform a deserialization operation to restore the user's session state, so that it can seamlessly take over the primary service to continue processing user requests.
[0124] The operation of session data synchronization may send the current session state information to a specific interface of the standby service through network communication, or update the session state information of the standby service through a shared storage system, such as a distributed file system or a database.
[0125] In EPG service, session state information refers to the state data maintained by the main service when processing user requests, including but not limited to the user's login status, the program information browsed by the user, and the program playback progress. When the main service fails, these session state information needs to be synchronously transmitted to the backup service so that the backup service can take over the main service and continue to provide uninterrupted services to users.
[0126] Specifically, first determine the relevant parameters of the file or memory area where the main service stores session data, such as file descriptor, mapping start address, mapping length, etc. Then, by calling the mmap function and passing in these relevant parameters, the system will map the specified file or memory area to the virtual address space of the process, so that the session data storage area of the main service can be directly accessed through the virtual address space to achieve accurate positioning.
[0127] It should be noted that the memory mapping mechanism is a technical means of mapping the contents of a file or device to the virtual address space of a process, so that the process can directly access the mapped contents as if it were accessing a memory. In this embodiment, the memory mapping mechanism can be used to quickly locate a specific area in the main service that stores session data in order to extract session state information.
[0128] Optionally, during the user's interaction with the main service, the system may mark and record the user's current session status at regular intervals or at key operation nodes, such as selecting a program type, for example, marking the user's current program classification level, whether it is in a playback state, and the playback progress (roughly marked as more than half played, etc.).
[0129] When the primary and backup services need to be switched, only the marked key session state information is passed to the backup service, and the backup service restores the user's approximate operation scenario based on these simple tags. This simplified session management mechanism is designed to reduce the amount of data saved and restored during the primary and backup service switching process, thereby reducing complexity and improving the switching efficiency of the primary and backup services.
[0130] Optionally, during the normal operation of the main service, a cache mechanism is set up to periodically cache commonly used program-related information or the latest program guide information, such as popular program introductions, recent popular broadcast time periods, etc. When the main service fails, the cached relevant information is immediately extracted from the cache, and a static page is quickly deployed based on the information, which contains the latest program guide information and the expected time or contact information for service recovery. Although this method cannot provide dynamic EPG services, it can keep users' information acquisition in an emergency and reduce the inconvenience caused to users by service interruptions.
[0131] Step S470: Serializing the session state information in the session data storage area.
[0132] After determining the specific location of the session data storage, the session state information needs to be converted into a format that can be transmitted over the network. Serialization refers to the process of converting the state information of an object into a byte stream, so that it can be easily transmitted over the network or saved to persistent storage. Common serialization formats include JSON, XML, etc. The serialized session data is sent to the backup service. The backup server can deserialize to restore the original data structure of the session data.
[0133] Step S480: constructing a transmission data packet including serialized session state information according to the network configuration information of the standby service, and synchronizing the transmission data packet to the standby service.
[0134] After the serialized session state information is prepared, a transport packet is created. The transport packet contains the serialized session state information and the necessary network configuration information. The transport packet also needs to follow a specific protocol format so that the backup service can parse and process it correctly. This process involves defining the transport packet header and payload part. The transport packet header contains metadata such as identifiers and version numbers, while the payload contains the actual serialized session state information.
[0135] It should be noted that the network configuration information usually includes the IP address and port number of the backup service, which are used to establish a connection with the backup service.
[0136] In an optional implementation, step S480 further includes steps S481-S482: Step S481: Start the confirmation feedback monitoring thread.
[0137] A confirmation feedback monitoring thread is an independent execution path in a computer program that continuously monitors whether confirmation feedback information has been received from a backup service. A thread can be seen as a small unit of parallel execution within a program, which can focus on a specific task without affecting the execution of other functions of the main program.
[0138] Exemplarily, a receiving function of the socket library, such as a recv or recvfrom function, is used to check whether a data packet has arrived from the backup service, and whether it is confirmation feedback information is determined by parsing the content of the data packet.
[0139] Step S482: If no confirmation feedback of the backup service is received within the preset feedback time, retransmission of the transmission data packet is performed until the confirmation feedback is received or the preset number of retransmissions is reached.
[0140] If the backup service does not receive confirmation feedback within the preset feedback time, it is necessary to perform a retransmission operation on the transmission data packet. The preset feedback time is a time interval preset by the system to determine the maximum time to wait for confirmation feedback. According to the results of continuous monitoring by the started confirmation feedback monitoring thread, it is determined whether the backup service has not received confirmation feedback.
[0141] When it is determined that no confirmation feedback has been received, the retransmission operation is performed using the network communication related functions or libraries to resend the previously constructed transmission data packet to the IP address and port of the backup service. In addition, during the retransmission process, the number of retransmissions will be counted and recorded. Each time a retransmission occurs, it will check whether the current number of retransmissions has reached the preset number of retransmissions. If it has not yet reached the preset number of retransmissions, the retransmission operation will continue until the confirmation feedback is received or the preset number of retransmissions is reached.
[0142] In another optional implementation, step S480 further includes steps S490 to S492: Step S490: restoring the serialized session state information contained in the transmission data packet into a session data structure; First, the serialized session state information synchronized to the backup service is deserialized to restore the serialized session state information to the original session data structure. The deserialization process needs to be performed according to the specific format used in the serialization processing operation.
[0143] Deserialization is the reverse process of serialization, and is usually restored according to the rules and format followed during serialization.
[0144] For example, if the serialization is performed in JSON format, the function of the corresponding JSON parsing library can be used to implement parsing. By calling the function, the serialized session state information is passed in as a parameter, and the function parses it according to the format rules of JSON, and restores the serialized session state information in the form of byte stream to the original session data structure form, that is, converts the serialized session state information back to the original data organization form containing various session related information, so that the backup service can perform and restore the session interaction based on the original session data structure.
[0145] Step S491: determining an expected recovery point of the session interaction according to the interaction sequence identifier and the expected target behavior data in the session data structure; In the session data structure, the interaction sequence identifier is closely associated with the information of each interaction stage. By traversing the relevant fields or elements in the session data structure, the interaction sequence identifier corresponding to the previous interaction is found. After the interaction sequence identifier is found, the expected recovery point of the session interaction can be determined based on the location of the interaction sequence identifier in the data structure and the expected target behavior data.
[0146] For example, if the interaction sequence identifiers are arranged in chronological order or operation order, the expected recovery point at which the expected target behavior data preloading ends can be located according to the order of the interaction sequence identifiers and related timestamps, operation types and other information.
[0147] Step S492: Encapsulate the session data corresponding to the expected recovery point and the expected target behavior data into a recovery request and send it to the backup service to recover and continue the user's current session state.
[0148] In this embodiment, based on the session state information after the deserialization operation, the front-end interface and the backup service need to re-establish the operation process corresponding to the session interaction previously performed on the primary service.
[0149] For example, if the user was previously browsing a program on the primary service and the playback reached a specific progress, the backup service will continue to provide playback services to the user from the program playback progress corresponding to the expected recovery point based on the program playback progress in the restored session state information and the program playback progress in the preloaded target behavior data.
[0150] First, relevant session data is extracted from the expected recovery point. These session data contain various status information after the expected target behavior data preload is completed, such as the user's program browsing progress at that time, etc. Then, these session data are encapsulated into a recovery request data packet according to the specific network protocol format and the interface requirements of the backup service.
[0151] During the encapsulation process, the header information of the data packet must be determined, such as the request type identifier, target address, etc., and the body must be accurately filled with the extracted session data.
[0152] After receiving the recovery request data packet, the backup service will perform corresponding processing operations based on the session data therein and update the relevant status information to its own service logic, so that the session interaction between the front-end interface and the backup service can be restored to the state before the user interface was disconnected from the primary service, achieving seamless recovery of the session state during the entire primary-backup switching process, ensuring the continuity of the user experience, and allowing users to continue to use the service normally with the previous session state after the primary service fails and switches to the backup service.
[0153] The present application provides a master-standby switching device based on EPG service, and the master-standby switching device based on EPG service includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the master-standby switching method based on EPG service in the above-mentioned embodiment 1.
[0154] Reference below Figure 7 , which shows a schematic diagram of the structure of a master-slave switching device based on EPG service suitable for implementing the embodiment of the present application. The master-slave switching device based on EPG service in the embodiment of the present application may include various hardware and software components for implementing the master-slave switching method based on EPG service. Figure 7 The active-standby switching device based on the EPG service shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0155] like Figure 7As shown, the active / standby switching device based on the EPG service may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the active / standby switching device based on the EPG service are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the active / standby switching device based on the EPG service to communicate wirelessly or wired with other devices to exchange data. Although the active / standby switching device based on the EPG service with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0156] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0157] The active-standby switching device based on EPG service provided by the present application adopts the active-standby switching device method based on EPG service in the above embodiment, which can solve the technical problem of how to realize seamless switching of active-standby service in EPG service. Compared with the prior art, the beneficial effects of the active-standby switching device based on EPG service provided by the present application are the same as the beneficial effects of the active-standby switching method based on EPG service provided by the above embodiment, and other technical features in the active-standby switching device based on EPG service are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0158] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0159] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0160] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the active-standby switching method based on the EPG service in the above-mentioned embodiment.
[0161] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0162] The computer-readable storage medium may be included in the master-slave switching device based on the EPG service; or may exist independently without being assembled into the master-slave switching device based on the EPG service.
[0163] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the master-slave switching device based on the EPG service, the master-slave switching device based on the EPG service: after receiving the fault signal of the main service, obtains the current session data of the front-end interface; converts the session data into feature data and inputs it into the prediction model to obtain the prediction result of the feature data; obtains the expected target behavior data corresponding to the prediction result according to the prediction result; constructs a switching instruction including the expected target behavior data, and sends the switching instruction to the front-end interface, so that the front-end interface preloads the expected target behavior data and establishes a connection with the backup service.
[0164] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0165] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0166] The modules involved in the embodiments described in the present application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0167] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned active-standby switching method based on EPG services, and can solve the technical problem of how to achieve seamless switching of active-standby services in EPG services. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the active-standby switching method based on EPG services provided by the above-mentioned embodiments, and will not be described in detail here.
[0168] An embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the active / standby switching method based on the EPG service as described above.
[0169] The computer program product provided by the present application can solve the technical problem of how to achieve seamless switching of the primary and standby services in the EPG service. Compared with the prior art, the beneficial effects of the computer program product provided by the embodiment of the present application are the same as the beneficial effects of the primary and standby switching method based on the EPG service provided by the above embodiment, which will not be repeated here.
[0170] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.
[0171] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0172] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0173] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for switching between active and standby modes based on EPG service, characterized in that: The active / standby switching method based on the EPG service includes: After receiving the fault signal from the main service, obtain the current session data of the front-end interface; Converting the session data into feature data and inputting the feature data into a prediction model to obtain a prediction result of the feature data; According to the prediction result, obtaining the expected target behavior data corresponding to the prediction result; A switching instruction including the expected target behavior data is constructed, and the switching instruction is sent to the front-end interface, so that the front-end interface is preloaded with the expected target behavior data and establishes a connection with the backup service.
2. The active / standby switching method based on EPG service according to claim 1, characterized in that: After receiving the fault signal of the main service, before the step of obtaining the current session data of the front-end interface, the method includes: Send a heartbeat request to the main service according to a preset sending cycle, and when the sending operation of the heartbeat request is triggered within a single preset sending cycle, construct a heartbeat request data packet; After sending the heartbeat request data packet to the primary service, monitoring the network interface of the primary service; If the heartbeat response data packet of the primary service is not received within the preset response period or the heartbeat response data packet is abnormal, it is determined that the primary service is faulty.
3. The active / standby switching method based on EPG service as claimed in claim 2, characterized in that: After sending the heartbeat request data packet to the primary service, the step of monitoring the network interface of the primary service comprises: When sending a heartbeat request data packet to the primary service, synchronously start a timer to record a starting timestamp when sending the heartbeat request data packet; Monitor the data packet inflow of the network interface of the primary service, extract the response identifier of each data packet, and match it with the request identifier in the heartbeat request data packet to identify whether the data packet is a heartbeat response data packet of the primary service; If the heartbeat response data packet is not matched within the preset response period, the timer stops after running to the preset response period; If the heartbeat response data packet is matched within the preset response period, stop the timer and record the termination timestamp when the heartbeat response data packet is received; Based on the start timestamp and the end timestamp, a response time of the heartbeat request is calculated.
4. The active / standby switching method based on EPG service according to claim 1, characterized in that: Before the step of converting the session data into feature data and inputting the feature data into a prediction model to obtain a prediction result of the feature data, the method includes: Traverse the program browsing records in the historical behavior data, count the browsing time of each program type, and calculate the program type preference characteristics; Calculate the number of operations of the conversation interaction in each preset time interval in the historical behavior data to obtain a historical active time period, wherein the historical active time period includes the preset time interval in which the number of operations exceeds the average active threshold; Acquire the operation sequence of the current session interaction, and match the operation sequence with a preset operation path pattern to obtain a matching result; Based on at least one of the program type preference feature, the historical active time period, and the matching result, feature data of the session data is constructed.
5. The active / standby switching method based on EPG service according to claim 1, characterized in that: The step of acquiring the expected target behavior data corresponding to the prediction result according to the prediction result further includes: Analyze the prediction results and extract the operation behavior category with the highest probability in the prediction results; Based on the operation behavior category, generating expected target behavior data, the expected target behavior data including user operation or program selection; The step of generating the expected target behavior data includes at least one of the following: Determining the user operation or the program selection according to the same operation behavior category in the historical behavior data; According to a preset user behavior pattern, the operation behavior category is mapped to the corresponding expected target behavior data.
6. The active / standby switching method based on EPG service according to claim 1, characterized in that: The step of constructing a switching instruction including the expected target behavior data and sending the switching instruction to the front-end interface so that the front-end interface preloads the expected target behavior data and establishes a connection with the backup service includes: Obtaining mission-critical parameters in the target behavior data; Constructing a task list according to the task key parameters, wherein the task list includes at least one subtask item; For each of the subtask items, generating a corresponding preloading instruction, and integrating the preloading instruction into the switching instruction; The switching instruction is sent to the front-end interface, so that the front-end interface performs a preloading operation according to the order of the task list, and synchronously establishes a connection with the backup service when performing the preloading operation.
7. The active / standby switching method based on EPG service according to claim 1, characterized in that: The step of constructing a switching instruction including the expected target behavior data, and sending the switching instruction to the front-end interface so that the front-end interface preloads the expected target behavior data and establishes a connection with the backup service also includes: Locate the session data storage area of the main service through a memory mapping mechanism; Serializing the session state information stored in the session data storage area; A transmission data packet including serialized session state information is constructed according to the network configuration information of the standby service, and the transmission data packet is synchronized to the standby service.
8. The active / standby switching method based on EPG service according to claim 7, characterized in that: After the step of constructing a transmission data packet containing serialized session state information according to the network configuration information of the standby service and synchronizing the transmission data packet to the standby service, the method further includes: Restoring the serialized session state information contained in the transmission data packet into a session data structure; Determining an expected resumption point of the session interaction according to the interaction sequence identifier and the expected target behavior data in the session data structure; The session data corresponding to the expected recovery point and the expected target behavior data are packaged into a recovery request and sent to the backup service to recover and continue the user's current session state.
9. A master-slave switching device based on EPG service, characterized in that: The active-standby switching device based on the EPG service comprises: a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the active-standby switching method based on the EPG service as described in any one of claims 1 to 8.
10. A computer storage medium, characterized in that: The computer storage medium is a computer-readable storage medium, and a computer program is stored on the computer storage medium. When the computer program is executed by a processor, the steps of the active-standby switching method based on the EPG service as described in any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Telephone traffic switching method, device, equipment, storage medium and computer program product
CN120729993A
Traffic switching method, apparatus, device, storage medium and computer program product
CN120729993B
Cloud card resource dynamic scheduling method and device and electronic equipment
CN122268929A