Server switching method and apparatus, and electronic device

By dynamically adjusting the switching parameters of the DHCP server, the problem of unreliable DHCP server switching is solved, the reliability of the DHCP server and the network environment is improved, and the stability of the DHCP server and the network environment is adapted to dynamic changes.

CN119892795BActive Publication Date: 2025-11-07NEW H3C TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510115143.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-11-07
Estimated Expiration
2045-01-23

AI Technical Summary

Technical Problem

In a CRS network environment, the switching parameters of the DHCP server in the existing technology are fixed parameters that are pre-configured manually. These parameters cannot adapt to the dynamic changes in the stability of the DHCP server and the network environment, which may lead to switching to a less stable server, affecting the reliability of DHCP server switching and the reliability of the network environment.

Method used

By dynamically adjusting the switching parameters of the DHCP server, including the selection priority and switching wait time, and utilizing the switching count, return packet speed, and historical network stability parameters of each DHCP server within a specified historical time period, the selection priority and switching wait time are dynamically adjusted to adapt to the dynamic changes in the stability of the DHCP server and the network environment.

Benefits of technology

This effectively avoids switching to an unstable server when switching DHCP servers, improving the reliability of DHCP server switching and thus improving the reliability of the network environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892795B_ABST
    Figure CN119892795B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a server switching method and device and electronic equipment. In the embodiments of the present application, the switching parameters of each DHCP server, i.e., the selected priority and the switching waiting time, are dynamically adjusted by using the number of switching times of each DHCP server within a specified historical time period, the latest recorded packet speed information of each DHCP server, the latest recorded historical network stability parameters, and the current network stability parameters, so that the adjusted switching parameters of each DHCP server are adapted to the stability of each DHCP server and the networking environment as much as possible. This can effectively avoid the situation that the DHCP server with poor stability is switched to when switching the DHCP server, thereby improving the reliability of the DHCP server switching and further improving the reliability of the networking environment of each DHCP server.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of communication technology, and in particular to a server switching method and device and electronic equipment. BACKGROUND

[0002] DHCP protocol is usually applied in a local network environment, and mainly functions to centrally manage and allocate address information such as IP addresses, so that hosts in the network environment can dynamically obtain address information such as IP addresses. DHCP is the abbreviation of Dynamic Host Configuration Protocol; and IP is the abbreviation of Internet Protocol.

[0003] In a Client-Relay-Server (C-R-S) networking environment, when a DHCP relay server (also known as a Relay) receives an address request message sent by a client (such as the host described above), it selects the highest-ranked DHCP server (also known as a server) from the DHCP servers according to the pre-configured order of the DHCP servers, sends the message to the current DHCP server, so that the current DHCP server returns the corresponding address information to the client based on the message; based on this, if no response result returned by the current DHCP server is received after a set switching waiting time (such as 10 seconds), the current DHCP server is switched to the next DHCP server according to the above-mentioned order, that is, the next DHCP server is used as the current DHCP server, and the message is sent to the current DHCP server; and this process is repeated until the address information returned by the current DHCP server based on the message is received.

[0004] However, in the above application process, the order of the DHCP servers and the set switching waiting time are fixed parameters pre-configured manually, while the stability of the DHCP servers and the stability of the networking environment are dynamically changing, and the pre-configured order and the set switching waiting time cannot be applied to the dynamically changing DHCP servers and networking environment, so that when the DHCP server is switched, it may be switched to a DHCP server with poor stability, affecting the reliability of the DHCP server switching, and thus affecting the reliability of the networking environment. SUMMARY

[0005] Therefore, the present application provides a server switching method, device and electronic equipment to improve the reliability of DHCP server switching.

[0006] The embodiment of the application provides a server switching method, which is applied to an electronic device, the electronic device establishes connections with N dynamic host configuration protocol (DHCP) servers respectively, and N is greater than 1; the method comprises the following steps:

[0007] obtaining the switching times information of each DHCP server in a specified historical time period, the latest recorded packet speed information of each DHCP server, and the latest recorded historical network stability parameter;

[0008] determining a first adjustment coefficient for adjusting the switching parameter of each DHCP server according to the switching times information of each DHCP server in the specified historical time period and the latest recorded packet speed information of each DHCP server, wherein the switching parameter comprises a selected priority and a switching waiting time;

[0009] adjusting the selected priority of each DHCP server according to the first adjustment coefficient of each DHCP server and the latest recorded historical network stability parameter;

[0010] adjusting the switching waiting time of each DHCP server according to the latest recorded historical network stability parameter and a current network stability parameter, wherein the current network stability parameter is determined depending on the first adjustment coefficient of each DHCP server.

[0011] The embodiment of the application further provides a server switching device, which is applied to an electronic device, the electronic device establishes connections with N dynamic host configuration protocol (DHCP) servers respectively, and N is greater than 1; the device comprises the following steps:

[0012] a obtaining module, which is used for obtaining the switching times information of each DHCP server in a specified historical time period, the latest recorded packet speed information of each DHCP server, and the latest recorded historical network stability parameter;

[0013] a determining module, which is used for determining a first adjustment coefficient for adjusting the switching parameter of each DHCP server according to the switching times information of each DHCP server in the specified historical time period and the latest recorded packet speed information of each DHCP server, wherein the switching parameter comprises a selected priority and a switching waiting time;

