Server switching method and device, electronic equipment and storage medium

The method addresses the inefficiency of existing server switching by evaluating multiple performance attributes to determine when to switch from the main server to a standby server, enhancing system stability and reducing server wear.

CN119226084APending Publication Date: 2024-12-31GUANGZHOU BAOLUN ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411361189.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

Existing server switching methods in dual-machine hot standby systems cause excessive wear and reduced performance of the main server due to prolonged use, as the slave server is only activated upon failure, leading to inefficiencies in system stability.

Method used

A method and device for timely server switching based on evaluating performance attributes in multiple dimensions (CPU usage, memory usage, disk I/O, and response rate) to determine when to switch from the main server to a standby server, using data acquisition, evaluation attribute determination, and performance attribute determination modules to ensure optimal switching.

Benefits of technology

This approach ensures timely and efficient server switching, reducing the load on the main server and maintaining performance by accurately evaluating its operating state and switching when necessary, thereby minimizing performance loss and ensuring system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226084A_ABST
    Figure CN119226084A_ABST
Patent Text Reader

Abstract

The invention discloses a server switching method and device, electronic equipment and a storage medium. According to the specific scheme, to-be-processed data of a main server under at least one evaluation dimension under at least one time slice is obtained, wherein the at least one evaluation dimension comprises at least one of a central processing unit use dimension, a memory use dimension, a disk read-write dimension and a main server response rate dimension; for at least one evaluation dimension, determining to-be-fused evaluation attributes under the current evaluation dimension according to the to-be-processed data under the current evaluation dimension and an evaluation function corresponding to the current evaluation dimension; according to the to-be-fused evaluation attribute corresponding to the at least one evaluation dimension, determining an operation performance attribute of the main server; and when the operation performance attribute meets a preset condition, switching from the master server to the target slave server. According to the invention, timely switching of the main server is realized, the loss of the main server is reduced, and the operation performance of the main server is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of device control, and in particular to a server switching method, device, electronic device and storage medium. Background Art

[0002] In the broadcasting industry, especially in scenarios where system stability needs to be guaranteed, such as airports, subway stations, and offshore oil fields, dual-machine hot standby is used to ensure broadcast stability.

[0003] However, in actual applications, the main server is usually working, and the slave server is in a standby state until the main server fails, and then the server is switched. However, this method uses the main server for a long time, which makes the main server too worn out, thereby reducing the performance of the main server. Summary of the invention

[0004] The present invention provides a server switching method, device, electronic equipment and storage medium, which realize timely switching of a main server, reduce the loss of the main server and ensure the operating performance of the main server.

[0005] According to one aspect of the present invention, a server switching method is provided, the method comprising:

[0006] Obtaining data to be processed in at least one evaluation dimension of the primary server in at least one time slice, where the at least one evaluation dimension includes at least one of a central processing unit usage dimension, a memory usage dimension, a disk read / write dimension, and a primary server response rate dimension;

[0007] For at least one evaluation dimension, determining the evaluation attribute to be integrated under the current evaluation dimension according to the data to be processed under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension;

[0008] Determine the operation performance attribute of the master server according to the evaluation attribute to be integrated corresponding to at least one evaluation dimension;

[0009] When the running performance attributes meet the preset conditions, the master server switches to the target slave server.

[0010] According to another aspect of the present invention, there is provided a server switching device, the device comprising:

[0011] A data acquisition module, used to acquire the to-be-processed data of the main server under at least one evaluation dimension under at least one time slice, wherein the at least one evaluation dimension includes at least one item of a CPU usage dimension, a memory usage dimension, a disk read / write dimension, and a main server response rate dimension;

[0012] An evaluation attribute determination module, for determining, for at least one evaluation dimension, an evaluation attribute to be integrated under the current evaluation dimension according to the data to be processed under the current evaluation dimension and an evaluation function corresponding to the current evaluation dimension;

[0013] A performance attribute determination module, used to determine the operation performance attribute of the main server according to the to-be-fused evaluation attribute corresponding to at least one evaluation dimension;

[0014] The server switching module is used to switch from the master server to the target slave server when the running performance attribute meets the preset conditions.

[0015] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0016] at least one processor; and

[0017] a memory communicatively connected to at least one processor; wherein,

[0018] The memory stores a computer program that can be executed by at least one processor. The computer program is executed by at least one processor so that the at least one processor can execute the server switching method of any embodiment of the present invention.

