Network flow control method, computer readable storage medium and mobile terminal

By filtering out target applications that require speed limit on the mobile terminal and configuring speed limit rules in the traffic allocation chain, the problem of low network traffic control efficiency in mobile terminals is solved, and more balanced and efficient network traffic management is achieved.

CN119212010BActive Publication Date: 2025-03-21NIO SMART TECHNOLOGY (SHENZHEN) CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411666749.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-03-21
Estimated Expiration
2044-11-21

AI Technical Summary

Technical Problem

The prior art has low efficiency and is not timely in controlling network traffic in mobile terminals, which affects the user experience.

Method used

When running multiple applications on a mobile terminal, the target applications that require speed limit are filtered according to the preset filtering rules, and the speed limit rules are configured in the traffic allocation chain to limit the download and upload network speed of the target applications.

Benefits of technology

It realizes unified traffic control for mobile terminal applications, balances network traffic load, improves traffic management efficiency, and solves the problems of low and untimely traffic allocation efficiency in the existing technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119212010B_ABST
    Figure CN119212010B_ABST
Patent Text Reader

Abstract

The present application relates to the field of communication technology, and specifically provides a network traffic control method, a computer-readable storage medium, and a mobile terminal, aiming to solve the problem of low efficiency and untimely distribution of existing traffic. The present application provides a network traffic control method, which is applied to a mobile terminal, and multiple applications are run on the mobile terminal, including: according to preset screening rules, filtering out target applications that need to be speed-limited from the multiple applications; creating a traffic distribution chain according to the target application, and configuring preset speed limit rules in the traffic distribution chain; and limiting the speed of the target application in the traffic distribution chain based on the speed limit rules. Unified traffic control is performed on applications, and unified speed limit rules make network traffic distribution balanced and faster, solving the problem of low efficiency and untimely distribution of existing traffic.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and specifically provides a network traffic control method, a computer-readable storage medium, and a mobile terminal. Background Art

[0002] Currently, most of the solutions for controlling mobile terminal traffic are aimed at servers or intermediate network devices, such as routers / switches, and are usually allocated on a device basis. For user mobile terminals such as mobile phones, there is no good traffic control solution for a single application APP.

[0003] The terminal receives the inbound traffic sent by the server and distributes it to different applications. The existing solutions are mainly the following two: one is to virtualize a network device, perform the flow of "physical network entrance, virtual network entrance, virtual network exit" inside the mobile terminal, and then perform speed limit processing at the virtual network exit; due to the additional step of forwarding data to the virtual network device, this method will lead to reduced data processing efficiency and increased system load, resulting in lag and increased power consumption, affecting the user experience.

[0004] The other method is to manage the links of each application, but this method will lead to problems of untimely and incomplete traffic control, resulting in the inability to allocate bandwidth traffic completely according to the strategy. At the same time, the efficiency of data packet processing is reduced because a large number of matching rules are set.

[0005] Accordingly, the art needs a new network traffic control solution to solve the above problems. Summary of the invention

[0006] The present application aims to solve the above technical problem, that is, to solve the problem of low efficiency and untimely distribution of existing traffic in the terminal.

[0007] In a first aspect, the present application provides a network traffic control method, which is applied to a mobile terminal, on which multiple applications are running, comprising: filtering out a target application that needs to be speed limited from the multiple applications according to a preset filtering rule; creating a traffic distribution chain according to the target application, and configuring a preset speed limit rule in the traffic distribution chain; and limiting the speed of the target application in the traffic distribution chain based on the speed limit rule.

[0008] In a technical solution of the above-mentioned network traffic control method, the types of target applications include foreground target applications and background target applications, and the target applications that need to be speed limited are screened out from the multiple applications according to preset screening rules, including: obtaining the download network speed of each application in the multiple applications and the network performance index of the foreground application, and the foreground application is included in the multiple applications; if there are foreground applications with unqualified network performance indicators, and the total download network speed of the background applications exceeds a preset first network speed threshold, all background applications are regarded as the background target applications; if the download network speed of the foreground application with unqualified network performance indicators exceeds a preset second network speed threshold, the foreground application with a download network speed exceeding the second network speed threshold is regarded as the foreground target application.

[0009] In a technical solution of the above-mentioned network traffic control method, a traffic distribution chain is created according to the target application, and a preset speed limit rule is configured in the traffic distribution chain, including: setting the maximum total download network speed according to the type of the target application, wherein the type of the target application includes a foreground target application and a background target application; performing traffic scheduling according to the maximum total download network speed, and discarding data packets of the target application that exceed the maximum total download network speed.

