Flow distribution method, device, equipment and medium
Patent Information
- Application Number
- CN202211537452.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-02
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-12-02
Smart Images

Figure CN115941487B
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a flow distribution method, device, equipment and medium. Background Art
[0002] In a communication billing service platform, when there are multiple applications that need to use traffic, it is necessary to allocate appropriate traffic to the multiple applications and control excessive use of traffic.
[0003] Most of the traffic control is based on CPU time-division traffic control technology, but CPU time-division traffic control technology has defects in traffic distribution between multiple tasks and cannot accurately control the traffic usage of each application, resulting in unreasonable traffic distribution results. Summary of the invention
[0004] The present application provides a traffic distribution method, apparatus, device and medium, which can accurately control the traffic usage of a single application.
[0005] On the one hand, the present application provides a flow distribution method, comprising:
[0006] For each time slice, the area corresponding to the total flow in the time slice is divided according to the set number of time intervals and the number of unit flows, so as to establish a time slice grid; wherein a single grid in the time slice grid represents the unit flow in a single time interval;
[0007] According to the weight of each application and the unit flow quantity, the number of grids occupied by each application in the time slice grid is obtained, and according to the upper limit of the number of grids of a single application in the time slice grid, the number of grids occupied by each application in the time slice grid is adjusted;
[0008] Calculate the sum of the flows of the applications in the time slice according to the number of grids occupied by the applications in the time slice grid and the unit flow as the allocated flow in the time slice;
[0009] According to the allocated flow in each time slice, the flow distribution result is obtained by integration.
[0010] In one embodiment, obtaining the number of grids occupied by each application in the time slice grid according to the weight of each application and the unit flow quantity, and adjusting the number of grids occupied by the application in the time slice grid according to the upper limit of the number of grids of each application in the time slice grid, includes:
[0011] Calculate the ratio of the weight of each application to the sum of the weights of the applications to obtain the weight ratio of each application; multiply the weight ratio of each application by the unit flow quantity to obtain the number of grids occupied by the application in a single column of the time slice grid;
[0012] Determine an upper limit of the number of grids of a single application in a single column of the time slice grid according to the unit flow, the number of each application and the total flow in the time slice;
[0013] If the number of grids occupied by any application in a single column of the time slice grid exceeds the upper limit of the number of grids of the single application in a single column of the time slice grid, the number of grids occupied by the application in the single column of the time slice grid is adjusted to the upper limit of the number of grids;
[0014] The number of grids occupied by the application in a single column of the time slice grid is multiplied by the number of time intervals to obtain the number of grids occupied by the application in the time slice grid.
[0015] In one embodiment, determining the upper limit of the number of grids of a single application in a single column of the time slice grid according to the unit flow, the number of each application, and the total flow in the time slice includes:
[0016] Calculate the ratio of the total flow in the time slice to the number of each application to obtain the flow upper limit of a single application in the time slice;
[0017] The flow upper limit of the single application in the time slice is calculated and divided by the product of the unit flow and the number of time intervals, and the obtained result is used as the upper limit of the number of grids in a single column of the time slice grid for the single application.
[0018] In one embodiment, the method further includes: calculating the ratio of the weight of each application to the sum of the weights of the applications to obtain the weight ratio of each application; and multiplying the weight ratio of each application by the unit traffic quantity to obtain the number of grids occupied by the application in a single column of the time slice grid.
[0019] If the number of grids occupied by the application in a single column of the time slice grid is not an integer, the number of grids occupied by the application in a single column of the time slice grid is adjusted by rounding down.
[0020] In one embodiment, for each time slice, the total flow in the time slice is divided according to the set number of time intervals and the number of unit flows to establish a time slice grid, including:
[0021] A coordinate system is established for each time slice, wherein the horizontal axis of the coordinate system represents time and the vertical axis represents flow;
[0022] Determine a first coordinate point on the horizontal axis and a second coordinate point on the vertical axis, wherein a region established with the first coordinate point and the second coordinate point as opposite angles represents a total flow in the time slice;
[0023] The horizontal axis corresponding to the area is divided according to the number of time intervals, and the vertical axis corresponding to the area is divided according to the number of unit flows, to obtain the time slice grid.
[0024] On the other hand, the present application provides a flow distribution device,
[0025] include:
[0026] An establishment module is used to divide the area corresponding to the total flow in each time slice according to the set number of time intervals and the number of unit flows, so as to establish a time slice grid; wherein a single grid in the time slice grid represents the unit flow in a single time interval;
[0027] A processing module, used for obtaining the number of grids occupied by each application in the time slice grid according to the weight of each application and the number of unit flows, and adjusting the number of grids occupied by each application in the time slice grid according to the upper limit of the number of grids of a single application in the time slice grid;
[0028] The processing module is further used to calculate the sum of the flows of the applications in the time slice according to the number of grids occupied by the applications in the time slice grid and the unit flow, as the allocated flow in the time slice;
[0029] The integration module is used to integrate the flow distribution results according to the distribution flow in each time slice.
[0030] In one embodiment, the processing module is specifically used to calculate the ratio of the weight of each application to the sum of the weights of the applications to obtain the weight ratio of each application; multiply the weight ratio of each application by the unit flow quantity to obtain the number of grids occupied by the application in a single column of the time slice grid;
[0031] The processing module is further configured to determine an upper limit of the number of grids of a single application in a single column of the time slice grid according to the unit flow, the number of each application and the total flow in the time slice;
[0032] The processing module is further configured to adjust the number of grids occupied by any application in a single column of the time slice grid to the upper limit of the number of grids if the number of grids occupied by any application in a single column of the time slice grid exceeds the upper limit of the number of grids of the single application in a single column of the time slice grid;
[0033] The processing module is further specifically configured to multiply the number of grids of the application in a single column of the time slice grid by the number of time intervals to obtain the number of grids occupied by the application in the time slice grid.
[0034] In one embodiment, the processing module is further configured to calculate a ratio of a total flow rate in the time slice to a number of each application, and obtain a flow rate upper limit of a single application in the time slice;
[0035] The processing module is specifically used to calculate the flow upper limit of the single application in the time slice divided by the product of the unit flow and the number of time intervals, and the obtained result is used as the upper limit of the number of grids of the single application in a single column of the time slice grid.
[0036] In one embodiment, the processing module is further used to adjust the number of grids occupied by the application in a single column of the time slice grid by rounding down if the number of grids occupied by the application in a single column of the time slice grid is not an integer.
[0037] In one embodiment, the establishing module is specifically used to establish a coordinate system for each time slice, wherein the horizontal axis of the coordinate system represents time and the vertical axis represents flow;
[0038] The establishment module is further specifically used to determine a first coordinate point on the horizontal axis and a second coordinate point on the vertical axis, wherein a region established with the first coordinate point and the second coordinate point as opposite angles represents a total flow in the time slice;
[0039] The establishment module is specifically further used to divide the horizontal axis corresponding to the area according to the number of time intervals, and to divide the vertical axis corresponding to the area according to the number of unit flows, so as to obtain the time slice grid.
[0040] In yet another aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0041] The memory stores computer-executable instructions;
[0042] The processor executes the computer-executable instructions stored in the memory to implement the above method.
[0043] On the other hand, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method as described above.
[0044] In the traffic distribution method, device, equipment and medium provided by the present application, firstly, for each time slice, the area corresponding to the total traffic in the time slice is divided to establish a time slice grid; then, the number of grids occupied by each application in the time slice grid is obtained, and according to the upper limit of the number of grids of a single application in the time slice grid, the number of grids occupied by each application in the time slice grid is adjusted; then, the sum of the traffic of each application in the time slice is calculated as the allocated traffic in the time slice; finally, according to the allocated traffic in each time slice, the traffic distribution result is integrated. Through the scheme of the present application, the upper limit of the traffic usage of a single application in the time slice can be accurately controlled, so as to reasonably allocate the usage traffic of each application while ensuring the upper limit of the overall bandwidth. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0046] Figure 1 This is a schematic diagram of an application scenario for this application example;
[0047] Figure 2 A flow chart of a flow distribution method provided in Example 1 of the present application;
[0048] Figure 3 A schematic diagram of a time slice grid provided in the first embodiment;
[0049] Figure 4 A flow chart of another flow distribution method provided in Example 1 of the present application;
[0050] Figure 5 A flow chart of another flow distribution method provided in Example 1 of the present application;
[0051] Figure 6 A schematic diagram of another time slice grid provided in the first embodiment;
[0052] Figure 7 A flow chart of another flow distribution method provided in Example 1 of the present application;
[0053] Figure 8 A schematic diagram of another time slice grid provided for the first embodiment;
[0054] Fig. 9A schematic diagram of the structure of a flow distribution device provided in Example 2 of the present application;
[0055] Fig.10 This is a schematic diagram of the structure of an electronic device provided in Example 3 of the present application.
[0056] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0057] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0058] Figure 1 This is a schematic diagram of the application scenario of the example of this application. When there are multiple applications using traffic at the same time, a period of time is determined as the time length of the time slice, and the traffic of the multiple applications is allocated in each time slice to obtain an allocation result. The traffic usage of the applications is controlled by the traffic allocation method to ensure the traffic upper limit of the multiple applications in each time slice.
[0059] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their ordinary and common meanings.
[0060] The technical solutions of the present application and the technical solutions of the present application are described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. In the description of the present application, unless otherwise clearly specified and limited, each term should be understood in a broad sense in the art. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0061] Embodiment 1
[0062] Figure 2 A flow chart of a flow distribution method provided in Example 1 of the present application is shown as follows: Figure 2 As shown, the method includes:
[0063] Step 201: for each time slice, according to the set number of time intervals and number of unit flows, the area corresponding to the total flow in the time slice is divided to establish a time slice grid; wherein a single grid in the time slice grid represents the unit flow in a single time interval;
[0064] Step 202: according to the weight of each application and the unit flow quantity, the number of grids occupied by each application in the time slice grid is obtained, and according to the upper limit of the number of grids of a single application in the time slice grid, the number of grids occupied by each application in the time slice grid is adjusted;
[0065] Step 203: Calculate the sum of the flows of the applications in the time slice according to the number of grids occupied by the applications in the time slice grid and the unit flow, as the allocated flow in the time slice;
[0066] Step 204: Integrate the allocated flows in each time slice to obtain a flow allocation result.
[0067] The executor of this embodiment is a traffic distribution system, which can be implemented through a computer program, such as application software, etc.; or, it can also be implemented as a medium storing relevant computer programs, such as a USB flash drive, a cloud disk, etc.; or, it can also be implemented through a physical device integrated or installed with relevant computer programs, such as a chip, etc.
[0068] Combined with the scenario example: within a period of time, when there are multiple applications that need to use traffic at the same time, in order to control the traffic usage of the applications, this period of time can be evenly divided into multiple time slices, and a traffic upper limit is allocated for each time slice, that is, the total traffic that the multiple applications can use within a time slice. The amount of traffic can be characterized by the size of an area, and the area corresponding to the total traffic that can be used in a time slice is taken as the first area, and the first area is divided to establish a time slice grid. Specifically, the time slice is evenly divided into multiple time intervals, the number of time intervals that the time slice can be divided into is determined, and the number of unit traffic is determined, and the first area is divided according to the number of time intervals and the number of unit traffic. Figure 3 A schematic diagram of a time slice grid provided in the first embodiment of the present invention is shown. For example, the time length of a time slice is 1 second, the upper limit of the total flow rate that can be used in a time slice is set to 100M, and the number of time intervals and the number of unit flows are both set to 10. Then, the time interval is 100ms, the upper limit of the flow rate in a single time interval is 10M, and the unit flow rate is 1M. Figure 3 As shown, Figure 3 Each grid is represented as a unit flow in a single time interval, that is, the flow represented by a grid is 1M.
[0069] When allocating traffic to the multiple applications in the time slice, the amount of traffic that can be allocated to each application depends on the weight corresponding to the application, and since a traffic upper limit is set in a time slice, the traffic upper limit is averaged over the multiple applications to obtain the traffic upper limit that each application can use in a time slice. For example, if there are 5 applications that need to be allocated traffic, the upper limit of the total traffic that can be used in a time slice is 100M, the upper limit of the traffic that can be used by each application in a time slice is determined, and the upper limit of the number of grids that can be allocated to each application in the time slice is determined, that is, the first number of grids. After allocating traffic to each application according to the weight corresponding to the application, if the number of grids allocated to a certain application exceeds the determined first number of grids, the number of grids occupied by the application in the time slice is adjusted so that the number of allocated grids does not exceed the first number of grids. After allocating traffic to each application in this way, the sum of the traffic allocated to each application in the time slice is calculated, and the sum of the traffic is used as the allocated traffic of the time slice. The traffic allocation result is obtained by integrating the allocated traffic of each time slice during this period, and the traffic allocation result is the number of traffic that should be allocated to the multiple applications during this period.
[0070] In this example, for each time slice, the area corresponding to the total flow in the time slice is divided according to the set number of time intervals and the number of unit flows to establish a time slice grid, and then the number of grids occupied by each application in the time slice grid is obtained according to the weight of each application and the number of unit flows, and the number of grids occupied by each application in the time slice grid is adjusted according to the upper limit of the number of grids in the time slice grid for a single application, and then the sum of the flows of each application in the time slice is calculated according to the number of grids occupied by each application in the time slice grid and the unit flow, as the allocated flow in the time slice, and finally the flow distribution result is obtained by integrating according to the allocated flow in each time slice. Through the scheme of this example, the upper limit of the flow usage of a single application in the time slice can be accurately controlled, so as to reasonably distribute the flow used by each application while ensuring the upper limit of the overall bandwidth.
[0071] Optional, Figure 4 A flow chart of another flow distribution method provided in Embodiment 1 of the present application, wherein step 202 includes:
[0072] Step 401: Calculate the ratio of the weight of each application to the sum of the weights of the applications to obtain the weight ratio of each application; multiply the weight ratio of each application by the unit flow quantity to obtain the number of grids occupied by the application in a single column of the time slice grid;
[0073] Step 402: Determine an upper limit of the number of grids of a single application in a single column of the time slice grid according to the unit flow, the number of each application and the total flow in the time slice;
[0074] Step 403: if the number of grids occupied by any application in a single column of the time slice grid exceeds the upper limit of the number of grids of the single application in a single column of the time slice grid, the number of grids occupied by the application in the single column of the time slice grid is adjusted to the upper limit of the number of grids;
[0075] Step 404: multiply the number of grids of the application in a single column of the time slice grid by the number of time intervals to obtain the number of grids occupied by the application in the time slice grid.
[0076] Combined with the scenario example, when obtaining the number of grids occupied by each application in the time slice grid according to the weight of each application and the unit flow quantity, the weight ratio of each application can be calculated, and then the weight ratio of each application can be multiplied by the unit flow quantity to obtain the number of grids occupied in a time interval, that is, the number of grids occupied in a single column of the time slice grid. For example, if there are 5 applications A1, A2, A3, A4 and A5 that need to be allocated flow, the weights of the 5 applications are 2, 2, 3.5, 1 and 1.5 respectively, and the weight ratios of the 5 applications are calculated to be 0.2, 0.2, 0.35, 0.1 and 0.15 respectively, and the weight ratios of the 5 applications are multiplied by the unit flow quantity, that is, by 10, to obtain the number of grids occupied by the 5 applications in a single column of the time slice grid as 2, 2, 3.5, 1 and 1.5 respectively.
[0077] The calculation result shows that the number of grids allocated to the two applications A3 and A5 is not an integer. Optionally, if the number of grids occupied by the application in a single column of the time slice grid is not an integer, the number of grids occupied by the application in a single column of the time slice grid is adjusted by rounding down. That is, the number of grids allocated to the two applications A3 and A5 is rounded down to obtain 3 and 1.
[0078] Then, based on the unit flow, the number of applications, and the total flow in the time slice, determine the upper limit of the number of grids that can be allocated to each application in a single column of the time slice grid, that is, the second number of grids. The result of the grid number allocation of each application in a single column of the time slice grid is calculated by weight. If it is found from the grid number allocation result that the grid number allocation result of a certain application exceeds the second number of grids, the grid number allocation result of the application is adjusted to the second number of grids. Then, based on the grid allocation result of each application in a single column of the time slice grid, multiply it by the number of time intervals to obtain the number of grids occupied by each application in the time slice grid. This example calculates the weight ratio of each application, multiplies it by the unit flow number, and multiplies it by the number of time intervals to obtain the number of grids allocated to each application in the time slice grid. The method of this example can accurately control the number of grids allocated to each application.
[0079] Optional, Figure 5 A flow chart of another flow distribution method provided in Embodiment 1 of the present application, wherein step 402 includes:
[0080] Step 501: Calculate the ratio of the total flow in the time slice to the number of each application to obtain the flow upper limit of a single application in the time slice;
[0081] Step 502: Calculate the flow upper limit of the single application in the time slice and divide it by the product of the unit flow and the number of time intervals, and obtain the result as the upper limit of the number of grids in a single column of the time slice grid for the single application.
[0082] In combination with the scenario example, in the process of determining the number of second grids that can be allocated to each application in a single column of the time slice grid according to the unit traffic, the number of each application and the total traffic in the time slice, the ratio of the total traffic in the time slice to the number of each application can be calculated to obtain the upper limit of the traffic of a single application in the time slice. For example, if there are 5 applications that need to be allocated traffic, and the upper limit of the total traffic that can be used in a time slice is 100M, then the upper limit of the traffic that can be used by each application in a time slice is 20M. Then calculate the product of the unit traffic and the number of time intervals, and divide the upper limit of the traffic that can be used by each application in a time slice by the product to obtain the number of second grids that can be allocated to a single application in a single column of the time slice grid. That is, the product of the unit traffic and the number of time intervals is 10M, and the result of dividing the upper limit of the traffic that can be used by each application in a time slice by the product is 2, that is, the number of the second grids is 2. According to the above, if there is an application whose grid number allocation result in a single column of the time slice grid exceeds the second grid number, the grid number allocation result is adjusted to 2, that is, the grid number allocated by the A3 application in a single column of the time slice grid is adjusted to 2, so the grid numbers allocated by the 5 applications in a single column of the time slice grid are 2, 2, 2, 1 and 1 respectively. Figure 6 A schematic diagram of another time slice grid provided in the first embodiment, such as Figure 6 As shown, the number of grids allocated to the five applications in a single column of the time slice grid is multiplied by the number of time intervals to obtain the number of grids occupied by each application in the time slice grid, i.e., 20, 20, 10, and 10. The total number of grids allocated to the five applications in the time slice grid is 80, i.e., the total traffic allocated to the five applications in the time slice is 80M. It is worth mentioning that when allocating traffic to all applications in a time slice grid, the traffic should be allocated according to the number of grids occupied by the final application. The applications with more allocated grids are closer to the bottom, ensuring that the applications with more allocated grids are transmitted first. According to the number of grids allocated to the five applications in the time slice grid, the three applications A1, A2, and A3 have the largest number of allocated grids. The three applications A1, A2, and A3 should be placed at the bottom, and the two applications A4 and A5 should be placed at the top. This example achieves the control of the upper limit of the traffic used by each application by setting the upper limit of the number of grids that can be allocated to a single application in the time slice grid.
[0083] Optional, Figure 7 A flow chart of another flow distribution method provided in Embodiment 1 of the present application, wherein step 201 includes:
[0084] Step 701: Establish a coordinate system for each time slice, where the horizontal axis of the coordinate system represents time and the vertical axis represents flow;
[0085] Step 702: determine a first coordinate point on the horizontal axis and a second coordinate point on the vertical axis, wherein a region established with the first coordinate point and the second coordinate point as opposite angles represents the total flow in the time slice;
[0086] Step 703: Divide the horizontal axis corresponding to the area according to the number of time intervals, and divide the vertical axis corresponding to the area according to the number of unit flows to obtain the time slice grid.
[0087] Combined with the scenario example, in the process of dividing each time slice into a time slice grid, a coordinate system can be established for the time slice, specifically, with time as the horizontal axis and flow as the vertical axis. The length of each time slice is 1s, so the first coordinate point on the horizontal axis is 1s, and the time slice is divided into multiple time intervals. If the number of time intervals is 10, which means that the length of each time interval is 0.1s, then the time slice is divided into 10 time intervals of 0.1s according to the number of time intervals. If the total flow in each time interval is 10M, 10M is used as the second coordinate on the vertical axis, and then a region is established with the first coordinate point and the second coordinate point as the vertex, and the region represents the total flow in the time slice, and the total flow is 100M. Finally, the number of unit flows is determined to divide the vertical axis. If the number of unit flows is 10, the unit flow on the vertical axis is 1M. Figure 8 A schematic diagram of another time slice grid provided in the first embodiment, such as Figure 8 As shown, after dividing the time interval number and the unit flow number as the horizontal and vertical axes respectively, a time slice grid can be obtained. This example uses time as the horizontal axis and flow as the vertical axis, and divides the time interval number and the unit flow number as the horizontal and vertical axes respectively. The time slice grid can be obtained based on the method of this example.
[0088] In this embodiment, for each time slice, the area corresponding to the total flow in the time slice is divided according to the set number of time intervals and the number of unit flows to establish a time slice grid, and then the number of grids occupied by each application in the time slice grid is obtained according to the weight of each application and the number of unit flows, and the number of grids occupied by each application in the time slice grid is adjusted according to the upper limit of the number of grids in the time slice grid of a single application, and then the sum of the flows of each application in the time slice is calculated according to the number of grids occupied by each application in the time slice grid and the unit flow, as the allocated flow in the time slice, and finally the flow allocation result is obtained by integrating according to the allocated flow in each time slice. Through the scheme of this embodiment, the upper limit of the flow usage of a single application in the time slice can be accurately controlled, so as to reasonably allocate the flow used by each application while ensuring the upper limit of the overall bandwidth.
[0089] Embodiment 2
[0090] Fig. 9 A schematic diagram of the structure of a flow distribution device provided in Example 2 of the present application is shown in FIG. Fig. 9 As shown, the device comprises:
[0091] Establishing module 91, for each time slice, dividing the area corresponding to the total flow in the time slice according to the set number of time intervals and the number of unit flows, so as to establish a time slice grid; wherein a single grid in the time slice grid represents the unit flow in a single time interval;
[0092] The processing module 92 is used to obtain the number of grids occupied by each application in the time slice grid according to the weight of each application and the unit flow quantity, and adjust the number of grids occupied by each application in the time slice grid according to the upper limit of the number of grids of a single application in the time slice grid;
[0093] The processing module 92 is further configured to calculate the sum of the flows of the applications in the time slice according to the number of grids occupied by the applications in the time slice grid and the unit flow, as the allocated flow in the time slice;
[0094] The integration module 93 is used to integrate the allocated flows in each time slice to obtain a flow allocation result.
[0095] The executor of this embodiment is a traffic distribution device, which can be implemented by a computer program, such as application software, etc.; or, it can also be implemented as a medium storing relevant computer programs, such as a USB flash drive, a cloud disk, etc.; or, it can also be implemented by a physical device integrated or installed with relevant computer programs, such as a chip, etc.
[0096] Combined with the scenario example: within a period of time, when there are multiple applications that need to use traffic at the same time, in order to control the traffic usage of the application, this period of time can be evenly divided into multiple time slices, and a traffic upper limit is allocated for each time slice, that is, the total traffic that the multiple applications can use in a time slice. The amount of traffic can be represented by the size of an area, and the establishment module 91 takes the area corresponding to the total traffic that can be used in a time slice as the first area, and divides the first area to establish a time slice grid. Specifically, the time slice is evenly divided into multiple time intervals, the number of time intervals that the time slice can be divided into is determined, and the number of unit traffic is determined, and the first area is divided by the number of time intervals and the number of unit traffic. For example, the time length of the time slice is 1 second, the upper limit of the total traffic that can be used in a time slice is set to 100M, and the number of time intervals and the number of unit traffic are set to 10, then the time interval is 100ms, the upper limit of the traffic in a single time interval is 10M, and the unit traffic is 1M, that is, the traffic represented by a grid is 1M.
[0097] When allocating traffic to the multiple applications in the time slice, the amount of traffic that can be allocated to each application depends on the weight corresponding to the application, and since a traffic upper limit is set in a time slice, the processing module 92 averages the traffic upper limit to the multiple applications to obtain the traffic upper limit that each application can use in a time slice. For example, if there are 5 applications that need to be allocated traffic, the upper limit of the total traffic that can be used in a time slice is 100M, the upper limit of the traffic that can be used by each application in a time slice is determined, and the upper limit of the number of grids that can be allocated to each application in the time slice is determined, that is, the first number of grids. After allocating traffic to each application according to the weight corresponding to the application, if there is an application that allocates more grids than the determined first number of grids, the number of grids occupied by the application in the time slice is adjusted so that the number of allocated grids does not exceed the first number of grids. After allocating traffic to each application according to this method, the integration module 93 calculates the sum of the traffic allocated to each application within the time slice, uses the sum of the traffic as the allocated traffic of the time slice, and integrates the allocated traffic of each time slice within this period to obtain the traffic allocation result, which is the amount of traffic that should be allocated to the multiple applications within this period.
[0098] In this example, the division module 91 divides the area corresponding to the total flow in the time slice according to the set number of time intervals and the number of unit flows for each time slice to establish a time slice grid. Then, the processing module 92 obtains the number of grids occupied by each application in the time slice grid according to the weight of each application and the number of unit flows, and adjusts the number of grids occupied by each application in the time slice grid according to the upper limit of the number of grids in the time slice grid for a single application. Then, the integration module 93 calculates the sum of the flows of each application in the time slice according to the number of grids occupied by each application in the time slice grid and the unit flow, as the allocated flow in the time slice. Finally, the flow allocation result is obtained by integrating according to the allocated flow in each time slice. Through the scheme of this example, the upper limit of the flow usage of a single application in the time slice can be accurately controlled, so as to reasonably allocate the flow used by each application while ensuring the upper limit of the overall bandwidth.
[0099] Optionally, the processing module 92 is specifically configured to calculate the ratio of the weight of each application to the sum of the weights of the applications to obtain the weight ratio of each application; multiply the weight ratio of each application by the unit flow quantity to obtain the number of grids occupied by the application in a single column of the time slice grid;
[0100] The processing module 92 is further configured to determine an upper limit of the number of grids of a single application in a single column of the time slice grid according to the unit flow, the number of each application and the total flow in the time slice;
[0101] The processing module 92 is further configured to adjust the number of grids occupied by any application in a single column of the time slice grid to the upper limit of the number of grids if the number of grids occupied by any application in a single column of the time slice grid exceeds the upper limit of the number of grids of the single application in a single column of the time slice grid;
[0102] The processing module 92 is further configured to multiply the number of grids of the application in a single column of the time slice grid by the number of time intervals to obtain the number of grids occupied by the application in the time slice grid.
[0103] Combined with the scenario example, when the processing module 92 obtains the number of grids occupied by each application in the time slice grid according to the weight of each application and the unit flow number, the weight ratio of each application can be calculated, and then the weight ratio of each application is multiplied by the unit flow number to obtain the number of grids occupied in a time interval, that is, the number of grids occupied in a single column of the time slice grid. For example, if there are 5 applications A1, A2, A3, A4 and A5 that need to be allocated traffic, the weights of the 5 applications are 2, 2, 3.5, 1 and 1.5 respectively, and the weight ratios of the 5 applications are calculated to be 0.2, 0.2, 0.35, 0.1 and 0.15 respectively, and the weight ratios of the 5 applications are multiplied by the unit flow number, that is, by 10, to obtain the number of grids occupied by the 5 applications in a single column of the time slice grid as 2, 2, 3.5, 1 and 1.5 respectively.
[0104] The calculation result shows that the number of grids allocated by the two applications A3 and A5 is not an integer. Optionally, the processing module 92 is further configured to adjust the number of grids occupied by the application in a single column of the time slice grid by rounding down if the number of grids occupied by the application in a single column of the time slice grid is not an integer. That is, the number of grids allocated by the two applications A3 and A5 is rounded down to obtain 3 and 1, respectively.
[0105] Then, the processing module 92 determines the upper limit of the number of grids that can be allocated to each application in a single column of the time slice grid, i.e., the second number of grids, based on the unit flow, the number of each application, and the total flow in the time slice. The result of the grid number allocation of each application in a single column of the time slice grid is calculated by weight. If it is found from the grid number allocation result that the grid number allocation result of a certain application exceeds the second number of grids, the grid number allocation result of the application is adjusted to the second number of grids. Then, the processing module 92 multiplies the grid allocation result of each application in a single column of the time slice grid by the number of time intervals to obtain the number of grids occupied by each application in the time slice grid. The processing module 92 of this example calculates the weight ratio of each application, multiplies it by the number of unit flow, and multiplies it by the number of time intervals to obtain the number of grids allocated to each application in the time slice grid. The method of this example can accurately control the number of grids allocated to each application.
[0106] Optionally, the processing module 92 is further configured to calculate a ratio of the total flow in the time slice to the number of each application, so as to obtain a flow upper limit of a single application in the time slice;
[0107] The processing module 92 is further specifically used to calculate the flow upper limit of the single application in the time slice divided by the product of the unit flow and the number of time intervals, and the result is used as the upper limit of the number of grids of the single application in a single column of the time slice grid.
[0108] In combination with the scenario example, the processing module 92 can calculate the ratio of the total flow in the time slice to the number of applications to obtain the upper limit of the flow of a single application in the time slice when determining the number of second grids that can be allocated to each application in a single column of the time slice grid according to the unit flow, the number of applications and the total flow in the time slice. For example, if there are 5 applications that need to be allocated flow, and the upper limit of the total flow that can be used in a time slice is 100M, then the upper limit of the flow that can be used by each application in a time slice is 20M. Then calculate the product of the unit flow and the number of time intervals, and divide the upper limit of the flow that can be used by each application in a time slice by the product to obtain the number of second grids that can be allocated to a single application in a single column of the time slice grid. That is, the product of the unit flow and the number of time intervals is 10M, and the result of dividing the upper limit of the flow that can be used by each application in a time slice by the product is 2, that is, the number of the second grids is 2. According to the above, if there is an application whose grid number allocation result in a single column of the time slice grid exceeds the second grid number, the grid number allocation result is adjusted to 2, that is, the grid number allocated by the A3 application in a single column of the time slice grid is adjusted to 2, so the grid numbers allocated by the five applications in a single column of the time slice grid are 2, 2, 2, 1 and 1 respectively. The grid numbers allocated by the five applications in a single column of the time slice grid are multiplied by the time interval number to obtain the grid numbers occupied by each application in the time slice grid, that is, 20, 20, 20, 10 and 10. The total grid number allocated by the five applications in the time slice grid is 80, that is, the total traffic allocated to the five applications in the time slice is 80M. It is worth mentioning that when allocating traffic to all applications in a time slice grid, the traffic should be allocated according to the number of grids occupied by the final application. The applications with more allocated grids are closer to the bottom, ensuring that the applications with more allocated grids are transmitted first. According to the number of grids allocated to the five applications in the time slice grid, the number of grids allocated to the three applications A1, A2 and A3 is the largest, and the three applications A1, A2 and A3 should be placed at the bottom, and the two applications A4 and A5 should be placed at the top. The processing module 92 of this example controls the upper limit of the traffic used by each application by setting the upper limit of the number of grids that can be allocated to a single application in the time slice grid.
[0109] Optionally, an establishing module 91 is specifically used to establish a coordinate system for each time slice, wherein the horizontal axis of the coordinate system represents time and the vertical axis represents flow;
[0110] The establishment module 91 is further specifically used to determine a first coordinate point on the horizontal axis and a second coordinate point on the vertical axis, wherein a region established with the first coordinate point and the second coordinate point as opposite angles represents a total flow in the time slice;
[0111] The establishment module 91 is further specifically used to divide the horizontal axis corresponding to the area according to the number of time intervals, and to divide the vertical axis corresponding to the area according to the number of unit flows, so as to obtain the time slice grid.
[0112] Combined with the scenario example, the establishment module 91 can establish a coordinate system for each time slice in the process of dividing the time slice grid to obtain the time slice grid. Specifically, time is used as the horizontal axis and flow is used as the vertical axis. The length of each time slice is 1s, so the first coordinate point on the horizontal axis is 1s, and the time slice is divided into multiple time intervals. If the number of time intervals is 10, it means that the length of each time interval is 0.1s, and the time slice is divided into 10 time intervals of 0.1s according to the number of time intervals. If the total flow in each time interval is 10M, 10M is used as the second coordinate on the vertical axis, and then a region is established with the first coordinate point and the second coordinate point as the vertex, and the region represents the total flow in the time slice, and the total flow is 100M. Finally, the establishment module 91 determines the number of unit flows to divide the vertical axis. If the number of unit flows is 10, the unit flow on the vertical axis is 1M. The module 91 established in this example uses time as the horizontal axis and flow as the vertical axis, and divides the horizontal and vertical axes by the number of time intervals and the number of unit flows, respectively. The time slice grid can be obtained based on the method of this example.
[0113] In this embodiment, the division module 91 divides the area corresponding to the total flow in the time slice according to the set number of time intervals and the number of unit flows for each time slice to establish a time slice grid. Then, the processing module 92 obtains the number of grids occupied by each application in the time slice grid according to the weight of each application and the number of unit flows, and adjusts the number of grids occupied by each application in the time slice grid according to the upper limit of the number of grids in the time slice grid of a single application. Then, the integration module 93 calculates the sum of the flows of each application in the time slice according to the number of grids occupied by each application in the time slice grid and the unit flow, as the allocated flow in the time slice, and finally integrates the flow allocation result according to the allocated flow in each time slice. Through the scheme of this embodiment, the upper limit of the flow usage of a single application in the time slice can be accurately controlled, so as to reasonably allocate the flow usage of each application while ensuring the upper limit of the overall bandwidth.
[0114] Embodiment 3
[0115] Fig.10 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present application, such as Fig.10 As shown, the electronic device includes:
[0116] The electronic device includes a processor 291 and a memory 292; it may also include a communication interface 293 and a bus 294. The processor 291, the memory 292, and the communication interface 293 may communicate with each other through the bus 294. The communication interface 293 may be used for information transmission. The processor 291 may call the logic instructions in the memory 292 to execute the method of the first embodiment.
[0117] In addition, the logic instructions in the above-mentioned memory 292 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0118] The memory 292 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present application. The processor 291 executes the functional application and data processing by running the software programs, instructions and modules stored in the memory 292, that is, implementing the method of the above-mentioned embodiment 1.
[0119] The memory 292 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 292 may include a high-speed random access memory and may also include a non-volatile memory.
[0120] An embodiment of the present application provides a non-temporary computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method described in the above embodiment.
[0121] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the inventions claimed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary techniques in the art that are not claimed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims below.
[0122] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A flow distribution method, characterized in that: include: For each time slice, the area corresponding to the total flow in the time slice is divided according to the set number of time intervals and the number of unit flows, so as to establish a time slice grid; wherein a single grid in the time slice grid represents the unit flow in a single time interval; According to the weight of each application and the unit flow quantity, obtaining the number of grids occupied by each application in a single column of the time slice grid; Calculate the ratio of the total flow in the time slice to the number of each application to obtain the flow upper limit of a single application in the time slice; Calculate the flow upper limit of the single application in the time slice and divide it by the product of the unit flow and the number of time intervals, and use the result as the upper limit of the number of grids in a single column of the time slice grid for the single application; If the number of grids occupied by any application in a single column of the time slice grid exceeds the upper limit of the number of grids of the single application in a single column of the time slice grid, the number of grids occupied by the application in the single column of the time slice grid is adjusted to the upper limit of the number of grids; Multiplying the number of grids of the application in a single column of the time slice grid by the number of time intervals to obtain the number of grids occupied by the application in the time slice grid; Calculate the sum of the flows of the applications in the time slice according to the number of grids occupied by the applications in the time slice grid and the unit flow as the allocated flow in the time slice; According to the allocated flow in each time slice, the flow distribution result is obtained by integration.
2. The method according to claim 1, characterized in that: The obtaining, according to the weight of each application and the unit flow quantity, the number of grids occupied by each application in a single column of the time slice grid comprises: Calculate the ratio of the weight of each application to the sum of the weights of the applications to obtain the weight ratio of each application; The weight ratio of each application is multiplied by the unit traffic quantity to obtain the number of grids occupied by the application in a single column of the time slice grid.
3. The method according to claim 2, characterized in that After calculating the ratio of the weight of each application to the sum of the weights of the applications to obtain the weight proportion of each application; and multiplying the weight proportion of each application by the unit flow quantity to obtain the number of grids occupied by the application in a single column of the time slice grid, the method further includes: If the number of grids occupied by the application in a single column of the time slice grid is not an integer, the number of grids occupied by the application in a single column of the time slice grid is adjusted by rounding down.
4. The method according to any one of claims 1 to 3, characterized in that: For each time slice, the total flow in the time slice is divided according to the set number of time intervals and the number of unit flows to establish a time slice grid, including: A coordinate system is established for each time slice, wherein the horizontal axis of the coordinate system represents time and the vertical axis represents flow; Determine a first coordinate point on the horizontal axis and a second coordinate point on the vertical axis, wherein a region established with the first coordinate point and the second coordinate point as opposite angles represents a total flow in the time slice; The horizontal axis corresponding to the area is divided according to the number of time intervals, and the vertical axis corresponding to the area is divided according to the number of unit flows, to obtain the time slice grid.
5. A flow distribution device, characterized in that: include: An establishment module is used to divide the area corresponding to the total flow in each time slice according to the set number of time intervals and the number of unit flows, so as to establish a time slice grid; wherein a single grid in the time slice grid represents the unit flow in a single time interval; A processing module, configured to obtain the number of grids occupied by each application in a single column of the time slice grid according to the weight of each application and the number of unit flows; calculate the ratio of the total flow in the time slice to the number of each application to obtain the flow upper limit of a single application in the time slice; calculate the flow upper limit of the single application in the time slice divided by the product of the unit flow and the number of time intervals, and obtain the result as the upper limit of the number of grids in a single column of the time slice grid for the single application; if the number of grids occupied by any application in a single column of the time slice grid exceeds the upper limit of the number of grids in a single column of the time slice grid for the single application, adjust the number of grids occupied by the application in the single column of the time slice grid to the upper limit of the number of grids; multiply the number of grids in a single column of the time slice grid by the number of time intervals to obtain the number of grids occupied by the application in the time slice grid; The processing module is further used to calculate the sum of the flows of the applications in the time slice according to the number of grids occupied by the applications in the time slice grid and the unit flow, as the allocated flow in the time slice; The integration module is used to integrate the traffic distribution results according to the distribution traffic in each time slice.
6. The device according to claim 5, characterized in that The processing module is specifically used to calculate the ratio of the weight of each application to the sum of the weights of the applications to obtain the weight ratio of each application; multiply the weight ratio of each application by the unit traffic quantity to obtain the number of grids occupied by the application in a single column of the time slice grid.
7. The device according to claim 6, characterized in that The processing module is further specifically configured to adjust the number of grids occupied by the application in a single column of the time slice grid by rounding down if the number of grids occupied by the application in a single column of the time slice grid is not an integer.
8. The device according to any one of claims 5 to 7, characterized in that: The establishment module is specifically used to establish a coordinate system for each time slice, wherein the horizontal axis of the coordinate system represents time and the vertical axis represents flow; The establishment module is further specifically used to determine a first coordinate point on the horizontal axis and a second coordinate point on the vertical axis, wherein a region established with the first coordinate point and the second coordinate point as opposite angles represents a total flow in the time slice; The establishment module is specifically further used to divide the horizontal axis corresponding to the area according to the number of time intervals, and to divide the vertical axis corresponding to the area according to the number of unit flows, so as to obtain the time slice grid.
9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 4.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 4 when executed by a processor.
11. A computer program product comprising: A computer program, characterized in that when the computer program is executed by a processor, it is used to implement the method according to any one of claims 1 to 4.