[0014] a first adjustment module, which is used for adjusting the selected priority of each DHCP server according to the first adjustment coefficient of each DHCP server and the latest recorded historical network stability parameter;

[0015] The second adjusting module is configured to adjust the switching waiting time of each DHCP server according to the latest recorded historical network stability parameter and the current network stability parameter, and the current network stability parameter is determined according to the first adjusting coefficient of each DHCP server.

[0016] The embodiments of the present application also provide an electronic device, which comprises:

[0017] a processor; and

[0018] A computer readable storage medium has computer program instructions stored therein, and the computer program instructions, when executed by a processor, cause the processor to perform the steps of the above method.

[0019] The embodiments of the present application also provide a computer readable storage medium having computer program instructions stored thereon, and the computer program instructions, when executed by a processor, cause the processor to perform the steps of the above method.

[0020] As can be seen from the above technical solutions, in the embodiments of the present application, by using the number of switching times of each DHCP server in a specified historical time period, the latest recorded packet speed information of each DHCP server, the latest recorded historical network stability parameter, and the current network stability parameter, the switching parameters of each DHCP server, i.e., the selected priority and the switching waiting time, are dynamically adjusted so that the adjusted switching parameters of each DHCP server are suitable for the dynamically changing stability of each DHCP server and the networking environment, which can effectively avoid the situation that the DHCP server with poor stability is switched to when the DHCP server is switched, thereby improving the reliability of the DHCP server switching and further improving the reliability of the networking environment of each DHCP server. BRIEF DESCRIPTION OF DRAWINGS

[0021] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.

[0022] Figure 1 The method flowchart provided by the embodiments of the present application.

[0023] Figure 2 Another method flowchart provided by the embodiments of the present application.

[0024] Figure 3 Still another method flowchart provided by the embodiments of the present application.

[0025] Figure 4 The device structure diagram provided by the embodiments of the present application.

[0026] Figure 5 An electronic device structure schematic diagram is provided for the embodiments of the present application. DETAILED DESCRIPTION

[0027] As described before, in the related art, in the C-R-S networking environment, the DHCP relay server selects the DHCP server for processing the address request message sent by the client according to the pre-configured order of each DHCP server and the set waiting time when receiving the address request message. However, this will cause the following problems:

[0028] (1) In actual application, the stability of the network link between the DHCP relay server and each DHCP server (denoted as server) is inconsistent; for example, it is assumed that the DHCP relay server is connected with three DHCP servers (denoted as server 1, server 2, and server 3, respectively), and the pre-configured order of each server is server 1, server 2, and server 3; and the current order of each server according to the stability of the network link between the DHCP relay server and the server from high to low is server 3, server 1, and server 2; thus, if the server is switched according to the pre-configured order each time, the server with worse network link stability may be switched to, thereby reducing the reliability of server switching;

[0029] (2) The stability of the same server at different times (i.e., the stability of the device itself) is also dynamically changing; if the server is switched according to the pre-configured order, the server with worse stability may be switched to, thereby reducing the reliability of server switching;

[0030] (3) Different servers have different network links between the DHCP relay server and the server and different stabilities; the server with higher stability does not need a long switching waiting time, while the server with lower stability needs to be given enough message processing time, i.e., a relatively long switching waiting time. The use of the pre-configured fixed switching waiting time cannot be applied to the server and the networking environment with dynamically changing stability, and will reduce the reliability of server switching.

[0031] To solve the above problems, the embodiment of the present application provides a server switching method, by dynamically adjusting the switching parameters of each DHCP server, i.e. the selected priority and the switching waiting time, so that the adjusted switching parameters of each DHCP server are suitable for the dynamically changing stability of each DHCP server and the networking environment, which can effectively avoid the situation that the DHCP server with poor stability is switched to when switching the DHCP server, thereby improving the reliability of the DHCP server switching, and further improving the reliability of the networking environment of each DHCP server.

[0032] In order for those skilled in the art to better understand the technical solutions provided by the embodiments of the present application, and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be further described in detail below with reference to the drawings.

[0033] Referring to Figure 1 , Figure 1 The method flowchart provided by the embodiments of the present application. The method is applied to an electronic device. As an embodiment, the electronic device establishes a connection with N DHCP servers respectively, and N is greater than 1; the electronic device can be a DHCP relay server, etc., and the embodiments are not specifically limited.

[0034] As shown in Figure 1 , the flowchart can include the following steps:

[0035] Step 101, obtaining the switching frequency information of each DHCP server in a specified historical time period, the latest recorded packet speed information of each DHCP server, and the latest recorded historical network stability parameters.

[0036] In the embodiment, as an embodiment, to make the switching parameters of each DHCP server suitable for the dynamically changing stability of each DHCP server and the networking environment of each DHCP server, the switching parameters of N DHCP servers can be adjusted every set adjustment time. Here, the set adjustment time can be flexibly set based on actual application requirements, such as 10 minutes, 1 hour or 2 hours, etc., and the embodiments are not specifically limited. Based on this, when it is determined that the switching parameters of N DHCP servers need to be adjusted, the switching frequency information of each DHCP server in a specified historical time period, the latest recorded packet speed information of each DHCP server, and the latest recorded historical network stability parameters are first obtained, for subsequent adjustment of the switching parameters of each DHCP server. As for the specific content of the switching parameters, examples will be described below, which will not be described here.