[0010] In a technical solution of the above-mentioned network traffic control method, the method also includes: if the target application includes a foreground target application, obtaining a target link from multiple download links of the foreground target application, the target link being a link among the multiple download links whose download speed exceeds a preset third speed threshold; setting a maximum link download speed for the target link; performing traffic scheduling according to the maximum link download speed, and discarding data packets of the target link that exceed the maximum link download speed.

[0011] In a technical solution of the above-mentioned network traffic control method, the speed of the target application is limited based on the speed limit rule in the traffic distribution chain, including: jumping the inbound traffic of the mobile terminal to the traffic distribution chain, and limiting the download speed of the target application based on the speed limit rule in the traffic distribution chain.

[0012] In a technical solution of the above-mentioned network traffic control method, the speed limit rule also includes an outbound speed limit rule, and the method also includes: jumping the outbound traffic of the mobile terminal to the traffic distribution chain, and limiting the upload speed of the target application in the traffic distribution chain based on the outbound speed limit rule.

[0013] In a technical solution of the above-mentioned network traffic control method, the network performance indicators include at least retransmission rate and network transmission delay, and the method also includes: for each foreground application, when all items in the network performance indicators of the foreground application exceed the corresponding preset thresholds, determining that the foreground application is a foreground application with unqualified network performance indicators.

[0014] In a technical solution of the above-mentioned network traffic control method, the method further includes: if there is no foreground application whose network performance indicator is unqualified, and there is a speed limit rule being executed, then the speed limit rule being executed is released.

[0015] In a technical solution of the above-mentioned network traffic control method, the method also includes: at every preset period, based on the download network speed of each application in the current multiple applications and the network performance index of the foreground application, re-determining whether there is a target application that needs to be speed limited, and dynamically adjusting the speed limit rule based on the result of the re-determination, and the dynamic adjustment includes setting a new speed limit rule for the re-determined target application, lifting the current speed limit rule, or maintaining the current speed limit rule.

[0016] In a technical solution of the above-mentioned network traffic control method, creating a traffic distribution chain according to the target application and configuring a preset speed limit rule in the traffic distribution chain includes: creating the traffic distribution chain based on an iptables tool.

[0017] In a technical solution of the above-mentioned network traffic control method, creating a traffic distribution chain according to the target application and configuring a preset speed limit rule in the traffic distribution chain also includes: filtering out the target application through a Berkeley packet filter; and setting the speed limit rule for the target application through a hash limit module to achieve the limitation of the download speed of the target application.

[0018] In a technical solution of the above-mentioned network traffic control method, the speed limit rules also include outbound speed limit rules, and the traffic distribution chain is created according to the target application, and the preset speed limit rules are configured in the traffic distribution chain, and also includes: matching the target application through an owner module; and setting the outbound speed limit rules for the target application through a hash restriction module to achieve the limitation of the upload speed of the target application.

[0019] In a second aspect, the present application provides a computer-readable storage medium storing a plurality of program codes, wherein the program codes are suitable for being loaded and run by a processor to execute the network traffic control method described in any one of the above-mentioned network traffic control method technical solutions.

[0020] In a third aspect, the present application provides a mobile terminal comprising a processor and a memory, wherein the memory is suitable for storing multiple program codes, and the program codes are suitable for being loaded and run by the processor to execute the network traffic control method described in any one of the above-mentioned network traffic control method technical solutions.

[0021] When adopting the above technical solution, this application performs unified traffic control on applications based on the download speed of each application and the network performance indicators of the foreground application. The unified speed limit rules make the network traffic load distributed evenly and faster, solving the problem of low efficiency and untimely traffic distribution in the existing market.

[0022] This application performs network traffic control based on iptables tools and native input chains, etc., without the need to introduce virtual network devices, further improving the speed of network traffic control. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The preferred embodiments of the present application are described below in conjunction with the accompanying drawings, in which:

[0024] Figure 1 It is a schematic diagram of the main steps of a network traffic control method according to an embodiment of the present application;

[0025] Figure 2 is a detailed step flow chart of a network traffic control method according to an embodiment of the present application;

[0026] Figure 3 It is a technical architecture diagram of traffic distribution involved in one embodiment of the present application;

[0027] Figure 4 It is a main structural block diagram of a mobile terminal for executing the network traffic control method of the present application;

[0028] Figure 5 is a hardware structure diagram of a mobile terminal according to an embodiment of the present application;

[0029] Figure 6 It is a detailed step flow chart of a network traffic control method according to an embodiment of the present application. DETAILED DESCRIPTION

[0030] Some embodiments of the present application are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present application and are not intended to limit the protection scope of the present application.

[0031] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme of the embodiments of the present application will be clearly and completely described below in conjunction with the drawings of the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the described embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0032] Unless otherwise defined, the technical terms or scientific terms used in this application should be understood by people with ordinary skills in the field to which this application belongs. "First", "second" and similar words used in this application do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0033] The present application provides a network traffic control method, which is applied to a mobile terminal, where multiple applications (APPs) are running on the mobile terminal.