[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the server switching method of any embodiment of the present invention when executed.

[0020] According to another aspect of the present invention, a computer program product is provided, including a computer program, wherein the computer program implements the server switching method according to any embodiment of the present invention when executed by a processor.

[0021] The technical solution of the embodiment of the present invention provides data support for the subsequent determination of the operating performance of the main server through the data to be processed under at least one evaluation dimension of the main server under at least one time slice. For at least one evaluation dimension, the evaluation attribute to be fused under the current evaluation dimension is determined according to the data to be processed under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension. The operating performance attribute of the main server is determined according to the evaluation attribute to be fused corresponding to at least one evaluation dimension, thereby achieving an accurate evaluation of the operating performance of the main server. When the operating performance attribute meets the preset conditions, the main server switches to the target slave server, which solves the problem of excessive loss and reduced performance of the main server caused by server switching processing when the main server fails in the prior art. The present invention realizes timely switching of the main server, reduces the loss of the main server, and ensures the operating performance of the main server.

[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0024] Figure 1 is a flow chart of a server switching method provided by an embodiment of the present invention;

[0025] Figure 2 is a flow chart of a method for determining an attribute to be fused and evaluated provided by an embodiment of the present invention;

[0026] Figure 3 is a structural schematic diagram of a server switching device provided by an embodiment of the present invention;

[0027] Figure 4 It is a structural schematic diagram of an electronic device for implementing the server switching method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] Embodiment 1

[0031] Figure 1 This is a flow chart of a server switching method provided by the first embodiment of the present invention. This embodiment can be applied to evaluate the operating performance of the main server and determine whether server switching is required. The method can be executed by a server switching device, which can be implemented in the form of hardware and / or software. The server switching device can be configured in electronic devices such as mobile phones, computers or servers. Figure 1 As shown, the method includes:

[0032] S110. Obtain the data to be processed in at least one evaluation dimension of the main server in at least one time slice, where the at least one evaluation dimension includes at least one of a central processing unit usage dimension, a memory usage dimension, a disk read and write dimension, and a main server response rate dimension.

[0033] Among them, the main server is the server currently in use. To facilitate the accuracy of subsequent data processing, the data to be processed of at least one evaluation dimension under at least one time slice can be obtained. The time slice can be a time length set according to actual needs. For example, the time slice can be 1 second or 5 seconds. Here, only the time slice is given as an example and is not limited to this. The evaluation dimension can be a dimension set according to actual needs and used to evaluate the operating performance of the main server. The evaluation dimension can include at least one of the central processing unit usage dimension, the memory usage dimension, the disk read and write dimension, and the main server response rate dimension. The central processing unit usage dimension can be used to evaluate the degree of central processing unit usage. The memory usage dimension can be used to evaluate the degree of memory usage. The disk read and write dimension can be used to evaluate the disk read and write rate. The main server response rate dimension can be used to evaluate the main server response time. The data to be processed can be the device operation data corresponding to the main server under each evaluation dimension. The corresponding data to be processed under different evaluation dimensions are different.

[0034] Specifically, the data to be processed corresponding to at least one of the central processing unit usage dimension, memory usage dimension, disk read and write dimension, and main server response rate dimension of the main server in at least one time slice is obtained.

[0035] Exemplarily, the application scenario is an airport broadcast scenario, the operating system of the main server is the Linux system, and the programming language is the GO language. The pending data under the CPU usage dimension can be the non-idle time and total processing time corresponding to the CPU processing tasks. The pending data under the memory usage dimension can be the used memory and total memory corresponding to the main server. The pending data under the disk read and write dimension can be the disk read and write waiting time. The pending data under the main server response rate dimension can be the start time and end time of the main server processing the network request. The pending data of the main server under at least one evaluation dimension can be obtained regularly through the application programming interface (Application Programming Interface, API).

[0036] S120. For at least one evaluation dimension, determine the evaluation attribute to be integrated under the current evaluation dimension according to the data to be processed under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension.

[0037] The evaluation function can be used to evaluate the operating performance of the primary server under the current evaluation dimension. The evaluation attribute to be integrated can be used to characterize the operating performance of the primary server under the current evaluation dimension.

[0038] Specifically, for the CPU usage dimension, the evaluation attributes to be integrated under the CPU usage dimension are calculated based on the data to be processed under the CPU usage dimension and the evaluation function corresponding to the CPU usage dimension. For example, if the data to be processed is the non-idle time and total processing time corresponding to the CPU processing task, the CPU utilization can be calculated based on the non-idle time and total processing time. The CPU utilization is processed based on the evaluation function to obtain the evaluation attributes to be integrated under the CPU usage dimension.