[0037] In the embodiment, as an example, the specified historical time period can be a time period ending at the time when the switching parameter of the N DHCP servers needs to be adjusted, and the time length is the same as the set adjustment time. The embodiment is not specifically limited in this regard, and can be flexibly set based on actual application requirements.

[0038] In the embodiment, the switching number information of any DHCP server indicates the switching number of the DHCP. Based on this, as an example, for any DHCP server, if it is found that the DHCP server is switched to by a DHCP server other than the DHCP server within the specified historical time period, the sum of the latest recorded switching number of the DHCP server and a set value is taken as the switching number of the DHCP server; the set value can be 1, for example. It should be noted that at the start time of the specified historical time period, the switching number of the DHCP server is an initial value, which can be 0, for example.

[0039] In the embodiment, the packet return speed information of any DHCP server indicates the packet return speed of the DHCP. The packet return speed of any DHCP server is determined according to the packet return time of the DHCP server, for example, the packet return speed of any DHCP server can be the ratio of 1 to the packet return time of the DHCP server, which is not specifically limited in this regard. The packet return time of the DHCP server can be the time period between the time when the address request message is sent from the sending end and the time when the DHCP server returns the response result based on the address request message.

[0040] In step 102, according to the switching number information of each DHCP server within the specified historical time period and the latest recorded packet return speed information of each DHCP server, a first adjustment coefficient for adjusting the switching parameter of each DHCP server is correspondingly determined, and the switching parameter includes the selected priority and the switching waiting time.

[0041] In the embodiment, the first adjustment coefficient for adjusting the switching parameter of the DHCP server can be understood as a parameter associated with the device stability of the DHCP server. The higher the device stability of the DHCP server, the higher the first adjustment coefficient of the DHCP server, and the lower the device stability of the DHCP server, the lower the first adjustment coefficient of the DHCP server.

[0042] For any DHCP server, if the number of switches of the DHCP server in the specified historical time period is large and the speed of the reply packet is slow (i.e., the smaller the speed of the reply packet is, the smaller the value is), it indicates that the device stability of the DHCP server is low, and in this case, the first adjustment coefficient of the DHCP server is low. If the number of switches of the DHCP server in the specified historical time period is small and the speed of the reply packet is fast (i.e., the larger the speed of the reply packet is, the larger the value is), it indicates that the device stability of the DHCP server is high, and in this case, the first adjustment coefficient of the DHCP server is high. Based on this, as an embodiment, the first adjustment coefficient of any DHCP server in the embodiment and the number of switches of the DHCP server in the specified historical time period are negatively correlated, and the first adjustment coefficient of any DHCP server in the embodiment and the speed of the reply packet of the DHCP server recorded last time are positively correlated.

[0043] In the embodiment, the first adjustment coefficient for adjusting the switching parameter of each DHCP server is determined according to the number of switches of each DHCP server in the specified historical time period and the speed of the reply packet of each DHCP server recorded last time. There are many ways in specific implementation, for example, as an embodiment, for each DHCP server, the number of switches of the DHCP server in the specified historical time period and the speed of the reply packet of each DHCP server recorded last time can be input into a preset function for calculating the first adjustment coefficient to obtain the first adjustment coefficient for adjusting the switching parameter of the DHCP server.

[0044] Based on the above description, the preset function for calculating the first adjustment coefficient in the embodiment can be flexibly set according to the negative correlation between the first adjustment coefficient of any DHCP server and the number of switches of the DHCP server in the specified historical time period, and the positive correlation between the first adjustment coefficient of any DHCP server and the speed of the reply packet of the DHCP server recorded last time. For example, as an embodiment, the preset function for calculating the first adjustment coefficient can be Rs=Vs / (Ns+1), where Rs represents the first adjustment coefficient of the DHCP server, Vs represents the speed of the reply packet of the DHCP server, and Ns represents the number of switches of the DHCP server.

[0045] In step 103, the selected priority of each DHCP server is adjusted according to the first adjustment coefficient of each DHCP server and the historical network stability parameter recorded last time.

[0046] In the embodiment, in order to effectively ensure that each DHCP server after adjustment of the switching parameter is more suitable for the dynamically changing stability of the DHCP server and the network environment where each DHCP server is located, when updating the selected priority of each DHCP server, at least the device stability of each DHCP server and the stability of the network environment where each DHCP server is located need to be considered. The network stability parameter is used to indicate the stability of the network where the N DHCP servers are located.

[0047] Based on this, for any DHCP server, the embodiment can adjust the selected priority of the DHCP server according to the parameter associated with the device stability of the DHCP server, that is, the first adjustment coefficient of the DHCP server, and the latest recorded historical network stability parameter, so that the adjusted selected priority of the DHCP server is more suitable for the dynamically changing stability of the DHCP server and the network environment where each DHCP server is located. This can effectively avoid the situation that the switching to a DHCP server with poor stability may occur when switching the DHCP server, thereby improving the reliability of the DHCP server switching, and further improving the reliability of the networking environment where each DHCP server is located.

[0048] As for how to adjust the selected priority of each DHCP server according to the first adjustment coefficient of each DHCP server and the latest recorded historical network stability parameter in the step 103, examples will be described below, which will not be described here.

[0049] In step 104, the switching waiting time of each DHCP server is adjusted according to the latest recorded historical network stability parameter and the current network stability parameter.