[0034] In terms of software architecture, for common architectures of mobile terminals, such as Linux, Android systems, etc., network traffic can usually be controlled through specific command line tools and kernel modules. In one embodiment of the present application, the network traffic control method can be implemented based on the native architecture of the mobile terminal.

[0035] In terms of hardware structure, the network traffic involved in this application depends on the wireless communication hardware of the mobile terminal. Figure 5 The hardware structure diagram of a mobile terminal according to one embodiment of the present application is shown.

[0036] The wireless communication function of the mobile terminal can be implemented through antenna 1, antenna 2, mobile communication module 550, wireless communication module 560, modem processor, baseband processor, etc. In some embodiments, antenna 1 of the mobile terminal is coupled with mobile communication module 550, and antenna 2 is coupled with wireless communication module 560, so that the mobile terminal can communicate with other devices through a wireless communication network.

[0037] The mobile communication module 550 can provide the mobile terminal with solutions for wireless communications including 2G / 3G / 4G / 5G. The mobile communication module 550 can include at least one filter, a switch, a power amplifier, a low noise amplifier (Low Noise Amplifier, LNA), etc. The mobile communication module 550 can receive electromagnetic waves from the antenna 1, and perform processing such as filtering and amplifying the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.

[0038] The wireless communication module 560 can provide wireless communication solutions for application in mobile terminals, including wireless local area networks (WLAN), wireless fidelity (Wi-Fi) networks, Bluetooth (BT), global navigation satellite systems (GNSS), near field communication technology (NFC), infrared technology (IR), etc.

[0039] For further information, see Figure 1 , Figure 1 FIG. 1 is a schematic diagram of the main steps of a network traffic control method according to an embodiment of the present application. Figure 1 As shown, the network traffic control method in the embodiment of the present application mainly includes the following steps S11 to S13.

[0040] Step S11, according to a preset screening rule, screening out a target application that needs to be speed-limited from the multiple applications.

[0041] In one embodiment of the present application, the types of target applications include foreground target applications and background target applications, and the target applications that need to be speed limited are screened out from the multiple applications according to preset screening rules, specifically including the following steps S21-S22: Step S21, obtaining the download network speed of each application in the multiple applications and the network performance index of the foreground application, and the foreground application is included in the multiple applications.

[0042] For mobile terminals, whether the network of the foreground application is smooth has a great impact on the user experience. Therefore, this application uses whether the network of the foreground application is smooth as the key to confirming whether network traffic control is needed, that is, to determine whether its network performance indicators are qualified.

[0043] In one embodiment, the network performance indicator includes at least a retransmission rate and a network transmission delay (RoundTrip Time, RTT), and the method further includes: for each foreground application, when all items in the network performance indicator of the foreground application exceed corresponding preset thresholds, determining that the foreground application is a foreground application with unqualified network performance indicators. In this embodiment, the foreground application whose retransmission rate and RTT both exceed the corresponding preset thresholds is a foreground application with unqualified network performance indicators.

[0044] In other embodiments, the network performance indicator may also include other items, such as packet loss rate. Those skilled in the art may set the specific items included in the network performance indicator according to actual needs.

[0045] However, the network freeze of the foreground application may be caused by the background application, the foreground application, or both. Therefore, it is necessary to determine whether there is a target application that needs to be speed-limited according to different reasons, and further filter the target application, please refer to step S22.

[0046] Step S22, filtering out the target application from the multiple applications; if there is a foreground application whose network performance indicator is unqualified, and the total download speed of the background applications exceeds a preset first speed threshold, all background applications are used as the background target applications; if the download speed of the foreground application whose network performance indicator is unqualified exceeds a preset second speed threshold, the foreground application whose download speed exceeds the second speed threshold is used as the target application.

[0047] Specifically, the detailed steps of selecting the target application from the multiple applications can be found in Figure 6 .

[0048] Figure 6 It is a detailed step flow chart of a network traffic control method according to an embodiment of the present application.

