Memory flow control method and device, storage medium and electronic equipment

文档序号:1893206 发布日期:2021-11-26 浏览:12次 中文

阅读说明:本技术 内存流量控制方法、装置、存储介质及电子设备 (Memory flow control method and device, storage medium and electronic equipment ) 是由 朱敏 于 2021-08-26 设计创作,主要内容包括:本申请涉及计算机技术领域,具体涉及一种内存流量控制方法、装置、存储介质及电子设备,包括:从当前时刻起对每个虚拟通道按照预设时间窗口获取每个时间窗口的流量值;结合预设时间窗口确定每个时间窗口的实时流量值;计算每个虚拟通道在所有时间窗口总时间内的总流量值;计算所有虚拟通道在所有个时间窗口总时间内的总流量值;再结合预先确认的内存总量和每个虚拟通道的内存量对每个虚拟通道进行条件判定;将通过判定的虚拟通道内的报文丢弃,继续传输下一个报文。通过条件式判定是否丢弃虚拟通道内的报文,不仅避免了因流量拥塞造成的丢包,还能够及时空出虚拟通道,继续进行数据传输,避免了流量通道的无效占用,提高了数据传输效率。(The application relates to the technical field of computers, in particular to a memory flow control method, a memory flow control device, a memory medium and electronic equipment, wherein the memory flow control method comprises the following steps: acquiring a flow value of each time window for each virtual channel from the current moment according to a preset time window; determining a real-time flow value of each time window by combining a preset time window; calculating the total flow value of each virtual channel in the total time of all time windows; calculating the total flow value of all virtual channels in the total time of all time windows; then, carrying out condition judgment on each virtual channel by combining the total memory amount confirmed in advance and the memory amount of each virtual channel; and discarding the message passing through the judged virtual channel, and continuously transmitting the next message. Whether the message in the virtual channel is discarded or not is judged in a conditional mode, so that packet loss caused by flow congestion is avoided, the virtual channel can be vacated in time, data transmission is continued, invalid occupation of the flow channel is avoided, and data transmission efficiency is improved.)

1. A method for controlling memory traffic, the method comprising:

from the current moment, acquiring a flow value of each time window of j +1 time windows according to a preset time window for historical flow data of each virtual channel, wherein j is an integer greater than or equal to 0;

determining a real-time flow value of each time window according to the flow value of each time window and a preset time window;

giving a weight to each time window, and performing weighted summation on the total flow values of the j +1 time windows to obtain the total flow value of each virtual channel in the total time of the j +1 time windows;

calculating total flow values of all virtual channels in the total time of j +1 time windows according to the total flow values of each virtual channel in the total time of j +1 time windows;

performing condition judgment on each virtual channel according to the total flow value of each virtual channel in j +1 time window total time, the total flow values of all the virtual channels in j +1 time window total time, the total amount of a pre-confirmed memory and the pre-calculated amount of the memory allocated to each virtual channel;

and discarding the message in the virtual channel passing the condition judgment, and continuously transmitting the next message.

2. The method according to claim 1, wherein the obtaining process of the total amount of the pre-determined memory and the amount of the memory allocated to each virtual channel includes:

determining the total amount of memory Mall

Dividing the flow channel of the memory into 8 virtual channels PiWhere i ∈ [0..7 ]];

According to the total memory amount MallAnd the empirical value T of the flow of the memoryall-expAnd empirical flow values T for said 8 virtual channelsi-expCalculating the memory amount m of each virtual channeli

The flow experience value is an average value of the flow obtained according to historical experience.

3. The method according to claim 2, wherein the amount M of memory is determined according to the total amount of memoryallAnd the empirical value T of the flow of the memoryall-expAnd empirical flow values T for said 8 virtual channelsi-expCalculating the memory amount m of each virtual channeliThe method comprises the following steps:

according to the formulaCalculating the memory amount m of each virtual channeli