[0050] Based on the above description, in the embodiment, in order to effectively ensure that each DHCP server after adjustment of the switching parameter is more suitable for the dynamically changing stability of the DHCP server and the network environment where each DHCP server is located, when adjusting the switching waiting time of each DHCP server, at least the device stability of each DHCP server and the stability of the network environment where each DHCP server is located need to be considered.

[0051] Based on this, for any DHCP server, the embodiment can adjust the switching waiting time of the DHCP server according to the parameters associated with the device stability of the DHCP server and the stability of the network environment where each DHCP server is located, that is, the latest recorded historical network stability parameters and the current network stability parameters, so that the adjusted switching waiting time of the DHCP server is more suitable for the DHCP server with dynamic stability change and the network environment where each DHCP server is located. This can effectively avoid the situation that the DHCP server with poor stability is switched to when switching the DHCP server, thereby improving the reliability of the DHCP server switching, and further improving the reliability of the networking environment where each DHCP server is located.

[0052] In the embodiment, as an example, the current network stability parameter can be determined by taking the average of the first adjustment coefficients of each DHCP server as the current network stability parameter.

[0053] In the embodiment, as an example, the adjusted switching parameters of the N DHCP servers can be used as the basis for selecting each DHCP server for address request message processing. Specifically, when the DHCP relay server receives an address request message sent by the client, it first selects the DHCP server with the highest selection priority from each DHCP server as the current DHCP server based on the selection priority of each DHCP server, and sends the address request message to the current DHCP server. If the response result of the address request message (that is, the address information such as IP address in response to the address request message) is not received after the switching waiting time of the current DHCP server, the DHCP server with the highest selection priority is selected from the remaining DHCP servers that have not been selected as the DHCP server to be switched to based on the selection priority of each DHCP server. The selected DHCP server to be switched to is taken as the current DHCP server, and the step of sending the address request message to the current DHCP server is returned until the response result of the address request message returned by the current DHCP server is received.

[0054] As for how to adjust the switching waiting time of each DHCP server according to the latest recorded historical network stability parameters and the current network stability parameters in this step 104, examples will be described below, which will not be described here.

[0055] At this point, the process of Figure 1 shown in the flowchart is completed.

[0056] Through Figure 1As can be seen from the flow, in the embodiment of the present application, by using the number of switches of each DHCP server in the specified historical time period, the latest recorded packet speed information of each DHCP server, the latest recorded historical network stability parameter, and the current network stability parameter, the switching parameters of each DHCP server, i.e., the selected priority and the switching waiting time, are dynamically adjusted, so that the adjusted switching parameters of each DHCP server are adapted to the stability of each DHCP server and the networking environment as much as possible, which can effectively avoid the situation that the DHCP server with poor stability is switched to when switching the DHCP server, thereby improving the reliability of the DHCP server switching, and further improving the reliability of the networking environment of each DHCP server.

[0057] The following describes how to adjust the selected priority of each DHCP server according to the first adjustment coefficient of each DHCP server and the latest recorded historical network stability parameter in step 103:

[0058] In the embodiment, there are many implementation manners for adjusting the selected priority of each DHCP server according to the first adjustment coefficient of each DHCP server and the latest recorded historical network stability parameter; for example, as an embodiment, for each DHCP server, first, the first difference between the first adjustment coefficient of the DHCP server and the latest recorded historical network stability parameter is calculated; then, the first difference is input into a first specified function to obtain a second adjustment coefficient for adjusting the switching parameter of the DHCP server; finally, the second adjustment coefficient of the DHCP server is input into a second specified function to obtain a calculation result, and the calculation result is taken as the selected priority of the DHCP server.

[0059] In the embodiment, the second adjustment coefficient for adjusting the switching parameter of the DHCP server can be understood as a parameter associated with the device stability of the DHCP server and / or the overall stability of the network environment where the DHCP server is located, the higher the device stability of the DHCP server and / or the overall stability of the network environment where the DHCP server is located, the higher the second adjustment coefficient of the DHCP server, and the lower the device stability of the DHCP server and / or the overall stability of the network environment where the DHCP server is located, the lower the second adjustment coefficient of the DHCP server.

[0060] For any DHCP server, the greater the first difference between the first adjustment coefficient of the DHCP server and the latest recorded historical network stability parameter, the higher the device stability of the DHCP server and / or the overall stability of the network environment in which the DHCP server is located, and in this case, the greater the second adjustment coefficient of the DHCP server; correspondingly, the smaller the first difference between the first adjustment coefficient of the DHCP server and the latest recorded historical network stability parameter, the lower the device stability of the DHCP server and / or the overall stability of the network environment in which the DHCP server is located, and in this case, the smaller the second adjustment coefficient of the DHCP server. Based on this, as an embodiment, for any DHCP server, the second adjustment coefficient of the DHCP server and the first difference between the first adjustment coefficient of the DHCP server and the latest recorded historical network stability parameter are in a positive correlation relationship.

[0061] Based on the above description, the first specified function used to calculate the second adjustment coefficient in this embodiment can be flexibly set according to the positive correlation relationship between the second adjustment coefficient of the DHCP server and the first difference between the first adjustment coefficient of the DHCP server and the latest recorded historical network stability parameter. For example, as an embodiment, the above-mentioned first specified function can be: Hs' = Hs + a(Rs-Ra), where Hs' represents the second adjustment coefficient currently calculated, Hs represents the latest recorded second adjustment coefficient, a represents a preset adjustment factor indicating the adjustment amplitude, a is greater than 0, and Ra represents the latest recorded historical network stability parameter.

