Server selection method, device and electronic device
Through the request routing strategy of the pendulum experiment, the server resource interval is dynamically adjusted, which solves the problem of unreasonable server resource allocation in the existing technology and achieves efficient request distribution and resource utilization.
Patent Information
- Application Number
- CN202111652500.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2041-12-30
AI Technical Summary
In the existing technology, the problem of unreasonable server resource allocation is mainly due to the inability to dynamically adjust resource allocation due to fixed frequency calls, and the inability to effectively cope with request distribution in high-concurrency scenarios.
The request routing strategy based on the pendulum experiment is used to determine the preset swing value range of the server and receive the request sent by the terminal device to determine the swing value corresponding to the request and dynamically adjust the server resource range to ensure that the request is distributed to the appropriate server.
It realizes dynamic adjustment of the distribution of requests based on server resources, relieves server pressure, improves resource utilization, and solves the problem of unreasonable resource allocation caused by fixed frequency calls.
Smart Images

Figure CN114338690B
Abstract
Description
Technical Field
[0001] The present application relates to the field of information technology, and in particular to a server selection method, device and electronic device. Background Art
[0002] With the rapid development of the Internet, the number of users is also increasing. High concurrency is one of the factors that must be considered in the design of Internet distributed system architecture. The industry basically adopts vertical expansion (improving the processing capacity of a single machine) and horizontal expansion (server cluster deployment) to cope with high-concurrency data request scenarios. This has led to the development of data request routing technology. Currently, algorithms for server cluster deployment usually use polling, hashing, etc. This traditional request routing distribution method is too mechanical in the face of massive data requests and cannot divide the requests.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present application provide a server selection method, device and electronic device to at least solve the technical problem in the prior art that calling server resources at a fixed frequency leads to unreasonable resource allocation.
[0005] According to one aspect of an embodiment of the present application, a server selection method is provided, which is applicable to a router, and includes: determining a preset swing value interval corresponding to the server, wherein the swing value is the angle between the cycloid and the vertical direction; receiving a request sent by a terminal device; determining the swing value corresponding to the request; determining a target preset swing value interval in which the swing value is located, and determining a target server corresponding to the target preset swing value interval as the server for processing the request.
[0006] Optionally, determining the preset swing value interval corresponding to the server includes: determining the current data carrying margin of the server, wherein the data carrying margin is the difference between the maximum data carrying capacity of the server and the current data carrying capacity; and determining the preset swing value interval corresponding to the server based on the current data carrying margin of the server.
[0007] Optionally, determining a preset swing value interval corresponding to a server based on a current data carrying margin of the server includes: determining the sum of data carrying margins corresponding to multiple servers; determining a ratio of a data carrying margin corresponding to each server in the multiple servers to the sum of the data carrying margins; and determining a preset swing value interval corresponding to each server in the multiple servers based on the ratio, wherein the interval length of the preset swing value interval is positively correlated with the size of the ratio.
[0008] Optionally, determining a preset swing value interval corresponding to each server in a plurality of servers based on the ratio, wherein the interval length of the preset swing value interval is positively correlated with the size of the ratio includes: updating the ratio of the data carrying margin corresponding to each server in a plurality of servers to the sum of the data carrying margins at a preset frequency; determining a preset swing value interval corresponding to each server in a plurality of servers based on the updated ratio, wherein the interval length of the preset swing value interval is positively correlated with the size of the updated ratio.
[0009] Optionally, determining the swing value corresponding to the request includes: when receiving the request, assigning an initial swing condition to the request, wherein the initial swing condition includes at least one of the following: the initial position of the pendulum, the weight of the pendulum, the length of the pendulum line, the magnitude and direction of the applied external force; based on the initial swing condition, simulating the movement of the pendulum; determining a target time point, wherein the target time point is any time point during the movement of the pendulum, and the swing value corresponding to the target time point is the swing value corresponding to the request.
[0010] Optionally, after determining the swing value corresponding to the request, the method further includes: storing the swing value corresponding to the request in a database.
[0011] Optionally, determining the preset swing value interval corresponding to the server includes: determining multiple preset swing value intervals with the same interval length; determining the distribution of the swing values stored in the database, wherein the distribution of the swing values includes the preset swing value interval in which the swing values are located; determining a target number of swing values corresponding to each preset swing value interval in the multiple preset swing value intervals based on the distribution of the swing values stored in the database, wherein the target number of swing values is the number of swing values stored in the database that are located in the preset swing value interval; determining a data carrying margin corresponding to each server in the multiple servers; determining the preset swing value interval corresponding to each server based on the data carrying margin corresponding to each server and the target number of swing values corresponding to each preset swing value interval.
[0012] Optionally, determining the preset swing value interval corresponding to each server based on the data carrying margin corresponding to each server and the target swing value number corresponding to each preset swing value interval includes: sorting the servers in descending order according to the data carrying margin to obtain a server arrangement order; sorting the preset swing value intervals in descending order according to the target swing value number to obtain a preset swing value interval arrangement order; determining the preset swing value interval corresponding to the server based on the server arrangement order and the preset swing value interval arrangement order, wherein the serial number of the server in the service arrangement order is the same as the serial number of the preset swing value interval corresponding to the server in the preset swing value interval arrangement order.
[0013] According to another aspect of an embodiment of the present application, a server selection device is also provided, which is suitable for use in a router, and includes: a processing module for determining a preset swing value interval corresponding to the server, wherein the swing value is the angle between the cycloid and the vertical direction; a communication module for receiving a request sent by a terminal device; a calculation module for determining the swing value corresponding to the request; and an allocation module for determining a target preset swing value interval in which the swing value is located, and determining a target server corresponding to the target preset swing value interval as the server for processing the request.
[0014] According to another aspect of an embodiment of the present application, a non-volatile storage medium is provided, which includes a stored program, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the above-mentioned server selection method.
[0015] According to another aspect of the embodiments of the present application, an electronic device is provided. The electronic device includes a processor, and the processor is used to run a program, wherein the above-mentioned server selection method is executed when the program is run.
[0016] In an embodiment of the present application, a request routing strategy based on a pendulum experiment is adopted. By determining the preset swing value interval corresponding to the server and receiving the request sent by the terminal device, the swing value corresponding to the request is determined, the target preset swing value interval in which the swing value is located is determined, and the target server corresponding to the target preset swing value interval is determined as the server for processing the request, thereby achieving the purpose of distributing the request to the server in the corresponding interval according to the swing value, thereby achieving the technical effect of dynamically adjusting the distribution of the corresponding request according to the server resources, and further solving the technical problem of unreasonable resource allocation caused by calling server resources at a fixed frequency in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 It is a hardware structure block diagram of a computer terminal (or electronic device) for implementing a server selection method according to an embodiment of the present application;
[0019] Figure 2 is a flow chart of a server selection method according to an embodiment of the present application;
[0020] Figure 3 is a flow chart of determining a preset swing value interval corresponding to a server according to an embodiment of the present application;
[0021] Figure 4It is a flow chart of determining a preset swing value interval according to the current data carrying margin of the server according to an embodiment of the present application;
[0022] Figure 5 is a flow chart for determining a preset swing value interval corresponding to each server in a plurality of servers according to a ratio according to an embodiment of the present application;
[0023] Figure 6a is a flow chart of determining a swing value corresponding to a request according to an embodiment of the present application;
[0024] Figure 6b is a diagram of a pendulum experiment model according to an embodiment of the present application;
[0025] Figure 6c is a flow chart of distributing requests to servers within a corresponding swing interval according to an embodiment of the present application;
[0026] Figure 7 is another flow chart for determining a preset swing value interval corresponding to a server according to an embodiment of the present application;
[0027] Figure 8 It is a flow chart of determining a preset swing value interval according to a data carrying margin of a server and a target swing value quantity according to an embodiment of the present application;
[0028] Fig. 9 It is a structural diagram of a server selection device according to an embodiment of the present application. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application 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 interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] The server selection method embodiment provided in the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or electronic device) for implementing a server selection method. Figure 1 As shown, the computer terminal 10 (or electronic device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0032] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or electronic device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0033] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the server selection method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the server selection method of the above-mentioned application is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0034] The transmission module 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0035] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or electronic device).
[0036] It should be noted that, in some optional embodiments, the above Figure 1 The computer device (or electronic device) shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. It should be noted that Figure 1 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the above-described computer device (or electronic device).
[0037] Under the above operating environment, this application provides Figure 2 It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than that shown here.
[0038] Figure 2is a flow chart of a server selection method according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0039] Step S202, determining a preset swing value interval corresponding to the server, wherein the swing value is the angle between the cycloid and the vertical direction;
[0040] Step S204, receiving a request sent by the terminal device;
[0041] Step S206, determining a swing value corresponding to the request;
[0042] Step S208, determining the target preset swing value interval where the swing value is located, and determining the target server corresponding to the target preset swing value interval as the server to process the request.
[0043] The prior art requests server resources at a fixed frequency, and the request distribution method is not flexible enough. The server selection method provided in the embodiment of the present application can dynamically adjust the server interval. If the resources of a server are high-quality, the server swing interval can be dynamically changed to increase the server call frequency; on the other hand, it can be dynamically analyzed according to the collected swing values and server CPU resources. If the pressure on a server is too large, the swing value interval corresponding to the server can be dynamically adjusted to ensure the dynamic distribution of requests and relieve the server pressure; on another hand, if the prior art adds or deletes servers, it is necessary to modify the configuration and restart the implementation, while the method in the embodiment of the present application can dynamically request server resources by changing the swing value interval.
[0044] In step S202 of the server selection method, the preset swing value interval corresponding to the server is determined, such as Figure 3 The flowchart shown specifically includes the following steps:
[0045] Step S302, determining the current data carrying capacity of the server, wherein the data carrying capacity is the difference between the maximum data carrying capacity of the server and the current data carrying capacity, the data carrying capacity may be the remaining amount of resources that can be currently requested from the server, and the maximum data carrying capacity may be the maximum amount of resources that can be requested from the server;
[0046] Step S304, determines the preset swing value interval corresponding to the server based on the current data carrying margin of the server. If the current data carrying margin of the server is large, the preset swing value interval corresponding to the server is also large, that is, the server can provide more resources, that is, the current data carrying margin of the server is positively correlated with the preset swing value interval corresponding to the server.
[0047] In step S304 of the server selection method, the preset swing value interval corresponding to the server is determined according to the current data carrying margin of the server, such as Figure 4 The flowchart shown specifically includes the following steps:
[0048] Step S402, determining the sum of data carrying margins corresponding to multiple servers;
[0049] Step S404, determining a ratio of a data carrying margin corresponding to each server in the plurality of servers to a sum of data carrying margins;
[0050] Step S406, determining a preset swing value interval corresponding to each server in the plurality of servers according to the ratio, wherein the interval length of the preset swing value interval is positively correlated with the size of the ratio.
[0051] In step S402 to step S406, the following example is used for explanation. If there are three servers, namely server A, server B and server C, the data carrying margin corresponding to server A is 10, the data carrying margin corresponding to server B is 20, and the data carrying margin corresponding to server C is 30, then the sum of the data carrying margins corresponding to the three servers is 10+20+30=60. Through step S402, it is calculated that the ratio corresponding to server A is 10 / 60=1 / 6, the ratio corresponding to server B is 20 / 60=1 / 3, and the ratio corresponding to server C is 30 / 60=1 / 2. It can be seen that the size of the ratio is sorted from high to low, and the corresponding servers are server C, server B, and server A, respectively. Therefore, the interval length of the swing value interval of server C is greater than the interval length of the swing value interval of server B, and the interval length of the swing value interval of server B is greater than the interval length of the swing value interval of server A.
[0052] In step S406 of the server selection method, a preset swing value interval corresponding to each server in the plurality of servers is determined according to the ratio, wherein the interval length of the preset swing value interval is positively correlated with the size of the ratio, such as Figure 5 The flowchart shown specifically includes the following steps:
[0053] Step S502, updating the ratio of the data carrying margin corresponding to each server in the plurality of servers to the sum of the data carrying margins at a preset frequency;
[0054] Step S504, determining a preset swing value interval corresponding to each server in the plurality of servers according to the updated ratio, wherein the interval length of the preset swing value interval is positively correlated with the size of the updated ratio.
[0055] In steps S502 to S504, since the resources allocatable in the server change with time, in order to better determine the resources allocatable to the server at the current moment, it is necessary to update the ratio of the data carrying margin corresponding to each server in the server to the sum of the data carrying margins at a preset frequency. For example, the preset frequency can be set to 1s, and the preset swing value interval corresponding to the server is determined based on the ratio updated at the preset frequency.
[0056] In step S206 of the server selection method, a swing value corresponding to the request is determined, such as Figure 6a The flowchart shown specifically includes the following steps:
[0057] Step S602, when receiving the request, assigning an initial swing condition to the request, wherein the initial swing condition includes at least one of the following: the initial position of the pendulum, the weight of the pendulum, the length of the pendulum line, the magnitude and direction of the applied external force;
[0058] Step S604, simulating the movement of the pendulum according to the initial swing condition;
[0059] Step S606, determining a target time point, wherein the target time point is any time point during the motion of the pendulum, and the swing value corresponding to the target time point is the swing value corresponding to the request.
[0060] In step S602 to step S606, when receiving a request for server resources, the server is first assigned a corresponding swing interval and an initial swing condition for the request. By inputting the pendulum weight, the pendulum line length, the initial position of the pendulum, the magnitude and direction of the applied external force and other conditions, the server is assigned a corresponding swing interval and an initial swing condition for the request. Figure 6b The pendulum experimental model shown in the figure has pendulums of different sizes corresponding to different pendulum weights. By simulating the movement of the pendulum and based on the swing time of the pendulum, the final swing value of the pendulum after the swing time is determined. If the final swing value is within the swing range allocated by server A, the router distributes the request to server A.
[0061] The above process can be Figure 6c The flowchart shown in Figure 6c In the process, step S612 is a client request to call server resources, step S614 is to assign initial swing conditions to the request in step S612, step S616 is to determine the swing value through the pendulum experiment model, and the swing value is the average value of the swing values obtained by multiple pendulum experiments, step S618 is to store the swing value in the database for recording, step S620 is to determine the swing interval to which the swing value belongs, determine the server corresponding to the swing interval, and thus distribute the request to the servers in the corresponding swing interval.
[0062] It should be noted that in order to prevent the occurrence of accidental events, the number of swings of the pendulum can be limited, the swing conditions of the pendulum are consistent each time, and the average of the swing values obtained multiple times is taken as the final swing value of this request. By uniformly recording the average of the pendulum swing values of each request, the request threshold that the server can withstand can be obtained by analyzing this situation. If the final swing value of the request is within the swing range corresponding to multiple servers, the server with the largest swing range among the multiple servers is assigned to the request.
[0063] In step S206 of the server selection method, after determining the swing value corresponding to the request, the method further includes: after obtaining the final swing value, storing the swing value corresponding to the request in a database for analyzing the distribution of the request.
[0064] In step S202 of the server selection method, the preset swing value interval corresponding to the server is determined, such as Figure 7 The flowchart shown specifically includes the following steps:
[0065] Step S702, determining a plurality of preset swing value intervals with the same interval length;
[0066] Step S704, determining the distribution of the swing values stored in the database, wherein the distribution of the swing values includes the preset swing value interval in which the swing values are located;
[0067] Step S706, determining the target number of swing values corresponding to each preset swing value interval in a plurality of preset swing value intervals according to the distribution of the swing values stored in the database, wherein the target number of swing values is the number of swing values stored in the database that are in the preset swing value interval;
[0068] Step S708, determining the data carrying margin corresponding to each server in the plurality of servers;
[0069] Step S710 , determining a preset swing value interval corresponding to each server according to the data carrying margin corresponding to each server and the target swing value quantity corresponding to each preset swing value interval.
[0070] In step S702 to step S710, another method for determining the preset swing value interval corresponding to the server is provided. In the above steps, the lengths of the swing value intervals corresponding to multiple servers are the same, such as the swing value intervals corresponding to the servers are all 10. Specifically, the swing value intervals can be 10 to 20, 20 to 30, etc. Since the lengths of the swing value intervals are the same, the distribution of the swing values is determined by judging the number of target swing values that the swing values fall into different swing intervals, that is, the probability of the swing values falling into different swing intervals is determined. Specifically, since the distribution of the swing values is stored in the database, that is, the swing interval to which the swing values belong, the target number of swing values corresponding to each swing interval is determined by the preset number of swings. For example, the number of swing values that fall into the swing value interval of 10 to 20 is 5 times, and the number of swing values that fall into the swing value interval of 20 to 30 is 10 times. The preset swing value interval corresponding to each server is determined by step S710.
[0071] In step S710 of the server selection method, the preset swing value interval corresponding to each server is determined according to the data carrying margin corresponding to each server and the target swing value number corresponding to each preset swing value interval, such as Figure 8 The flowchart shown specifically includes the following steps:
[0072] Step S802, sorting the servers in descending order according to the data carrying margin to obtain a server arrangement order;
[0073] Step S804, sorting the preset swing value intervals in descending order according to the number of target swing values to obtain an arrangement order of the preset swing value intervals;
[0074] Step S806, determining the preset swing value interval corresponding to the server based on the server arrangement order and the preset swing value interval arrangement order, wherein the serial number of the server in the service arrangement order is the same as the serial number of the preset swing value interval corresponding to the server in the preset swing value interval arrangement order.
[0075] In step S802 to step S806, it is a limiting process of step S710. Step S802 sorts the data carrying margins corresponding to the servers in descending order according to the data carrying margins of each server. For example, if the data carrying margin corresponding to server A is 50, the data carrying margin corresponding to server B is 30, and the data carrying margin corresponding to server C is 10, then the order of server A, server B, and server C is followed; in step S804, the preset swing value intervals are sorted in descending order of the target swing value number, such as the target swing value number of the swing value interval of 10 to 20. The value is 5, the target swing value number of the swing value interval of 20 to 30 is 10, and the target swing value number of the swing value interval of 30 to 40 is 15, then the preset swing value intervals are sorted in descending order according to the target swing value number to obtain a swing value interval of 30 to 40, a swing value interval of 20 to 30, and a swing value interval of 10 to 20; in step S806, the preset swing value intervals corresponding to the servers are determined. For example, in the example, the preset swing value interval corresponding to server A is 30 to 40, the preset swing value interval corresponding to server B is 20 to 30, and the preset swing value interval corresponding to server C is 10 to 20.
[0076] Through the above steps, a request routing strategy based on the pendulum experiment is adopted. By determining the preset swing value interval corresponding to the server and receiving the request sent by the terminal device, the swing value corresponding to the request is determined, the target preset swing value interval in which the swing value is located is determined, and the target server corresponding to the target preset swing value interval is determined as the server for processing the request, thereby achieving the purpose of distributing the request to the server in the corresponding interval according to the swing value, thereby achieving the technical effect of dynamically adjusting the distribution of the corresponding request according to the server resources, and further solving the technical problem of unreasonable resource allocation caused by calling server resources at a fixed frequency in the prior art.
[0077] Fig. 9 is a structural diagram of a server selection device according to an embodiment of the present application, such as Fig. 9 As shown, the device is suitable for use in a router, and includes:
[0078] Processing module 902, used to determine a preset swing value interval corresponding to the server, wherein the swing value is the angle between the cycloid and the vertical direction;
[0079] The communication module 904 is used to receive a request sent by a terminal device;
[0080] A calculation module 906, configured to determine a swing value corresponding to the request;
[0081] The allocation module 908 is used to determine the target preset swing value interval where the swing value is located, and determine the target server corresponding to the target preset swing value interval as the server for processing the request.
[0082] The processing module 902 in the server selection device determines the preset swing value interval corresponding to the server, which specifically includes the following processes: determining the current data carrying margin of the server, wherein the data carrying margin is the difference between the maximum data carrying capacity of the server and the current data carrying capacity; and determining the preset swing value interval corresponding to the server based on the current data carrying margin of the server.
[0083] In the server selection device, a preset swing value interval corresponding to the server is determined based on the current data carrying margin of the server, which specifically includes the following processes: determining the sum of the data carrying margins corresponding to multiple servers; determining the ratio of the data carrying margin corresponding to each server in the multiple servers to the sum of the data carrying margins; determining the preset swing value interval corresponding to each server in the multiple servers based on the ratio, wherein the interval length of the preset swing value interval is positively correlated with the size of the ratio.
[0084] In the server selection device, a preset swing value interval corresponding to each server in a plurality of servers is determined based on the ratio, wherein the interval length of the preset swing value interval is positively correlated with the size of the ratio. Specifically, the process includes: updating the ratio of the data carrying margin corresponding to each server in a plurality of servers to the sum of the data carrying margins at a preset frequency; and determining the preset swing value interval corresponding to each server in a plurality of servers based on the updated ratio, wherein the interval length of the preset swing value interval is positively correlated with the size of the updated ratio.
[0085] The calculation module 906 in the server selection device determines the swing value corresponding to the request, which specifically includes the following process: when receiving the request, assigning an initial swing condition to the request, wherein the initial swing condition includes at least one of the following: the initial position of the pendulum, the weight of the pendulum, the length of the pendulum line, the magnitude and direction of the applied external force; based on the initial swing condition, simulating the movement of the pendulum; determining the target time point, wherein the target time point is any time point during the movement of the pendulum, and the swing value corresponding to the target time point is the swing value corresponding to the request.
[0086] After the calculation module 906 in the server selection device determines the swing value corresponding to the request, the server selection device further includes the following process: storing the swing value corresponding to the request in a database.
[0087] The processing module 902 in the server selection device determines the preset swing value interval corresponding to the server, which specifically includes the following processes: determining multiple preset swing value intervals with the same interval length; determining the distribution of the swing values stored in the database, wherein the distribution of the swing values includes the preset swing value intervals in which the swing values are located; determining the target number of swing values corresponding to each preset swing value interval in the multiple preset swing value intervals based on the distribution of the swing values stored in the database, wherein the target number of swing values is the number of swing values stored in the database that are located in the preset swing value interval; determining the data carrying margin corresponding to each server in the multiple servers; determining the preset swing value interval corresponding to each server based on the data carrying margin corresponding to each server and the target number of swing values corresponding to each preset swing value interval.
[0088] In the server selection device, the preset swing value interval corresponding to each server is determined according to the data carrying margin corresponding to each server and the target swing value number corresponding to each preset swing value interval, which specifically includes the following processes: sorting the servers in descending order according to the data carrying margin to obtain the server arrangement order; sorting the preset swing value intervals in descending order according to the target swing value number to obtain the preset swing value interval arrangement order; determining the preset swing value interval corresponding to the server according to the server arrangement order and the preset swing value interval arrangement order, wherein the serial number of the server in the service arrangement order is the same as the serial number of the preset swing value interval corresponding to the server in the preset swing value interval arrangement order.
[0089] It should be noted that Fig. 9 The server selection device shown is used to perform Figures 2 to 8 The server selection method shown, therefore the relevant explanations in the above server selection method are also applicable to the server selection device, and will not be repeated here.
[0090] An embodiment of the present application also provides a non-volatile storage medium, which includes a stored program, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the following server selection method: determine a preset swing value interval corresponding to the server, wherein the swing value is the angle between the cycloid and the vertical direction; receive a request sent by a terminal device; determine the swing value corresponding to the request; determine a target preset swing value interval in which the swing value is located, and determine that the target server corresponding to the target preset swing value interval is the server that processes the request.
[0091] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0092] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0093] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0094] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0095] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0096] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0097] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A server selection method, applicable to a router, It is characterized in that include: Determine a preset swing value interval corresponding to the server, wherein the swing value is the angle between the cycloid and the vertical direction; Receiving a request sent by a terminal device; determining a swing value corresponding to the request; Determining a target preset swing value interval in which the swing value is located, and determining a target server corresponding to the target preset swing value interval as a server for processing the request; The method further comprises: storing the swing value corresponding to the request in a database; Determine a plurality of preset swing value intervals having the same interval length; Determining a distribution of the swing values stored in the database, wherein the distribution of the swing values includes the preset swing value interval in which the swing value is located; Determining the target number of swing values corresponding to each of the plurality of preset swing value intervals according to the distribution of the swing values stored in the database, wherein the target number of swing values is the number of swing values stored in the database that are within the preset swing value interval; Determine a data carrying margin corresponding to each of the plurality of servers; The preset swing value interval corresponding to each of the servers is determined according to the data carrying margin corresponding to each of the servers and the target swing value quantity corresponding to each of the preset swing value intervals.
2. The server selection method according to claim 1, It is characterized in that Determine the preset swing value interval corresponding to the server includes: Determining a current data carrying capacity of the server, wherein the data carrying capacity is a difference between a maximum data carrying capacity of the server and a current data carrying capacity; A preset swing value interval corresponding to the server is determined according to the current data carrying margin of the server.
3. The server selection method according to claim 2, It is characterized in that Determining a preset swing value interval corresponding to the server according to the current data carrying margin of the server includes: Determine the sum of the data carrying margins corresponding to the plurality of servers; Determine a ratio of a data carrying margin corresponding to each server in the plurality of servers to a sum of the data carrying margins; A preset swing value interval corresponding to each of the plurality of servers is determined according to the ratio, wherein the interval length of the preset swing value interval is positively correlated with the size of the ratio.
4. The server selection method according to claim 3, It is characterized in that Determining a preset swing value interval corresponding to each of the plurality of servers according to the ratio, wherein the interval length of the preset swing value interval is positively correlated with the size of the ratio comprises: updating a ratio of a data carrying margin corresponding to each server in the plurality of servers to a sum of the data carrying margins at a preset frequency; According to the updated ratio, a preset swing value interval corresponding to each of the plurality of servers is determined, wherein the interval length of the preset swing value interval is positively correlated with the size of the updated ratio.
5. The server selection method according to claim 1, It is characterized in that Determining a swing value corresponding to the request includes: Upon receiving the request, assigning an initial swing condition to the request, wherein the initial swing condition includes at least one of the following: an initial position of the pendulum, a weight of the pendulum, a length of the pendulum line, and a magnitude and direction of an applied external force; According to the initial swing condition, simulating the movement of the pendulum; A target time point is determined, wherein the target time point is any time point during the motion of the pendulum, and the swing value corresponding to the target time point is the swing value corresponding to the request.
6. The server selection method according to claim 1, It is characterized in that Determining the preset swing value interval corresponding to each server according to the data carrying margin corresponding to each server and the target swing value quantity corresponding to each preset swing value interval includes: Sorting the servers in descending order according to the data carrying margin to obtain a server arrangement order; Sorting the preset swing value intervals in descending order according to the number of the target swing values to obtain an arrangement order of the preset swing value intervals; The preset swing value interval corresponding to the server is determined based on the server arrangement order and the preset swing value interval arrangement order, wherein the serial number of the server in the server arrangement order is the same as the serial number of the preset swing value interval corresponding to the server in the preset swing value interval arrangement order.
7. A server selection device, suitable for use in a router, It is characterized in that include: A first processing module, configured to determine a preset swing value interval corresponding to the server, wherein the swing value is an angle between a cycloid and a vertical direction; A communication module, used for receiving a request sent by a terminal device; a calculation module, configured to determine a swing value corresponding to the request; an allocation module, configured to determine a target preset swing value interval within which the swing value is located, and to determine a target server corresponding to the target preset swing value interval as a server for processing the request; The second processing module is used to store the swing value corresponding to the request in a database; determine a plurality of preset swing value intervals with the same interval length; determine the distribution of the swing values stored in the database, wherein the distribution of the swing values includes the preset swing value interval in which the swing value is located; determine the number of target swing values corresponding to each of the plurality of preset swing value intervals based on the distribution of the swing values stored in the database, wherein the target number of swing values is the number of swing values stored in the database that are located in the preset swing value interval; determine the data carrying margin corresponding to each of the plurality of servers; determine the preset swing value interval corresponding to each of the servers based on the data carrying margin corresponding to each of the servers and the target number of swing values corresponding to each preset swing value interval.
8. A non-volatile storage medium, It is characterized in that The non-volatile storage medium includes a stored program, wherein when the program is executed, the device where the non-volatile storage medium is located is controlled to execute the server selection method according to any one of claims 1 to 6.
9. An electronic device, It is characterized in that The electronic device comprises a processor, and the processor is used to run a program, wherein the program executes the server selection method according to any one of claims 1 to 6 when running.
Citation Information
Patent Citations
Load balancing method and device for monitoring server and load balancing method and device for server
CN109218341A
Application request processing method and device and router
CN109729131A
Communication link establishment method and device, electronic equipment and medium
CN110740162A
Resource scheduling method and device, electronic equipment and computer readable storage medium
CN111694646A
Method of maintaining availability of requested network resources, method of data storage management, method of data storage management in a network, network of resource servers, network, resource management server, content management server, network of video servers, video server, software for controlling the distribution of network resources
US20040047354A1