4. The method of claim 1, wherein determining the real-time flow value for each time window based on the flow value for each time window and a predetermined time window comprises:

according to the formulaCalculating the real-time flow value of each time window;

wherein T isiReal-time traffic value in bytes/sec, TW, which is a time windowiFor a virtual channel PiTotal flow value in bytes, W, within a time windowiIs a preset time window in seconds.

5. The method of claim 2, wherein the assigning a weight to each time window and performing a weighted summation on the total traffic values of the j +1 time windows to obtain the total traffic value of each virtual channel in the total time of the j +1 time windows comprises:

is the same virtualChannel weighting of traffic per time window

According to the formula

Computing virtual channel PiTotal flow value T in total time of j +1 time windowsijWij

Wherein, WijFor the ith virtual channel PiThe jth time window of (a) in seconds, TijFor the ith virtual channel PiOf the jth time window WijIn bytes/sec.

6. The method of claim 5, wherein calculating the total traffic value of all virtual channels in j +1 time windows total time according to the total traffic value of each virtual channel in j +1 time windows total time comprises:

according to the formulaCalculating total flow value TW of all virtual channels in j +1 time windowsallThe unit is byte.

7. The method according to claim 6, wherein said performing a conditional decision on each virtual channel according to the total traffic value of each virtual channel in j +1 time windows, the total traffic value of all virtual channels in j +1 time windows, the total amount of pre-determined memory, and the pre-calculated amount of memory allocated to each virtual channel comprises:

according to the conditional formula

Carrying out condition judgment on each virtual channel;

if the virtual channel PiAfter the numerical values in the conditional expression are substituted, if the conditional expression is established, the virtual channel P is judgediJudging through the condition;

if the virtual channel PiSubstituting various numerical values in the conditional expression, judging that the conditional expression is not established, and judging that the virtual channel P isiThe condition determination is failed.

8. A memory flow control device, the device comprising:

the acquisition unit is used for acquiring the flow value of each time window of j +1 time windows according to a preset time window from the current moment to the historical flow data of each virtual channel, wherein j is an integer greater than or equal to 0;

the determining unit is used for determining the real-time flow value of each time window according to the flow value of each time window and a preset time window;

the summing unit is used for giving a weight to each time window and carrying out weighted summation on the total flow values of the j +1 time windows to obtain the total flow value of each virtual channel in the total time of the j +1 time windows;

the calculating unit is used for calculating the total flow value of all the virtual channels in the total time of the j +1 time windows according to the total flow value of each virtual channel in the total time of the j +1 time windows;

a determining unit, configured to perform condition determination on each virtual channel according to a total traffic value of each virtual channel in j +1 time window total time, a total traffic value of all virtual channels in j +1 time window total time, a total amount of a pre-determined memory, and a pre-calculated amount of memory allocated to each virtual channel;

and the transmission unit is used for discarding the message in the virtual channel passed by the condition judgment and continuously transmitting the next message.

9. A storage medium storing a computer program executable by one or more processors to implement the memory flow control method according to any one of claims 1 to 7.

10. An electronic device, comprising a memory and a processor, wherein the memory stores a computer program, the memory and the processor are communicatively connected, and the computer program, when executed by the processor, performs the memory flow control method according to any one of claims 1 to 7.

Technical Field

The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for controlling memory flow, a storage medium, and an electronic device.

Background

The memory flow control is a method for limiting the data sending rate, and because the flow rate of the memory input and output data is limited, when the input flow data exceeds the maximum rate at which the memory can receive the data, packet loss occurs, which causes data loss and waste of network resources.