[0039] For the memory usage dimension, the evaluation attributes to be integrated under the memory usage dimension are calculated based on the data to be processed and the evaluation function under the memory usage dimension. For example, if the data to be processed is the used memory and the total memory corresponding to the master server, the memory utilization can be calculated based on the used memory and the total memory. The memory utilization is processed according to the evaluation function to obtain the evaluation attributes to be integrated under the memory usage dimension.

[0040] For the disk read / write dimension, the evaluation attributes to be fused under the disk read / write dimension are calculated based on the data to be processed and the evaluation function under the disk read / write dimension. For example, if the data to be processed is the disk read / write waiting time, the disk read / write waiting time is processed based on the evaluation function to obtain the evaluation attributes to be fused under the disk read / write dimension.

[0041] For the main server response rate dimension, the evaluation attribute to be integrated under the main server response rate dimension is calculated based on the data to be processed and the evaluation function under the main server response rate dimension. For example, if the data to be processed is the start time and end time of the main server processing the network request, the corresponding response time of the main server is calculated based on the start time and end time. The response time is processed according to the evaluation function to obtain the evaluation attribute to be integrated under the main server response rate dimension.

[0042] S130: Determine the operating performance attribute of the main server according to the to-be-integrated evaluation attribute corresponding to at least one evaluation dimension.

[0043] The operation performance attribute can be used to characterize the overall operation performance of the main server.

[0044] Specifically, the evaluation attributes to be integrated corresponding to at least one evaluation dimension are accumulated to obtain the operation performance attribute of the main server, so as to determine whether to perform server switching based on the operation performance attribute of the main server.

[0045] S140. When the operating performance attribute meets the preset condition, the master server is switched to the target slave server.

[0046] The preset condition may be a pre-set server switching condition. Optionally, if the running performance attribute reaches a preset evaluation threshold, it is determined that the running performance attribute meets the preset condition. The target slave server may be a predetermined standby server to be switched. Optionally, the target slave server may be a server selected from at least one standby server, whose running status meets the actual demand.

[0047] Specifically, when the operation performance attribute reaches the preset evaluation threshold, it is determined that the operation performance attribute meets the preset condition. At this time, the master server is switched to the target slave server to implement the server switching process. Correspondingly, if the operation performance attribute does not reach the preset evaluation threshold, the operation performance attribute does not meet the preset condition, and the server switching process is not performed at this time.

[0048] Optionally, you can use the keepalived tool to automatically downgrade the master server to a slave server and upgrade the target slave server to the master server. The keepalived tool has built-in response processing logic. By writing shell scripts to process the monitoring logic, it determines the operating performance attributes of the master server. When the operating performance attributes meet the preset conditions, the keepalived mechanism automatically triggers server switching.

[0049] In an embodiment of the present invention, when the operating performance attributes meet the preset conditions, the method also includes: obtaining the task progress information of each task to be synchronized in the main server and the data to be synchronized corresponding to the task progress information, wherein the data to be synchronized is the processed data corresponding to the completed progress in the task progress information; synchronizing the task progress information and the data to be synchronized to the target slave server.

[0050] Among them, the task to be synchronized can be understood as the task that needs to synchronize data in the main server. The task progress information can be the running progress information of the task to be synchronized. Optionally, the task progress information can include completed progress and unfinished progress. The data to be synchronized is the processed data corresponding to the completed progress in the task progress information. The completed progress is the progress of the task to be synchronized that has been executed. The processed data can be understood as the processed data corresponding to the completed progress. For example, taking the completed progress of 40% as an example, the data to be synchronized can be the processed data corresponding to the completed progress of 40%.

[0051] Specifically, the task progress information of each task to be synchronized in the master server is obtained. According to the task progress information of the current task to be synchronized, the data to be synchronized corresponding to the task progress information is determined. Based on this, the data to be synchronized corresponding to each task to be synchronized is determined. The task progress information and the data to be synchronized are synchronized to the target slave server to achieve data synchronization between the target slave server and the master server.

[0052] Optionally, data synchronization may include database synchronization, file synchronization, and Redis cache data synchronization. When synchronizing the database, the data in the database is synchronized in real time through the master-slave data synchronization method of the database. When synchronizing the Redis cache data, cache data synchronization is achieved through the master-slave replication of Redis. When synchronizing the file, the changes in the file directory are monitored in real time, and all changed files in the directory are synchronized.

[0053] Exemplarily, if the task to be synchronized is a task being executed in the master server, that is, the completed progress in the task progress information of the task to be synchronized is not 100%, then the data to be synchronized of the task to be synchronized is determined according to the completed progress, so as to synchronize the data to be synchronized to the target slave server. For example, taking the task to be synchronized as the music being played as an example, the position of the audio file read is identified and recorded in the cache to synchronize it to the target slave server. When switching to the target slave server, the task to be synchronized continues to be executed from the synchronized audio file position.