[0062] In this embodiment, the selected priority of any DHCP server is associated with the device stability of the DHCP server and / or the overall stability of the network environment in which the DHCP server is located; specifically, the higher the device stability of the DHCP server and / or the overall stability of the network environment in which the DHCP server is located, the higher the selected priority of the DHCP server, and the lower the device stability of the DHCP server and / or the overall stability of the network environment in which the DHCP server is located, the lower the selected priority of the DHCP server. Based on this, the selected priority of any DHCP server in this embodiment and the second adjustment coefficient of the DHCP server are in a positive correlation relationship; that is, the greater the second adjustment coefficient of the DHCP server, the higher the selected priority of the DHCP server, and the smaller the second adjustment coefficient of the DHCP server, the lower the selected priority of the DHCP server.

[0063] Based on the above description, the second specified function used for determining the selected priority of the DHCP server in the embodiment can be flexibly set according to the positive correlation between the selected priority of the DHCP server and the second adjustment coefficient of the DHCP server. For example, as an embodiment, the second specified function can be Ps’ = Ps + β * Hs, where Ps’ represents the selected priority of the DHCP server currently determined, Ps represents the selected priority of the DHCP server recorded last time, and β represents a preset priority adjustment factor, and β is greater than 0.

[0064] The following describes how to adjust the switching waiting time of each DHCP server according to the latest recorded historical network stability parameter and the current network stability parameter in step 103.

[0065] In the embodiment, there are many specific implementation manners for adjusting the switching waiting time of each DHCP server according to the latest recorded historical network stability parameter and the current network stability parameter; for example, as an embodiment, referring to the method flow diagram shown in FIG. 8, the method can include the following steps: Figure 2

[0066] Step 201: For each DHCP server, input the second adjustment coefficient of the DHCP server into a third specified function to obtain a first reference time for adjusting the switching waiting time of the DHCP server.

[0067] In the embodiment, as known from the foregoing description, the greater the second adjustment coefficient of the DHCP server, the higher the device stability of the DHCP server, and if the DHCP server switches, it indicates that the device stability of the DHCP server can be irrelevant, but the device failure of the DHCP server can occur, so the switching waiting time does not need to be prolonged due to the device stability of the DHCP server, that is, the switching waiting time of the DHCP server can be reduced; based on this, the greater the second adjustment coefficient of the DHCP server, the smaller the first reference time for adjusting the switching waiting time of the DHCP server.

[0068] ​Correspondingly, the smaller the second adjustment coefficient of the DHCP server is, the lower the device stability of the DHCP server is, and if the DHCP server switches, it indicates that it may be related to the device stability of the DHCP server. In this case, the switching waiting time needs to be extended due to the device stability of the DHCP server, that is, the switching waiting time of the DHCP server can be increased to reserve sufficient message processing time for the DHCP server as much as possible. Therefore, the smaller the second adjustment coefficient of the DHCP server is, the greater the first reference time for adjusting the switching waiting time of the DHCP server is.

[0069] Based on the above description, in the embodiment, the first reference time for adjusting the switching waiting time of any DHCP server is negatively correlated with the second adjustment coefficient of the DHCP server.

[0070] In the embodiment, the third specified function for calculating the first reference time can be flexibly set according to the negative correlation between the first reference time for adjusting the switching waiting time of any DHCP server and the second adjustment coefficient of the DHCP server. For example, as an embodiment, the third specified function can be Ts’ = Ts- γ*Hs, where Ts’ represents the first reference time of the DHCP server currently calculated, Ts represents the first reference time of the DHCP server recorded last time, γ represents a preset first time adjustment factor, and γ is greater than 0.

[0071] In step 202, a second difference between the current network stability parameter and the latest recorded historical network stability parameter is calculated.

[0072] In step 203, the second difference is input into a fourth specified function to obtain a second reference time for adjusting the switching waiting time of the DHCP server.

[0073] In the embodiment, the greater the second difference is, the more the overall stability of the network environment in which the DHCP server is currently located is improved compared to the overall stability of the network environment in which the DHCP server is previously located. If the DHCP server switches, it indicates that it may be unrelated to the overall stability of the network environment in which the DHCP server is located, but it may be due to a device failure of the DHCP server. In this case, the switching waiting time does not need to be extended due to the overall stability of the network environment in which the DHCP server is located, that is, the switching waiting time of the DHCP server can be reduced. Therefore, the greater the second difference is, the smaller the second reference time for adjusting the switching waiting time of the DHCP server is.

[0074] Correspondingly, the smaller the second difference is, the more stable the network environment where the DHCP server is currently located is, compared to the overall stability of the network environment where the DHCP server is previously located. At this time, if the DHCP server switches, it may be related to the overall stability of the network environment where the DHCP server is located. In this case, the switching waiting time needs to be extended due to the overall stability of the network environment where the DHCP server is located, that is, the switching waiting time of the DHCP server can be increased to reserve sufficient message processing time for the DHCP server as much as possible. Therefore, the smaller the second difference is, the larger the second reference time for adjusting the switching waiting time of the DHCP server is.

[0075] Based on the above description, the second reference time for adjusting the switching waiting time of any DHCP server in the embodiment is negatively correlated with the second difference.