Priority-based Flow Control (PFC) adopted in the market at present is defined in an IEEE:802.1Qbb standard document, and is an enhancement to a suspension mechanism of the traditional Flow Control. In contrast to conventional flow control mechanisms, conventional flow control blocks all traffic on one link when congestion occurs. PFC, in turn, allows 8 virtual lanes to be created on an ethernet link and assigns an IEEE 802.1P priority level to each virtual lane, allowing any one of the virtual lanes to be individually suspended and restarted while allowing traffic for the other virtual lanes to pass through without interruption. Although the method enables the network to create a service without packet loss for a single virtual link, when the control virtual channel of the method stops sending messages independently, the suspended virtual channel is in an occupied state but no effective flow is generated, which causes waste of memory flow.

Disclosure of Invention

In view of the above problems, the present application provides a memory flow control method, apparatus, storage medium, and electronic device, which solve the technical problem in the related art that when a virtual channel is controlled to suspend sending a packet alone, the suspended virtual channel is in an occupied state but no effective flow is generated, resulting in memory flow waste.

In a first aspect, the present application provides a method for controlling memory traffic, where the method includes:

from the current moment, acquiring a flow value of each time window of j +1 time windows according to a preset time window for historical flow data of each virtual channel, wherein j is an integer greater than or equal to 0;

determining a real-time flow value of each time window according to the flow value of each time window and a preset time window;

giving a weight to each time window, and performing weighted summation on the total flow values of the j +1 time windows to obtain the total flow value of each virtual channel in the total time of the j +1 time windows;

calculating total flow values of all virtual channels in the total time of j +1 time windows according to the total flow values of each virtual channel in the total time of j +1 time windows;

performing condition judgment on each virtual channel according to the total flow value of each virtual channel in j +1 time window total time, the total flow values of all the virtual channels in j +1 time window total time, the total amount of a pre-confirmed memory and the pre-calculated amount of the memory allocated to each virtual channel;

and discarding the message in the virtual channel passing the condition judgment, and continuously transmitting the next message.

In some embodiments, the process of obtaining the total amount of the memory confirmed in advance and the amount of the memory allocated to each virtual channel includes:

determining the total amount of memory Mall

Dividing the flow channel of the memory into 8 virtual channels PiWhere i ∈ [0..7 ]];

According to the total memory amount MallAnd the empirical value T of the flow of the memoryall-expAnd empirical flow values T for said 8 virtual channelsi-expCalculating the memory amount m of each virtual channeli

The flow experience value is an average value of the flow obtained according to historical experience.

In some embodiments, the memory amount M is determined according to the total memory amountallAnd the empirical value T of the flow of the memoryall-expAnd empirical flow values T for said 8 virtual channelsi-expCalculating the memory amount m of each virtual channeliThe method comprises the following steps:

according to the formulaCalculating the memory amount m of each virtual channeli

In some embodiments, the determining the real-time flow value for each time window according to the flow value for each time window and the preset time window includes:

according to the formulaCalculating the real-time flow value of each time window;

wherein T isiReal-time traffic value in bytes/sec, TW, which is a time windowiFor a virtual channel PiTotal flow value in bytes, W, within a time windowiIs a preset time window in seconds.

In some embodiments, the assigning a weight to each time window and performing weighted summation on the total traffic values of the j +1 time windows to obtain the total traffic value of each virtual channel in the total time of the j +1 time windows includes:

assigning traffic weights to each time window of the same virtual channel

According to the formulaComputing virtual channel PiTotal flow value T in total time of j +1 time windowsijWij

Wherein, WijFor the ith virtual channel PiThe jth time window of (a) in seconds, TijFor the ith virtual channel PiOf the jth time window WijIn bytes/sec.

In some embodiments, the calculating a total traffic value of all virtual channels in j +1 time windows total time according to a total traffic value of each virtual channel in j +1 time windows total time includes:

according to the formulaComputing all virtualizationsTotal flow value TW of channels in total time of j +1 time windowsallThe unit is byte.

In some embodiments, the performing the condition determination on each virtual channel according to the total flow value of each virtual channel in the total time of j +1 time windows, the total flow values of all virtual channels in the total time of j +1 time windows, the total amount of the memory confirmed in advance, and the amount of the memory allocated to each virtual channel calculated in advance includes:

according to the conditional formulaCarrying out condition judgment on each virtual channel;

if the virtual channel PiAfter the numerical values in the conditional expression are substituted, if the conditional expression is established, the virtual channel P is judgediJudging through the condition;

if the virtual channel PiSubstituting various numerical values in the conditional expression, judging that the conditional expression is not established, and judging that the virtual channel P isiThe condition determination is failed.

In a second aspect, a memory flow control device, the device comprising:

the acquisition unit is used for acquiring the flow value of each time window of j +1 time windows according to a preset time window from the current moment to the historical flow data of each virtual channel, wherein j is an integer greater than or equal to 0;

the determining unit is used for determining the real-time flow value of each time window according to the flow value of each time window and a preset time window;

the summing unit is used for giving a weight to each time window and carrying out weighted summation on the total flow values of the j +1 time windows to obtain the total flow value of each virtual channel in the total time of the j +1 time windows;

the calculating unit is used for calculating the total flow value of all the virtual channels in the total time of the j +1 time windows according to the total flow value of each virtual channel in the total time of the j +1 time windows;

a determining unit, configured to perform condition determination on each virtual channel according to a total traffic value of each virtual channel in j +1 time window total time, a total traffic value of all virtual channels in j +1 time window total time, a total amount of a pre-determined memory, and a pre-calculated amount of memory allocated to each virtual channel;

and the transmission unit is used for discarding the message in the virtual channel passed by the condition judgment and continuously transmitting the next message.

In a third aspect, a storage medium storing a computer program executable by one or more processors may be used to implement the memory flow control method as described in the first aspect.

In a fourth aspect, an electronic device includes a memory and a processor, the memory stores a computer program, the memory and the processor are communicatively connected, and the computer program, when executed by the processor, performs the memory flow control method according to the first aspect.

The application provides a memory flow control method, a memory flow control device, a storage medium and an electronic device, which comprise: from the current moment, acquiring a flow value of each time window of j +1 time windows according to a preset time window for historical flow data of each virtual channel, wherein j is an integer greater than or equal to 0; determining a real-time flow value of each time window according to the flow value of each time window and a preset time window; giving a weight to each time window, and performing weighted summation on the total flow values of the j +1 time windows to obtain the total flow value of each virtual channel in the total time of the j +1 time windows; calculating total flow values of all virtual channels in the total time of j +1 time windows according to the total flow values of each virtual channel in the total time of j +1 time windows; performing condition judgment on each virtual channel according to the total flow value of each virtual channel in j +1 time window total time, the total flow values of all the virtual channels in j +1 time window total time, the total amount of a pre-confirmed memory and the pre-calculated amount of the memory allocated to each virtual channel; and discarding the message in the virtual channel passing the condition judgment, and continuously transmitting the next message. Whether the message in the virtual channel is discarded or not is judged in a conditional mode, so that packet loss caused by flow congestion is avoided, the virtual channel can be vacated in time, data transmission is continued, invalid occupation of the flow channel is avoided, and data transmission efficiency is improved.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.

Fig. 1 is a schematic flow chart of a memory flow control method according to an embodiment of the present disclosure;

FIG. 2 is a schematic diagram of a time window in historical traffic provided by an embodiment of the present application;

fig. 3 is a schematic diagram of j +1 time windows in historical traffic provided in an embodiment of the present application;

fig. 4 is a schematic structural diagram of a memory flow control device according to an embodiment of the present disclosure;

fig. 5 is a connection block diagram of an electronic device according to an embodiment of the present application.

Detailed Description

The following detailed description will be provided with reference to the accompanying drawings and embodiments, so that how to apply the technical means to solve the technical problems and achieve the corresponding technical effects can be fully understood and implemented. The embodiments and various features in the embodiments of the present application can be combined with each other without conflict, and the formed technical solutions are all within the scope of protection of the present application.