[0054] In an embodiment of the present invention, before switching from the master server to the target slave server, the method also includes: processing the operating performance attributes and the data to be processed under each evaluation dimension according to a pre-configured notification template, generating notification information, and feeding back the notification information to the target terminal, wherein the pre-configured notification template includes a notification method and notification terminology information of at least one notification object.

[0055] Among them, the notification template is a pre-configured template used to generate notification information. The notification template can simplify operations and improve notification efficiency. The notification object in the notification template can be the staff who needs to be notified when the server is switched. The notification method is the contact information of the notification object. The notification method can be telephone, email, text message and other methods. The notification terminology information can be understood as the common language corresponding to the notification information. For example, the notification terminology information can be "server switching is required", which is only an example here and does not limit the notification terminology information. The notification information can be information used to inform the notification object that the server switching is currently required. The target terminal can be understood as the terminal device of the notification object. Optionally, the target terminal can be an electronic device such as a mobile phone or a computer.

[0056] Specifically, before switching from the master server to the target slave server, the operating performance attributes and the data to be processed under each evaluation dimension are processed according to the pre-configured notification template to generate notification information. The notification information includes the operating performance attributes, the data to be processed, and the notification terminology information. The notification information is fed back to the target terminal of the notification object.

[0057] Exemplarily, in combination with the above example, before the server switching process is performed, the operating performance attributes and the pending data corresponding to the main server and the CPU utilization, memory usage, disk read and write waiting time and response time obtained after the pending data are processed can be recorded in the notification template to generate notification information. According to the email address configured in the notification template, an email alarm is triggered, and the notification information is sent to the target terminal of the system administrator by email.

[0058] The technical solution of this embodiment provides data support for the subsequent determination of the operating performance of the main server through the data to be processed under at least one evaluation dimension of the main server under at least one time slice. For at least one evaluation dimension, the evaluation attribute to be fused under the current evaluation dimension is determined according to the data to be processed under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension. The operating performance attribute of the main server is determined according to the evaluation attribute to be fused corresponding to at least one evaluation dimension, thereby achieving an accurate evaluation of the operating performance of the main server. When the operating performance attribute meets the preset conditions, the main server switches to the target slave server, which solves the problem of excessive loss and reduced performance of the main server caused by server switching processing when the main server fails in the prior art. The present invention realizes timely switching of the main server, reduces the loss of the main server, and ensures the operating performance of the main server.

[0059] Embodiment 2

[0060] Figure 2 This is a flowchart of a method for determining the evaluation attributes to be fused provided by the second embodiment of the present invention. This embodiment is a refinement of the step "determining the evaluation attributes to be fused under the current evaluation dimension according to the data to be processed under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension". For its specific implementation method, please refer to the technical solution of this embodiment. Among them, the technical terms that are the same or corresponding to the above embodiments are not repeated here. Figure 2 As shown, the method includes:

[0061] S210. For the CPU usage dimension and the memory usage dimension, based on the first data and the second data in the data to be processed under the current evaluation dimension under each time slice, determine the data calculation result of the first data relative to the second data under each time slice.

[0062] Among them, the first data and the second data under the CPU usage dimension are respectively the non-idle time and the total processing time corresponding to the CPU processing tasks, and the first data and the second data under the memory usage dimension are respectively the used memory and the total memory corresponding to the main server.

[0063] The non-idle duration can be understood as the length of time that the central processing unit is in a non-idle state when processing a task. For example, when the central processing unit is executing instructions, processing tasks, or performing other computing tasks, the central processing unit is in a non-idle state. The total processing duration can be understood as the total length of time that the central processing unit processes tasks. The total memory can be understood as the total memory corresponding to the main server. The used memory can be the used memory determined by the total memory, available memory, and cache of the main server. The data calculation result can be understood as the ratio between the first data and the second data.

[0064] Specifically, for the CPU usage dimension, the ratio between the non-idle time and the total processing time in each time slice is determined based on the non-idle time and the total processing time in each time slice, i.e., the data calculation result of the CPU usage dimension. For the memory usage dimension, the ratio between the used memory and the total memory in each time slice is calculated, i.e., the data calculation result of the memory usage dimension.

[0065] Exemplarily, in combination with the above example, for the CPU usage dimension, the data in the / proc / stat file is periodically obtained to obtain the non-idle time and total processing time of the CPU in each time slice. The ratio between the non-idle time and the total processing time is calculated to obtain the CPU utilization rate in each time slice, that is, the data calculation result. Since the CPU utilization rate changes dynamically, regularly obtaining the non-idle time and total processing time of the CPU and calculating the CPU utilization rate can improve the accuracy of data processing. Generally, the shorter the interval between time slices, the more accurate the CPU utilization rate.