[0049] Step S600, system network access; Step S610, monitor the download network speed of each application and the network performance index of the foreground application; wherein the switching between the foreground and background applications is monitored, and the UID (UserIdentifier) ​​of the foreground and background applications is marked respectively, multiple UIDs are dynamically managed, and the network performance index of the current foreground application is accurately obtained; Step S620, determine whether there is a foreground application with unqualified network performance index, if so, execute step S631; if not, enter result 641, there is no target application; the step S620 is intended to determine whether the current foreground application is running smoothly; Step S631, determine whether the total download network speed of the background application exceeds the preset first network speed threshold; if not, execute step S632, determine whether the download network speed of the foreground application with unqualified network performance index exceeds the preset The second network speed threshold set; if not, enter result 641, there is no target application; if so, enter result 642, there is only a foreground target application; specifically, the foreground target application is a foreground application whose network performance indicator is unqualified and whose download speed exceeds the second network speed threshold; if the judgment result of step S631 is yes, execute step S633 to determine whether the download speed of the foreground application whose network performance indicator is unqualified exceeds the preset second network speed threshold; if not, enter result 643, there is only a background target application; specifically, the background target application is all background applications; if so, enter result 644, there are background target applications and foreground target applications; specifically, the background target application is all background applications, and the foreground target application is a foreground application whose network performance indicator is unqualified and whose download speed exceeds the second network speed threshold.

[0050] The above results 642, 643 and 644 all belong to the existence of target applications.

[0051] In this embodiment, the order of the steps of "determining whether the total download network speed of the background application exceeds the first network speed threshold" and "determining whether the download network speed of the foreground application with unqualified network performance indicators exceeds the second network speed threshold" can be swapped. In other words, this embodiment does not limit the order of the above steps, which will not affect the judgment results of whether there is a target application and what type of target application exists, and can achieve the same technical effect.

[0052] In one embodiment, the download network speed of each application in the multiple applications can be obtained through whole machine monitoring, and the download network speeds of the background applications can be added up to obtain the total download network speed of the background applications; the total download network speed of the background applications can also be obtained by subtracting the total download network speed of the foreground applications from the total download network speed.

[0053] Those skilled in the art can set specific thresholds according to actual needs. For example, please refer to the following Table 1.

[0054] Table 1:

[0055]

[0056] The download network speed of 2M / B shown in Table 1 is the first network speed threshold, the threshold of the retransmission rate in the network performance index is 60%~100%, and the threshold of RTT is 400ms. Specifically, the network transmission delay can be judged using its average value. In one embodiment, it is monitored that the total download network speed in the background is greater than 2MB / S, there are applications in the foreground with a retransmission rate greater than 60%, and an average RTT greater than 400ms. It can be determined that the network of the foreground application is not smooth at this time, and it is caused by the large traffic download of the background application. At this time, it is confirmed that there is a target application that needs to be speed limited, and the target application includes the background target application.

[0057] Step S12: creating a traffic distribution chain according to the target application, and configuring a preset speed limit rule in the traffic distribution chain.

[0058] Compared with upload traffic, download traffic occupies most of the bandwidth. Therefore, if you want to reasonably control network traffic, you need to focus on configuring the download speed of the application.

[0059] In one embodiment of the present application, the download network speed of the target application is limited based on the speed limit rule in the traffic distribution chain.

[0060] In one embodiment, the traffic distribution chain is created according to the target application, and a preset speed limit rule is configured in the traffic distribution chain, including: setting the maximum total download network speed according to the type of the target application, wherein the type of the target application includes a foreground target application and a background target application; performing traffic scheduling according to the maximum total download network speed, and discarding data packets of the target application that exceed the corresponding maximum total download network speed.

[0061] Exemplarily, a first maximum total download network speed may be set for the total download network speed of the background target application, or a second maximum total download network speed may be set for the total download network speed of the foreground target application.

[0062] When traffic is scheduled according to the maximum total download network speed, theoretically the download network speed of the target application should be limited to less than the maximum total download network speed, but in practice, due to uneven data packets sent by the application, there is still a possibility of traffic exceeding the limit. Presetting the discarding (DROP) of data packets of the target application that exceed the maximum total download network speed in the speed limit rule can further ensure the stability of network traffic control.

[0063] Generally, when there is a background target application, it is usually the poor bandwidth configuration of the foreground and background applications that causes the foreground network to freeze; when there is a foreground target application, it is usually the poor download management of individual foreground applications that causes the foreground target application to be unsmooth.

[0064] Furthermore, for foreground applications with poor download management, since the foreground target application includes multiple download links, but usually only a few links are downloading large amounts of data, causing network freezes. Therefore, in addition to setting a maximum download speed, you can further find the specific link that causes network freezes and limit the speed of the download link.

[0065] In one embodiment, the method also includes: if the target application includes a foreground target application, obtaining a target link from multiple download links of the foreground target application, the target link being a link among the multiple download links whose download speed exceeds a preset third speed threshold; setting a corresponding maximum link download speed for the target link; performing traffic scheduling according to the maximum link download speed, and discarding data packets of the target link that exceed the corresponding maximum link download speed.

[0066] Furthermore, in one embodiment of the present application, creating a traffic distribution chain according to the target application and configuring a preset speed limit rule in the traffic distribution chain includes: creating the traffic distribution chain based on an iptables tool.

[0067] Iptables is a common command line tool that can set rules through the kernel's Netfilter framework to manage and control network traffic.