As known in the background art, Priority-based Flow Control (PFC) currently adopted in the market is defined in the IEEE:802.1Qbb standard document, which is an enhancement to the suspension mechanism of the conventional Flow Control. In contrast to conventional flow control mechanisms, conventional flow control blocks all traffic on one link when congestion occurs. PFC, in turn, allows 8 virtual lanes to be created on an ethernet link and assigns an IEEE 802.1P priority level to each virtual lane, allowing any one of the virtual lanes to be individually suspended and restarted while allowing traffic for the other virtual lanes to pass through without interruption. Although the method enables the network to create a service without packet loss for a single virtual link, when the control virtual channel of the method stops sending messages independently, the suspended virtual channel is in an occupied state but no effective flow is generated, which causes waste of memory flow.

In view of this, the present application provides a memory flow control method, an apparatus, a storage medium, and an electronic device, which solve the technical problem in the related art that when a control virtual channel suspends sending a packet alone, the suspended virtual channel is in an occupied state but no effective flow is generated, which results in memory flow waste.

Example one

Fig. 1 is a schematic flow chart of a memory flow control method according to an embodiment of the present application, and as shown in fig. 1, the method includes:

s101, from the current moment, acquiring a flow value of each time window of j +1 time windows according to a preset time window for historical flow data of each virtual channel;

in step S101, j is an integer greater than or equal to 0;

s102, determining a real-time flow value of each time window according to the flow value of each time window and a preset time window;

s103, giving a weight to each time window, and performing weighted summation on the total flow values of the j +1 time windows to obtain the total flow value of each virtual channel in the total time of the j +1 time windows;

s104, calculating total flow values of all virtual channels in the total time of j +1 time windows according to the total flow values of each virtual channel in the total time of j +1 time windows;

s105, carrying out condition judgment on each virtual channel according to the total flow value of each virtual channel in j +1 time window total time, the total flow values of all the virtual channels in j +1 time window total time, the total amount of a pre-confirmed memory and the pre-calculated amount of the memory allocated to each virtual channel;

and S106, discarding the message in the virtual channel which passes the condition judgment, and continuously transmitting the next message.

It should be noted that, the discarded packet in this application is not a discarded packet, but is actively discarded, the discarded packet is recorded and protected by other mechanisms, and data is not lost, for example, the discarded packet is added to a queue again for data transmission, because the size of the data stream that can be carried by each of the 8 virtual channels is different, when the virtual channel that can transmit the discarded packet is matched, normal transmission of the packet can be completed.

Further, the method and the device judge whether to discard the message in the virtual channel through the conditional expression, not only avoid packet loss caused by flow congestion, but also can timely vacate the virtual channel and continue data transmission, avoid invalid occupation of the flow channel and improve the data transmission efficiency.

In some embodiments, the process of obtaining the total amount of the memory confirmed in advance and the amount of the memory allocated to each virtual channel includes:

determining the total amount of memory Mall

Dividing the flow channel of the memory into 8 virtual channels PiWhere i ∈ [0..7 ]];

According to the total memory amount MallAnd the empirical value T of the flow of the memoryall-expAnd empirical flow values T for said 8 virtual channelsi-expCalculating the memory amount m of each virtual channeli

The flow experience value is an average value of the flow obtained according to historical experience.

In some embodiments, the memory amount M is determined according to the total memory amountallEmpirical value of flow of said memoryTall-expAnd empirical flow values T for said 8 virtual channelsi-expCalculating the memory amount m of each virtual channeliThe method comprises the following steps:

according to the formulaCalculating the memory amount m of each virtual channeli

It should be noted that the total amount of the memory is obtained according to the ratio of the traffic experience value of each virtual channel to the traffic experience value of the memory, that is, the ratio is

After transformation, the formula can be obtained

It should be noted that, for x ∈ [ a.. b ], where a and b are both integers, specifically, a < ═ x < ═ b, and x is an integer.