[0066] Combined with the above example, for the memory usage dimension, the / proc / meminfo file is read regularly to obtain the total memory, available memory, and memory allocated to the cache and buffer of the master server. The used memory is obtained by subtracting the available memory and the memory allocated to the cache and buffer from the total memory. The ratio between the used memory and the total memory is calculated to determine the memory usage rate, that is, the data calculation result under the memory usage dimension. Based on this, the operations of data processing and conversion can be reduced to obtain accurate data calculation results.

[0067] S220: Determine an average data result based on the data calculation result in each time slice.

[0068] The average data result may be a result obtained by performing mean processing on the data calculation results.

[0069] Specifically, if there is only one data calculation result under a time slice under the current evaluation dimension, the data calculation result is used as the average data result. If there are multiple data calculation results under multiple time slices under the current evaluation dimension, the multiple data calculation results are averaged to obtain the average data result.

[0070] S230: Determine the evaluation attribute to be integrated under the current evaluation dimension based on the average data result and the evaluation function corresponding to the current evaluation dimension.

[0071] The evaluation function may be a function determined according to the evaluation attribute threshold and the weight coefficient. The evaluation attribute threshold may be a standard value corresponding to the average data result set according to actual needs. The weight coefficient may be a coefficient corresponding to the current evaluation dimension. For example, the evaluation function may be H=w_C*(C / C_t), where w_C is the weight coefficient, C is the data to be processed, and C_t is the evaluation attribute threshold.

[0072] Specifically, for the CPU usage dimension, the ratio of the average data result to the evaluation attribute threshold is determined based on the average data result of the CPU usage dimension and the evaluation attribute threshold of the evaluation function. According to the ratio and the weight coefficient of the evaluation function, the evaluation attribute to be fused under the CPU usage dimension is determined. For the memory usage dimension, the ratio of the average data result to the evaluation attribute threshold is determined based on the average data result of the memory usage dimension and the evaluation attribute threshold of the evaluation function. According to the ratio and the weight coefficient of the evaluation function, the evaluation attribute to be fused under the memory usage dimension is determined.

[0073] In an embodiment of the present invention, a method for determining the evaluation attributes to be fused under the current evaluation dimension based on the average data result and the evaluation function may be: determining the processing result of the average data result relative to the evaluation attribute threshold of the current evaluation dimension; based on the processing result and the weight coefficient of the current evaluation dimension, determining the evaluation attributes to be fused corresponding to the current evaluation dimension.

[0074] The evaluation attribute threshold may be a standard value corresponding to the average data result. The processing result may be understood as the ratio of the average data result to the evaluation attribute threshold. The weight coefficient may be a coefficient corresponding to the current evaluation dimension. It should be noted that the weight coefficient and the evaluation attribute threshold are both values ​​set according to actual needs. Optionally, the weight coefficient and the evaluation attribute threshold may be the result calculated based on the test boundary value of the server with the same configuration.

[0075] Specifically, the processing result of the average data result relative to the evaluation attribute threshold of the current evaluation dimension is determined, and the processing result is multiplied by the weight coefficient corresponding to the current evaluation dimension to obtain the evaluation attribute to be fused under the current evaluation dimension.

[0076] Exemplarily, in combination with the above example, for the CPU usage dimension, the average data result may be the average value of the CPU utilization. If the average value of the CPU utilization is 80%, the evaluation attribute threshold under the CPU usage dimension may be 85%, and the weight coefficient is 0.3. Then, the evaluation attribute to be fused under the CPU usage dimension is: 0.3*(80% / 85%)≈0.28.

[0077] For the memory usage dimension, the average data result may be the average value of the memory usage rate. If the average value of the memory usage rate is 80%, the evaluation attribute threshold under the memory usage dimension may be 80%, and the weight coefficient is 0.3. Then, the evaluation attribute to be fused under the memory usage dimension is: 0.3*(80% / 80%)=0.3.

[0078] In an embodiment of the present invention, the data to be processed under the disk read and write dimension is the disk read and write waiting time of the main server. The method for determining the evaluation attribute to be merged under the disk read and write dimension can be: for the disk read and write dimension, according to the disk read and write waiting time under at least one time slice, the evaluation attribute threshold corresponding to the disk read and write dimension, and the weight coefficient, determine the evaluation attribute to be merged under the disk read and write dimension.

[0079] The disk read / write waiting time can be understood as the input / output waiting time of the disk device in the primary server.