[0068] In other embodiments of the present application, other suitable network traffic management tools, such as nftables, may be selected.

[0069] Taking the Android system as an example, the technical architecture diagram of traffic allocation involved in one embodiment of the present application can be found in Figure 3 .

[0070] Among them, raw, mangle, nat, filter tables, as well as INPUT chain and OUTPUT chain all belong to the system native architecture.

[0071] The raw table is used to set a tag before the data packet enters the connection tracking; the mangle table is used to modify the quality of service (QoS) field of the data packet, or change other data packet header fields; the nat table is used for network address translation; the filter table is used to filter data packets. Through a specific mechanism, the filtered data packets can be sent to the user state for interaction or processing.

[0072] The INPUT chain is used to process all packets entering the local machine, that is, inbound traffic; the OUTPUT chain is used to process all packets sent from the local machine, that is, outbound traffic.

[0073] The architecture also includes matching extension (Matches) modules such as BPF (Berkely Packet Filter), hashlimit (hash limit), owner (owner), statistic (statistics), limit (speed limit), and connmask (link mark).

[0074] Among them, BPF creates a BPF configuration file to identify the UID of the data packet to distinguish between foreground applications and background applications for traffic filtering. The hashlimit module limits the traffic rate based on the hash table; the owner module matches according to the UID of the process to which the data packet belongs. Through these matching extension modules, the matching rules of the data packet can be further refined based on the links of these system native architectures.

[0075] WLAN and rmnet_data are commonly used network interfaces.

[0076] In one embodiment of the present application, creating a traffic distribution chain according to the target application and configuring a preset speed limit rule in the traffic distribution chain also includes: filtering out the target application through a Berkeley packet filter; and setting the speed limit rule for the target application through a hash limit module to limit the download speed of the target application.

[0077] In another embodiment of the present application, the speed limit rules also include outbound speed limit rules, creating a traffic distribution chain according to the target application and configuring preset speed limit rules in the traffic distribution chain, and also including: matching the target application through an owner module; and setting the outbound speed limit rules for the target application through a hash restriction module to achieve limitation on the upload speed of the target application.

[0078] In the terminal device, the target application is filtered through BPF, and its UID or other identification information is matched to ensure that the data packets of the target application are filtered out for speed limiting; the target application is matched through the owner module; hashlimit is used in the traffic distribution chain to set the maximum download speed of the target application. This module monitors the download or upload traffic of the application to ensure that it is within the limited rate range, and discards some data packets that exceed the limit to achieve speed limiting.

[0079] Exemplarily, in one embodiment of the present application, a custom chain nm_TRAFFIC is created as a traffic distribution chain, and its code is as follows: iptables -t filter -N nm_TRAFFIC; iptables -t filter -A INPUT -m bpf--object-pinned / sys / fs / bpf / xxxx -j nm_TRAFFIC; iptables -t filter -A OUTPUT-m owner --uid uid number-j nm_TRAFFIC.

[0080] For example, in one embodiment, if the total download speed is 4000 kb / s, the total download speed of the background application is limited to no more than 50% of the total speed, that is, the hashlimit-upto 2000 kb / s is limited, and packets exceeding the limit are DROP processed.

[0081] When the actual download speed of the target application exceeds the set maximum total download speed, the excess data traffic is DROP processed, that is, the data packets are discarded, thereby effectively controlling the traffic usage of the application to ensure the reasonable allocation and use of network resources.

[0082] In actual operation, for a target application that needs to be speed-limited, an allowed burst flow rate, namely hashlimit-burst, can also be set for it. Based on the maximum flow rate and the allowed burst flow rate, the flow rate of the target application that exceeds the limit is DROP processed.

[0083] Set the allowed burst traffic, that is, allow the target application to exceed the maximum traffic limit in a short period of time. Taking the token bucket algorithm as an example, burst traffic is controlled by accumulating "tokens" and generating a certain number of tokens at regular intervals. The duration of the burst period is related to the size of the token bucket and the generation speed. Generally, traffic peaks between a few hundred milliseconds and a few seconds can be considered short-term burst traffic.

[0084] Step S13: limiting the speed of the target application based on the speed limiting rule in the traffic distribution chain.

[0085] In one embodiment of the present application, the speed limiting of the target application based on the speed limit rule in the traffic distribution chain includes: redirecting the inbound traffic of the mobile terminal to the traffic distribution chain, and limiting the download speed of the target application based on the speed limit rule in the traffic distribution chain.

[0086] In one embodiment, the inbound traffic is redirected to the traffic distribution chain via an INPUT chain.

[0087] By connecting the traffic distribution chain to the INPUT chain of the system's native architecture, it helps to flexibly implement real-time traffic control, and can apply speed limit rules in the early stage of data processing, directly filter and limit download traffic, avoid burdening the system before the traffic enters other links, and improve the overall traffic management efficiency of the system.