[0076] In the embodiment, the fourth specified function for calculating the second reference time can be flexibly set according to the negative correlation between the second reference time for adjusting the switching waiting time of any DHCP server and the second difference. For example, as an embodiment, the fourth specified function can be: Ta'= Ta- δ*(Ra'- Ra), where Ta' represents the second reference time of the DHCP server currently calculated, Ta represents the second reference time of the DHCP server recorded latest, δ represents a preset second time adjustment factor, δ is greater than 0, Ra' represents the current network stability parameter, and Ra represents the historical network stability parameter recorded latest.

[0077] Step 204: Taking the sum of the first reference time and the second reference time as the switching waiting time of the DHCP server.

[0078] Thus far, the description of how to adjust the switching waiting time of each DHCP server according to the historical network stability parameter recorded latest and the current network stability parameter is completed.

[0079] In order to facilitate understanding of the specific implementation process of the above server switching method, the following will be described by way of example.

[0080] In the embodiment, the updating of the server switching parameter based on the Gradient Bandits algorithm is taken as an example for illustration. The Gradient Bandits algorithm can be understood as a policy optimization method based on reinforcement learning, which can be used to learn how to select the most appropriate behavior (or action). It should be noted that this is only an example for illustration, and the algorithm used in the embodiment is not specifically limited, and can be flexibly set based on actual application requirements.

[0081] For the convenience of understanding, the related terms in the Gradient Bandits algorithm are explained first here:

[0082] Reward: can refer to a feedback signal for evaluating the good or bad of a certain behavior (or action); the greater the value of the reward, the better the behavior.

[0083] Preference function: it is related to the reward and has a positive correlation with the reward. Based on this, the preference function can refer to a function for measuring the good or bad of each action, which indicates the expected reward when selecting a certain action (in the scenario of the embodiment, it can refer to selecting a certain server) in the current state.

[0084] In the embodiment, initially, based on the Gradient Bandits algorithm, the initial parameters of each server connected to the DHCP relay server are pre-configured based on the actual application requirements: initial switching waiting time T0, initial selected priority P0, initial overall switching time Ta0, and initial overall average reward Ra0. Wherein, T0 of each server is the same, and Ta0 of each server is the same. Wherein, the initial overall switching time Ta0 is set based on the stability of the network environment of each server, that is, the initial overall switching time Ta0 is used to indicate the stability of the network environment of each server at the initial time.

[0085] It should be noted that the initial switching waiting time T0, the initial overall switching time Ta0 and the initial selected priority P0 of each server are used as the basis for selecting each DHCP server for address request message processing at the initial time. As for how to use the initial switching waiting time T0, the initial overall switching time Ta0 and the initial selected priority P0 of each server for address request message processing, please refer to the related description above, which will not be repeated here.

[0086] Based on the above description, as an embodiment, referring to the server switching method shown in Figure 3 , the method is applied to a DHCP relay server, and the DHCP relay server is connected with N DHCP servers, that is, servers, N is greater than 1; the method can include the following steps:

[0087] Step 301, when it is determined that the switching parameters of the N servers need to be updated, for each server, the real-time reward Rsx t corresponding to the server is calculated according to the switching number information of the server in a specified historical time period and the latest recorded packet speed information of the server.

[0088] Here, the switching parameters comprise at least a switching waiting time and a selection priority. The real-time reward Rsx t corresponding to the server can be understood as a feedback signal for evaluating the action of "selecting the server". As for how to calculate the real-time reward Rsx t corresponding to the server, please refer to the calculation method of the first adjustment coefficient, which will not be repeated here.

[0089] Step 302, inputting the real-time reward Rsx t corresponding to the server and the difference between the latest recorded overall average reward and the initial overall average reward Ra0 into the configured preference function to obtain the preference value Ht(s) corresponding to the server; wherein the difference and the preference value Ht(s) corresponding to the server are in a positive correlation relationship.

[0090] It can be understood that if it is the first time to adjust the switching parameters of the N servers, the latest recorded overall average reward is the initial overall average reward Ra0. The preference value Ht(s) corresponding to any server can be understood as a value for measuring the action of "selecting the server".

[0091] In the embodiment, the latest recorded overall average reward corresponds to the latest recorded historical network stability parameter; the configured preference function corresponds to the first specified function; and the preference value Ht(s) corresponds to the second adjustment coefficient.

[0092] Step 303, adjusting the selection priority of the server according to the preference value Ht(s) corresponding to the server; wherein the preference value Ht(s) corresponding to the server and the selection priority of the server are in a positive correlation relationship.

[0093] The specific implementation of the step can be found in the above-mentioned specific implementation of inputting the second adjustment coefficient of the DHCP server into the second specified function to obtain a calculation result and taking the calculation result as the selection priority of the DHCP server, which will not be repeated here.

[0094] Step 304, calculating the self-switching waiting time Tsx t of the server according to the preference value Ht(s) corresponding to the server; wherein the preference value Ht(s) corresponding to the server and the self-switching waiting time Tsx t of the server are in a positive correlation relationship.

[0095] In the embodiment, the self-switching waiting time Tsx tCorresponding to the first reference time described above. Based on this, the specific implementation of this step can be seen from the specific implementation of inputting the second adjustment coefficient of the DHCP server into the third designated function to obtain the first reference time for adjusting the switching waiting time of the DHCP server described above, which will not be repeated here.

[0096] Step 305, according to the real-time reward Rsx t of each server corresponding to the mean value and the difference value between the latest recorded overall average reward, determine the current overall switching waiting time Ta t ; wherein the difference value and the current overall switching waiting time Ta t between them are negatively related.