[0080] Specifically, for the disk read and write dimension, the disk read and write waiting time under at least one time slice is averaged to obtain the average disk read and write waiting time. The ratio of the average disk read and write waiting time to the evaluation attribute threshold corresponding to the disk read and write dimension is calculated. Based on the ratio and the weight coefficient corresponding to the disk read and write dimension, the evaluation attribute to be fused under the disk read and write dimension is obtained.

[0081] Exemplarily, in combination with the above example, the proc / diskstats file is read to extract the disk read and write wait time of each disk device. Since the data read from the proc / diskstats file is the cumulative value since the main server was running, the disk read and write wait time corresponding to the time slice can be determined according to the set time slice. If the disk read and write wait time is 8ms, the evaluation attribute threshold corresponding to the disk read and write dimension is 10ms, and the weight coefficient is 0.2. Then the evaluation attribute to be merged under the disk read and write dimension is 0.2 (8 / 10) = 0.16.

[0082] In an embodiment of the present invention, the data to be processed under the main server response rate dimension is the start time and end time of the main server processing the network request. The method for determining the evaluation attribute to be fused under the main server response rate dimension can be: for the main server response rate dimension, based on the start time and end time of the main server processing the network request, determine the response duration under at least one time slice; based on the response duration under at least one time slice, the evaluation attribute threshold corresponding to the main server response rate dimension, and the weight coefficient, determine the evaluation attribute to be fused under the main server response rate dimension.

[0083] The start time can be understood as the start time of initiating the network request. The end time can be the time when the network request is processed. The response time can be understood as the time to process the network request, that is, the difference between the end time and the start time.

[0084] Specifically, for the main server response rate dimension, the corresponding response time under each time slice is calculated according to the start time and end time of the main server processing the network request. The response time under at least one time slice is averaged to obtain the average value of the response time. According to the average value of the response time and the evaluation attribute threshold corresponding to the main server response rate dimension, the ratio of the average value of the response time to the evaluation attribute threshold is determined. According to the ratio and the weight coefficient, the evaluation attribute to be fused under the main server response rate dimension is determined.

[0085] Exemplarily, the time when the network request is initiated is taken as the starting time, and the time when the program logic processing corresponding to the network request is completed is taken as the ending time. According to the starting time and the ending time, the time difference of processing the network request, that is, the response time, is calculated. Since the network requests are different, the response time of processing the network requests is also different. Then, the response time under at least one time slice is averaged to obtain the average value of the response time. Based on this, the calculation error caused by the different response times of the network requests can be avoided.

[0086] If the average response time is 1 second, the evaluation attribute threshold corresponding to the primary server response rate dimension is 2 seconds, and the weight coefficient is 0.2, then the evaluation attribute to be merged under the primary server response rate dimension is: 0.2*(1 / 2)=0.1.

[0087] Further, in combination with the above example, if the main server includes the evaluation attributes to be integrated under the above four evaluation dimensions, the operating performance attribute of the main server is: 0.28+0.3+0.16+0.1=0.84.

[0088] The technical solution of this embodiment determines the data calculation result of the first data relative to the second data under each time slice based on the first data and the second data in the data to be processed under the current evaluation dimension under each time slice by using the CPU usage dimension and the memory usage dimension. Based on the data calculation result under each time slice, the average data result is determined. Based on the average data result and the evaluation function corresponding to the current evaluation dimension, the evaluation attribute to be fused under the current evaluation dimension is determined. The processing method of the evaluation attributes to be fused under the disk read and write dimension and the main server response rate dimension is similar. Through the above method, the evaluation attributes to be fused under the four evaluation dimensions are accurately determined, which improves the accuracy of data processing. Based on this, it is convenient to evaluate the operating performance of the main server according to the corresponding evaluation attributes to be fused under the four evaluation dimensions in the future, so as to determine whether the main server needs to perform server switching processing, so as to reduce the operating pressure of the main server and ensure the operating performance of the main server.

[0089] Embodiment 3

[0090] Figure 3 FIG. 1 is a schematic diagram of the structure of a server switching device provided by Embodiment 3 of the present invention. Figure 3 As shown, the apparatus includes: a data acquisition module 310 , an evaluation attribute determination module 320 , a performance attribute determination module 330 and a server switching module 340 .

[0091] The data acquisition module 310 is used to obtain the data to be processed under at least one evaluation dimension of the main server under at least one time slice, and the at least one evaluation dimension includes at least one of the central processing unit usage dimension, the memory usage dimension, the disk read and write dimension, and the main server response rate dimension; the evaluation attribute determination module 320 is used to determine the evaluation attribute to be integrated under the current evaluation dimension for at least one evaluation dimension according to the data to be processed under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension; the performance attribute determination module 330 is used to determine the operating performance attribute of the main server according to the evaluation attribute to be integrated corresponding to at least one evaluation dimension; the server switching module 340 is used to switch from the main server to the target slave server when the operating performance attribute meets the preset conditions.