[0088] Furthermore, the upload speed of the terminal device can also be managed and controlled to more comprehensively control network traffic.

[0089] In one embodiment, the speed limit rule also includes an outbound speed limit rule, and the method also includes: jumping the outbound traffic of the mobile terminal to the traffic distribution chain, and limiting the upload speed of the target application in the traffic distribution chain based on the outbound speed limit rule.

[0090] The outbound speed limit rule can refer to the above speed limit rule and be set according to actual conditions.

[0091] In one embodiment, outbound traffic is redirected to the traffic distribution chain via an OUTPUT chain.

[0092] Furthermore, the method also includes: if there is no foreground application whose network performance indicator is unqualified, and there is a speed limit rule being executed, then canceling the speed limit rule being executed.

[0093] In one embodiment, creating a traffic distribution chain according to the target application and configuring a preset speed limit rule in the traffic distribution chain further includes determining whether the same target application is currently executing the speed limit rule before issuing the speed limit rule.

[0094] Please continue reading Figure 6 If the target application (641) does not exist, execute step S651 to determine whether the speed limit rule is being executed; if not, return to continue to execute step S610 to monitor the download speed of each application and the network performance indicators of the foreground application; if so, execute step S661 to release the speed limit rule being executed; if the target application (642, 643, 644) exists, execute step S652 to determine whether the same target application is currently executing the speed limit rule; if not, execute step S662 to issue the speed limit rule; if so, execute step S663 to maintain the speed limit rule.

[0095] In one embodiment, when executing the above-mentioned network traffic control method, further, at every preset period, it is re-determined whether there is a target application that needs to be speed limited based on the download network speed of each application in the current multiple applications and the network performance index of the foreground application, and the speed limit rule is dynamically adjusted based on the result of the re-determination. The dynamic adjustment includes setting a new speed limit rule for the re-determined target application, releasing the current speed limit rule, or maintaining the current speed limit rule.

[0096] Exemplarily, the interval period is 3 to 30 seconds.

[0097] The above technical solution implements unified traffic control on applications, which can easily handle all traffic of applications without the tedious processing of each single link, avoiding too many rules that lead to slower data distribution and increased system load; by further monitoring the network speed and link quality of the foreground application, when the user is stuck due to uneven traffic distribution, the network speed is dynamically allocated and deallocated.

[0098] When adopting the above technical solution, this application performs unified traffic control on applications based on the download speed of each application and the network performance indicators of the foreground application. The unified speed limit rules make the network traffic load distributed evenly and faster, solving the problem of low efficiency and untimely traffic distribution in the existing market.

[0099] This application performs network traffic control based on the ptables tool and native INPUT chain, OUTPUT chain, etc., without the need to introduce virtual network devices, further improving the speed of network traffic control.

[0100] Furthermore, this application also provides an example of a complete network traffic control process, please refer to Figure 2 .

[0101] Figure 2 It is a detailed step flow chart of a network traffic control method according to an embodiment of the present application.

[0102] Since the foreground and background APPs are often switched during the use of the mobile terminal, step S211 can be executed after the process is started to monitor the switching of the foreground and background APPs, and mark the UIDs of the foreground APP and the background APP respectively to dynamically manage multiple UIDs.

[0103] After the system is connected to the network in step S221, step S212 is executed to monitor the network performance indicators of the foreground APP. In this embodiment, the retransmission rate and RTT of the foreground APP are monitored. In step S213, if the retransmission rate and RTT increase and exceed the preset threshold, it is judged that the foreground APP is stuck, and the current network speed is further monitored.

[0104] On the other hand, after the system network is connected in step S221, step S222 is executed to monitor the network speed of the whole machine. Specifically, the monitoring of the network speed of the whole machine includes monitoring the download network speed of all APPs running on the mobile terminal. In step S223, if the total download network speed of the background application is greater than the preset threshold, and a large-traffic application is currently downloading, the current foreground APP retransmission rate and RTT are obtained.

[0105] Step S230, obtaining the download network speed of each application and the network performance index of the foreground application.

[0106] In some embodiments of the present application, instead of steps S211 to S223, the download network speed of the entire machine, the retransmission rate and RTT of the foreground application may also be monitored simultaneously.

[0107] Step S231, determining whether there is a target application that needs speed limiting.

[0108] Exemplarily, if it is determined that a target application exists, step S233 is further executed to determine whether the same target application is executing the speed limit rule; if it is not obtained that the same target application is executing the speed limit rule, step S242 is executed to issue the speed limit rule; if the same target application is executing the speed limit rule, step S243 is executed to maintain the speed limit rule.