[0097] In this embodiment, the mean value of the real-time reward Rsx t of each server corresponds to the current network stability parameter described above. The mean value of the real-time reward Rsx t of each server corresponds to the second difference value described above. The current overall switching waiting time Ta t corresponds to the second reference time described above. Based on this, the specific implementation of this step can be seen from the specific implementation of inputting the second difference value into the fourth designated function to obtain the second reference time for adjusting the switching waiting time of the DHCP server described above, which will not be repeated here.

[0098] Step 306, the sum of the server's own switching waiting time Tsx t and the current overall switching waiting time Ta t is used as the switching waiting time of the server.

[0099] Thus complete Figure 3 the flow shown in the figure. This embodiment adjusts the switching parameters of each server, i.e. the selected priority and the switching waiting time, dynamically and periodically, so that the adjusted switching parameters of each server are suitable for the dynamically changing stability of each server and the network environment of each server, which can effectively avoid the situation that the server is switched to a server with poor stability when switching the server, thereby improving the reliability of server switching, and further improving the reliability of the network environment of each server.

[0100] So far, the method provided by the embodiment of the application is described, and the device provided by the embodiment of the application is described as follows:

[0101] Referring to Figure 4 , Figure 4A structural schematic diagram of a server switching device is provided for an embodiment of the present application. The device is applied to an electronic device, and the electronic device establishes a connection with N DHCP servers respectively, where N is greater than 1; as shown in the figure, the device 400 includes an acquisition module 401, a determination module 402, a first adjustment module 403, and a second adjustment module 404. Figure 4

[0102] The acquisition module 401 is configured to acquire the number of switching times of each DHCP server in a specified historical time period, the latest recorded packet speed information of each DHCP server, and the latest recorded historical network stability parameter.

[0103] The determination module 402 is configured to determine a first adjustment coefficient for adjusting the switching parameter of each DHCP server according to the number of switching times of each DHCP server in the specified historical time period and the latest recorded packet speed information of each DHCP server, and the switching parameter includes the selected priority and the switching waiting time.

[0104] The first adjustment module 403 is configured to adjust the selected priority of each DHCP server according to the first adjustment coefficient of each DHCP server and the latest recorded historical network stability parameter.

[0105] The second adjustment module 404 is configured to adjust the switching waiting time of each DHCP server according to the latest recorded historical network stability parameter and the current network stability parameter, and the current network stability parameter is determined in dependence on the first adjustment coefficient of each DHCP server.

[0106] As an embodiment, the first adjustment module 403 is specifically configured to:

[0107] For each DHCP server, calculate a first difference value between the first adjustment coefficient of the DHCP server and the latest recorded historical network stability parameter;

[0108] input the first difference value into a first specified function to obtain a second adjustment coefficient for adjusting the switching parameter of the DHCP server;

[0109] input the second adjustment coefficient of the DHCP server into a second specified function to obtain a calculation result, and take the calculation result as the selected priority of the DHCP server.

[0110] As an embodiment, the second adjustment coefficient of the DHCP server and the first difference value have a positive correlation relationship.

[0111] The selected priority of the DHCP server and the second adjustment coefficient of the DHCP server have a positive correlation relationship. ​

[0112] As an embodiment, the second adjustment module 404 is specifically configured to:

[0113] For each DHCP server, input the second adjustment coefficient of the DHCP server into a third specified function to obtain a first reference time for adjusting the handover waiting time of the DHCP server;

[0114] Calculate a second difference between the current network stability parameter and the latest recorded historical network stability parameter;

[0115] Input the second difference into a fourth specified function to obtain a second reference time for adjusting the handover waiting time of the DHCP server;

[0116] Take the sum of the first reference time and the second reference time as the handover waiting time of the DHCP server.

[0117] As an embodiment, the first reference time and the second adjustment coefficient of the DHCP server are in a negative correlation relationship;

[0118] The second reference time and the second difference are in a negative correlation relationship.

[0119] As an embodiment, the first adjustment coefficient of any DHCP server is in a negative correlation relationship with the number of times of handover of the DHCP server within a specified historical time period, and is in a positive correlation relationship with the latest recorded packet return speed information of the DHCP server.

[0120] As an embodiment, the current network stability parameter is determined by the following way:

[0121] Take the average of the first adjustment coefficients of all DHCP servers as the current network stability parameter.

[0122] So far, the structure of the device is described. Figure 4

[0123] The implementation process of the functions and roles of each module in the above device is specifically described in the implementation process of the corresponding steps in the above method, and will not be repeated here.

[0124] ​For the device embodiment, since it basically corresponds to the method embodiment, the relevant part can be seen from the part of the method embodiment. The device embodiment described above is only illustrative, wherein the modules described as separate components can or can not be physically separated, and the components displayed as modules can or can not be physical modules, i.e., can be located in one place or distributed on multiple network modules. Part or all of the modules can be selected to achieve the purpose of the application according to actual needs. Those skilled in the art can understand and implement without creative labor.

[0125] Please refer to Figure 5 A hardware structure schematic diagram of an electronic device is provided for an exemplary embodiment of the present application. The electronic device can include a processor 501, a communication interface 502, a computer readable storage medium 503 and a communication bus 504. The processor 501, the communication interface 502 and the computer readable storage medium 503 complete the communication among each other through the communication bus 504. Among them, the computer readable storage medium 503 stores computer program instructions; the processor 501 can execute the steps of the method described in the above embodiment by executing the computer program instructions stored in the computer readable storage medium 503. The electronic device can also include other hardware according to the actual function of the electronic device, which will not be described here.