[0092] The technical solution of this embodiment provides data support for the subsequent determination of the operating performance of the main server through the data to be processed under at least one evaluation dimension of the main server under at least one time slice. For at least one evaluation dimension, the evaluation attribute to be fused under the current evaluation dimension is determined according to the data to be processed under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension. The operating performance attribute of the main server is determined according to the evaluation attribute to be fused corresponding to at least one evaluation dimension, thereby achieving an accurate evaluation of the operating performance of the main server. When the operating performance attribute meets the preset conditions, the main server switches to the target slave server, which solves the problem of excessive loss and reduced performance of the main server caused by server switching processing when the main server fails in the prior art. The present invention realizes timely switching of the main server, reduces the loss of the main server, and ensures the operating performance of the main server.

[0093] On the basis of the above embodiment, optionally, the evaluation attribute determination module includes: a data calculation result determination unit, which is used to determine the data calculation result of the first data relative to the second data in each time slice based on the first data and the second data in the data to be processed in the current evaluation dimension in each time slice for the central processing unit usage dimension and the memory usage dimension; an average data result determination unit, which is used to determine the average data result based on the data calculation result in each time slice; an evaluation attribute determination unit, which is used to determine the evaluation attribute to be merged in the current evaluation dimension based on the average data result and the evaluation function corresponding to the current evaluation dimension; wherein the first data and the second data in the central processing unit usage dimension are respectively the non-idle time and the total processing time corresponding to the central processing unit when processing the task, and the first data and the second data in the memory usage dimension are respectively the used memory amount and the total memory amount corresponding to the main server.

[0094] Optionally, the evaluation attribute determination unit is used to determine the processing result of the average data result relative to the evaluation attribute threshold of the current evaluation dimension; based on the processing result and the weight coefficient of the current evaluation dimension, determine the evaluation attribute to be fused corresponding to the current evaluation dimension.

[0095] Optionally, the data to be processed under the disk read and write dimension is the disk read and write waiting time of the main server, and the evaluation attribute determination module is used to: for the disk read and write dimension, determine the evaluation attribute to be merged under the disk read and write dimension according to the disk read and write waiting time under at least one time slice, the evaluation attribute threshold corresponding to the disk read and write dimension, and the weight coefficient.

[0096] Optionally, the data to be processed under the main server response rate dimension is the start time and end time of the main server processing the network request, and the evaluation attribute determination module is used to: for the main server response rate dimension, based on the start time and end time of the main server processing the network request, determine the response duration under at least one time slice; based on the response duration under at least one time slice, the evaluation attribute threshold corresponding to the main server response rate dimension, and the weight coefficient, determine the evaluation attribute to be merged under the main server response rate dimension.

[0097] Optionally, when the operating performance attributes meet preset conditions, the device also includes: a data synchronization module, which includes: a data acquisition unit, used to obtain task progress information of each task to be synchronized in the master server and the data to be synchronized corresponding to the task progress information, wherein the data to be synchronized is the processed data corresponding to the completed progress in the task progress information; a data synchronization unit, used to synchronize the task progress information and the data to be synchronized to the target slave server.

[0098] Optionally, before switching from the master server to the target slave server, the device also includes: a notification information feedback module, which is used to process the operating performance attributes and the data to be processed under each evaluation dimension according to a pre-configured notification template, generate notification information, and feed back the notification information to the target terminal, wherein the pre-configured notification template includes a notification method and notification terminology information of at least one notification object.

[0099] The server switching device provided in the embodiment of the present invention can execute the server switching method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0100] Embodiment 4

[0101] Figure 4 1 is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0102] like Figure 4As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0103] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0104] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a server switching method.

[0105] In some embodiments, the server switching method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the server switching method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the server switching method in any other appropriate manner (e.g., by means of firmware).

[0106] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0107] The computer program for implementing the server switching method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0108] Embodiment 5

[0109] Embodiment 5 of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to cause a processor to execute a server switching method, the method comprising:

[0110] Obtain the data to be processed under at least one evaluation dimension of the master server under at least one time slice, wherein the at least one evaluation dimension includes at least one of a central processing unit usage dimension, a memory usage dimension, a disk read / write dimension, and a master server response rate dimension; for at least one evaluation dimension, determine the evaluation attribute to be integrated under the current evaluation dimension according to the data to be processed under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension; determine the operating performance attribute of the master server according to the evaluation attribute to be integrated corresponding to the at least one evaluation dimension; when the operating performance attribute meets a preset condition, switch from the master server to the target slave server.