In some embodiments, the determining the real-time flow value for each time window according to the flow value for each time window and the preset time window includes:

according to the formulaCalculating the real-time flow value of each time window;

wherein T isiReal-time traffic value in bytes/sec, TW, which is a time windowiFor a virtual channel PiTotal flow value in bytes, W, within a time windowiIs a preset time window in seconds.

It should be noted that, as shown in fig. 2, a time window diagram in the historical traffic is shown. In practical operation, the memory configuration of each channel needs to be determined in advance, i.e. MallAnd miIs a constant value, i ∈ [0..7 ]]. And TallAnd TiThe value is changed in real time, i ∈ [0..7 ]]Wherein, TallTo enter intoThe total flow value into the memory is in bytes.

Therefore, an accurate real-time instantaneous flow value cannot be obtained, and the flow value can only be obtained by calculating the total flow value in the past time window, namely the time window is time, the flow value in the time window can be obtained in the historical flow measurement record, and the average flow value can be obtained by dividing the flow value by the time. And because the time interval value of the time window is very small, the average flow can be approximately regarded as the real-time flow of the window.

In some embodiments, the assigning a weight to each time window and performing weighted summation on the total traffic values of the j +1 time windows to obtain the total traffic value of each virtual channel in the total time of the j +1 time windows includes:

assigning traffic weights to each time window of the same virtual channel

According to the formulaComputing virtual channel PiTotal flow value T in total time of j +1 time windowsijWij

Wherein, WijFor the ith virtual channel PiThe jth time window of (a) in seconds, TijFor the ith virtual channel PiOf the jth time window WijIn bytes/sec.

It should be noted that, as shown in fig. 3, a schematic diagram of j +1 time windows in the historical traffic is shown. Because a time window in fig. 2 can only reflect the traffic situation of the channel in the recent period of time, historical related traffic is not considered, and the traffic situation of the channel can also be reflected to a certain extent. Because the method of calculating the flow window in a weighting mode is adopted, more historical flows are added into the real-time flow calculation, the effect of the historical flows is considered, different weights are given to the historical flows in a weighting mode, and the real-time flows can be calculated more accurately.

Wherein, the virtual channel PiThe total flow rate in j +1 time windows is the virtual channel PiThe total flow value over the total time of all time windows in the past can be obtained from historical flow measurement records.

In some embodiments, the calculating a total traffic value of all virtual channels in j +1 time windows total time according to a total traffic value of each virtual channel in j +1 time windows total time includes:

according to the formulaCalculating total flow value TW of all virtual channels in j +1 time windowsallThe unit is byte.

It should be noted that, the total flow value T in the total time of j +1 time windows of each virtual channel is obtainedijWijThen, summing the total flow values of 8 virtual channels to finally obtain the total flow value TW of all virtual channels in the total time of j +1 time windowsall

In some embodiments, the performing the condition determination on each virtual channel according to the total flow value of each virtual channel in the total time of j +1 time windows, the total flow values of all virtual channels in the total time of j +1 time windows, the total amount of the memory confirmed in advance, and the amount of the memory allocated to each virtual channel calculated in advance includes:

according to the conditional formulaCarrying out condition judgment on each virtual channel;

if the virtual channel PiAfter the numerical values in the conditional expression are substituted, if the conditional expression is established, the virtual channel P is judgediJudging through the condition;

if the virtual channel PiAfter various numerical values in the conditional expression are substituted, if the conditional expression is not satisfied, the virtual flux is judgedWay PiThe condition determination is failed.

