A method and device for dynamically adjusting bandwidth
By broadcasting bandwidth requests and responses in the server cluster, allowing overloaded servers to obtain idle bandwidth, solving the problem of inflexible bandwidth adjustment in the event of central controller failure, and improving the flexibility and utilization of bandwidth adjustment.
Patent Information
- Application Number
- CN202111583308.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-12-22
AI Technical Summary
The existing central controller has strong dependence, which causes the server cluster to be unable to flexibly adjust bandwidth when the central controller fails, resulting in inflexible bandwidth adjustment solutions.
By broadcasting bandwidth requests and responses in the server cluster, the overloaded server allows the acquisition of free bandwidth from other servers and reject unnecessary bandwidth sharing when necessary, achieving dynamic bandwidth adjustment and optimization.
It improves the flexibility and utilization of bandwidth adjustment solutions, ensuring that the server cluster can still effectively adjust bandwidth when the central controller fails, and meets the traffic needs of different servers.
Smart Images

Figure CN114430373B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for dynamically adjusting bandwidth. Background Art
[0002] The complexity of Internet applications continues to increase, and the types of services accessed are increasing. Different types of services have different bandwidth requirements, so it is necessary to implement specific speed limit strategies for different users or different services.
[0003] Currently, most central controllers are used to allocate bandwidth to servers in a server cluster. Specifically, the central controller collects traffic information from each server, and then allocates the total bandwidth in the entire cluster to each server according to the traffic ratio based on the traffic information of each server, thereby achieving bandwidth adjustment.
[0004] This solution is highly dependent on the central controller. When the central controller fails, the server cluster cannot adjust the bandwidth, making the entire bandwidth adjustment solution inflexible. Summary of the invention
[0005] The present application provides a method and device for dynamically adjusting bandwidth, which are used to improve the flexibility of bandwidth adjustment schemes.
[0006] In a first aspect, the present application provides a method for dynamically adjusting bandwidth, which can be executed by a first server, or by a chip in the first server, and is described below using the execution of the first server as an example.
[0007] In one possible implementation, the first server determines that the bandwidth of the first server in the first time period is in an overloaded state based on the traffic of the first server in the first time period, and broadcasts a bandwidth request in the server cluster, wherein the bandwidth of the first server in the first time period is determined based on the traffic of the first server in a second time period, and the second time period is before the first time period; the first server receives a second bandwidth response from a second server in the server cluster in response to the bandwidth request, and the second bandwidth response indicates a second shared bandwidth provided by the second server to the first server.
[0008] In the above technical solution, if the first server determines that its bandwidth is overloaded, it can request bandwidth from other servers in the server cluster. If other servers have idle bandwidth, the first server can obtain the bandwidth shared by other servers to the first server, which helps to increase the bandwidth of the first server so that the bandwidth of the first server can meet the traffic transmission requirements of the first server. In this solution, two servers can be directly written to improve the flexibility of the bandwidth adjustment solution in the cluster.
[0009] In a possible implementation, it also includes: the first server receives a third bandwidth response from a third server in the server cluster in response to a bandwidth request, the third bandwidth response indicating a third shared bandwidth provided by the third server to the first server; when the bandwidth of the first server and the second shared bandwidth in the first time period meet the bandwidth demand corresponding to the traffic of the first server in the first time period, the first server rejects the third shared bandwidth.
[0010] In the above technical solution, the first server can receive bandwidth responses from multiple servers in response to bandwidth requests. The first server can select the bandwidth shared by some of the servers (i.e., the second server) and reject the bandwidth shared by other servers (i.e., the third server). Accordingly, the third server can further share its idle bandwidth with other servers in the server cluster, thereby improving the flexibility of the bandwidth adjustment scheme in the cluster and helping to improve bandwidth utilization.
[0011] In a possible implementation, after the first server receives the second bandwidth response from the second server in the server cluster in response to the bandwidth request, the method further includes: the first server increasing the bandwidth of the first server according to the second shared bandwidth.
[0012] In a possible implementation, after the first server receives the second bandwidth response from the second server in the server cluster in response to the bandwidth request, the method further includes: the first server determines, based on the traffic of the first server in the third time period, that the bandwidth of the first server in the third time period is in an idle state, and broadcasts an idle bandwidth notification in the server cluster; wherein the idle bandwidth notification indicates that the bandwidth of the first server in the third time period includes a first shared bandwidth for sharing.
[0013] In the above technical solution, if the first server determines that the bandwidth of the first server is in an idle state, it can broadcast an idle bandwidth notification in the server cluster to inform other servers that the current bandwidth of the first server includes bandwidth that can be shared with other servers. Correspondingly, if the bandwidth of other servers is in an overloaded state, they can request bandwidth from the first server. This improves the flexibility of the bandwidth adjustment solution in the cluster and helps to improve the utilization rate of bandwidth.
[0014] In a possible implementation, it also includes: the first server determines that the fourth server exits from the server cluster; the first server shares the bandwidth of the fourth server before exiting from the server cluster with other servers in the server cluster based on the total traffic of the server cluster and the traffic of the first server. In the above technical solution, when a server exits from the server cluster, the bandwidth used by the exiting server before can be shared with other servers that remain in the server cluster, thereby improving the flexibility of the bandwidth adjustment solution in the cluster and helping to improve the utilization of bandwidth.
[0015] In a possible implementation, it also includes: the first server determines that the fifth server joins the server cluster, and the bandwidth demand corresponding to the total traffic of the server cluster is greater than the total bandwidth of the server cluster; the first server triggers each server in the server cluster to reallocate the total bandwidth of the server cluster according to the traffic of each server and the total traffic of the server cluster. In the above technical solution, when a new server joins the server cluster, the new server also needs to transmit data, then the new server can request bandwidth from other servers in the server cluster, thereby improving the flexibility of the bandwidth adjustment plan in the cluster and helping to improve bandwidth utilization.
[0016] In a possible implementation, any two servers in the server cluster are connected via a switch. In the above technical solution, communication between any two servers in the server cluster is achieved via a switch, so that messages broadcast by each server can be received by other servers in the server cluster.
[0017] In a second aspect, the present application provides a device for dynamically adjusting bandwidth, which may be a first server or a chip in the first server. The device includes a processing module and a transceiver module.
[0018] In one possible implementation, a processing module is used to determine that the bandwidth of the device in the first time period is in an overloaded state based on the traffic of the device in the first time period; a transceiver module is used to broadcast a bandwidth request in a server cluster, wherein the bandwidth of the device in the first time period is determined based on the traffic of the device in a second time period, and the second time period is before the first time period; the transceiver module is also used to receive a second bandwidth response from a second server in the server cluster in response to the bandwidth request, the second bandwidth response indicating a second shared bandwidth provided by the second server to the device.
[0019] In one possible implementation, the transceiver module is also used to receive a third bandwidth response from a third server in the server cluster in response to a bandwidth request, and the third bandwidth response indicates a third shared bandwidth provided by the third server to the device; when the bandwidth of the device and the second shared bandwidth in the first time period meet the bandwidth requirements corresponding to the traffic of the device in the first time period, the processing module may reject the third shared bandwidth.
[0020] In a possible implementation, after the transceiver module receives the second bandwidth response from the second server in the server cluster in response to the bandwidth request, the processing module is further configured to: increase the bandwidth of the device according to the second shared bandwidth.
[0021] In one possible implementation, after the transceiver module receives the second bandwidth response of the second server in the server cluster in response to the bandwidth request, the processing module is also used to: determine that the bandwidth of the device in the third time period is in an idle state based on the traffic of the device in the third time period; the transceiver module is also used to: broadcast an idle bandwidth notification in the server cluster; wherein the idle bandwidth notification indicates that the bandwidth of the device in the third time period includes a first shared bandwidth for sharing.
[0022] In a possible implementation, the processing module is further used to: determine that the fourth server exits from the server cluster; and share the bandwidth before the fourth server exits from the server cluster with other servers in the server cluster based on the total traffic of the server cluster and the traffic of the device.
[0023] In one possible implementation, the processing module is also used to: determine that the fifth server is added to the server cluster, and the bandwidth demand corresponding to the total traffic of the server cluster is greater than the total bandwidth of the server cluster; trigger each server in the server cluster to reallocate the total bandwidth of the server cluster according to the traffic of each server and the total traffic of the server cluster.
[0024] In a possible implementation manner, any two servers in the server cluster are connected via a switch.
[0025] In a third aspect, the present application provides a computer-readable storage medium, in which a computer program or instructions are stored. When the computer program or instructions are executed by a computing device, the computing device executes the method in the above-mentioned first aspect or any possible implementation of the first aspect.
[0026] In a fourth aspect, the present application provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a computing device, the method in the above-mentioned first aspect or any possible implementation manner of the first aspect is implemented.
[0027] In a fifth aspect, the present application provides a computing device, comprising a processor, wherein the processor is connected to a memory, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the device performs the method in the above-mentioned first aspect or any possible implementation of the first aspect.
[0028] The technical effects that can be achieved in any of the second to fifth aspects mentioned above can refer to the description of the beneficial effects in the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A system architecture diagram applicable to a method for dynamically adjusting bandwidth provided in this application;
[0030] Figure 2 A schematic diagram of the process of the first method for dynamically adjusting bandwidth provided by this application;
[0031] Figure 3 A flowchart of a second method for dynamically adjusting bandwidth provided by this application;
[0032] Figure 4 A schematic diagram of a process for adjusting bandwidth of other servers when a server exits a cluster provided in this application;
[0033] Figure 5 A schematic diagram of a process for adjusting bandwidth of other servers when a server joins a cluster provided in this application;
[0034] Figure 6 A schematic diagram of the format of a request message / response message / confirmation message provided for this application;
[0035] Figure 7 A schematic diagram of the format of a notification message for periodic bandwidth collection provided by this application;
[0036] Figure 8 A schematic diagram of the format of a reset message / NOWAIT message / idle bandwidth message provided for this application;
[0037] Fig. 9 A schematic diagram of the structure of the first device for dynamically adjusting bandwidth provided by the present application;
[0038] Fig.10 A schematic diagram of the structure of a second device for dynamically adjusting bandwidth provided by the present application;
[0039] Fig.11 A schematic diagram of the structure of a third device for dynamically adjusting bandwidth provided in the present application. DETAILED DESCRIPTION
[0040] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0041] like Figure 1 A system architecture diagram applicable to a method for dynamically adjusting bandwidth provided as an example in the present application includes a switch and a server cluster, wherein the server cluster includes multiple servers, which can be represented as server 1, server 2, ..., server N, respectively, where N is an integer greater than or equal to 2. Each server in the server cluster can be connected to the switch, so that any two servers in the server cluster can communicate through the switch. Furthermore, the switch can form a broadcast domain, and any server in the server cluster can broadcast messages in the broadcast domain.
[0042] Based on the above system architecture diagram, Figure 2 A flowchart of a method for dynamically adjusting bandwidth is exemplarily provided for the present application, wherein the first server may be any server in a server cluster.
[0043] Step 201: The first server determines that the bandwidth of the first server is in an overloaded state in the first time period according to the traffic of the first server in the first time period, and broadcasts a bandwidth request in the server cluster.
[0044] The bandwidth of the first server in the first time period is determined based on the traffic of the first server in the second time period, wherein the second time period is before the first time period.
[0045] Specifically, the first server can periodically collect traffic information, and determine whether the available bandwidth of the first server in the current cycle is in an overloaded state or an idle state according to the traffic of the first server in the current cycle and the available bandwidth of the first server in the current cycle. Exemplarily, when the bandwidth required for the traffic of the first server is greater than a preset ratio of the available bandwidth of the first server (such as 120%), the available bandwidth of the first server is in an overloaded state; when the bandwidth required for the traffic of the first server is less than a preset ratio of the available bandwidth of the first server (such as 80%), the available bandwidth of the first server is in an idle state. The available bandwidth can also be referred to as the speed limit bandwidth value, local bandwidth, bandwidth, etc.
[0046] The available bandwidth of the first server in the current cycle may be obtained by proportionally allocating the total bandwidth corresponding to the server cluster to the first server in the previous cycle according to the traffic of the first server and the total traffic of the server cluster; or the available bandwidth of the first server in the current cycle may be obtained by negotiating bandwidth usage between the first server and other servers in the server cluster in the previous cycle.
[0047] In a specific scenario, if the first server determines that the available bandwidth of the first server in the first time period is in an overloaded state based on the traffic of the first server in the first time period, a bandwidth request is broadcast in the server cluster, and the broadcast bandwidth request can be used to request bandwidth from other servers. Optionally, the broadcast bandwidth request includes the bandwidth requested by the first server. Accordingly, other servers in the server cluster can receive the bandwidth request from the first server. For one of the servers, the server can determine whether the local bandwidth is in an idle state. If so, the local idle bandwidth can be shared with the first server, otherwise, the bandwidth can not be shared with the first server.
[0048] Exemplarily, a server in an idle state with available bandwidth in a server cluster may be referred to as a second server. The second server may determine the second shared bandwidth that can be shared with the first server based on the local available bandwidth and its own traffic, and then send a second bandwidth response to the first server, wherein the second bandwidth response may be used to indicate the second shared bandwidth provided by the second server to the first server. When the second server sends the second bandwidth response to the first server, it may specifically send the second bandwidth response to the first server in a unicast manner, so that other servers cannot receive the second bandwidth response, thereby avoiding unnecessary bandwidth usage conflicts.
[0049] In addition, each server in the server cluster can also broadcast its own bandwidth usage at a fixed period, and the bandwidth usage can include its own flow information and bandwidth information. Accordingly, the first server can receive notification information from other servers, thereby obtaining the flow information and bandwidth information of other servers in the server cluster. Specifically, the bandwidth usage can be a notification message.
[0050] Step 202: The first server receives a second bandwidth response from a second server in the server cluster in response to a bandwidth request.
[0051] After receiving the second bandwidth response, the first server can determine whether the traffic demand of the first server can be met after increasing the local available bandwidth according to the second shared bandwidth based on the second shared bandwidth indicated by the second bandwidth response and the local available bandwidth. If so, it may no longer receive the bandwidth shared by other servers.
[0052] Exemplarily, the third server in the server cluster sends a third bandwidth response to the first server, where the third bandwidth response can be used to indicate the third shared bandwidth provided by the third server to the first server. However, since the first server determines that the second shared bandwidth and the locally available bandwidth can already meet the current traffic demand, that is, the first server determines that the bandwidth of the first server in the first time period and the second shared bandwidth can already meet the bandwidth demand corresponding to the traffic of the first server in the first time period, the first server can reject the bandwidth shared by the third server. For the third server, after receiving the rejection indication from the first server, it can share its third shared bandwidth with other servers when it receives bandwidth requests from other servers. This helps to improve the flexibility of bandwidth sharing.
[0053] Optionally, after determining to receive the second shared bandwidth of the second server, the first server sends a confirmation of acceptance to the second server, and after determining not to receive the third shared bandwidth of the third server, sends a rejection of acceptance to the third server, or does not send a confirmation of acceptance or a rejection of acceptance to the third server.
[0054] In addition, if the first server determines, based on the second shared bandwidth and the local available bandwidth, that the traffic demand of the first server cannot be met after the local available bandwidth is increased according to the second shared bandwidth, it may also receive bandwidth shared by other servers so that the first server can meet the bandwidth demand corresponding to the traffic of the first server after increasing the available bandwidth.
[0055] In one possible manner, the first server may broadcast bandwidth requests multiple times, and after each bandwidth request is broadcast, the first timer is started, wherein the first timer may correspond to a first preset duration and a first preset number of times. For example, if the first preset duration is 2s and the first preset number of times is 3, the first server will start the first timer after broadcasting the bandwidth request for the first time. If the first server receives a bandwidth response from other servers before the first timer reaches 2s, the request is determined to be successful; if the first timer reaches 2s and still does not receive a bandwidth response from other servers, the first server may broadcast the bandwidth request again and start the first timer for the second time. Based on the above similar process, until the first server receives a bandwidth response from other servers, the request is determined to be successful; or until the first timer has not received a bandwidth response from other servers after being started 3 times, the request is considered to have failed.
[0056] In one possible manner, after a server in a server cluster sends a bandwidth response to a first server, it may start a timer and determine whether it is necessary to share its idle bandwidth (or shared bandwidth) with the first server based on the timer. Taking the second server as an example, after the second server sends a second bandwidth response to the first server, it may start a second timer, wherein the second timer may correspond to a second preset duration and a second preset number of times. For example, if the second preset duration is 2s and the second preset number of times is 3 times, the second server may start a second timer after sending a second bandwidth response to the first server. If the second server receives a confirmation from the first server before the second timer reaches 2s, it is determined that the sharing is successful; if the first timer reaches 2s and still does not receive a confirmation from the first server, the first server may send a second bandwidth response to the first server again and start the second timer for the second time. Based on the above similar process, until the second server receives a confirmation from the first server, it is determined that the bandwidth is successfully shared with the first server; or until the second timer has not received a confirmation from the first server after being started 3 times, it is considered that the bandwidth is not successfully shared with the first server.
[0057] Step 203: The first server increases its bandwidth according to the second shared bandwidth.
[0058] Exemplarily, the first server can transmit the traffic in the first time period through the second shared bandwidth and the available bandwidth of the first server in the first time period. It should be noted that step 203 can be before rejecting the third shared bandwidth of the third server, or after rejecting the third shared bandwidth of the third server.
[0059] The first server may also determine that the available bandwidth of the first server is in an idle state in the third time period according to the traffic of the first server in the third time period and the available bandwidth of the first server in the third time period. The first server may then broadcast an idle bandwidth notification (specifically, an idle bandwidth message) in the server cluster, wherein the idle bandwidth notification may be used to indicate that the available bandwidth of the first server includes a first shared bandwidth that can be shared with other servers. Accordingly, after other servers receive the idle bandwidth notification broadcast by the first server, they may request shared bandwidth from the first server based on the first shared bandwidth indicated in the idle bandwidth notification.
[0060] In order to better explain the embodiment of the present application, the following takes server 1, server 2 and server 3 as examples for explanation. Figure 3 A schematic diagram of another exemplary flow chart of a method for dynamically adjusting bandwidth:
[0061] Among them, server 1, server 2 and server 3 will periodically send their respective bandwidth usage information.
[0062] In step 301, after determining that its local bandwidth is overloaded, server 1 may broadcast a bandwidth request, and accordingly, server 2 receives the bandwidth request from server 1, and server 3 receives the bandwidth request from server 1. Specifically, the bandwidth request may be a request message.
[0063] In step 302, server 2 sends a bandwidth response to server 1, which can be used to indicate the bandwidth that server 2 can share with server 1; server 3 sends a bandwidth response to server 1, which can be used to indicate the bandwidth that server 3 can share with server 1. The bandwidth response can specifically be a response message.
[0064] Step 303, server 1 determines to accept the bandwidth shared by server 2, and sends a confirmation of acceptance to server 2, wherein the confirmation of acceptance may specifically be a confirmation message. Server 1 determines to refuse to accept the bandwidth shared by server 3, and sends a rejection of acceptance to server 3, wherein the rejection of acceptance may specifically be a NOWAIT message.
[0065] Subsequently, after determining that its local bandwidth is idle, server 1 may share the local idle bandwidth with other servers. For details, see steps 304 to 307 below.
[0066] Step 304, server 1 broadcasts idle bandwidth notification, and accordingly, server 2 receives idle bandwidth notification from server 1, and server 3 receives idle bandwidth notification from server 1. The idle bandwidth notification may specifically be an idle bandwidth notification.
[0067] Step 305 , server 2 sends a bandwidth request to server 1 , thereby requesting bandwidth from server 1 ; server 3 sends a bandwidth request to server 1 , thereby requesting bandwidth from server 1 .
[0068] Step 306: After receiving the bandwidth requests respectively sent by server 2 and server 3, server 1 determines to share bandwidth with server 2, and then sends a bandwidth response to server 2, where the bandwidth response may specifically be a reply message.
[0069] Step 307: After receiving the bandwidth response from server 1, server 2 sends a confirmation to the server 1, where the confirmation may be a confirmation message.
[0070] When a server in the server cluster exits (or is called offline), the bandwidth used by the server before exiting can be shared by other servers. The exiting server can be called the fourth server. If the first server determines that the fourth server exits the server cluster, the first server can share the bandwidth before the fourth server exits the server cluster with other servers in the server cluster based on the total traffic of the server cluster and the traffic of the first server, or based on the traffic of each server in the server cluster.
[0071] Exemplarily, the first server may determine whether the server is still in the server cluster by periodically receiving bandwidth usage of the servers in the server cluster. Exemplarily, the first server may determine that the fourth server exits the server cluster after determining that the bandwidth usage of the fourth server has not been detected for multiple consecutive periods.
[0072] like Figure 4 A schematic diagram of adjusting bandwidth of other servers when a server exits a cluster provided as an example in this application:
[0073] Step 401, the first server periodically detects bandwidth usage of the fourth server;
[0074] Step 402, after the first server fails to detect the bandwidth usage of the fourth server in multiple cycles, it is determined that the fourth server is offline from the server cluster, that is, the fourth server is determined to be in an offline state (or exit state);
[0075] Step 403, the first server searches for the fourth server again;
[0076] Step 404: the first server searches again and determines that the fourth server is still offline.
[0077] Step 405: The first server shares the bandwidth of the fourth server before it exits the server cluster with other servers in the server cluster.
[0078] It should be noted that the above takes the first server as an example to illustrate that the server cluster detects that the fourth server is offline. In this application, other servers in the server cluster are also used to perform the above detection action.
[0079] In one possible way, when a new server (for example, the fifth server) joins the server cluster, the fifth server may broadcast the bandwidth usage with an initial mark (init) in the server cluster. Accordingly, after receiving the bandwidth usage of the fifth server, the first server determines whether the bandwidth demand corresponding to the total flow of the server cluster is greater than the total bandwidth of the server cluster. If so, it indicates that the total bandwidth of the current server cluster cannot meet the bandwidth demand corresponding to the total flow of the server cluster. The first server may broadcast a bandwidth reset request in the server cluster. The bandwidth reset request can be used to trigger each server in the server cluster to reallocate the total bandwidth of the server cluster according to the flow of each server and the total flow of the server cluster. The bandwidth reset request can specifically be a reset message.
[0080] In another possible manner, after the fifth server joins the server cluster, it can broadcast the bandwidth usage with the initial mark in the server cluster. Accordingly, other servers in the server cluster can receive the bandwidth usage with the initial mark. Other servers in the server cluster send bandwidth usage to the fifth server, and the bandwidth usage may include their own traffic information and bandwidth information. The fifth server determines whether the bandwidth demand corresponding to the total traffic of the server cluster is greater than the total bandwidth of the server cluster. If so, it broadcasts a bandwidth reset request in the server cluster so that each server reallocates the total bandwidth of the server cluster according to the traffic of each server and the total traffic of the server cluster.
[0081] In another possible way, after joining the server cluster, the fifth server may broadcast the bandwidth usage with the initial mark in the server cluster, where the bandwidth usage may be equivalent to a bandwidth request. Accordingly, if the available bandwidth of a server in the server cluster includes idle bandwidth (or shareable bandwidth), the server may send a bandwidth response to the fifth server, thereby sharing its shareable bandwidth with the fifth server. However, when the bandwidth of each server is in a non-idle state, the fifth server does not obtain the bandwidth shared by other servers. It may broadcast a bandwidth reset request in the server cluster so that each server reallocates the total bandwidth of the server cluster according to the traffic of each server and the total traffic of the server cluster.
[0082] like Figure 5 A schematic diagram of adjusting bandwidth of other servers when a server joins a cluster provided as an example in this application:
[0083] Step 501, the fifth server is added to the server cluster;
[0084] Step 502: The fifth server broadcasts bandwidth usage in the server cluster, where the bandwidth usage carries an initial mark;
[0085] Step 503: The fifth server receives bandwidth usage feedback from other servers in the server cluster;
[0086] Step 502: The fifth server determines whether the bandwidth requirement corresponding to the total flow of the server cluster is greater than the total bandwidth of the server cluster, that is, whether the total bandwidth of the current server cluster is overloaded. If so, execute steps 503 and 504; otherwise, execute steps 505 and 506.
[0087] Step 503, broadcasting a bandwidth reset request in the server cluster;
[0088] Step 504: Each server in the server cluster reallocates the total bandwidth of the server cluster according to the traffic of each server and the total traffic of the server cluster.
[0089] Step 505: The fifth server broadcasts a bandwidth request in the server cluster.
[0090] Step 506: The fifth server receives responses from other servers in the server cluster, thereby obtaining the available bandwidth of the fifth server.
[0091] The following example illustrates that each server in the server cluster is allocated with a to-be-allocated bandwidth according to its own traffic. The to-be-allocated bandwidth here can be the total bandwidth of the server cluster, or it can be the bandwidth of the fourth server before it exits the server cluster: the to-be-allocated bandwidth is, for example, 60Mhz, the traffic of server 1 in the server cluster is 10bit / s, the traffic of server 2 is 20bit / s, and the traffic of server 3 is 30bit / s, then the total traffic in the server cluster is 60bit / s, and each server in the server cluster is allocated with a bandwidth according to its own traffic. Specifically, server 1 occupies a bandwidth of 10Mhz, server 2 occupies a bandwidth of 20Mhz, and server 3 occupies a bandwidth of 30Mhz.
[0092] The above technical solution is based on the bandwidth adjustment protocol. Information is exchanged between servers in the server cluster, which can complete the dynamic adjustment of bandwidth, thereby helping to achieve autonomous adjustment of cluster bandwidth without the intervention of external devices; and through the bandwidth protocol, combined with periodic adjustment and real-time adjustment, the efficiency and accuracy of bandwidth adjustment are improved while taking into account the traffic load and real-time performance of the server.
[0093] like Figure 6 A schematic diagram of the format of a request message / response message / confirmation message provided as an example for this application, such as Figure 7 A schematic diagram of the format of a notification message for periodic bandwidth collection provided as an example in this application, such as Figure 8 A schematic diagram of the format of a reset message / NOWAI message / idle bandwidth message provided as an example for this application.
[0094] The meaning of each field in the message is as follows:
[0095] DST MAC:
[0096] The length is 6 bytes and the value is the broadcast MAC address or the unicast MAC address of the destination cluster member.
[0097] SRC MAC:
[0098] The length is 6 bytes and the value is the local MAC address of the sending cluster member.
[0099] FRAME TYPE:
[0100] The length is 2 bytes, identifying the frame type and used for Ethernet message parsing.
[0101] MARKER&VERSION:
[0102] The length is 2 bytes, used as message validity check and subsequent extension.
[0103] PACKET TYPE:
[0104] Length: 1 byte, set the message type;
[0105] NEGOTIATE: negotiate to adjust bandwidth information;
[0106] NOTIFY: Notify bandwidth information and other information;
[0107] STATUS:
[0108] Length 1 byte, carrying the status of the device;
[0109] INIT: in initialization state, used for initialization configuration;
[0110] COMPLETE: In normal operation, initialization has been completed.
[0111] PACKET LENGTH:
[0112] Length: 2 bytes, message length, the complete message length starting from MARKER.
[0113] SENDER MAC:
[0114] The length is 6 bytes, which is the MAC address of the member on the packet sending side. It is used to identify the sender and is also used to count the number of gateways in the initial stage to determine the initial speed limit value.
[0115] TYPE:
[0116] Length: 1 byte, identifies the type of tlv carried:
[0117] NEGOTIATE negotiation message:
[0118] REQEST: request bandwidth, plus the size of the requested bandwidth;
[0119] RESPOND: respond to bandwidth request and add the shareable bandwidth size;
[0120] CONFIRM: confirms the response, used when multiple gateways provide bandwidth, and requests bandwidth;
[0121] NOTIFY message:
[0122] NOTIFY: broadcast the real-time bandwidth and speed limit bandwidth of this gateway;
[0123] NOWAIT: Notifies the answering device that it does not need to wait for confirmation.
[0124] FREE: Notify the current device that there is free bandwidth.
[0125] RESET: Notify all member devices to reset the speed limit bandwidth.
[0126] LEN:
[0127] The length is 1 byte, indicating the length of the TLV information.
[0128] POLICY FLAGS:
[0129] Length 2 bytes, identifies the specific attributes or identification information of the specified speed limit bandwidth configuration, such as the override identifier. POLICY INDEX:
[0130] The length is 4 bytes. The specified speed limit bandwidth information is found based on this value. The speed limit bandwidth information of the specified cluster member is also found based on this value and the MAC address.
[0131] CUR BANDWIDTH:
[0132] The length is 4 bytes and indicates the real-time bandwidth of the cluster member.
[0133] LIMIT BANDWIDTH:
[0134] The length is 4 bytes and it indicates the speed limit set on the cluster member.
[0135] LIMIT STATISTIC:
[0136] The length is 8 bytes and it is the rate limit traffic counted by cluster members periodically.
[0137] REQ / RESPOND BANDWITH:
[0138] The length is 4 bytes and is used in bandwidth request and response to indicate the bandwidth to be adjusted.
[0139] Of course, the above description is merely an exemplary description, and each message may further include other fields, and each field in the message may also occupy other byte lengths, etc.
[0140] Based on the same inventive concept as above, the present application provides a device for dynamically adjusting bandwidth, which can be any server in a server cluster. For example, the structural diagram of the device can be seen in Fig. 9 As shown, the device may include a protocol module 901, a traffic collection module 902, a speed limit module 903, and a traffic monitoring module 904.
[0141] The traffic collection module 902 can periodically collect traffic information, calculate whether the local bandwidth in the server is overloaded or idle, and then notify the protocol module 901. After receiving the notification message, the protocol module 901 will broadcast the bandwidth usage. If the server is in an overloaded state, it can broadcast a bandwidth request. After receiving the bandwidth request, other servers in the server cluster determine that their available bandwidth is idle, and then send a response to the server. After receiving the response, the server can adjust the available bandwidth and send a confirmation of acceptance to the server that sent the response.
[0142] The speed limit module 903 monitors in real time whether the bandwidth is overloaded and exceeds a certain threshold, or idle and is below a certain threshold. If the speed limit module 903 detects a situation, it can notify the protocol module 901 to process it immediately. At this time, if an overload occurs, a bandwidth request is sent to all other servers in the cluster; if a large amount of idle bandwidth is found, an idle bandwidth notification is sent to all other servers in the cluster. Correspondingly, if a server is in an overloaded state, a bandwidth request will be sent.
[0143] The traffic monitoring module 904 will regularly count the bandwidth usage of the server cluster (i.e., the total traffic and total bandwidth of the server cluster), as well as the bandwidth usage of each server in the server cluster, and select the server with the highest priority or the largest MAC address for periodic traffic reporting based on the bandwidth usage of each server;
[0144] By broadcasting bandwidth usage information at regular intervals, each server in the server cluster can quickly detect whether a server is offline, and then immediately redistribute the bandwidth of the offline server;
[0145] If a new server is added during capacity expansion, the new server will periodically send a specified number of bandwidth usage information with an initial tag. After receiving the information, other servers will respond with their own bandwidth usage information, and the new server will save the received bandwidth usage information. If the available bandwidth of a server in the server cluster is idle, it can share bandwidth with the new server based on its own bandwidth usage; if all other servers in the server cluster are overloaded, the new server can send a bandwidth reset request, requiring each server in the server cluster to reset the available bandwidth of each server based on the ratio of its own traffic load to the traffic load of the total server cluster.
[0146] If the speed limit bandwidth configuration is newly issued, that is, the total bandwidth of the server cluster is newly configured, then each server in the server cluster can be initialized to the new bandwidth. By counting the bandwidth usage for a specified number of times, each server saves the bandwidth usage of all other servers. At this time, each server can set its own available bandwidth based on its own traffic load and the total traffic load.
[0147] Based on the same inventive concept as above, the present application provides another device for dynamically adjusting bandwidth, which can be any server in a server cluster. For example, the schematic diagram of the structure of the device can be seen in Fig.10 As shown, the device may include a processing module 1001 and a transceiver module 1002.
[0148] In one possible implementation, the processing module 1001 is used to determine that the bandwidth of the device in the first time period is in an overloaded state based on the traffic of the device in the first time period; the transceiver module 1002 is used to broadcast a bandwidth request in the server cluster, wherein the bandwidth of the device in the first time period is determined based on the traffic of the device in the second time period, and the second time period is before the first time period; the transceiver module 1002 is also used to receive a second bandwidth response from a second server in the server cluster in response to the bandwidth request, the second bandwidth response indicating a second shared bandwidth provided by the second server to the device.
[0149] In one possible implementation, the transceiver module 1002 is also used to receive a third bandwidth response from a third server in the server cluster in response to a bandwidth request, the third bandwidth response indicating a third shared bandwidth provided by the third server to the device; when the bandwidth of the device and the second shared bandwidth in the first time period meet the bandwidth requirements corresponding to the traffic of the device in the first time period, the processing module 1001 may reject the third shared bandwidth.
[0150] In a possible implementation, after the transceiver module 1002 receives the second bandwidth response from the second server in the server cluster in response to the bandwidth request, the processing module 1001 is further configured to: increase the bandwidth of the device according to the second shared bandwidth.
[0151] In one possible implementation, after the transceiver module 1002 receives the second bandwidth response of the second server in the server cluster in response to the bandwidth request, the processing module 1001 is also used to: determine, based on the traffic of the device in the third time period, that the bandwidth of the device in the third time period is in an idle state; the transceiver module 1002 is also used to: broadcast an idle bandwidth notification in the server cluster; wherein the idle bandwidth notification indicates that the bandwidth of the device in the third time period includes a first shared bandwidth for sharing.
[0152] In a possible implementation, the processing module 1001 is further used to: determine that the fourth server exits from the server cluster; and share the bandwidth before the fourth server exits from the server cluster with other servers in the server cluster based on the total traffic of the server cluster and the traffic of the device.
[0153] In one possible implementation, the processing module 1001 is also used to: determine that the fifth server is added to the server cluster, and the bandwidth demand corresponding to the total traffic of the server cluster is greater than the total bandwidth of the server cluster; trigger each server in the server cluster to reallocate the total bandwidth of the server cluster according to the traffic of each server and the total traffic of the server cluster.
[0154] In a possible implementation, any two servers in the server cluster are connected via a switch.
[0155] Based on the above content and the same concept, Fig.11 The device 1100 provided in an embodiment of the present application is shown. Fig.11 The device shown can be Fig.10 A hardware circuit implementation of the device shown in the figure. The device can be applied to the flowchart shown above to perform the function of the server in the above method embodiment.
[0156] For ease of explanation, Fig.11 Only the main components of the device are shown.
[0157] Fig.11 The device 1100 shown includes a communication interface 1110, a processor 1120 and a memory 1130, wherein the memory 1130 is used to store program instructions and / or data. The processor 1120 may operate in conjunction with the memory 1130. The processor 1120 may execute program instructions stored in the memory 1130. When the instructions or programs stored in the memory 1130 are executed, the processor 1120 is used to execute the operations performed by the processing module 1001 in the above embodiment, and the communication interface 1110 is used to execute the operations performed by the transceiver module 1002 in the above embodiment.
[0158] The memory 1130 is coupled to the processor 1120. The coupling in the embodiment of the present application is an indirect coupling or communication connection between devices, units or modules, which can be electrical, mechanical or other forms, for information exchange between devices, units or modules. At least one of the memories 1130 may be included in the processor 1120.
[0159] In the embodiment of the present application, the communication interface may be a transceiver, a circuit, a bus, a module or other types of communication interfaces. In the embodiment of the present application, when the communication interface is a transceiver, the transceiver may include an independent receiver, an independent transmitter, or a transceiver with integrated transceiver functions or a communication interface.
[0160] The device 1100 may further include a communication line 190. The communication interface 1110, the processor 1120, and the memory 1130 may be interconnected via the communication line 190; the communication line 190 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The communication line 190 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.11 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0161] Based on the above content and the same concept, the present application provides a computer-readable storage medium, in which a computer program or instruction is stored. When the computer program or instruction is executed by a computing device, the computing device executes the method in the above method embodiment.
[0162] Based on the above content and the same concept, the present application provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a computing device, the method in the above method embodiment is implemented.
[0163] Based on the above content and the same concept, the present application provides a computing device, including a processor, the processor is connected to a memory, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the device performs the method in the above method embodiment.
[0164] It is understood that the various numbers involved in the embodiments of the present application are only for the convenience of description and are not used to limit the scope of the embodiments of the present application. The size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic.
[0165] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of protection of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for dynamically adjusting bandwidth, characterized in that: include: The first server determines, based on the traffic of the first server in the first time period, that the bandwidth of the first server in the first time period is in an overloaded state, and broadcasts a bandwidth request in the server cluster, wherein the bandwidth of the first server in the first time period is determined based on the traffic of the first server in a second time period, and the second time period is before the first time period; The first server receives a second bandwidth response from a second server in the server cluster in response to the bandwidth request, the second bandwidth response indicating a second shared bandwidth provided by the second server to the first server; The first server receives a third bandwidth response from a third server in the server cluster in response to the bandwidth request, wherein the third bandwidth response indicates a third shared bandwidth provided by the third server to the first server; When the bandwidth of the first server and the second shared bandwidth in the first time period meet the bandwidth demand corresponding to the traffic of the first server in the first time period, the first server rejects the third shared bandwidth; The method further comprises: A fifth server is added to the server cluster; The fifth server broadcasts bandwidth usage information, wherein the bandwidth usage information carries an initial mark; The fifth server receives bandwidth usage feedback from other servers; If it is determined that the total bandwidth of the server cluster is overloaded, a bandwidth reset request is broadcasted, where the bandwidth reset request is used to request each server to reallocate the total bandwidth of the server cluster; If it is determined that the total bandwidth of the server cluster is not overloaded, a bandwidth request is broadcasted, where the bandwidth request is used to request available bandwidth from other servers.
2. The method according to claim 1, characterized in that After the first server receives a second bandwidth response from a second server in the server cluster in response to the bandwidth request, the method further includes: The first server increases the bandwidth of the first server according to the second shared bandwidth.
3. The method according to claim 1, characterized in that After the first server receives a second bandwidth response from a second server in the server cluster in response to the bandwidth request, the method further includes: The first server determines, based on the traffic of the first server in the third time period, that the bandwidth of the first server in the third time period is in an idle state, and broadcasts an idle bandwidth notification in the server cluster; wherein the idle bandwidth notification indicates that the bandwidth of the first server in the third time period includes a first shared bandwidth for sharing.
4. The method according to claim 1, characterized in that Also includes: The first server determines that the fourth server exits from the server cluster; The first server shares the bandwidth of the fourth server before it exits from the server cluster with other servers in the server cluster according to the total traffic of the server cluster and the traffic of the first server.
5. The method according to claim 1, characterized in that Also includes: The first server determines that the fifth server is added to the server cluster, and the bandwidth demand corresponding to the total traffic of the server cluster is greater than the total bandwidth of the server cluster; The first server triggers each server in the server cluster to reallocate the total bandwidth of the server cluster according to the traffic of each server and the total traffic of the server cluster.
6. The method according to any one of claims 1 to 5, characterized in that Any two servers in the server cluster are connected via a switch.
7. A device for dynamically adjusting bandwidth, characterized in that: Comprising modules for executing the method as claimed in any one of claims 1 to 6.
8. A computing device, characterized in that The computer comprises a processor connected to a memory, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the computing device executes the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or instructions, and when the computer program or instructions are executed by a computing device, the method according to any one of claims 1 to 6 is implemented.