[0126] Correspondingly, the present application also provides a computer readable storage medium, which stores a plurality of computer program instructions, and the computer program instructions can implement the method disclosed in the above exemplary embodiments of the present application when executed by a processor.

[0127] Exemplarily, the above computer readable storage medium can be any electronic, magnetic, optical or other physical storage device, which can contain or store information such as executable instructions, data, etc. For example, the computer readable storage medium can be RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard drive), solid state disk, any type of storage disk (such as optical disk, dvd, etc.), or similar storage medium, or combination thereof. The processor and the memory can be supplemented by or incorporated into special logic circuit.

[0128] The above is only a preferred embodiment of the present application, and is not used to limit the present application, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A server switching method, characterized by, The method is applied to an electronic device, the electronic device establishes a connection with N dynamic host configuration protocol (DHCP) servers respectively, and N is greater than 1; the method comprises the following steps: obtaining the number of switching times of each DHCP server in a specified historical time period, the latest recorded packet speed information of each DHCP server, and the latest recorded historical network stability parameter; determining a first adjustment coefficient for adjusting the switching parameter of each DHCP server according to the number of switching times of each DHCP server in the specified historical time period and the latest recorded packet speed information of each DHCP server, wherein the switching parameter comprises a selected priority and a switching waiting time; adjusting the selected priority of each DHCP server according to the first adjustment coefficient of each DHCP server and the latest recorded historical network stability parameter; adjusting the switching waiting time of each DHCP server according to the latest recorded historical network stability parameter and a current network stability parameter, wherein the current network stability parameter is determined in dependence on the first adjustment coefficient of each DHCP server.

2. The method of claim 1, wherein, The method for adjusting the selected priority of each DHCP server according to the first adjustment coefficient of each DHCP server and the latest recorded historical network stability parameter comprises the following steps: for each DHCP server, calculating a first difference value between the first adjustment coefficient of the DHCP server and the latest recorded historical network stability parameter; inputting the first difference value into a first specified function to obtain a second adjustment coefficient for adjusting the switching parameter of the DHCP server; inputting the second adjustment coefficient of the DHCP server into a second specified function to obtain a calculation result, and taking the calculation result as the selected priority of the DHCP server.

3. The method of claim 2, wherein, The second adjustment coefficient of the DHCP server and the first difference value are in a positive correlation relationship; the selected priority of the DHCP server and the second adjustment coefficient of the DHCP server are in a positive correlation relationship.

4. The method of claim 2, wherein, The method for adjusting the switching waiting time of each DHCP server according to the latest recorded historical network stability parameter and the current network stability parameter comprises the following steps: for each DHCP server, inputting the second adjustment coefficient of the DHCP server into a third specified function to obtain a first reference time for adjusting the switching waiting time of the DHCP server; calculating a second difference value between the current network stability parameter and the latest recorded historical network stability parameter; inputting the second difference value into a fourth specified function to obtain a second reference time for adjusting the switching waiting time of the DHCP server; taking the sum of the first reference time and the second reference time as the switching waiting time of the DHCP server.

5. The method of claim 4, wherein, The first reference time and the second adjustment coefficient of the DHCP server are in a negative correlation relationship; the second reference time and the second difference value are in a negative correlation relationship.

6. The method of claim 1, wherein The first adjustment coefficient of any DHCP server is negatively related to the number of switching times of the DHCP server in a specified historical time period, and is positively related to the latest recorded packet return speed information of the DHCP server.

7. The method of claim 1, wherein, The current network stability parameter is determined by: The mean value of the first adjustment coefficient of each DHCP server is taken as the current network stability parameter.

8. A server switching apparatus characterized by comprising: The device is applied to an electronic device, and the electronic device establishes a connection with N dynamic host configuration protocol (DHCP) servers respectively, where N is greater than 1. The device comprises: An acquisition module is configured to acquire the number of switching times of each DHCP server in a specified historical time period, the latest recorded packet return speed information of each DHCP server, and the latest recorded historical network stability parameter. A determination module is configured to determine, according to the number of switching times of each DHCP server in a specified historical time period and the latest recorded packet return speed information of each DHCP server, a first adjustment coefficient for adjusting a switching parameter of each DHCP server, wherein the switching parameter comprises a selection priority and a switching waiting time. A first adjustment module is configured to adjust, according to the first adjustment coefficient of each DHCP server and the latest recorded historical network stability parameter, the selection priority of each DHCP server. A second adjustment module is configured to adjust, according to the latest recorded historical network stability parameter and a current network stability parameter, the switching waiting time of each DHCP server, wherein the current network stability parameter is determined in dependence on the first adjustment coefficient of each DHCP server.

9. An electronic device, comprising: The electronic device comprises: a processor; and a computer readable storage medium having stored therein computer program instructions, which, when executed by the processor, cause the processor to perform the steps in any one of the methods of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium has stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the steps in any one of the methods of claims 1 to 7.

Citation Information

Patent Citations

  • Method for improving reliability of 6RD (IPv6 rapid deployment) network, home gateway and DHCP (dynamic host configuration protocol) server

    CN102710804A

  • Method of acquiring IP address, terminal device and storage medium

    CN107968848A