[0109] If it is determined that the target application does not exist, step S232 is further executed to determine whether the speed limit rule is being executed; if the speed limit rule is being executed, step S241 is executed to release the speed limit rule; if no application is executing the speed limit rule, return to step S230.

[0110] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effect of the present application, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present application.

[0111] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0112] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0113] On the other hand, the present application provides a computer-readable storage medium storing a plurality of program codes, wherein the program codes are suitable for being loaded and run by a processor to execute the network traffic control method described in any one of the above-mentioned network traffic control method technical solutions.

[0114] For ease of explanation, only the parts related to the embodiments of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present application. The computer-readable storage medium can be a storage device formed by various mobile terminals. Optionally, the computer-readable storage medium in the embodiments of the present application is a non-temporary computer-readable storage medium.

[0115] Another aspect of the present application also provides a mobile terminal, including a processor and a memory, wherein the memory is suitable for storing multiple program codes, and the program codes are suitable for being loaded and run by the processor to execute the network traffic control method described in any one of the above-mentioned network traffic control method technical solutions.

[0116] Please see attached Figure 4 , Figure 4 It is a main structural block diagram of a mobile terminal used to execute the network traffic control method of the present application.

[0117] like Figure 4 As shown, the mobile terminal 400 may include at least one processor 401; and a memory 402 that is communicatively connected to the at least one processor 401; wherein the memory 402 stores a computer program 403, and when the computer program 403 is executed by the at least one processor 401, the method described in any of the above embodiments is implemented.

[0118] The mobile terminal 400 in the embodiment of the present application may be, but is not limited to, a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), an augmented reality (AR), a virtual reality (VR) device, a vehicle-mounted device, a wearable device, etc. The embodiment of the present application does not limit this.

[0119] In the embodiment of the present application, the mobile terminal or each network device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and a memory. The operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux operating system, Unix operating system, Android operating system, iOS operating system, or Windows operating system. The application layer includes applications such as browsers, address books, word processing software, and instant messaging software.

[0120] For further information, see Figure 5 In addition to the aforementioned wireless communication hardware, the hardware structure of a mobile terminal generally includes the following parts: Figure 5 As shown, the mobile terminal may further include: a processor 510, an external memory interface 520, an internal memory 521, a Universal Serial Bus (USB) interface 530, a charging management module 540, a wireless charging coil 540A, a power management module 541, a battery 542, an antenna 1, an antenna 2, a mobile communication module 550, a wireless communication module 560, an audio module 570, a speaker 570A, a microphone 570B, an earphone interface 570C, a sensor module 580, a button 590, a motor 591, an indicator 592, a camera module 593, a display screen 594, and a Subscriber Identification Module (SIM) card interface 595, etc. The processor 510 may be directly or indirectly connected to other components through a system bus.

[0121] The processor 510 may include one or more processing units, for example, the processor 510 may include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors. The processor 510 may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of reading and executing instructions.

[0122] The internal memory 521 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 521 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function, etc. The data storage area may store data created during the use of the mobile terminal, etc. The internal memory 521 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (Universal Flash Storage, UFS), etc. The processor 510 executes various functional applications and data processing of the mobile terminal by running instructions stored in the internal memory 521 and / or instructions stored in a memory provided in the processor.

[0123] The sensor module 580 may include an ambient light sensor 580A, a gyro sensor 580B, an air pressure sensor 580C, a proximity light sensor 580D, an acceleration sensor 580E, a fingerprint sensor 580F, a Hall sensor 580G, a laser sensor 580H, and the like.

[0124] It is to be understood that the above example structures do not constitute a specific limitation on the mobile terminal. In some other examples, the mobile terminal may include more or fewer components, or combine certain components, or split certain components, or different component arrangements. In some examples, the same type of components may be one or more, such as a speaker or a microphone, etc. The illustrated components may include hardware, software, or a combination of software and hardware.

[0125] So far, the technical solutions of the present application have been described in conjunction with the specific implementations shown in the accompanying drawings, but it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific implementations. Without departing from the principles of the present application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present application.

[0126] The relevant user personal information that may be involved in the various embodiments of this application is strictly in accordance with the requirements of laws and regulations, following the principles of legality, legitimacy and necessity, based on the reasonable purposes of business scenarios, to process the personal information that users actively provide during the use of products / services or generated due to the use of products / services, as well as the personal information obtained with the user's authorization.

[0127] The user personal information processed by the applicant will vary depending on the specific product / service scenario, and shall be based on the specific scenario in which the user uses the product / service, which may involve the user's account information, device information, driving information, vehicle information or other related information. The applicant will treat the user's personal information and its processing with a high degree of diligence.