It should be noted that, as we have previously known, the total memory amount is obtained according to the ratio of the flow empirical value of each virtual channel to the flow empirical value of the memory, and the flow empirical value is the flow value of the memory and the virtual channel obtained according to the historical experience, we have now obtained the flow values of the memory and the virtual channel in real time, that is, the total flow value T of each virtual channel in the total time of j +1 time windowsijWijAnd total flow value TW for all virtual channels over j +1 time windowsallSimilarly, the real-time flow value of the virtual channel also conforms to the proportional formula under the normal data transmission working stateThus, the formula can be obtainedAnd once the virtual channel has a total flow value T in j +1 time windowsijWijWhen the maximum bearer flow value of the virtual channel allocated according to the proportion is exceeded, i.e. when the maximum bearer flow value of the virtual channel allocated according to the proportion is exceededThen traffic congestion will occur to cause packet loss, so as to avoid packet loss and avoid the virtual channel from being occupied inefficiently, and determine the total traffic value T of the virtual channel in the total time of j +1 time windowsijWijAccording to the conditional formulaAnd actively discarding the message being transmitted and continuously transmitting the next message.

To sum up, an embodiment of the present application provides a method for controlling a memory flow, including: from the current moment, acquiring a flow value of each time window of j +1 time windows according to a preset time window for historical flow data of each virtual channel, wherein j is an integer greater than or equal to 0; determining a real-time flow value of each time window according to the flow value of each time window and a preset time window; giving a weight to each time window, and performing weighted summation on the total flow values of the j +1 time windows to obtain the total flow value of each virtual channel in the total time of the j +1 time windows; calculating total flow values of all virtual channels in the total time of j +1 time windows according to the total flow values of each virtual channel in the total time of j +1 time windows; performing condition judgment on each virtual channel according to the total flow value of each virtual channel in j +1 time window total time, the total flow values of all the virtual channels in j +1 time window total time, the total amount of a pre-confirmed memory and the pre-calculated amount of the memory allocated to each virtual channel; and discarding the message in the virtual channel passing the condition judgment, and continuously transmitting the next message. Whether the message in the virtual channel is discarded or not is judged in a conditional mode, so that packet loss caused by flow congestion is avoided, the virtual channel can be vacated in time, data transmission is continued, invalid occupation of the flow channel is avoided, and data transmission efficiency is improved.

Example two

Based on the memory flow control method disclosed in the above embodiment of the present invention, fig. 4 specifically discloses a memory flow control device applying the memory flow control method.

As shown in fig. 4, an embodiment of the present invention discloses a memory flow control device, including:

an obtaining unit 401, configured to obtain, from a current time, a flow value of each time window of j +1 time windows for historical flow data of each virtual channel according to a preset time window, where j is an integer greater than or equal to 0;

a determining unit 402, configured to determine a real-time flow value of each time window according to the flow value of each time window and a preset time window;

a summing unit 403, configured to assign a weight to each time window, and perform weighted summation on the total traffic values of the j +1 time windows to obtain a total traffic value of each virtual channel in the total time of the j +1 time windows;

a calculating unit 404, configured to calculate total traffic values of all virtual channels in the total time of j +1 time windows according to the total traffic value of each virtual channel in the total time of j +1 time windows;

a determining unit 405, configured to perform condition determination on each virtual channel according to a total flow value of each virtual channel in j +1 time window total times, a total flow value of all virtual channels in j +1 time window total times, a total amount of a pre-determined memory, and a pre-calculated amount of memory allocated to each virtual channel;

a transmission unit 406, configured to discard the packet in the virtual channel that passes through the condition determination, and continue to transmit the next packet.

For the specific working processes of the data obtaining unit 401, the determining unit 402, the summing unit 403, the calculating unit 404, the determining unit 405, and the transmitting unit 406 in the memory flow control device disclosed in the above embodiment of the present invention, reference may be made to the corresponding contents in the memory flow control method disclosed in the above embodiment of the present invention, and details are not described here again.