[0111] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0112] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0113] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0114] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0115] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0116] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A server switching method, characterized in that: include: Obtaining data to be processed in at least one evaluation dimension of the primary server in at least one time slice, wherein the at least one evaluation dimension includes at least one of a central processing unit usage dimension, a memory usage dimension, a disk read / write dimension, and a primary server response rate dimension; For the at least one evaluation dimension, determining the evaluation attribute to be integrated under the current evaluation dimension according to the to-be-processed data under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension; Determining the operating performance attribute of the master server according to the to-be-fused evaluation attribute corresponding to the at least one evaluation dimension; When the operating performance attribute meets a preset condition, the master server switches to the target slave server.

2. The method according to claim 1, characterized in that: The step of determining the evaluation attribute to be integrated under the current evaluation dimension according to the data to be processed under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension includes: For the CPU usage dimension and the memory usage dimension, based on the first data and the second data in the data to be processed under the current evaluation dimension under each time slice, determine a data calculation result of the first data relative to the second data under each time slice; Based on the data calculation results under each time slice, an average data result is determined; Based on the average data result and the evaluation function corresponding to the current evaluation dimension, determining the evaluation attribute to be fused under the current evaluation dimension; Among them, the first data and the second data under the CPU usage dimension are respectively the non-idle time and the total processing time corresponding to the CPU processing tasks, and the first data and the second data under the memory usage dimension are respectively the used memory amount and the total memory amount corresponding to the main server.

3. The method according to claim 2, characterized in that The determining, based on the average data result and the evaluation function corresponding to the current evaluation dimension, the evaluation attribute to be integrated under the current evaluation dimension includes: Determining a processing result of the average data result relative to an evaluation attribute threshold of the current evaluation dimension; Based on the processing result and the weight coefficient of the current evaluation dimension, the to-be-fused evaluation attribute corresponding to the current evaluation dimension is determined.

4. The method according to claim 1, characterized in that: The data to be processed under the disk read and write dimension is the disk read and write waiting time of the master server, and the evaluation attribute to be merged under the current evaluation dimension is determined according to the data to be processed under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension, including: For the disk read and write dimension, the evaluation attribute to be fused under the disk read and write dimension is determined according to the disk read and write waiting time under at least one time slice, the evaluation attribute threshold corresponding to the disk read and write dimension, and the weight coefficient.

5. The method according to claim 1, characterized in that The data to be processed under the main server response rate dimension is the start time and the end time of the main server processing the network request. The determining of the evaluation attribute to be merged under the current evaluation dimension according to the data to be processed under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension includes: For the primary server response rate dimension, based on the start time and end time of the primary server processing the network request, determine the response duration under at least one time slice; Based on the response duration under the at least one time slice, the evaluation attribute threshold corresponding to the main server response rate dimension, and the weight coefficient, the evaluation attribute to be merged under the main server response rate dimension is determined.

6. The method according to claim 1, characterized in that When the operating performance attribute meets a preset condition, the method further includes: Acquire task progress information of each task to be synchronized in the master server and data to be synchronized corresponding to the task progress information, wherein the data to be synchronized is processed data corresponding to the completed progress in the task progress information; The task progress information and the data to be synchronized are synchronized to the target slave server.

7. The method according to claim 1, characterized in that Before switching from the master server to the target slave server, the method further includes: The operating performance attributes and the data to be processed under each evaluation dimension are processed according to a pre-configured notification template to generate notification information, and the notification information is fed back to the target terminal, wherein the pre-configured notification template includes a notification method and notification terminology information of at least one notification object.

8. A server switching device, characterized in that: include: A data acquisition module, used to acquire the to-be-processed data of the master server under at least one evaluation dimension under at least one time slice, wherein the at least one evaluation dimension comprises at least one item of a CPU usage dimension, a memory usage dimension, a disk read / write dimension, and a master server response rate dimension; An evaluation attribute determination module, configured to determine, for the at least one evaluation dimension, the evaluation attribute to be integrated under the current evaluation dimension according to the to-be-processed data under the current evaluation dimension and the evaluation function corresponding to the current evaluation dimension; A performance attribute determination module, configured to determine the operating performance attribute of the master server according to the to-be-fused evaluation attribute corresponding to the at least one evaluation dimension; The server switching module is used to switch from the master server to the target slave server when the running performance attribute meets the preset condition.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the server switching method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the server switching method according to any one of claims 1 to 7 when executed.