[0128] The Applicant attaches great importance to the security of user personal information and has adopted reasonable and feasible security protection measures that comply with industry standards to protect user information and prevent personal information from being accessed, disclosed, used, modified, damaged or lost without authorization.

Claims

1. A network traffic control method, applied to a mobile terminal, wherein multiple applications are running on the mobile terminal, characterized in that: include: According to preset screening rules, target applications that need to be speed-limited are screened out from the multiple applications; wherein the types of the target applications include foreground target applications and background target applications, specifically including: obtaining the download network speed of each application in the multiple applications and the network performance index of the foreground application, the foreground application being included in the multiple applications; if there is a foreground application with unqualified network performance index, and the total download network speed of the background applications exceeds a preset first network speed threshold, all background applications are taken as the background target applications; if the download network speed of the foreground application with unqualified network performance index exceeds a preset second network speed threshold, the foreground application with a download network speed exceeding the second network speed threshold is taken as the foreground target application; the network performance index includes at least a retransmission rate and a network transmission delay. For each foreground application, when all items in the network performance index of the foreground application exceed the corresponding preset thresholds, the foreground application is determined to be a foreground application with unqualified network performance index; A traffic distribution chain is created according to the target application, and a preset speed limit rule is configured in the traffic distribution chain; wherein a Berkeley packet filter (BPF) is used to create a BPF configuration file to identify a user identifier (UID) of a data packet, so as to distinguish between a foreground application and a background application, and perform traffic filtering; In the traffic distribution chain, the target application is rate-limited based on the rate-limiting rule.

2. The method according to claim 1, characterized in that The step of creating a traffic distribution chain according to the target application and configuring a preset speed limit rule in the traffic distribution chain includes: The maximum total download network speed is set respectively according to the type of the target application, wherein the type of the target application includes a foreground target application and a background target application; Traffic scheduling is performed according to the maximum total download network speed, and data packets of the target application that exceed the maximum total download network speed are discarded.

3. The method according to claim 2, characterized in that The method further comprises: If the target application includes a foreground target application, obtaining a target link from multiple download links of the foreground target application, the target link being a link whose download network speed exceeds a preset third network speed threshold among the multiple download links; Setting a maximum link download speed for the target link; Traffic scheduling is performed according to the maximum link download speed, and data packets of the target link that exceed the maximum link download speed are discarded.

4. The method according to claim 1, characterized in that: The limiting the speed of the target application based on the speed limiting rule in the traffic distribution chain includes: The inbound traffic of the mobile terminal is redirected to the traffic distribution chain, and the download network speed of the target application is limited in the traffic distribution chain based on the speed limit rule.

5. The method according to claim 1, characterized in that The speed limit rule also includes an outbound speed limit rule, and the method further includes: The outbound traffic of the mobile terminal is redirected to the traffic distribution chain, and the upload network speed of the target application is limited in the traffic distribution chain based on the outbound speed limit rule.

6. The method according to claim 1, characterized in that The method further comprises: If there is no foreground application whose network performance indicator is unqualified, and there is a speed limit rule being executed, the speed limit rule being executed is released.

7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: At every preset period, based on the download network speed of each application in the current multiple applications and the network performance index of the foreground application, it is re-determined whether there is a target application that needs to be speed limited, and the speed limit rule is dynamically adjusted based on the result of the re-determination. The dynamic adjustment includes setting a new speed limit rule for the re-determined target application, lifting the current speed limit rule, or maintaining the current speed limit rule.

8. The method according to any one of claims 1 to 6, characterized in that: The step of creating a traffic distribution chain according to the target application and configuring a preset speed limit rule in the traffic distribution chain includes: The traffic distribution chain is created based on the iptables tool.

9. The method according to claim 8, characterized in that The step of creating a traffic distribution chain according to the target application and configuring a preset speed limit rule in the traffic distribution chain further includes: The speed limit rule is set for the target application through a hash limit module to limit the download network speed of the target application.

10. The method according to claim 8, characterized in that The speed limit rule also includes an outbound speed limit rule, and the process of creating a traffic distribution chain according to the target application and configuring a preset speed limit rule in the traffic distribution chain also includes: Matching the target application through an owner module; and The outbound speed limit rule is set for the target application through the hash limit module to limit the upload network speed of the target application.

11. A computer-readable storage medium storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by a processor to execute the network traffic control method according to any one of claims 1 to 10.

12. A mobile terminal, characterized in that: The method comprises a processor and a memory, wherein the memory is suitable for storing a plurality of program codes, and is characterized in that the program codes are suitable for being loaded and run by the processor to execute the network traffic control method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Network bandwidth allocation method, terminal and computer storage medium

    CN110493828A

  • Uplink rate adjusting method and device, electronic equipment and storage medium

    CN113423122A

  • Bandwidth allocation method and device, equipment and storage medium

    CN116708309A