To sum up, the embodiment of the present application provides an internal memory flow control device, including: from the current moment, acquiring a flow value of each time window of j +1 time windows according to a preset time window for historical flow data of each virtual channel, wherein j is an integer greater than or equal to 0; determining a real-time flow value of each time window according to the flow value of each time window and a preset time window; giving a weight to each time window, and performing weighted summation on the total flow values of the j +1 time windows to obtain the total flow value of each virtual channel in the total time of the j +1 time windows; calculating total flow values of all virtual channels in the total time of j +1 time windows according to the total flow values of each virtual channel in the total time of j +1 time windows; performing condition judgment on each virtual channel according to the total flow value of each virtual channel in j +1 time window total time, the total flow values of all the virtual channels in j +1 time window total time, the total amount of a pre-confirmed memory and the pre-calculated amount of the memory allocated to each virtual channel; and discarding the message in the virtual channel passing the condition judgment, and continuously transmitting the next message. Whether the message in the virtual channel is discarded or not is judged in a conditional mode, so that packet loss caused by flow congestion is avoided, the virtual channel can be vacated in time, data transmission is continued, invalid occupation of the flow channel is avoided, and data transmission efficiency is improved.

EXAMPLE III

The present embodiment further provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., on which a computer program is stored, where the computer program, when executed by a processor, may implement the method steps of the first embodiment, and thus, the description of the embodiment is not repeated herein.

Example four

Fig. 5 is a connection block diagram of an electronic device 500 according to an embodiment of the present application, and as shown in fig. 5, the electronic device 500 may include: a processor 501, a memory 502, a multimedia component 503, an input/output (I/O) interface 504, and a communication component 505.

The processor 501 is configured to execute all or part of the steps in the memory flow control method according to the first embodiment. The memory 502 is used to store various types of data, which may include, for example, instructions for any application or method in the electronic device, as well as application-related data.

The Processor 501 may be implemented by an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a controller, a microcontroller, a microprocessor, or other electronic components, and is configured to execute the memory flow control method in the first embodiment.

The Memory 502 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk.

The multimedia component 503 may include a screen, which may be a touch screen, and an audio component for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in a memory or transmitted through a communication component. The audio assembly also includes at least one speaker for outputting audio signals.

The I/O interface 504 provides an interface between the processor 501 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons.

The communication component 505 is used for wired or wireless communication between the electronic device 500 and other devices. Wireless Communication, such as Wi-Fi, bluetooth, Near Field Communication (NFC), 2G, 3G, or 4G, or a combination of one or more of them, so that the corresponding Communication component 505 may include: Wi-Fi module, bluetooth module, NFC module.

In summary, the present application provides a method, an apparatus, a storage medium, and an electronic device for controlling a memory flow, where the method includes: from the current moment, acquiring a flow value of each time window of j +1 time windows according to a preset time window for historical flow data of each virtual channel, wherein j is an integer greater than or equal to 0; determining a real-time flow value of each time window according to the flow value of each time window and a preset time window; giving a weight to each time window, and performing weighted summation on the total flow values of the j +1 time windows to obtain the total flow value of each virtual channel in the total time of the j +1 time windows; calculating total flow values of all virtual channels in the total time of j +1 time windows according to the total flow values of each virtual channel in the total time of j +1 time windows; performing condition judgment on each virtual channel according to the total flow value of each virtual channel in j +1 time window total time, the total flow values of all the virtual channels in j +1 time window total time, the total amount of a pre-confirmed memory and the pre-calculated amount of the memory allocated to each virtual channel; and discarding the message in the virtual channel passing the condition judgment, and continuously transmitting the next message. Whether the message in the virtual channel is discarded or not is judged in a conditional mode, so that packet loss caused by flow congestion is avoided, the virtual channel can be vacated in time, data transmission is continued, invalid occupation of the flow channel is avoided, and data transmission efficiency is improved.

In the embodiments provided in the present application, it should be understood that the disclosed method can be implemented in other ways. The above-described method embodiments are merely illustrative.

It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Although the embodiments disclosed in the present application are described above, the above descriptions are only for the convenience of understanding the present application, and are not intended to limit the present application. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the disclosure as defined by the appended claims.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:网络拥塞的通告方法、代理节点、网络节点及计算机设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!