WO2022022429A1 - Buffer management method and related device - Google Patents

Buffer management method and related device Download PDF

Info

Publication number
WO2022022429A1
WO2022022429A1 PCT/CN2021/108275 CN2021108275W WO2022022429A1 WO 2022022429 A1 WO2022022429 A1 WO 2022022429A1 CN 2021108275 W CN2021108275 W CN 2021108275W WO 2022022429 A1 WO2022022429 A1 WO 2022022429A1
Authority
WO
WIPO (PCT)
Prior art keywords
buffer
terminal
data
rate
file
Prior art date
Application number
PCT/CN2021/108275
Other languages
French (fr)
Chinese (zh)
Inventor
王皓
张志军
胡征
许辰人
姚松平
郭兴民
李锋
顾燕杰
杨卓卿
Original Assignee
华为技术有限公司
北京大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司, 北京大学 filed Critical 华为技术有限公司
Publication of WO2022022429A1 publication Critical patent/WO2022022429A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0015Systems modifying transmission characteristics according to link quality, e.g. power backoff characterised by the adaptation strategy
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/16Threshold monitoring
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Definitions

  • the present application relates to the field of communication technologies, and in particular, to a buffer management method and related devices.
  • the mobile terminal can receive file data transmitted by other mobile terminals or servers.
  • the mobile terminal can transfer files with other mobile terminals to meet the user's requirement for sharing files (such as photos, audio and video, etc.).
  • the mobile terminal can transmit the file data to the opposite end based on the transmission control protocol (transmission control protocol, TCP) or the user datagram protocol (user datagram protocol, UDP).
  • TCP transmission control protocol
  • UDP user datagram protocol
  • the traditional TCP transport protocol is designed for low-speed, low-latency networks.
  • the sender and the receiver The end needs to establish a connection first, and a window congestion control mechanism is introduced to ensure reliability and order, which will affect the rate of file transfer.
  • UDP is a non-connection protocol.
  • the present application provides a buffer management method and a related device, which can realize that in the process of receiving file data by a terminal, according to the buffered data, available memory, network card receiving rate, disk writing rate, available memory and receiving rate of the buffer Adjust the size of the buffer to the frequency of user interaction. In this way, the overflow probability of the buffer in the terminal during high-speed transmission of file data can be reduced, and the packet loss rate can be reduced.
  • the present application provides a buffer management method, comprising: a terminal receiving data of a first file, storing the data of the first file in a first buffer, and storing data in the first buffer Data is written to disk.
  • the terminal monitors the amount of buffered data in the first buffer, the amount of data to be transmitted in the first file, the growth rate of buffered data in the first buffer, and the available memory capacity. If the buffered data growth rate of the first buffer is greater than 0, the terminal determines the buffered data volume of the first buffer, the to-be-transmitted data volume of the first file, the buffered data growth rate of the first buffer, and the network card reception rate according to the first buffer. , and determine the required total capacity value of the first buffer.
  • the terminal If the required total capacity of the first buffer is greater than or equal to the second value and less than or equal to the first value, and the remaining buffer capacity of the first buffer is less than the amount of data to be transmitted in the first file, the terminal The size of a buffer is adjusted to the required total capacity value of the first buffer, the first value being greater than the second value.
  • the application provides a buffer management method, which can realize that in the process of receiving file data by a terminal, according to factors such as buffered data in the buffer, available memory, network card receiving rate, disk writing rate, available memory capacity and other factors, and receiving user data
  • the frequency of interactive operations adjust the size of the buffer. In different scenarios, adjust the size of the buffer and apply for more storage space for the buffer as much as possible. In this way, the overflow probability of the buffer during high-speed transmission of file data can be reduced, and the packet loss rate can be reduced.
  • the terminal adjusts the size of the first buffer to the first buffer capacity, wherein the first buffer The ratio of the capacity to the available memory capacity is the first value.
  • the terminal adjusts the size of the first buffer to the required total capacity value of the first buffer .
  • the method further includes: if the terminal receives the The number of times input by the user is greater than the number of times threshold, and the amount of buffered data in the first buffer is less than or equal to the second buffer capacity.
  • the remaining data volume and the buffered data growth rate of the first buffer zone determine a safe sending rate, and the ratio of the second buffer capacity to the available memory capacity is the second value.
  • the terminal sends first rate information to the sender of the first file, where the first rate information is used to instruct the sender to adjust the sending rate of the first file to the safe sending rate.
  • the terminal receives the acknowledgment information sent by the sender. In response to the confirmation information, the terminal adjusts the size of the first buffer to the second buffer capacity.
  • the terminal will set the first value at the terminal.
  • the method further includes: if the number of times the terminal receives user input within a specified time period is greater than the number of times a threshold, and the buffered first buffer has been buffered If the amount of data is greater than the second buffer capacity, the terminal sends second rate information to the sender, where the second rate information is used to instruct the sender to adjust the sending rate of the first file to be less than or equal to the rate threshold, and the second buffer capacity is the same as the rate threshold.
  • the ratio of the available memory capacity is the second value. If the buffered data volume of the first buffer is smaller than the second buffer capacity, the terminal adjusts the size of the first buffer to the second buffer capacity.
  • the method further includes: the terminal according to the remaining buffer capacity of the first buffer, the first buffer The remaining data volume of the file and the growth rate of the buffered data of the first buffer zone determine the safe sending rate.
  • the terminal sends first rate information to the sender of the first file, where the first rate information is used to instruct the sender to adjust the sending rate of the first file to the safe sending rate.
  • the method further includes: if the number of times the terminal receives user input within a specified time period is greater than the number of times threshold, and the amount of buffered data in the first buffer is less than or equal to the second buffer capacity, the terminal determines according to the second buffer capacity, the amount of buffered data in the first buffer, the remaining data in the first file, the The buffered data growth rate of a buffer determines the safe sending rate, and the ratio of the second buffer capacity to the available memory capacity is the second value.
  • the terminal sends first rate information to the sender of the first file, where the first rate information is used to instruct the sender to adjust the sending rate of the first file to the safe sending rate.
  • the terminal receives the acknowledgment information sent by the sender. In response to the confirmation information, the terminal adjusts the size of the first buffer to the second buffer capacity.
  • the method further includes: if the number of times the terminal receives user input within a specified time period is greater than the number of times threshold, and the amount of buffered data in the first buffer is greater than the second buffer capacity, the terminal sends second rate information to the sender, where the second rate information is used to instruct the sender to adjust the sending rate of the first file to be less than or equal to a rate threshold, and the ratio of the second buffer capacity to the available memory capacity is the second value. If the buffered data volume of the first buffer is smaller than the second buffer capacity, the terminal adjusts the size of the first buffer to the second buffer capacity.
  • the method further includes: if the number of times the terminal receives user input within a specified time period is greater than the number of times threshold, and the amount of buffered data in the first buffer is greater than the second buffer capacity, the terminal sends second rate information to the sender, where the second rate information is used to instruct the sender to adjust the sending rate of the first file to be less than or equal to a rate threshold, and the ratio of the second buffer capacity to the available memory capacity is the second value. If the buffered data volume of the first buffer is smaller than the second buffer capacity, the terminal adjusts the size of the first buffer to the second buffer capacity.
  • the method further includes: when the terminal determines that the size of the first buffer is When the growth rate of the buffered data is less than 0, the terminal reduces the size of the first buffer by a specified capacity.
  • the terminal determines the required capacity value of the first buffer according to the following formula:
  • c is a conservative coefficient, 0 ⁇ c ⁇ 1
  • H is the required total capacity value of the first buffer
  • W is the buffered data volume of the first buffer
  • A is the buffered data of the first buffer Growth rate
  • FLS is the amount of data to be transmitted in the first file
  • rateNet is the receiving rate of the network card.
  • the terminal determines the safe sending rate according to the following formula:
  • c is a conservative coefficient, 0 ⁇ c ⁇ 1
  • X is the second buffer capacity
  • W is the buffered data volume of the first buffer
  • A is the buffer data growth rate of the first buffer
  • FLS is the The amount of data to be transmitted in the first file
  • V1 is the safe sending rate.
  • the terminal determines the safe sending rate according to the remaining buffer capacity of the first buffer, the remaining data volume of the first file, and the buffered data growth rate of the first buffer, which specifically includes :
  • the terminal determines the safe transmission rate according to the following formula:
  • c is a conservative coefficient, 0 ⁇ c ⁇ 1
  • P is the remaining buffer capacity of the first buffer
  • A is the buffer data growth rate of the first buffer
  • FLS is the amount of data to be transmitted in the first file
  • V1 is the safe sending rate.
  • the terminal adjusts the size of the first buffer to the third buffer capacity , the ratio of the third buffer capacity to the available memory capacity is a third value, and the third value is greater than the first value.
  • the terminal acquires the buffered data increment rate of the first buffer, specifically including:
  • the terminal obtains the buffered data growth rate of the first buffer by monitoring the change of the buffered data amount in the first buffer.
  • the terminal acquiring the buffered data increment rate of the first buffer zone specifically includes: acquiring, by the terminal, the writing rate of the data of the first file written to the disk.
  • the terminal determines the growth rate of the buffered data of the first buffer according to the receiving rate and the writing rate of the network card.
  • the present application provides a data transmission method, including: establishing a file transmission connection between a first terminal and a second terminal, where the file transmission connection is used to transmit a first file.
  • the first terminal acquires the upper limit of the transmission rate of the physical layer of the network card.
  • the first terminal determines the first rate according to the upper limit of the transmission rate of the physical layer.
  • the first terminal writes the first data of the first file to the MAC layer sending buffer qdisk_buffer at the first rate, and sends the first data of the first file in the MAC layer sending buffer to the MAC layer through the network card second terminal.
  • the first terminal When the first terminal determines that the buffered data volume of the MAC layer sending buffer is greater than or equal to the first warning water level, the first terminal writes the second data of the first file to the MAC layer sending buffer at the second rate data, and send the second data of the first file in the MAC layer sending buffer to the second terminal through the network card, wherein the first rate is greater than the second rate.
  • the buffer capacity and the first warning water level of the MAC layer sending buffer (qdisk_buffer) of the sending end 210 can be set, and according to the data of the MAC layer sending buffer (qdisk_buffer)
  • the amount of buffered data determines the sending rate of the data written by the sending end 210 into the first file to the sending buffer of the MAC layer, so that the file transmission speed is close to the limit rate of the physical channel and the packet loss rate is reduced.
  • the first terminal acquires first watermark information reported by the MAC layer, where the first watermark information is used to indicate that the buffered data amount in the MAC layer's transmission buffer is greater than or equal to the first watermark Warning water level.
  • the MAC layer can actively report the warning information to reduce the rate at which the data of the first file is written into the MAC layer's sending buffer in time.
  • the first terminal determines that the buffered data volume of the MAC layer sending buffer is greater than or equal to the first warning watermark and the remaining capacity of the MAC layer sending buffer is less than the size of the first file
  • the first terminal sends the second data written in the first file to the MAC layer sending buffer at the second rate, and sends the first file in the buffer to the MAC layer through the network card
  • the second data is sent to the second terminal.
  • the first terminal sends the first data of the first file to the MAC layer sending buffer at a first rate, and sends the first data in the MAC layer through the network card
  • the method further includes: when the first terminal determines that the buffered data amount of the MAC layer transmission buffer is greater than or equal to the first warning water level and the MAC layer transmission buffer
  • the first terminal writes the second data of the first file to the MAC layer sending buffer at the first rate, and sends the second data of the first file through the network card.
  • the MAC layer sends the second data of the first file in the buffer to the second terminal. In this way, when the remaining capacity of the MAC layer sending buffer is sufficient to accommodate the remaining sending data of the first file, the first terminal transmits the data of the first file at a high rate, which improves the file transfer rate.
  • the first terminal sends the second data of the first file to the MAC layer sending buffer at a second rate, and the MAC layer sends the first data in the buffer through the network card.
  • the method further includes: when the first terminal determines that the amount of buffered data in the first buffer is less than or equal to a first specified threshold, the first terminal uses the The first rate writes the third data of the first file into the MAC layer sending buffer, and sends the third data of the first file in the MAC layer sending buffer to the second terminal through the network card, wherein, The first specified threshold is less than the first warning water level.
  • the first terminal sends the data of the first file in the buffer to the MAC layer at a first rate, and sends the data of the first file in the buffer to the MAC layer through the network card.
  • Sending data to the second terminal and the method further includes: receiving, by the first terminal, the first message sent by the second terminal when it is determined that the buffer water level of the first buffer on the second terminal is greater than or equal to the second early warning water level Feedback.
  • the first terminal sends the fourth data written to the first file in the buffer to the MAC layer at a third rate, and sends the first file in the buffer to the MAC layer through the network card
  • the fourth data is sent to the second terminal, wherein the first rate is greater than the third rate.
  • the first buffer includes: any one of the IP fragmentation reassembly buffer ip_defrag_buffer on the second terminal and the write buffer write_buffer on the second terminal.
  • the transmission rate of the first terminal can be further determined by monitoring the buffered data volume of the IP fragmentation reassembly buffer (ip_defrag_buffer) of the second terminal and the write buffer (write_buffer) of the second terminal, so that the transmission speed of the file is close to the physical Channel limit rate and reduce packet loss rate.
  • ip_defrag_buffer the buffered data volume of the IP fragmentation reassembly buffer
  • write_buffer write buffer
  • the first terminal sends the fourth data of the first file to the MAC layer sending buffer at a third rate, and sends the fourth data in the MAC layer through the network card to the buffer.
  • the method further includes: the first terminal receives a second feedback sent by the second terminal when it is determined that the amount of buffered data in the first buffer is less than or equal to a second specified threshold information, the second specified threshold is less than the second warning water level.
  • the first terminal sends the fifth data written in the first file to the MAC layer sending buffer at the first rate, and sends the first data in the first file to the MAC layer through the network card.
  • Fifth data of the file is sent to the second terminal, wherein the first rate is greater than the third rate.
  • the first terminal can transmit the data of the first file at a high rate, thereby increasing the file transmission rate.
  • the method before the first terminal sends the data written in the first file in the buffer to the MAC layer at the first rate, the method further includes: acquiring, by the first terminal, measurement data reported by the MAC layer packet, the measurement data packet includes the time when the MAC layer reports the measurement data packet.
  • the first terminal determines the feedback time of the MAC layer according to the time when the MAC layer reports the measurement data packet and the time when the first terminal obtains the measurement data packet.
  • the first terminal determines, according to the upper limit of the transmission rate of the physical layer and the feedback time of the MAC layer, the buffer capacity of the transmission buffer of the MAC layer and the first warning water level.
  • the formula for the first terminal to determine the buffer capacity of the MAC layer sending buffer and the first warning water level is:
  • M is the buffer capacity of the sending buffer of the MAC layer
  • A is the warning water level
  • Vmax is the upper limit of the sending rate of the physical layer
  • Ts is the feedback time
  • M is the minimum value that satisfies the formula.
  • the file transfer connection includes any one of Wi-Fi direct connection, Wi-FisoftAP, ultra-wideband communication connection, and Bluetooth connection.
  • the second terminal determines the buffer capacity of the first buffer and the second early warning water level according to the upper limit of the transmission rate of the physical layer and the round-trip delay on the file transmission connection.
  • the formula for the second terminal to determine the buffer capacity of the first buffer and the second early warning water level is:
  • m is the buffer capacity of the sending buffer of the MAC layer
  • a is the warning water level
  • Vmax is the upper limit of the sending rate of the physical layer
  • RTT is the round-trip delay
  • m is the minimum value that satisfies the formula.
  • the present application provides a data storage method, comprising: a terminal receiving data of a first file, and storing the data of the first file in a network protocol stack receiving buffer.
  • the terminal takes out the data of the first file from the receiving buffer of the network protocol stack and writes it directly into the disk.
  • the terminal obtains the remaining buffer capacity of the receiving buffer of the network protocol stack, the amount of data to be transmitted of the first file, and the growth rate of the buffered data of the receiving buffer of the network protocol stack.
  • the terminal shall, according to the remaining buffer capacity of the receiving buffer of the network protocol stack, the amount of data to be transmitted of the first file, and the size of the receiving buffer of the network protocol stack, The buffer data growth rate and the network card receiving rate are used to determine the overflow time of the receiving buffer of the network protocol stack and the remaining transmission time of the first file.
  • the terminal will store it in the receiving buffer of the network protocol stack
  • the data in the area is dumped to the user mode buffer, and the data in the user mode buffer is written to the disk through the kernel mode write buffer.
  • the terminal after receiving the file data, the terminal can receive the watermark in the buffer through the network protocol stack in the kernel state, and adopt different data storage paths, so as to avoid the network protocol stack receiving buffering Packet loss is caused by overflow in the area, and the packet loss rate is reduced while transferring file data at high speed.
  • the terminal determines the overflow time of the receiving buffer of the network protocol stack according to the growth rate of the buffered data of the receiving buffer of the network protocol stack and the remaining buffer capacity of the receiving buffer of the network protocol.
  • the terminal determines the remaining transmission time of the first file according to the amount of data to be transmitted and the receiving rate of the network card of the first file.
  • the terminal dumps the buffered data in the receiving buffer of the network protocol stack to the user mode buffer, and takes out the data of the first file from the user mode buffer and passes through the kernel.
  • the method further includes: determining, by the terminal, the overflow time of the user state buffer according to the buffer data growth rate of the user state buffer and the remaining buffer capacity of the user state buffer . If the overflow time of the user mode buffer is less than the remaining transmission time of the first file, the terminal sends buffer information to the sender of the first file, and the buffer information is used to instruct the sender to reduce the transmission of the first file. rate. In this way, when the overflow time of the user-mode buffer is less than the remaining transmission time of the first file, the sender can be made to reduce the sending rate in time to prevent the user-mode buffer from overflowing.
  • the method further includes: if the amount of buffered data in the network protocol stack receiving buffer is lower than the second Threshold, the terminal determines the maximum overflow time of the receiving buffer of the network protocol stack according to the total buffer capacity of the receiving buffer of the network protocol stack and the buffer data growth rate of the user mode buffer. If the maximum overflow time of the receiving buffer of the network protocol stack is greater than or equal to the remaining transmission time of the first file, the terminal takes out the data of the first file from the receiving buffer of the network protocol stack and writes it directly to the disk. In this way, when the free capacity of the receiving buffer of the network protocol stack is large, the data of the first file is directly written to the disk from the receiving buffer of the network protocol stack, thereby saving processing power consumption of the processor.
  • the terminal dumps the data stored in the receiving buffer of the network protocol stack to the user mode buffer, which specifically includes: the terminal transfers all data stored in the receiving buffer of the network protocol stack Data is dumped to this user mode buffer.
  • the terminal transfers the data stored in the receiving buffer of the network protocol stack to the user mode buffer, which specifically includes: the terminal transfers the first data stored in the receiving buffer of the network protocol stack A portion of the data is dumped into this user mode buffer.
  • the method further includes: the terminal directly writes the second part of data stored in the network protocol stack receiving buffer into the disk.
  • the terminal acquires the buffered data growth rate of the receiving buffer of the network protocol stack, which specifically includes: the terminal acquires the buffered data amount by monitoring the change of the buffered data amount in the receiving buffer of the network protocol stack.
  • the buffered data growth rate of the network stack receive buffer.
  • the terminal acquiring the buffered data growth rate of the receiving buffer of the network protocol stack specifically includes: acquiring the writing rate of the data of the first file into the disk by the terminal. The terminal determines, according to the receiving rate of the network card and the writing rate, the growth rate of the buffered data of the receiving buffer of the network protocol stack.
  • the network protocol stack receiving buffer includes: a user datagram protocol UDP receiving buffer.
  • the present application provides a multi-path data prefetching method, including: a terminal acquiring a first HTTP request initiated by a first application of the terminal for a first URI, where the first HTTP request is used to request a server for the first HTTP request. data.
  • the terminal generates L second HTTP requests, where the L second HTTP requests are used to request second data from the server, wherein the second data includes the first data and the data volume of the second data is larger than the first data
  • the amount of data, L is a positive integer.
  • the terminal sends the L second HTTP requests to the server through L network paths respectively.
  • the terminal receives L first HTTP responses sent by the server on the L network paths, where the L first HTTP responses include the second data.
  • the terminal retrieves the first data from the second data, and returns the first data to the first application through an HTTP response.
  • the terminal receives a third HTTP request initiated by the first application for the first URI, where the third HTTP request is used to request third data from the server. If the second data includes the third data, the terminal extracts the third data from the second data, and returns the third data to the first application through an HTTP response.
  • the terminal can prefetch data of the second data amount from the server when the application service requests the data of the first data amount, wherein the second data amount is greater than the first data amount . Then, after receiving the data of the second data volume returned by the server, the terminal may first return the data of the first data volume in the second data volume to the application. Then, the remaining data (the second amount of data - the first amount of data) is stored in the prefetch buffer. When the application requests the remaining (the second amount of data - the first amount of data) bytes of data next time, the terminal can directly extract the remaining (the second amount of data - the first amount of data) bytes from the prefetch buffer data to the application. The bandwidth utilization rate of the network path between the terminal and the server is improved, and when the application frequently accesses data in different ranges on the same URI address, the time for the application to obtain the data can be saved.
  • the terminal if the byte range of the third data is not within the byte range of the second data, the terminal generates S fourth HTTP requests, and the S fourth HTTP requests are used to send The server requests fourth data, wherein the set of the fourth data and the second data includes the third data, and S is a positive integer.
  • the terminal receives S second HTTP responses sent by the server on the S network paths, where the S second HTTP responses include the fourth data.
  • the terminal takes out the third data from the fourth data and the second data, and returns the third data to the first application through an HTTP response. In this way, when the amount of data prefetched by the terminal last time is not enough to satisfy the data amount of this application, more data can be requested from the server.
  • the method before the terminal receives the third HTTP request initiated by the first application for the first URI, the method further includes: the terminal excludes the first data from the second data The remaining data outside the URI is stored in the first prefetch buffer corresponding to the first URI. If the second data includes the third data, the terminal takes out the third data from the second data, and returns the third data to the first application through an HTTP response, specifically including: if the second data Including the third data, the terminal fetches the third data from the first prefetch buffer, and returns the third data to the first application through an HTTP response. In this way, the terminal can store the multi-prefetched data in the buffer, and when the application requests data next time, the data can be returned to the application in time.
  • the method before the terminal generates the L second HTTP requests, the method further includes: the terminal determines, according to the byte range of the resource corresponding to the first URI last requested by the first application, the first 2 Byte range of data.
  • the terminal determines the byte range of the second data according to the byte range of the resource corresponding to the first URI requested by the first application last time, which specifically includes: In the byte range of the last request for the resource corresponding to the first URI, the last requested data amount and the last requested end byte position of the resource corresponding to the first URI requested by the first application last time are obtained.
  • the terminal determines that the current requested data volume is the specified multiple of the last requested data volume.
  • the terminal determines the byte range of the second data according to the data volume of the current request and the end byte position of the last request. In this way, the terminal 100 can determine the amount of data to be prefetched from the server each time.
  • the method further includes: when the last requested data volume of the specified multiple is greater than the remaining buffer capacity in the first prefetch buffer, the terminal determines that the current requested data volume is the The last requested amount of data.
  • the terminal determines the byte range of the second data according to the byte range of the resource corresponding to the first URI requested by the first application last time, which specifically includes: In the byte range of the last request for the resource corresponding to the first URI, the last requested data amount and the last requested end byte position of the resource corresponding to the first URI requested by the first application last time are obtained.
  • the terminal determines, according to the bandwidth and round-trip delay of the N available network paths, the first total bandwidth utilization rate of the N available network paths on the terminal when the requested data amount is a specified multiple of the last requested data amount, N ⁇ L , where N is a positive integer.
  • the terminal determines the specified multiple of the current requested data volume The amount of data requested last time.
  • the terminal determines the byte range of the second data according to the data volume of the current request and the end byte position of the last request.
  • the determination of the amount of data requested this time can be as follows:
  • the terminal determines that the current requested data volume is The last requested amount of data.
  • the terminal determines, according to the bandwidth and delay of the N available networks, the corresponding bandwidth when the total bandwidth utilization of the N available network paths is the specified threshold.
  • the first amount of prefetched data When the terminal determines that the first prefetched data volume is less than or equal to the remaining buffer capacity in the first prefetched buffer, the terminal determines that the current requested data volume is the first prefetched data volume.
  • the terminal determines that the first prefetched data volume is greater than the remaining buffer capacity in the first prefetched buffer.
  • the terminal is based on the bandwidth and round-trip delay of L network paths between the terminal and the server, the IP address of the server on the L network paths, and the bytes of the second data range, the L second HTTP requests are generated.
  • the terminal can determine the amount of data requested on each network path according to the network performance of each network path, thereby improving the bandwidth utilization rate of the network path and reducing the data transmission time.
  • the method further includes: acquiring, by the terminal, the initial HTTP request initiated by the first application for the first URI for the first time , the initial HTTP request is used to request the fifth data.
  • the terminal generates N fifth HTTP requests according to the byte range of the fifth data, wherein the lengths of the request ranges in the N fifth HTTP requests are the same, and N is greater than or equal to L.
  • the terminal sends the N fifth HTTP requests to the server through N available network paths respectively.
  • the terminal receives fifth data sent by the server on the N available network paths, and returns the fifth data to the first application.
  • the terminal obtains the round-trip delay and throughput on the N available network paths.
  • the terminal determines the bandwidths of the N available network paths according to the round-trip delay and throughput on the N available network paths and the data amounts respectively requested by the N fifth HTTP requests. In this way, the terminal can obtain network performance information on each network path.
  • the terminal After the terminal obtains the first HTTP request initiated by the first application for the first URI for the first time, the terminal creates the first prefetch buffer corresponding to the first URI.
  • the terminal determines the bandwidth of the N available network paths through the following formula:
  • the terminal before the terminal obtains the initial HTTP request initiated by the first application for the first URI for the first time, the terminal sends a DNS request on all network paths according to the domain name of the first URI.
  • the terminal receives N DNS responses on the N available network paths.
  • the terminal obtains, from the N DNS responses, the IP address of the server corresponding to each of the N available network paths. In this way, the terminal can obtain the IP address of the server on each network path.
  • the terminal determines the request data corresponding to each of the L network paths according to the bandwidth and round-trip delay of the L network paths between the terminal and the server, and the byte range of the second data quantity.
  • the terminal determines the respective request ranges corresponding to the L second HTTP requests according to the respective request data volumes corresponding to the L network paths and the byte range of the second data.
  • the terminal generates the L second HTTP requests according to the IP address of the server and the respective request ranges corresponding to the L second HTTP requests.
  • the terminal generates L second HTTPs according to the bandwidth and round-trip delay of L network paths between the terminal and the server, the IP address of the server on the L network paths, and the byte range of the second data Before the request, the terminal establishes a TCP connection with the server on the L network paths respectively.
  • the terminal determines the amount of requested data corresponding to each of the L network paths through the following formula:
  • M is the data volume of the second data
  • U i is used to represent the sub-request data volume corresponding to the ith network path in the L network paths
  • FCT i is used to represent the ith network in the L network paths
  • Z i is used to represent the bandwidth of the ith network path in the L network paths
  • c is a fixed value, 1 ⁇ i ⁇ L.
  • the terminal at the terminal, according to the bandwidth and round-trip delay of L network paths between the terminal and the server, the IP address of the server on the L network paths, and the bytes of the second data After the scope generates L second HTTP requests, the terminal establishes a TCP connection with the server on the L network paths respectively.
  • the terminal determines the amount of requested data corresponding to each of the L network paths through the following formula:
  • M is the data volume of the second data
  • U i is used to represent the sub-request data volume corresponding to the ith network path in the L network paths
  • FCT i is used to represent the ith network in the L network paths
  • Z i is used to represent the bandwidth of the ith network path in the L network paths
  • c is a fixed value, 1 ⁇ i ⁇ L.
  • the terminal selects the L network paths from the N available network paths.
  • the terminal when the terminal determines that the number of times the first application requests the resource corresponding to the first URI within a specified time period is greater than a specified number of times threshold, the terminal generates the above-mentioned L second HTTP requests.
  • the terminal determines that the number of times the first application requests the resource corresponding to the first URI within the specified time period is greater than the specified number of times threshold, and the first prefetch buffer corresponding to the first URI does not include
  • the terminal generates the above-mentioned L second HTTP requests.
  • the present application provides a terminal including one or more processors and one or more memories.
  • the one or more memories are coupled with one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, when the one or more processors execute the computer instructions, the terminal can execute the above A buffer management method or a data transmission method or a data storage method or a multi-path data prefetching method in any possible implementation manner of any aspect.
  • the embodiments of the present application provide a computer storage medium, including computer instructions, when the computer instructions are executed on the terminal, the terminal is made to execute the buffer management method or Data transfer method or data storage method or multi-path data prefetching method.
  • an embodiment of the present application provides a computer program product that, when the computer program product runs on a computer, enables the computer to execute the buffer management method or the data transmission method in any of the possible implementations of any of the above aspects Or data storage method or multi-path data prefetch method.
  • the present application provides a terminal, comprising: one or more functional modules, the one or more functional modules are used to execute the buffer management method or data in any possible implementation manner of any of the above aspects Transmission method or data storage method or multi-path data prefetching method.
  • FIG. 1 is a schematic diagram of a data transmission scenario provided by the first part of the embodiment of the present application
  • FIG. 2 is a schematic diagram of the relationship between a memory occupancy rate and the frequency of user interaction operations provided in the first part of the embodiment of the present application;
  • FIG. 3 is a schematic diagram of a buffer management strategy provided in the first part of the embodiment of the present application.
  • FIG. 4 is a schematic diagram of the hardware structure of a terminal provided in the first part of the embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a buffer management method provided in the first part of the embodiment of the present application.
  • FIG. 6 is a schematic diagram of the architecture of a data transmission system provided in the second part of the embodiment of the present application.
  • FIG. 7 is a schematic diagram of a buffer area of a data transmission system provided in the second part of the embodiment of the present application.
  • FIG. 8 is a schematic flowchart of a data transmission method provided in the second part of the embodiment of the present application.
  • FIG. 9 is a schematic diagram of a buffer model provided by the second part of the embodiment of the present application.
  • FIG. 10 is a schematic flowchart of a data transmission method provided in the second part of the embodiment of the present application.
  • FIG. 11 is a schematic diagram of the change of the buffer water level of the MAC layer transmission buffer provided in the second part of the embodiment of the present application.
  • Fig. 12 is the basic logic schematic diagram of the congestion control mechanism in the transmission control protocol TCP that the third part of the embodiment of the application provides;
  • FIG. 13 is a schematic diagram of the problem of the congestion control mechanism in the transmission control protocol TCP provided by the third part of the embodiment of the present application;
  • FIG. 14 is a schematic diagram of the architecture of a data storage system provided in the third part of the embodiment of the present application.
  • 15 is a schematic flowchart of a data storage method provided in the third part of the embodiment of the present application.
  • 16 is a schematic diagram of the principle of the multi-channel transmission control protocol MPTCP provided in the fourth part of the embodiment of the application;
  • FIG. 17 is a schematic diagram of the principle of the multi-path hypertext transfer protocol MPHTTP provided in the fourth part of the embodiment of the present application.
  • FIG. 18 is a schematic diagram of a system architecture of multipath transmission provided in the fourth part of the embodiment of the present application.
  • FIG. 19 is a schematic flowchart of multi-path transmission based on the multi-path hypertext transmission protocol MPHTTP provided in the fourth part of the embodiment of the present application;
  • 20 is a schematic time sequence diagram of a terminal requesting data from a server through an HTTP request provided by the fourth part of the embodiment of the present application;
  • 21 is a schematic diagram of the relationship between bandwidth utilization, fragment size, and network bandwidth provided by the fourth part of the embodiment of the present application.
  • FIG. 22A is a schematic schematic diagram of the principle of the multi-path data prefetching method provided in the fourth part of the embodiment of the present application.
  • FIG. 22B is a schematic schematic diagram of another multi-path data prefetching method provided in the fourth part of the embodiment of the present application.
  • FIG. 23 is a schematic diagram of the software architecture of the terminal provided in the fourth part of the embodiment of the present application.
  • 24 is a schematic flowchart of a method for a first application to obtain data on a server for the first time provided in the fourth part of the embodiment of this application;
  • 25 is a schematic flowchart of a method for the first application to obtain data on the server again provided in the fourth part of the embodiment of the present application;
  • 26 is a schematic flowchart of a multi-path data prefetching method provided in the fourth part of the embodiment of the present application.
  • FIG. 27 is a schematic diagram of an interaction flow of the multi-path data prefetching method provided in the fourth part of the embodiment of the present application.
  • first and second are only used for descriptive purposes, and should not be construed as implying or implying relative importance or implying the number of indicated technical features. Therefore, the features defined as “first” and “second” may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, the “multiple” The meaning is two or more.
  • the following describes a buffer management method and related content provided in the first part of the embodiment of the present application with reference to FIG. 1 to FIG. 5 .
  • sequence numbers of some nouns in the first part of the embodiments of the present application do not continue to follow the sequence of the sequence numbers of other parts of the embodiments of the present application, and the nouns in the first part of the embodiments of the present application are only used in the first part of the embodiments of the present application .
  • the channel limit rate does not match the internal processing rate of the terminal.
  • the sender transmits file data to the receiver, if the transmission is too fast, it is easy to lose data packets. If the transmission is too slow, the file transmission rate cannot approach the channel limit rate, wastes bandwidth, and cannot meet the needs of users.
  • a terminal using the universal flash storage (UFS) 3.0 standard can achieve a sequential write rate of 2.4 Gbps when idle.
  • the terminal using the universal flash storage (UFS) 2.0 standard can achieve a sequential write rate of 1.2Gbps when idle.
  • the sequential write rate of the mechanical hard disk 7200 when idle can reach 1.2Gbps.
  • the sequential write rate of a solid state disk (SSD) when idle can reach 3Gbps.
  • the channel transmission rate of the wireless local area network based on wireless fidelity (Wi-Fi) 5 for terminals equipped with 2x2 multiple-input multiple-output (MIMO) antennas can reach 1.7Gbps, based on WiFi 6
  • the channel transmission rate of the wireless local area network can reach the channel transmission rate can reach 2.4Gbps.
  • the packet sender can send file data to the packet receiver through the network.
  • the data packet receiving end can store the data packet in the buffer first, and then the data packet processing module (packet handler) of the data packet receiving end can sequentially take out the data packets from the buffer for processing, and release the buffer.
  • the storage space occupied by the fetched data in the area can be a user-mode buffer
  • the processing rate Vsrv of the data packet processing module fetching data from the user-mode buffer is related to the computing power and I/O computing power of the CPU
  • the receiving rate Vrerv of the user-mode buffer is related to channel related.
  • the capacity of the default user mode buffer is only 131Kb.
  • Vsrv is 1% less than the instantaneous rate of Vrerv, for a 1Gbps transmission link, it only takes about 0.1s for the user mode buffer to overflow from empty. All packets that overflow will have to All discarded. In this way, the sender sends data packets too fast, the packet loss rate is too high, and the sender sends data packets too slowly, which cannot meet the high-speed transmission requirements of end-to-end close-range large-bandwidth transmission scenarios.
  • FIG. 2 shows a relationship diagram between the memory occupancy rate and the frequency of user interaction operations provided in the first part of the embodiment of the present application.
  • the memory occupancy rate the ratio of the used memory to the total memory
  • FIG. 3 shows a schematic diagram of a buffer management strategy provided in the first part of the embodiment of the present application.
  • the terminal can determine which value range of the risk area, the safe area and the critical area is in the ratio of the buffer capacity of the buffer to the available memory.
  • the risk zone is greater than the first value (eg 50%)
  • the critical zone is less than or equal to the first value and greater than or equal to the second value (eg 20%)
  • the safety zone is less than the second value
  • the first value is greater than the second value .
  • the terminal can quickly apply for the buffer capacity storage space for the buffer in the available memory at one time, and then when the terminal determines that the buffer capacity of the buffer is too large, the terminal can divide more Decrease the buffer size of the buffer to the specified value.
  • the terminal can quickly apply for the buffer capacity storage space for the buffer in the available memory at one time, and then when the terminal determines that there is an interactive scene, the terminal can once Decreases the buffer capacity of the buffer to the specified value. In this way, as much storage space as possible is applied for the buffer to ensure high-speed transmission of file data, but in the case of user interaction, the storage space of the buffer can be released in time to provide the terminal with functions corresponding to user interaction. more available memory.
  • the first part of the embodiments of the present application provides a buffer management method, which can realize that in the process of receiving file data by a receiving terminal, according to the buffered data, available memory, network card receiving rate, disk writing rate, and available memory in the buffer And the frequency of receiving user interaction, adjust the size of the buffer, manage the size of the buffer in different scenarios, and apply for as much storage space as possible for the buffer. In this way, the overflow probability of the buffer during high-speed transmission of file data can be reduced, and the packet loss rate can be reduced.
  • FIG. 4 shows a schematic structural diagram of the terminal 100 .
  • the terminal 100 shown in FIG. 4 is only an example, and the terminal 100 may have more or less components than those shown in FIG. 4 , may combine two or more components, or may have Different part configurations.
  • the various components shown in FIG. 4 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
  • the terminal 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on.
  • SIM Subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light.
  • a pressure sensor 180A a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light.
  • a pressure sensor 180A a pressure sensor 180A
  • a gyroscope sensor 180B an air pressure sensor 180C
  • a magnetic sensor 180D a magnetic sensor 180D
  • an acceleration sensor 180E a distance sensor 180F
  • a proximity light sensor 180G a fingerprint sensor 180H
  • the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the terminal 100 .
  • the terminal 100 may include more or less components than shown, or some components may be combined, or some components may be separated, or different component arrangements.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait.
  • application processor application processor, AP
  • modem processor graphics processor
  • graphics processor graphics processor
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • different processing units can be independent devices, or can be integrated in one or more processors.
  • the controller may be the nerve center and command center of the terminal 100 .
  • the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transceiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the charging management module 140 is used to receive charging input from the charger.
  • the wireless communication function of the terminal 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in terminal 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 may provide a wireless communication solution including 2G/3G/4G/5G, etc. applied on the terminal 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low frequency baseband signal is processed by the baseband processor and passed to the application processor.
  • the application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 .
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the terminal 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • WLAN wireless local area networks
  • BT wireless fidelity
  • GNSS global navigation satellite system
  • frequency modulation frequency modulation, FM
  • NFC near field communication technology
  • infrared technology infrared, IR
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for
  • the antenna 1 of the terminal 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the terminal 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou navigation satellite system (beidou navigation satellite system, BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
  • global positioning system global positioning system, GPS
  • global navigation satellite system global navigation satellite system, GLONASS
  • Beidou navigation satellite system beidou navigation satellite system, BDS
  • quasi-zenith satellite system quadsi -zenith satellite system, QZSS
  • SBAS satellite based augmentation systems
  • the terminal 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • Display screen 194 is used to display images, videos, and the like.
  • Display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light).
  • LED diode AMOLED
  • flexible light-emitting diode flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on.
  • the terminal 100 may include one or N display screens 194 , where N is a positive integer greater than one.
  • the terminal 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal 100.
  • Internal memory 121 may be used to store computer executable program code, which includes instructions.
  • the processor 110 executes various functional applications and data processing of the terminal 100 by executing the instructions stored in the internal memory 121 .
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area can store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like.
  • the storage data area may store data (such as audio data, phone book, etc.) created during the use of the terminal 100 and the like.
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like.
  • the terminal 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like.
  • the audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal.
  • Speaker 170A also referred to as "speaker” is used to convert audio electrical signals into sound signals.
  • the terminal 100 can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also referred to as "earpiece” is used to convert audio electrical signals into sound signals.
  • the microphone 170C also called “microphone” or “microphone”, is used to convert sound signals into electrical signals.
  • the earphone jack 170D is used to connect wired earphones.
  • the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be provided on the display screen 194 .
  • the gyro sensor 180B may be used to determine the motion attitude of the terminal 100 .
  • the air pressure sensor 180C is used to measure air pressure.
  • the magnetic sensor 180D includes a Hall sensor.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the terminal 100 in various directions (generally three axes).
  • Distance sensor 180F for measuring distance.
  • the terminal 100 can measure the distance through infrared or laser.
  • Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the temperature sensor 180J is used to detect the temperature.
  • Touch sensor 180K also called "touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output related to touch operations may be provided through display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the terminal 100 , which is different from the position where the display screen 194 is located.
  • the bone conduction sensor 180M can acquire vibration signals.
  • the keys 190 include a power-on key, a volume key, and the like.
  • Motor 191 can generate vibrating cues.
  • the indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
  • the SIM card interface 195 is used to connect a SIM card.
  • Terminal 100 device types may include cell phones, televisions, tablet computers, speakers, watches, desktop computers, laptop computers, handheld computers, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, and personal computers
  • a digital assistant personal digital assistant, PDA
  • PDA personal digital assistant
  • AR Augmented reality
  • VR virtual reality
  • the specific type of the terminal is not particularly limited in this embodiment of the present application.
  • the first part of the embodiments of the present application introduces a buffer management method, and provides a buffer management method, including: a terminal receives data of a first file, and stores the data of the first file in a first buffer , and write the data in the first buffer to the disk.
  • the terminal monitors the amount of buffered data in the first buffer, the amount of data to be transmitted in the first file, the growth rate of buffered data in the first buffer, and the available memory capacity. If the buffered data growth rate of the first buffer is greater than 0, the terminal determines the buffered data volume of the first buffer, the to-be-transmitted data volume of the first file, the buffered data growth rate of the first buffer, and the network card reception rate according to the first buffer.
  • the terminal determines the required total capacity value of the first buffer. If the required total capacity of the first buffer is greater than or equal to the second value and less than or equal to the first value, and the remaining buffer capacity of the first buffer is less than the amount of data to be transmitted in the first file, the terminal The size of a buffer is adjusted to the required total capacity value of the first buffer, the first value being greater than the second value.
  • the buffer management method in the process of receiving file data by a terminal, it can be implemented according to the buffered data, available memory, network card receiving rate, disk writing rate, and available memory capacity of the buffer. Adjust the size of the buffer based on factors such as the frequency with which user interaction is received. In different scenarios, adjust the size of the buffer and apply for more storage space for the buffer as much as possible. In this way, the overflow probability of the buffer during high-speed transmission of file data can be reduced, and the packet loss rate can be reduced.
  • FIG. 5 shows a schematic flowchart of a buffer management method provided by an embodiment of the present application. As shown in Figure 5, the method may include:
  • the terminal 100 may establish a file transmission connection with the sending end of the first file, and set the size of the first buffer as a default value.
  • the sender of the first file may be other terminals or servers.
  • the terminal 100 may be directly connected with other terminals through Wi-Fi (for example, wireless fidelity peer to peer (Wi-Fi P2P)), Wi-Fi softAP, Communication technologies such as ultra-wideband (UWB) transmit the data of the first file.
  • Wi-Fi P2P wireless fidelity peer to peer
  • Wi-Fi softAP Wi-Fi softAP
  • Communication technologies such as ultra-wideband (UWB) transmit the data of the first file.
  • UWB ultra-wideband
  • the terminal 100 may receive the total data volume of the first file sent by the sending end.
  • the terminal 100 may set the size of the first buffer as a default value.
  • the total data volume of the first file may be 3000 megabytes (megabytes, MB), and the default value may be 20MB.
  • the terminal 100 receives the data of the first file, stores the data of the first file in the first buffer, and writes the data in the first buffer to the disk.
  • the terminal 100 may fetch the data of the first file from the first buffer and write it directly into the disk. In other embodiments, the terminal 100 may fetch the data of the first file from the first buffer indirectly through other The buffer is written to disk.
  • the terminal 100 may monitor the amount of buffered data in the first buffer, the amount of data to be transmitted in the first file, the reception rate of the network card, the growth rate of buffered data in the first buffer, and the available memory capacity.
  • the terminal 100 may periodically acquire the buffered data volume of the first buffer, the to-be-transmitted data volume of the first file, and the growth rate of the buffered data volume of the first buffer.
  • the buffered data volume of the first buffer, the to-be-transmitted data volume of the first file, the growth rate of the buffered data volume of the first buffer, and the available memory capacity are constantly changing.
  • the terminal 100 uses the buffered data volume of the buffer, the to-be-transmitted data volume of the first file, and the growth rate of the buffered data volume of the buffer, it needs to re-acquire the buffered data volume of the first buffer, the first buffer The amount of data to be transmitted of a file, the growth rate of the buffered data of the first buffer, and the available memory capacity.
  • the total memory capacity on the terminal 100 is fixed, for example, 8 gigabytes (gigabyte, GB), and the terminal 100 can monitor the occupied memory capacity. Then, the terminal 100 may determine the available memory capacity according to the total memory capacity and the occupied memory capacity. For example, the available memory capacity is the difference between the total memory capacity and the occupied memory capacity.
  • the terminal 100 determines the amount of buffered data in the first buffer (the value at this time is W1) and the amount of data to be transmitted in the first file (the value at this time is FLS1). ), the receiving rate of the network card (the value is rateNet1 at this time), the buffered data growth rate of the first buffer (the value is A1 at this time), and the required total capacity value of the first buffer is determined.
  • the terminal 100 can obtain the buffer data growth rate of the first buffer by monitoring the change of the buffer water level in the first buffer.
  • the terminal 100 may monitor the receiving rate of the network card and the disk writing rate of the first file.
  • the terminal 100 may determine the growth rate of the buffered data of the first buffer according to the receiving rate of the network card and the disk writing rate of the first file.
  • the buffer data growth rate of the first buffer may be the difference between the receiving rate of the network card and the disk writing rate of the first file.
  • the receiving rate of the network card may be 100 megabytes per second (megabytes per second, MBps)
  • the disk writing rate of the first file may be 90 MBps
  • the terminal 100 may determine the buffer data growth rate of the first buffer. 10MBps.
  • the examples are only used to explain the application and should not be construed as limitations.
  • the terminal 100 determines the required total capacity value of the first buffer zone by the following formula:
  • H is the required total capacity value of the first buffer
  • W can refer to the buffered data volume of the first buffer
  • A can refer to the buffered data growth rate of the first buffer
  • FLS refers to the amount of data to be transmitted in the first file
  • rateNet can refer to the network card receiving rate.
  • the value of the buffered data volume of the first buffer zone is measured to be W1
  • the value of the buffered data growth rate of the first buffer zone can be A1
  • the value of the data volume to be transmitted of the first file is FLS1
  • the value of the network card receiving rate is rateNet1.
  • the conservative coefficient c may be 0.8
  • the value W1 of the buffered data amount of the first buffer may be 12.5MB
  • the value A1 of the growth rate of the buffered data of the first buffer may be 17MBps
  • the value of the first file to be transmitted may be 17MBps.
  • the value of the data volume FLS1 can be 2000MB
  • the value of the network card receiving rate rateNet1 can be 200MBps. Therefore, the terminal 100 can determine that the required total capacity value H of the first buffer zone is 200MB through the above formula (1).
  • the terminal 100 determines whether the ratio of the required total capacity value of the first buffer to the available memory capacity (R1 in this case) on the terminal 100 is smaller than the second value.
  • the value of the available memory capacity on the terminal 100 may be measured as R1.
  • the second value may be 0.2.
  • the terminal 100 can immediately adjust the size of the first buffer to the required total capacity value.
  • the second value may be 0.2
  • the terminal 100 may determine that the required total capacity value of the first buffer is 200MB.
  • the value R1 of the available memory capacity may be 2000MB
  • the required total capacity value is related to the available memory.
  • the ratio of capacity may be 0.1 (less than 0.2). Therefore, the terminal 100 may set the size of the first buffer to 200MB, that is, the terminal 100 applies for 200MB of storage space for the first buffer from the available memory.
  • the terminal 100 can determine whether the buffered data growth rate of the buffer is less than or equal to 0, and if so, execute S508, and the terminal 100 can slowly reduce the size of the first buffer.
  • the terminal 100 immediately adjusts the size of the first buffer to the required total After the capacity value, the terminal 100 can periodically (for example, the period can be 2ms) determine whether the buffered data growth rate of the first buffer is less than or equal to 0, if so, the terminal 100 can slowly reduce the size of the first buffer; if not, Then the terminal 100 can perform the above step S504 again.
  • the terminal 100 can periodically (for example, the period can be 2ms) determine whether the buffered data growth rate of the first buffer is less than or equal to 0, if so, the terminal 100 can slowly reduce the size of the first buffer; if not, Then the terminal 100 can perform the above step S504 again.
  • the terminal 100 slowly reducing the size of the first buffer may include, when the terminal 100 determines that the buffered data growth rate of the first buffer is less than or equal to 0 each time, reducing the size of the first buffer Decrease the specified capacity.
  • the terminal 100 determines that the required total capacity value of the first buffer may be 200MB, and at this time, the value R1 of the available memory capacity may be 2000MB, and the terminal 100 applies for the first buffer from the available memory to 200MB. storage. After that, the terminal 100 periodically determines whether the growth rate of the buffered data of the first buffer is less than or equal to 0, and each time the terminal 100 determines that the growth rate of the buffered data of the first buffer is less than or equal to 0, the size of the first buffer may be Decrease 10MB, that is, release 10MB of storage space of the first buffer each time.
  • the examples are only used to explain the application and should not be construed as limitations.
  • the terminal 100 determines that the ratio of the required total capacity value of the first buffer to the available memory capacity on the terminal 100 is greater than or equal to the second value, the terminal 100 can determine that the required buffer capacity of the first buffer is equal to the available memory on the terminal 100. Whether the ratio of memory capacity is greater than the first value.
  • the terminal 100 may determine whether the remaining buffer capacity of the first buffer is smaller than the data to be transmitted of the first file quantity.
  • the terminal 100 may set the size of the first buffer to the first buffer capacity, the ratio of the first buffer capacity to the available memory capacity is the first value.
  • the first value (eg, 0.5) is greater than the second value (eg, 0.2).
  • the first value may be 0.5
  • the terminal 100 may determine that the required total capacity of the first buffer is 200MB.
  • the value R1 of the available memory capacity may be 300MB
  • the value of FLS1 is 2000MB
  • the value P1 of the remaining buffer capacity of the first buffer zone is 7.5MB
  • the terminal 100 can determine that the ratio of the required total capacity value of the first buffer zone to the available memory capacity can be 2/3 (greater than 0.5)
  • the remaining buffer capacity of the first buffer is less than the amount of data to be transmitted of the first file
  • the first buffer capacity is 150MB.
  • the terminal 100 may immediately adjust the size of the first buffer to 150MB.
  • the terminal 100 may set the size of the first buffer to the required size total capacity value.
  • the first value may be 0.5
  • the second value may be 0.2
  • the terminal 100 may determine that the required total capacity of the first buffer is 200MB, and at this time, the value R1 of the available memory capacity may be 500MB, and the terminal 100 It can be determined that the ratio of the required total capacity value of the first buffer to the available memory capacity can be 0.4 (greater than or equal to 0.2 and less than or equal to 0.5).
  • the terminal 100 may immediately adjust the size of the first buffer to 200MB.
  • the terminal 100 can determine that the Whether the number of user input is greater than the number of times threshold.
  • the user input may include one or more of touch input for a touch screen, input for physical keys, voice input, and the like.
  • the length of the specified time period may refer to a certain period of time (for example, 3 seconds) after the terminal 100 receives a certain user input. For example, when the terminal 100 receives continuous input from the user, the terminal 100 can determine whether there are 3 seconds in the continuous input. The number of times the terminal 100 receives user input is greater than 5 times within the time period.
  • the terminal 100 can determine whether the amount of buffered data in the first buffer is less than or equal to the second buffer capacity, where the second buffer capacity and The ratio of the available memory capacity (R2 in this case) is the second value.
  • the terminal 100 can use the second buffer capacity and the amount of buffered data in the first buffer (W2 at this time) , the amount of data to be transmitted in the first file (in this case, FLS2) and the buffered data growth rate in the first buffer (in this case, A2) to determine the safe sending rate.
  • the terminal 100 may send the first rate information to the sending end of the first file, to instruct the sending end to immediately adjust the sending rate of the first file to a safe sending rate.
  • the terminal 100 When the threshold for the number of times the terminal 100 receives user input within the specified time period is greater than the threshold for the number of times, and the value W2 of the buffered data amount in the first buffer is less than or equal to the second buffer capacity, the terminal 100 The amount of buffered data in a buffer (this time is W2), the amount of data to be transmitted in the first file (this time is FLS2) and the growth rate of the buffered data volume of the first buffer (this time is A2), determine out the safe sending rate.
  • the terminal 100 can determine the safe transmission rate according to the following formula (2).
  • c is a conservative coefficient, in order to prevent the first buffer from overflowing, c ⁇ 1 can be set, so that the terminal 100 can predict the overflow time ratio of the first buffer The actual overflow time is advanced.
  • X1 is the second buffer capacity
  • W2 is the amount of buffered data in the first buffer
  • A2 is the growth rate of the buffered data in the first buffer
  • FLS2 is the amount of data to be transmitted in the first file
  • V1 can be the safe sending rate.
  • the terminal 100 may monitor the receiving rate of the network card and the disk writing rate of the first file.
  • the terminal 100 may determine the growth rate of the buffered data of the first buffer according to the receiving rate of the network card and the disk writing rate of the first file. Therefore, the above formula (2) can be replaced by the following formula (3):
  • rateIO1 is the disk write rate of the first file.
  • the above formula (3) is only used to explain the present application and should not be construed as a limitation.
  • the number of times the threshold is 5, the threshold of the number of times the terminal 100 receives user input within a specified time period is 8, c may be 0.8, the value W2 of the buffered data amount of the first buffer may be 100MB, and the available memory is 100MB.
  • the value R2 of the capacity may be 1000MB, the second value may be 0.2, the value FLS2 of the amount of data to be transmitted of the first file may be 1000MB, and the disk write rate rateIO1 may be 180MBps.
  • the terminal 100 may determine that the second buffer capacity may be 200MB.
  • the threshold for the number of times the user input is received within the specified time period is greater than the threshold for the number of times and the amount of buffered data in the first buffer is smaller than the second buffer capacity. Therefore, the terminal 100 can determine that the safe transmission rate V1 is 195.65MBps.
  • the terminal 100 may send the first rate information to the sending end of the first file.
  • the first rate information is used to instruct the sender to immediately adjust the sending rate of the first file to the safe sending rate.
  • the terminal 100 receives the confirmation information returned by the sender, and in response to the confirmation information, sets the size of the first buffer to the second buffer capacity (the value is X1).
  • the sending end may send confirmation information to the terminal 100 after immediately adjusting the sending rate of the first file to the above-mentioned safe sending rate.
  • the terminal 100 may set the size of the first buffer to the second buffer capacity (the value is X1) in response to the confirmation.
  • the terminal 100 can send the second rate information to the sender of the first file, the second rate The information is used to instruct the sender to adjust the sending rate of the first file to be less than or equal to the rate threshold.
  • the terminal 100 may determine whether the buffered data volume of the first buffer is smaller than the second buffer capacity. If so, in S520, the terminal 100 immediately adjusts the size of the first buffer to the second buffer capacity (the value at this time is X2).
  • the sender may reduce the sending rate of the first file according to the second rate information. In this way, the amount of buffered data in the first buffer on the terminal 100 will gradually decrease.
  • the terminal 100 may always monitor whether the amount of buffered data in the first buffer is less than the second buffer capacity. When the amount of buffered data in the first buffer is smaller than the second buffer capacity, the terminal 100 may immediately adjust the size of the first buffer to the second buffer capacity (the value at this time is X2).
  • the terminal 100 determines the remaining buffer capacity of the first buffer, the buffered data volume of the first buffer (the value is W3 at this time), The amount of data to be transmitted in the first file (in this case, FLS3) and the growth rate of the buffered data amount in the first buffer area (in this case, the value is A3), determine the safe sending rate.
  • the terminal 100 sends first rate information to the sender of the first file, where the first rate information is used to instruct the sender to immediately adjust the sending rate of the first file to a safe sending rate.
  • the terminal 100 may determine the safe transmission rate according to the following formula (4).
  • c is a conservative coefficient, in order to prevent the first buffer from overflowing, c ⁇ 1 can be set, so that the terminal 100 can predict the overflow time ratio of the first buffer The actual overflow time is advanced.
  • X2 is the second buffer capacity
  • W3 is the amount of buffered data in the first buffer
  • A3 is the growth rate of the buffered data in the first buffer
  • FLS3 is the amount of data to be transmitted in the first file
  • V2 can be the safe sending rate.
  • the terminal 100 may monitor the receiving rate of the network card and the disk writing rate of the first file.
  • the terminal 100 may determine the growth rate of the buffered data of the first buffer according to the receiving rate of the network card and the disk writing rate of the first file. Therefore, the above formula (4) can be replaced by the following formula (5):
  • rateIO2 is the disk write rate of the first file.
  • the above formula (5) is only used to explain the present application, and should not be construed as a limitation.
  • the value P of the remaining buffer capacity of the first buffer may be 100MB
  • the value FLS3 of the amount of data to be transmitted of the first file may be 800MB
  • the disk write rate rateIO2 can be 150MBps. Therefore, the terminal 100 can determine that the safe transmission rate V2 is 166.67MBps.
  • the terminal 100 may send the first rate information to the sending end of the first file.
  • the first rate information is used to instruct the sender to adjust the sending rate of the first file to the safe sending rate.
  • the terminal 100 may immediately adjust the size of the first buffer to the third buffer capacity, wherein the ratio of the third buffer capacity to the available memory capacity is a third value, and the third value is greater than the first value and greater than the second value.
  • the terminal 100 may perform the above step S513 again.
  • the above-mentioned specified ratio value may be 0.1
  • the total data volume of the first file may be 3000MB
  • the to-be-transmitted data volume of the first file may be 100MB
  • the third value may be 0.8
  • the available memory capacity may be 1000MB.
  • the terminal 100 can determine that the ratio of the data volume of the first file to be transmitted to the total data volume of the first file is 0.03 (less than 0.1), and the terminal 100 can immediately adjust the size of the first buffer to 800MB. After the terminal 100 adjusts the size of the first buffer to 800MB for 3 seconds, and the amount of data to be transmitted in the first file is still greater than 0, the terminal 100 may perform the above step S513 again.
  • the above examples are only used to explain the present application and should not be construed as limitations.
  • Embodiment 1 of the present application provides a buffer management method, which can realize that in the process of receiving file data by a terminal, according to factors such as buffered data in the buffer, available memory, network card reception rate, disk write rate, available memory capacity and other factors, and Adjust the size of the buffer to the frequency of user interaction. In different scenarios, adjust the size of the buffer and apply for more storage space for the buffer as much as possible. In this way, the overflow probability of the buffer during high-speed transmission of file data can be reduced, and the packet loss rate can be reduced.
  • sequence numbers of some terms in the second part of the embodiments of the present application do not continue to follow the sequence of the sequence numbers of other parts of the embodiments of the present application, and the nouns in the second part of the embodiments of the present application are only used in the second part of the embodiments of the present application. used in part.
  • the second part of the embodiments of the present application provides a data transmission method, including: establishing a file transmission connection between a first terminal and a second terminal, and the file transmission connection is used to transmit a first file.
  • the first terminal acquires the upper limit of the transmission rate of the physical layer of the network card.
  • the first terminal determines the first rate according to the upper limit of the transmission rate of the physical layer.
  • the first terminal writes the first data of the first file to the MAC layer sending buffer qdisk_buffer at the first rate, and sends the first data of the first file in the MAC layer sending buffer to the MAC layer through the network card second terminal.
  • the first terminal When the first terminal determines that the buffered data volume of the MAC layer sending buffer is greater than or equal to the first warning water level, the first terminal writes the second data of the first file to the MAC layer sending buffer at the second rate. data, and send the second data of the first file in the MAC layer sending buffer to the second terminal through the network card, wherein the first rate is greater than the second rate.
  • the buffer capacity and the first warning water level of the MAC layer sending buffer (qdisk_buffer) of the sending end 210 can be set, and the buffer is sent according to the MAC layer.
  • the buffered data volume of (qdisk_buffer) determines the sending rate of the data written by the sending end 210 into the first file to the MAC layer sending buffer, so that the file transmission speed is close to the limit rate of the physical channel and the packet loss rate is reduced.
  • FIG. 6 shows a schematic diagram of the architecture of the system 20 .
  • the system 20 includes a sending terminal 210 and a receiving terminal 220 .
  • the file data may be transmitted point-to-point between the sending terminal 210 and the receiving terminal 220 through a wireless network.
  • the sending terminal 210 and the receiving terminal 220 may be directly connected through Wi-Fi (for example, wireless fidelity peer to peer (Wi-Fi P2P)), Wi-Fi softAP, ultra-wideband (UWB) ) and other communication technologies to transmit file data.
  • Wi-Fi P2P wireless fidelity peer to peer
  • Wi-Fi softAP for example, Wi-Fi softAP, ultra-wideband (UWB)
  • UWB ultra-wideband
  • the device types of the transmitting terminal 210 and the receiving terminal 220 may include mobile phones, televisions, tablet computers, speakers, watches, desktop computers, laptop computers, handheld computers, notebook computers, ultra-mobile personal computers (UMPCs) ), netbooks, and personal digital assistants (personal digital assistants, PDAs), augmented reality (Augmented reality, AR) ⁇ virtual reality (virtual reality, VR) devices, etc., the specific types of terminals are not particularly limited in this embodiment of the present application.
  • FIG. 7 shows an architecture diagram of a data transmission system 400 provided in the second part of the embodiment of the present application.
  • the data transmission system 400 may include a sending terminal 210 and a receiving terminal 220 .
  • the sending terminal 210 may be referred to as a first terminal
  • the receiving terminal 220 may be referred to as a second terminal.
  • the software systems on the sending terminal 210 and the receiving terminal 220 may adopt a layered architecture, and the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
  • the software systems of the sending terminal 210 and the receiving terminal 220 may include user mode, kernel mode, and hardware layer.
  • the user mode may include an application layer and a minimalist protocol layer.
  • the kernel state may include a socket (Socket) abstraction layer, a user data protocol layer (UDP layer)/network layer (IP layer), and a MAC layer.
  • the hardware layer may include a network interface controller (NIC).
  • the application layer of the transmitting terminal 210 may include one or more applications.
  • the application 211 may be a data sharing application such as huawei share.
  • the minimalist protocol layer of the sending terminal 210 may include a sending rate scheduling module 212 and a read buffer (read_buffer) 213 .
  • the read buffer 213 may be used to buffer the file data read from the disk into the memory by the sending terminal 210 .
  • the sending rate scheduling module 212 can be used to set the buffer capacity and the warning water level of the designated one or more buffers (eg, the MAC layer sending buffer 215 ) in the sending terminal 210 .
  • the sending rate scheduling module 212 may also be configured to adjust the MAC according to the buffer watermark of one or more buffers in the sending terminal 210 (eg, the MAC layer sending buffer 215) and the buffering information sent by the sending rate feedback module 222 on the receiving terminal 220.
  • the buffer information may be used to indicate the buffer watermark of one or more buffers (eg, the write buffer 223 and the MAC layer receive buffer 226 ) on the receiving terminal 220 .
  • the socket abstraction layer of the sending terminal 210 may include a socket send buffer (socket_send_buffer) 214 .
  • the socket sending buffer 214 can be used to buffer the data written to the corresponding socket by the process of the application 211 in the sending terminal 210 .
  • the UDP layer/IP layer of the sending terminal 210 may encapsulate the file data delivered by the socket abstraction layer into data packets (eg, UDP data packets or IP data packets), and deliver the data packets to the MAC layer.
  • data packets eg, UDP data packets or IP data packets
  • the MAC layer of the sending terminal 210 may include a MAC layer sending buffer (qdisk_buffer) 215 .
  • the MAC layer sending buffer 215 can be used to buffer data packets (eg, UDP data packets/IP data packets) delivered by the UDP layer/IP layer.
  • the MAC layer can be used to sequentially take out data packets from the MAC layer sending buffer 215, encapsulate them into MAC data frames and send them to the network card.
  • the network card of the sending terminal 210 may include a network card sending buffer 216, and the buffer type of the network card sending buffer 216 may be a ring buffer (ring_buffer).
  • the network card sending buffer 216 can be used to buffer the MAC data packets delivered by the MAC layer.
  • the network card of the sending terminal 210 can be used to sequentially take out MAC data frames from the network card sending buffer 216, convert them into physical frames, and send them to the receiving terminal 220 point-to-point through the wireless network.
  • the application layer of the receiving terminal 220 may include one or more applications.
  • the application 221 may be a data sharing application such as Huawei Share.
  • the minimalist protocol layer of the receiving terminal 220 may include a sending rate feedback module 222 and a write buffer (write_buffer) 223 .
  • the write buffer 223 can be used to buffer the file data retrieved from the socket receive buffer 224 by the receiving terminal 220, and the receiving terminal 220 can sequentially retrieve the file data from the write buffer 223 and write it to the disk.
  • the sending rate feedback module 222 can be used to set the buffer capacity and the warning watermark of one or more buffers (eg, the write buffer 223 and the MAC layer receive buffer 226 ) on the receiving terminal 220 .
  • the sending rate feedback module 222 is further configured to acquire the buffer information of the one or more buffers of the receiving terminal 220 and send it to the sending rate scheduling module 212 of the sending terminal 210 .
  • the buffer information may be used to indicate the buffer watermark of one or more buffers (eg, the write buffer 223 and the MAC layer receive buffer 226 ) on the receiving terminal 220 .
  • the socket abstraction layer of the receiving terminal 220 may include a socket receive buffer (socket_receive_buffer) 224 .
  • the socket receiving buffer 224 can be used to buffer the file data reported by the UDP layer/IP layer.
  • the receiving terminal 220 may copy the file data from the socket receive buffer 224 to the write buffer 223 .
  • the UDP layer/IP layer of the receiving terminal 220 may include an IP fragmentation reassembly buffer (ip_defrag_buffer) 225 .
  • the IP data packets can be sequentially stored in the IP fragmentation and reassembly buffer 225, and then the receiving terminal 220 can sequentially store the IP data packets from the IP fragmentation and reassembly buffer 225.
  • the IP data packet is taken out and reassembled into a reassembled data packet according to the fragmentation, and is placed in the socket receiving buffer 224 after the logical processing of the UDP layer/IP layer is performed on the reassembled data packet.
  • the MAC layer of the receiving terminal 220 may include a MAC layer receive buffer (netdev_backlog_buffer) 226 .
  • the MAC layer receive buffer 226 can be used to buffer the MAC data packets obtained from the network card.
  • the receiving terminal 220 can sequentially take out the MAC data frames from the MAC layer receiving buffer 226, perform logical processing of the MAC layer, and report the UDP data packets/IP data packets obtained after processing to the UDP layer/IP layer.
  • the network card of the receiving terminal 220 may include a network card receiving buffer 227 .
  • the buffer type of the network card receiving buffer 227 may be a ring buffer (ring_buffer).
  • the network card receiving buffer 227 can be used to buffer the MAC data frame parsed by the receiving terminal 220 from the received physical frame.
  • the receiving terminal 220 can sequentially take out the MAC data frames from the network card receiving buffer 227, and perform logical processing at the MAC layer to parse out the UDP data packets/IP data packets.
  • the software workflow of the sending terminal 210 and the receiving terminal 220 is exemplarily described below with reference to a file transfer scenario.
  • the sending rate scheduling module 212 may set the buffer capacity of the multiple buffers on the sending terminal 210 .
  • the sending rate scheduling module 212 may set the buffer capacity and the warning water level of the MAC layer sending buffer 215 according to the maximum transmission rate of the physical channel and the round-trip transmission delay.
  • the sending rate feedback module 222 can set the buffer capacity of the multiple buffers on the receiving terminal 220 . Wherein, the sending rate feedback module 222 can set the buffer capacity and the warning water level of the MAC layer sending buffer 215 and the writing buffer 223 according to the maximum transmission rate of the physical channel and the round-trip delay.
  • the application 211 of the sending terminal 210 can issue a file sending request for the first file to the minimalist protocol layer, and request the minimalist protocol layer to read the first file from the disk (ie, read only memory (ROM)) to the read buffer 213, and then copy the file data from the read buffer 213 to the socket send buffer 214.
  • the application 211 calls the interface send_file( ) through the file sending, and calls the minimalist protocol layer to read the file data from the disk into the read buffer 213 .
  • the minimalist protocol layer of the sending terminal 210 can copy the file data in the read buffer 213 to the socket send buffer 214 by calling the socket sending interface socket_sendto().
  • the socket abstraction layer of the sending terminal 210 can call the UDP data packet sending interface (for example, udp_sendmsg( )), and extract the file data from the socket sending buffer 214 and deliver it to the UDP layer.
  • the UDP data packet sending interface for example, udp_sendmsg( )
  • the UDP layer of the sending terminal 210 can encapsulate the file data into UDP data packets, and call the IP data packet sending interface (for example, ip_queue_xmit()), trigger the IP layer to set routes, create IP protocol headers and IP options, and encapsulate the UDP data packets into IP packets.
  • the IP layer can deliver the IP data packet to the MAC layer sending buffer 215 .
  • the transmission between the sending terminal 210 and the receiving terminal 220 is close-range end-to-end transmission, the data transmission between the sending terminal 210 and the receiving terminal 220 does not need to select a route.
  • the sending terminal 210 may include the UDP layer, but not the IP layer. After the UDP layer of the sending terminal 210 can encapsulate the file data into a UDP data packet, it can be directly sent to the sending buffer 215 of the MAC layer.
  • the MAC layer of the sending terminal 210 can take out data packets (for example, UDP data packets or IP data packets) from the MAC layer send buffer 215, encapsulate them into MAC data packets, and call the network card sending interface (for example, hard_start_xmit() or net_tx_action( )) sends the MAC data packet to the network card sending buffer 216 in the network card.
  • data packets for example, UDP data packets or IP data packets
  • IP data packets for example, IP data packets
  • the network card sending interface for example, hard_start_xmit() or net_tx_action( )
  • the network card of the sending terminal 210 can take out the MAC data packet from the network card sending buffer 216 , encapsulate it into a data frame and send it to the receiving terminal 220 .
  • the network card of the receiving terminal 220 After the network card of the receiving terminal 220 receives the data frame sent by the sending terminal 210, it may be stored in the network card receiving buffer 227 first.
  • the network card of the receiving terminal 220 can parse the MAC data packet from the data frame, and send the MAC data packet to the MAC layer receiving buffer 226 through the network card receiving interface (eg, net_rx_action() or netif_receive_skb()).
  • the MAC layer of the receiving terminal 220 can take out the MAC data packet from the MAC layer receiving buffer 226, parse the IP data packet from the MAC data packet, and then convert the IP data packet by calling the IP data packet receiving interface (for example, ip_rcv()). sent to the IP layer.
  • the IP data packet receiving interface for example, ip_rcv()
  • the IP layer of the receiving terminal 220 can first store the IP data packets obtained from the MAC layer in the IP fragmentation reassembly buffer 225, and then the IP layer can take out the IP data packets from the IP fragmentation reassembly buffer 225, and store the IP data packets belonging to the same fragment.
  • the IP data packet is reassembled into a UDP data packet and sent to the UDP layer.
  • the UDP layer of the receiving terminal 220 can parse the file data from the UDP data packet, and send the file data to the socket receiving buffer 224 of the socket abstraction layer by calling the UDP receiving interface (for example, udp_rcv()). .
  • the socket abstraction layer of the receiving terminal 220 may copy the file data in the socket receive buffer 224 to the write buffer 223 of the minimalist protocol layer.
  • the application 221 of the receiving terminal 220 can retrieve the file data from the write buffer 223 by calling the file writing interface (for example, write_file( )), and write it into the disk of the receiving terminal 220 .
  • the file writing interface for example, write_file( )
  • the sending terminal 210 and the receiving terminal 220 at least three types of physical storage media may be included: disk (ie, ROM), running memory (ie, random access memory (random access memory, RAM)) , network card storage.
  • the disk can still retain data after a power failure, and can be used to save file data such as documents, pictures, music, and videos.
  • Runtime memory can be used for temporary data generated by the operating system and applications while they are running.
  • the network card may include a memory, which can be used to temporarily store data frames to be sent or received.
  • the read buffer 213 , the socket sending buffer 214 , and the MAC layer sending buffer 215 on the sending terminal 210 are established on the running memory of the sending terminal 210 .
  • the network card sending buffer 216 on the sending terminal 210 is established on the network card of the sending terminal 211 .
  • the write buffer 223 , the socket receive buffer 224 , the IP fragmentation reassembly buffer 225 and the MAC layer receive buffer 226 of the receiving terminal 220 are established on the receiving terminal 220 .
  • the network card receiving buffer 227 of the receiving terminal 220 is established on the network card of the receiving terminal 220 .
  • the data transmission rate between two buffers in the same physical storage medium is relatively fast, which is higher than the maximum transmission rate of the physical channel.
  • the data fetch rate from the socket sending buffer 214 in the sending terminal 210 can reach the maximum transmission rate of the physical channel.
  • the data processing rate of the UDP layer/IP layer of the sending terminal 210 can also reach the maximum transmission rate of the physical channel.
  • the data fetch rate from the socket receive buffer 224 in the receiving terminal 220 can reach the maximum transmission rate of the physical channel.
  • the IP layer of the sending terminal 210 adopts IP fragmentation transmission
  • the IP layer of the receiving terminal 220 needs to integrate the received IP data packet into a data packet according to the sequence number of the IP data packet, and then the receiving terminal 220 must wait for Only after all IP data packets within a sequence number range are received can they be integrated into one data packet in sequence.
  • the time sequence in which the receiving terminal 220 receives the IP data packets is not exactly the same as the sequence number sequence of the IP data packets. Therefore, the receiving terminal 220 will spend a long time waiting for all the IP data packets within a sequence number range. If there are missing IP data packets in multiple sequence number ranges, the IP layer cannot timely transfer the multiple IP data packets within each sequence number range. Reassembly into data packets may easily cause an overflow of IP fragmentation reassembly buffer (ip_defrag_buffer) 225.
  • ip_defrag_buffer IP fragmentation reassembly buffer
  • the data transfer rate between two buffers in different physical storage media is mainly affected by CPU computing power and I/O computing power.
  • the backlog of data in the sending buffer 215 of the MAC layer on the sending terminal 210 is affected by the channel capacity and the computing power of the CPU of the sending terminal 210, and the rate at which the data in the sending buffer 215 of the MAC layer is taken out is mainly affected by the network card Limited, and secondarily limited by the CPU soft interrupt load.
  • the CPU computing power of the receiving terminal 220 will affect the rate at which the kernel state retrieves data from the network card and puts it into the MAC layer receiving buffer 226. Therefore, the backlog of data in the MAC layer receiving buffer 226 will be affected by the CPU computing power of the receiving terminal 220. Impact.
  • the I/O computing power of the receiving terminal 220 will affect the rate at which data is fetched from the write buffer 223 and written to the disk.
  • the MAC layer sending buffer (qdisk_buffer) 215, the MAC layer receiving buffer (netdev_backlog_buffer) 226, the IP fragmentation reassembly buffer (ip_defrag_buffer) 225, and the write buffer (write_buffer) 223 may be used.
  • the sending rate feedback module 222 in the receiving terminal 220 may feed back the buffer water level of the MAC layer receive buffer 226 and the buffer water level of the write buffer 223 to the receiving terminal 220.
  • the sending rate scheduling module 212 of the sending terminal 210 may also obtain the buffer watermark of the MAC layer sending buffer 215 .
  • the sending rate scheduling module 212 may control the rate at which the sending terminal 210 writes the file data to the MAC layer sending buffer 215 according to the watermarks of the one or more buffers.
  • the sending terminal 210 writes the file data into the MAC layer sending buffer 215 at the network card limit rate (eg, 90% of the physical negotiation rate), and buffers the MAC layer sending
  • the file data in the area 215 is delivered to the network card, and the receiving terminal 220 is sent through the network card.
  • the sending terminal 210 may reduce the rate at which file data is written to the MAC layer send buffer 215 (eg, 10% of the upper limit of the physical layer send rate), After the contents in the one or more buffers have been digested, the sending terminal 210 resumes reading the file data from the fuselage storage to the read buffer at the limit rate of the network card (for example, 90% of the upper limit of the sending rate of the physical layer). District 213. In this way, the transmission speed of the file can be achieved close to the physical channel limit and the packet loss rate can be reduced.
  • the rate at which file data is written to the MAC layer send buffer 215 eg, 10% of the upper limit of the physical layer send rate
  • the sending terminal 210 resumes reading the file data from the fuselage storage to the read buffer at the limit rate of the network card (for example, 90% of the upper limit of the sending rate of the physical layer). District 213. In this way, the transmission speed of the file can be achieved close to the physical channel limit and the packet loss rate can be reduced.
  • FIG. 8 shows a schematic flowchart of a data transmission method provided in the second part of the embodiment of the present application.
  • the sending terminal 210 may be referred to as the first terminal, and the receiving terminal 220 may be referred to as the second terminal.
  • the method may include the following steps:
  • the sending terminal 210 obtains a transmission request for the first file.
  • the first file may be a file of types such as pictures, videos, documents, and the like.
  • the first file may be stored in the body storage of the sending terminal 210 .
  • the sending terminal 210 may obtain a transmission request for the first file input by the user, and the transmission request may include the storage address of the first file and address information (eg, IP address or MAC address, etc.) of the receiving terminal 220 .
  • address information eg, IP address or MAC address, etc.
  • the user may open a sharing interface for video files on the sending terminal 210 , and the sharing interface may include options for one or more devices discovered by the sending terminal 210 , wherein the one or more devices may include the receiving terminal 220 .
  • the sending terminal 210 may acquire a transmission request for the video file.
  • the sending terminal 210 establishes a file transmission connection with the receiving terminal 220 .
  • the sending terminal 210 may establish a file transmission connection with the receiving terminal 220 according to the address information of the receiving terminal 220 .
  • the file transfer connection may include Wi-Fi direct connection (for example, Wi-Fi P2P), Wi-Fi softAP, ultra wide band (UWB), Bluetooth and other communication connections.
  • the sending terminal 210 obtains the upper limit Vmax of the transmission rate of the physical layer and the feedback time Ts of the MAC layer.
  • the upper limit Vmax of the transmission rate of the physical layer may be preset on the transmission terminal 210 .
  • the upper limit Vmax of the physical layer transmission rate may be 1Gbps.
  • the transmitting terminal 210 and the receiving terminal 220 are configured with 2x2 MIMO antennas, and the connection network between the transmitting terminal 210 and the receiving terminal 220 is a wireless local area network based on Wi-Fi 6, the upper limit Vmax of the physical layer transmission rate may be 2.4Gbps .
  • the sending terminal 210 may negotiate with the receiving terminal 220 the upper limit Vmax of the physical layer sending rate of the sending terminal 210's network card.
  • the MAC layer of the sending terminal 210 may report the measurement data packet to the sending rate scheduling module of the upper layer.
  • the measurement data packet includes the time when the MAC layer reports the measurement data packet, and the transmission rate scheduling module of the sending terminal 210 may record the time when the measurement data packet is acquired after acquiring the measurement data packet.
  • the sending terminal 210 may determine the feedback time Ts of the MAC layer according to the time when the MAC layer reports the measurement data packet and the time when the first terminal obtains the measurement data packet.
  • the sending terminal 210 determines the buffer capacity of the sending buffer of the MAC layer and the first warning water level according to the upper limit Vmax of the sending rate of the physical layer and the feedback time Ts of the MAC layer.
  • the buffer may be the above-mentioned MAC layer sending buffer, the MAC layer receiving buffer on the receiving terminal 220 , the IP fragmentation reassembly buffer ip_defrag_buffer on the receiving terminal 220 , and the write buffer on the receiving terminal 220 An abstract model for any of the buffers in .
  • the total capacity of the MAC buffer may be M, and the first warning water level may be A*M. Therefore, when the buffer water level in the buffer is at the first warning water level, the remaining capacity of the buffer is (1- A)*M. where 0 ⁇ A ⁇ 1.
  • the MAC layer of the sending terminal 210 needs to report the first indication information to the sending rate scheduling module of the upper layer, so that the sending rate scheduling module of the upper layer can reduce the rate at which the data of the first file is written into the sending buffer of the MAC layer .
  • the maximum time this process takes is Ts. If the amount of buffered data in the buffer reaches the first warning water level A*M at time t, and the amount of buffered data continues to decrease at time t+ ⁇ t, it is necessary to ensure that the MAC layer gives the sending rate scheduling module an erroneous feedback ( It takes 0.5RTT), and readjusts back to the normal sending rate (it takes Ts again).
  • the sending terminal 210 can determine the buffer capacity and the warning water level of the MAC layer sending buffer by the following formulas (6) and (7) according to the upper limit Vmax of the physical layer transmission rate and the feedback time Ts of the MAC layer.
  • the buffer capacity M of the buffer should satisfy the minimum value in the range defined by the above formula (6) and formula (7).
  • Vmax may be 2.4Gbps (300MB/s)
  • Ts may be 2ms
  • the unit of the buffer capacity of the buffer may be the number of data packets with the maximum length, and the buffer is calculated in megabytes (MB) according to the above formula (6) and formula (7). ) as the unit of buffer capacity, it can be converted according to the maximum length of the data packet to obtain the buffer capacity of the buffer in the unit of the number of data packets. For example, if M is 1.2MB, and the maximum size of a data packet can be 1500 bytes (Byte), the buffer capacity of the buffer is 800 data packets.
  • the first warning water level may be preset, and the sending terminal 210 may determine the buffer capacity of the MAC layer buffer according to the above formula (6) and formula (7).
  • the buffer capacity of the MAC layer buffer may be preset, and the sending terminal 210 may determine the first warning water level according to the above formula (6) and formula (7).
  • the sending terminal 210 After the sending terminal 210 has set the buffer capacity of the MAC layer sending buffer and the first warning watermark, the sending terminal 210 can send the first data written in the first file to the MAC layer sending buffer at the first rate.
  • the sending terminal 210 sends the first data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • the sending terminal 210 may determine the first rate according to the upper limit of the transmission rate of the physical layer.
  • the first rate may be a value close to the upper limit of the transmission rate of the physical layer.
  • the upper limit of the sending rate of the physical layer is the upper limit of the sending rate that can be supported by the network card of the sending terminal 210 .
  • the first rate may be 90% of the maximum rate of the physical layer.
  • the upper limit of the transmission rate of the physical layer is 2.4Gbps
  • the first rate may be 2.16Gbps.
  • the process of writing the first data to the MAC layer sending buffer may refer to the embodiment shown in FIG. 7 , which will not be repeated here.
  • the sending terminal 210 can obtain the first data of the first file from the MAC layer sending buffer through the network card, encapsulate it into a data frame, and send it to the receiving terminal. 220.
  • the network card of the receiving terminal 220 can parse the MAC data packet from the data frame and send it to the MAC layer receiving buffer, and then the receiving terminal 220 can receive the buffer from the MAC layer. Take out the data of the first file and send it to the write buffer. Next, the receiving terminal 220 writes the data of the first file in the write buffer into the disk of the receiving terminal 220 .
  • the process for the receiving terminal 220 to retrieve the data of the first file from the MAC layer receive buffer and send it to the write buffer may refer to the embodiment shown in FIG. 7 , which will not be repeated here.
  • the sending terminal 210 monitors whether the buffered data amount in the sending buffer of the MAC layer is greater than or equal to the first warning water level. If yes, then execute S808, and the sending terminal 210 may determine whether the remaining capacity of the MAC layer sending buffer is less than the amount of data to be sent of the first file. When the remaining capacity of the MAC layer sending buffer is less than the amount of data to be sent in the first file, S809 is executed, and the sending terminal 210 sends the second data written in the first file to the MAC layer at the second rate.
  • the sending terminal 210 may send the second data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • the sending terminal 210 can send the second data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card, the sending terminal 210 can determine whether the buffered data amount in the MAC layer sending buffer is less than the first specified amount If it is the threshold, then execute S812, and the sending terminal 210 sends the third data written in the first file in the buffer to the MAC layer at the first rate.
  • the sending terminal 210 may send the third data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • the second rate is smaller than the above-mentioned first rate.
  • the first rate may be 90% of the upper limit of the transmission rate of the physical layer, and the second rate may be 10% or 0 of the upper limit of the transmission rate of the physical layer.
  • the sending terminal 210 stops reading the data of the first file from the disk.
  • the above-mentioned first specified threshold is smaller than the first warning water level and smaller than the buffer capacity of the MAC layer sending buffer.
  • the sending terminal 210 uses the second The rate writes the second data of the first file into the MAC layer sending buffer, and sends the second data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • the network card of the sending terminal 210 extracts the data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and sends the data to the receiving terminal 220 .
  • the sending terminal 210 may send the MAC layer to the MAC at the first rate
  • the layer sending buffer writes the third data of the first file, and sends the third data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • the network card of the sending terminal 210 still extracts the data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and sends the data to the receiving terminal 220 .
  • the data size of the first file is 800MB
  • the upper limit Vmax of the transmission rate of the physical layer may be 2.4Gbps (300MB/s)
  • the feedback time Ts of the MAC layer may be 2ms
  • the buffer capacity of the transmission buffer of the MAC layer may be 1.8 MB
  • the first warning water level can be 1.2MB.
  • the first rate may be 90% of the upper limit Vmax of the transmission rate of the physical layer, that is, 2.16Gbps (270MB/s)
  • the second rate may be 10% of the upper limit Vmax of the transmission rate of the physical layer, that is, 0.24Gbps (30MB/s).
  • the above-mentioned first specified threshold may be 10% of the buffer capacity of the transmission buffer of the MAC layer, that is, 0.18MB.
  • the sending terminal 210 After the sending terminal 210 sets the buffer capacity of the MAC layer sending buffer and the first warning watermark, the sending terminal 210 can write the first file of the first file to the MAC layer sending buffer at a rate of 2.16Gbps (270MB/s). data.
  • the network card of the sending terminal 210 can take out the first data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and send it to the receiving terminal 220 .
  • the sending terminal 210 monitors that the buffered data amount of the MAC layer sending buffer has reached 1.2MB, the remaining capacity of the MAC layer sending buffer is 0.6MB. If the amount of data to be sent in the first file is 600MB, at this time, the remaining capacity of the MAC layer sending buffer is less than the amount of data to be sent in the first file, and the sending terminal 210 can send the data to the MAC layer at a rate of 0.24Gbps (30MB/s).
  • the send buffer writes the second data to the first file.
  • the network card of the sending terminal 210 can take out the second data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and send it to the receiving terminal 220 .
  • the network card Since the rate at which the sending terminal 210 reads the data of the first file is reduced, the network card is still fetching the data of the first file from the MAC layer sending buffer at the maximum rate as much as possible, and sends it to the receiving terminal 220, and the MAC layer sends The amount of data in the buffer will drop.
  • the sending terminal 210 monitors that the amount of data in the MAC layer sending buffer drops to 0.18MB (10% of the total capacity), the sending terminal 210 can write to the MAC layer sending buffer at a rate of 2.16Gbps (270MB/s).
  • the third data of the first file The network card of the sending terminal 210 can take out the third data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and send it to the receiving terminal 220 .
  • the sending terminal 210 monitors that the buffered data volume of the MAC layer sending buffer is greater than or equal to the first warning water level, and the remaining capacity of the MAC layer sending buffer is greater than or equal to the first file to be sent
  • the sending terminal 210 can continue to send the second data written in the first file to the MAC layer sending buffer at the first rate, and send the second data of the first file in the MAC layer sending buffer to the receiving terminal through the network card 220.
  • the network card of the sending terminal 210 extracts the data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and sends the data to the receiving terminal 220 .
  • the sending terminal 210 can read the data of the first file at the limit rate and send it to the receiving terminal 220, and the MAC layer sends the buffer The zone will not overflow and drop packets.
  • the sending terminal 210 may continue to write to the sending buffer of the MAC layer at the first rate
  • the second data of the first file is sent to the receiving terminal 220 through the network card.
  • the sending terminal 210 may determine the rate at which the data of the first file is written into the MAC layer sending buffer only by monitoring the relationship between the buffered data amount in the MAC layer sending buffer and the first warning watermark. Specifically, when the sending terminal 210 monitors that the amount of buffered data in the sending buffer of the MAC layer is greater than or equal to the first warning water level, the sending terminal 210 may write the second data of the first file to the sending buffer of the MAC layer at the second rate. data, and send the second data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • the sending terminal 210 may continue to write the second data of the first file to the sending buffer of the MAC layer at the first rate, and The second data of the first file in the MAC layer sending buffer is sent to the receiving terminal 220 through the network card.
  • the buffer capacity and the first warning water level of the MAC layer sending buffer (qdisk_buffer) of the sending end 210 can be set, and the buffer is sent according to the MAC layer.
  • the buffered data volume of (qdisk_buffer) determines the sending rate of the data written by the sending end 210 into the first file to the MAC layer sending buffer, so that the file transmission speed is close to the limit rate of the physical channel and the packet loss rate is reduced.
  • FIG. 10 shows a schematic flowchart of a data transmission method provided in the second part of the embodiment of the present application.
  • the sending terminal 210 may be referred to as the first terminal, and the receiving terminal 220 may be referred to as the second terminal.
  • the method may include the following steps:
  • the sending terminal 210 obtains a transmission request for the first file.
  • step S501 in the foregoing embodiment shown in FIG. 8 , which will not be repeated here.
  • the sending terminal 210 establishes a file transmission connection with the receiving terminal 220 .
  • step S502 in the foregoing embodiment shown in FIG. 8 , which will not be repeated here.
  • the receiving terminal 220 obtains the upper limit Vmax of the transmission rate of the physical layer of the transmitting terminal 210 and the round-trip delay RTT on the file transmission connection.
  • the upper limit Vmax of the physical layer transmission rate may be preset on the receiving terminal 220 .
  • the upper limit Vmax of the physical layer transmission rate may be 1Gbps.
  • the transmitting terminal 210 and the receiving terminal 220 are configured with 2x2 MIMO antennas, and the connection network between the transmitting terminal 210 and the receiving terminal 220 is a wireless local area network based on Wi-Fi 6, the upper limit Vmax of the physical layer transmission rate may be 2.4Gbps .
  • the receiving terminal 220 may detect the round-trip delay between the receiving terminal 220 and the sending terminal 210 after establishing the file transmission connection with the sending terminal 210 .
  • the receiving terminal 220 may send an ICMP packet to the sending terminal 210, and the sending terminal 210 may return a response packet to the receiving terminal 220 after receiving the ICMP packet. Then, the receiving terminal 220 can calculate the round-trip delay RTT according to the time of sending the ICMP packet and the time of receiving the response packet returned by the sending terminal 210 .
  • the receiving terminal 220 may send the ICMP packet to the sending terminal 210 multiple times, and the receiving terminal 220 may determine the RTT according to the time difference between the sending and receiving of the multiple packets. For example, the receiving terminal 210 may determine the RTT based on the time difference between the sending and receiving of multiple packets. For another example, the receiving terminal 220 may determine the maximum value of the time differences between multiple packet sending and receiving as the RTT.
  • the receiving terminal 220 determines the respective buffer capacities and the second warning water level of the IP fragmentation reassembly buffer and the write buffer according to the upper limit Vmax of the transmission rate of the physical layer and the round-trip delay RTT.
  • the buffer capacity of the IP fragmentation reassembly buffer and the write buffer can both be m, and the second warning watermark can be a*m. Therefore, when the buffer watermark in the buffer is at the first warning watermark, the buffer's The remaining capacity is (1-a)*m. where 0 ⁇ a ⁇ 1.
  • the IP fragmentation reassembly buffer (or write buffer) Because it is necessary to ensure the highest transmission rate as much as possible, and at the same time to reduce the packet loss rate, it is necessary to monitor the buffered data volume of the IP fragmentation reassembly buffer (or write buffer), which can neither be empty nor overflow. If the amount of buffered data in the IP fragmentation reassembly buffer (or write buffer) reaches the second warning water level a*m at time t, and at time t+ ⁇ t, the IP fragmentation reassembly buffer (or write buffer) ) will continue to grow.
  • the receiving terminal 220 needs to send the buffer information to the sending rate scheduling module of the sending terminal 210, so that the sending terminal The sending rate scheduling module of 210 reduces the rate at which the data of the first file is written into the sending buffer of the MAC layer.
  • the maximum time this process takes is 0.5*RTT.
  • the receiving terminal 220 sends an erroneous feedback (it takes 0.5 RTT), re-adjust back to the normal sending rate (it takes 0.5*RTT again).
  • the sending terminal 210 can determine the buffer capacity of the IP fragmentation reassembly buffer and the write buffer and the second early warning water level according to the upper limit Vmax of the physical layer transmission rate and the round-trip delay RTT by the following formulas (8) and (9) String.
  • the receiving terminal 220 can set the buffer capacity of the IP fragmentation reassembly buffer and the write buffer and the second early warning watermark by formula (8) and formula (9) according to the upper limit Vmax of the physical layer transmission rate and the round-trip delay RTT. .
  • Vmax may be 2.4Gbps (300MB/s), and RTT may be 16ms.
  • the unit of the buffer capacity of the buffer may be the number of data packets with the maximum length, and the buffer is calculated in megabytes (MB) according to the above formula (8) and formula (9). ) as the unit of buffer capacity, it can be converted according to the maximum length of the data packet to obtain the buffer capacity of the buffer in the unit of the number of data packets. For example, if M is 7.2MB, and the maximum size of a data packet can be 1500 bytes (Byte), the buffer capacity of the buffer is 4800 data packets.
  • the second early warning water level may be preset, and the sending terminal 210 may determine the buffer capacity of the IP fragmentation reassembly buffer and the write buffer according to the above formula (8) and formula (9). .
  • the buffer capacity of the IP fragmentation reassembly buffer and the write buffer may be preset, and the sending terminal 210 may determine the second warning water level according to the above formula (8) and formula (9). .
  • the sending terminal 210 can send the buffer to the MAC layer at the first rate The first data of the first file is written in the area.
  • the sending terminal 210 transmits the first data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • the sending terminal 210 may determine the first rate according to the upper limit of the transmission rate of the physical layer.
  • the first rate may be a value close to the upper limit of the transmission rate of the physical layer.
  • the upper limit of the sending rate of the physical layer is the upper limit of the sending rate that can be supported by the network card of the sending terminal 210 .
  • the first rate may be 90% of the maximum rate of the physical layer.
  • the upper limit of the transmission rate of the physical layer is 2.4Gbps
  • the first rate may be 2.16Gbps.
  • the process of writing the first data to the MAC layer sending buffer may refer to the embodiment shown in FIG. 7 , which will not be repeated here.
  • the sending terminal 210 can obtain the first data of the first file from the MAC layer sending buffer through the network card, encapsulate it into a data frame, and send it to the receiving terminal. 220.
  • the network card of the receiving terminal 220 can parse the MAC data packet from the data frame and send it to the MAC layer receiving buffer, and then the receiving terminal 220 can receive the buffer from the MAC layer. Take out the data of the first file and send it to the write buffer. Next, the receiving terminal 220 writes the data of the first file in the write buffer into the disk of the receiving terminal 220 .
  • the process for the receiving terminal 220 to retrieve the data of the first file from the MAC layer receive buffer and send it to the write buffer may refer to the embodiment shown in FIG. 7 , which will not be repeated here.
  • the receiving terminal 220 can monitor whether there is a first buffer with the amount of buffered data greater than or equal to the second early warning water level in the IP fragmentation reassembly buffer and the write buffer, and if so, execute S1008, and the receiving terminal 220 can determine the first buffer Whether the remaining capacity in the buffer is less than the amount of data to be sent in the first file. If yes, perform S1009 , and the receiving terminal 220 may feed back the first buffer information to the sending terminal 210 .
  • the sending terminal 210 may write the first buffer to the MAC layer sending buffer at a third rate (for example, 10% or 0 of the upper limit of the physical layer sending rate) in response to the first buffer information.
  • the fourth data of the file may be written to the MAC layer sending buffer at a third rate (for example, 10% or 0 of the upper limit of the physical layer sending rate) in response to the first buffer information.
  • the sending terminal 210 sends the fourth data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • the third rate is less than the first rate.
  • the third rate may be 10% of the upper limit of the transmission rate of the physical layer of the transmitter 210, and so on.
  • the sending terminal 210 may send the total data volume of the first file to the receiving terminal 220.
  • the receiving terminal 220 may count the received data volume of the first file, and then the receiving terminal 220 may determine the to-be-sent data volume of the first file according to the total data volume and the received data volume of the first file.
  • the receiving terminal 220 can monitor the buffered data volume of the IP fragmentation reassembly buffer and the write buffer, and when it is detected that the buffered data volume of the first buffer in the IP fragmentation reassembly buffer and the write buffer is greater than or equal to the warning watermark , and when the remaining capacity of the first buffer is less than the amount of data to be sent in the first file, the receiving terminal 220 may feed back the first buffering information to the sending terminal 210, where the first buffering information may be used to instruct the sending terminal 210 to use the third The rate sends the fourth data written in the first file in the buffer to the MAC layer.
  • the sending terminal 210 can send the fourth data written in the first file to the MAC layer sending buffer at the third rate, and send the fourth data of the first file in the MAC layer sending buffer through the network card.
  • the data is sent to the receiving terminal 220 .
  • the buffer watermark of the receiving buffer or the write buffer at the MAC layer of the receiving terminal 220 may exceed the second warning watermark, and the remaining capacity of the IP fragmentation reassembly buffer or the write buffer is not enough to support the waiting of the first file.
  • the sending terminal 210 When sending the amount of data, let the sending terminal 210 reduce the data read in the first file, then, the sending rate of the network card of the sending terminal 210 will be reduced, and the IP fragmentation reassembly buffer or write buffer on the receiving terminal 220 will not overflow and be lost. Bag.
  • the receiving terminal 220 monitors that the buffered data volume of the first buffer in the MAC layer and the write buffer is greater than or equal to the second warning watermark, and the remaining capacity of the first buffer is greater than or equal to the data volume to be sent of the first file,
  • the receiving terminal 220 does not need to notify the sending terminal 210, and the sending terminal 210 continues to send the fourth data of the first file in the buffer to the MAC layer at the first rate, and sends the fourth data of the first file in the buffer to the MAC layer through the network card. sent to the receiving terminal 220 .
  • the sending terminal 210 can read the data of the first file at the limit rate and send it to the receiving terminal 220, In addition, the IP fragmentation reassembly buffer and the write buffer on the receiving terminal 220 will not overflow and lose packets.
  • the receiving terminal 220 monitors that the amount of buffered data in the first buffer in the MAC layer and the write buffer is less than or equal to the second early warning water level, the receiving terminal 220 does not need to notify the sending terminal 210 to send the The terminal 210 continues to write the fourth data of the first file in the MAC layer sending buffer at the first rate, and sends the fourth data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • the receiving terminal 220 may determine whether to trigger the sending terminal 210 to reduce the writing of the data of the first file to the MAC layer for sending only by monitoring the relationship between the amount of buffered data in the first buffer and the second warning water level The rate of the buffer. Specifically, when the receiving terminal 220 monitors that the amount of buffered data in the first buffer is greater than or equal to the first warning water level, the receiving terminal 220 sends the first buffering information to the sending terminal 210 . The sending terminal 210 may write the fourth data of the first file to the MAC layer sending buffer at a third rate in response to the first buffer information, and send the fourth data of the first file in the MAC layer sending buffer to the receiver through the network card. Terminal 220.
  • the receiving terminal 220 monitors that the amount of buffered data in the first buffer is less than the second early warning water level, the receiving terminal 220 does not need to send the first buffering information to the sending terminal 210 .
  • the sending terminal 210 may continue to write the fourth data of the first file in the MAC layer sending buffer at the first rate, and send the fourth data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • step S1012 After the receiving terminal 220 feeds back the first buffering information to the sending terminal 210, the receiving terminal 220 may determine whether the amount of buffered data in the first buffer is less than the second specified threshold. If so, step S1013 is executed, and the receiving terminal 220 feeds back the second buffer information to the transmitting terminal 210 .
  • the sending terminal 210 may, in response to the second buffering information, send the fifth data written in the first file in the buffer to the MAC layer at the first rate.
  • the sending terminal 210 sends the fifth data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • the receiving terminal 220 may feed back the second buffer information to the transmitting terminal 210.
  • the second buffer information may be used to instruct the sending terminal 210 to send the fifth data written in the first file in the buffer to the MAC layer at the first rate.
  • the sending terminal 210 can send the fifth data written in the first file to the MAC layer at the first rate, and send the first data in the MAC layer to the buffer through the network card.
  • the fifth data of a file is sent to the receiving terminal 220 .
  • the sending terminal 210 after the sending terminal 210 receives the second buffer information fed back by the receiving terminal 220, if the buffer water level of the MAC layer sending buffer is greater than or equal to the first warning water level, and the MAC layer sends the buffer If the remaining capacity of the area is less than or equal to the amount of data to be sent in the first file, the sending terminal 210 sends the data written in the first file in the buffer to the MAC layer at the second rate, and sends the first file in the buffer to the MAC layer through the network card. The data is sent to the receiving terminal 220.
  • the sending terminal 210 after the sending terminal 210 receives the second buffer information fed back by the receiving terminal 220, if the buffer water level of the MAC layer sending buffer is greater than or equal to the first warning water level, and the MAC layer sends the buffer The remaining capacity of the area is less than the amount of data to be sent in the first file, and the sending terminal 210 writes the data of the first file from the sending buffer to the MAC layer at the first rate, and sends the first file in the sending buffer to the MAC layer through the network card. The data is sent to the receiving terminal 220.
  • the data size of the first file is 800MB
  • the upper limit Vmax of the physical layer transmission rate may be 2.4Gbps (300MB/s)
  • the MAC layer feedback time Ts of the transmitting terminal 210 is 2ms
  • the MAC layer transmission buffer the MAC layer reception
  • the buffer capacity of the buffer and the write buffer can both be 1.8MB
  • the first warning water level can be 1.2MB.
  • the round-trip delay RTT between the sending terminal 210 and the receiving terminal 220 may be 16 ms.
  • the buffer capacity of the IP fragment reassembly buffer and write buffer can be 7.2MB.
  • the second warning water level can be 4.8MB.
  • the first rate may be 90% of the upper limit Vmax of the transmission rate of the physical layer, that is, 2.16Gbps (270MB/s)
  • the second rate may be 10% of the upper limit Vmax of the transmission rate of the physical layer, that is, 0.24Gbps (30MB/s).
  • the third rate may be 10% of the upper limit Vmax of the transmission rate of the physical layer, that is, 0.24Gbps (30MB/s).
  • the above-mentioned first specified threshold may be 10% of the buffer capacity of the transmission buffer of the MAC layer, that is, 0.18MB.
  • the above-mentioned second specified threshold may be 10% of the buffer capacity of the IP fragmentation reassembly buffer and the write buffer, that is, 0.72MB.
  • the sending terminal 210 can send the first data of the first file in the buffer to the MAC layer at a rate of 2.16Gbps (270MB/s).
  • the network card of the sending terminal 210 can extract the first data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and send it to the receiving terminal 220 .
  • the receiving terminal 220 detects that the buffered data volume of the IP fragmentation reassembly buffer (or the write buffer) has reached 4.8MB, the remaining capacity of the IP fragmentation reassembly buffer (or the write buffer) is 2.4MB. If the amount of data to be sent in the first file is 600MB, at this time, the remaining capacity of the IP fragmentation reassembly buffer (or write buffer) is smaller than the amount of data to be sent in the first file, and the receiving terminal 220 feeds back the first buffer information to the sender. Terminal 210.
  • the sending terminal 210 can send the fourth data written in the first file to the MAC layer sending buffer at a rate of 0.24Gbps (30MB/s), and send the MAC layer sending buffer through the network card.
  • the fourth data of the first file in the zone is sent to the receiving terminal 220 .
  • the rate at which the sending terminal 210 reads the data of the first file is reduced, the rate at which the network card takes out the data of the first file from the MAC layer sending buffer is also reduced.
  • the amount of data in the IP fragment reassembly buffer (or write buffer) drops.
  • the receiving terminal 220 may feed back the second buffer information to the sending terminal 210 .
  • the sending terminal 210 When the sending terminal 210 receives the second buffering information, if the sending terminal 210 monitors that the buffer water level of the MAC layer sending buffer is 1 MB (lower than the first warning water level by 1.2 MB), the sending terminal 210 can use 2.16 Gbps (270 MB) /s) to write the fifth data of the first file into the MAC layer sending buffer, and send the fifth data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • 2.16 Gbps 270 MB
  • the sending terminal 210 monitors that the buffer water level of the MAC layer send buffer is 1.2 MB (reaches the first warning water level of 1.2 MB), and the data volume of the first file to be sent is 1.2 MB. When it is 200MB (larger than the remaining capacity of the MAC layer sending buffer, which is 2.4MB), the sending terminal 210 can write the fifth data of the first file to the MAC layer sending buffer at a rate of 0.24Gbps (30MB/s), and pass the The network card sends the fifth data of the first file in the MAC layer sending buffer to the receiving terminal 220 .
  • the sending terminal 210 monitors that the buffer water level of the MAC layer send buffer is 1.2 MB (reaches the first warning water level of 1.2 MB), and the first When the amount of data to be sent in the file is 2MB (less than the remaining capacity of 2.4MB in the sending buffer of the MAC layer), the sending terminal 210 writes the fourth file of the first file to the sending buffer of the MAC layer at a rate of 2.16Gbps (270MB/s). and send the fourth data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
  • the receiving terminal 220 may send the buffer watermark of the IP fragmentation reassembly buffer and the buffer watermark of the write buffer to the sending terminal 210 periodically (eg, with a period of 2 ms).
  • the sending terminal 210 can determine whether there is a second buffer (eg, the MAC layer sending buffer) that is greater than or equal to the warning water level in the three buffers: the MAC layer sending buffer, the IP fragmentation reassembly buffer, and the write buffer. If it exists, the sending terminal 210 may determine whether the remaining capacity of the second buffer is less than the amount of data to be sent of the first file.
  • the sending terminal 210 may read the first file from the body storage at a fourth rate (for example, 10% or 0 of the upper limit of the physical layer sending rate).
  • the data is sent to the MAC layer send buffer.
  • the sending terminal 210 can judge whether the buffer watermark in the second buffer is less than or equal to the specified threshold, and if so, the sending terminal 210 can send the buffer to the MAC layer at the first rate (eg, 90% of the upper limit of the physical layer sending rate)
  • the fourth data of the first file is written into the area, and the fourth data of the first file in the MAC layer sending buffer is sent to the receiving terminal 220 through the network card.
  • the fourth rate is smaller than the first rate.
  • the MAC layer sending buffer In the second part of the embodiment of the present application, it is not limited to monitor the buffer watermarks in the three buffers: the MAC layer sending buffer, the IP fragmentation reassembly buffer and the write buffer, and the sending rate of the sending terminal 210 is not limited Take control.
  • the sending rate of the sending terminal 210 may also be controlled by monitoring buffer watermarks in the three buffers of the MAC layer sending buffer, the MAC layer receiving buffer, and the writing buffer. In some embodiments, the sending rate of the sending terminal 210 may also be monitored by monitoring the buffer watermarks in the four buffers: the MAC layer sending buffer, the IP fragmentation reassembly buffer, the MAC layer receiving buffer, and the writing buffer. Take control. In some embodiments, the sending rate of the sending terminal 210 may also be controlled by monitoring the buffer watermarks in the four buffers, the sending buffer and the writing buffer, of the MAC layer. For the process of controlling the sending rate of the sending terminal 210, reference may be made to the foregoing embodiment shown in FIG. 7, and details are not described herein again.
  • FIG. 11 shows a schematic diagram of the time-varying buffer watermark of the MAC layer transmit buffer on the transmitting terminal 210 in a data transmission method provided in the second part of the embodiment of the present application.
  • the buffer capacity of the sending buffer (qdisk_buffer) of the MAC layer on the sending terminal 210 may be 10,000 data packets, and the warning watermark may be 7,500 data packets.
  • the buffer water mark in the sending buffer of the MAC layer does not reach 10000, indicating that the sending terminal 210 sends The rate reaches the limit of the hardware, and the MAC layer send buffer does not overflow and lose packets.
  • the transmitting terminal 210 transmits a 20 GB file to the receiving terminal 220 based on the Wi-Fi 6 network and the radar frequency band is turned on
  • the average transmission rate can reach 210 MB/s
  • the transmission rate jitter can be less than 10MB/s
  • the number of lost packets is less than 10.
  • a data transmission method provided in the second part of the embodiment of the present application can be set by setting the capacity and warning water level of one or more buffers specified on the sending end and the receiving end.
  • the MAC layer of the sending end sends the buffer (qdisk_buffer), the MAC layer send buffer (netdev_backlog_buffer) of the receiver, the IP fragmentation reassembly buffer (ip_defrag_buffer) of the receiver, and the write buffer (write_buffer) of the receiver.
  • the sending rate of the sender can be determined according to the current amount of buffered data in the one or more buffers, so that the transmission speed of the file is close to the limit rate of the physical channel and the packet loss rate is reduced.
  • sequence numbers of some terms in the third part of the embodiments of the present application do not continue to follow the sequence numbers of other parts of the embodiments of the present application, and the nouns in the third part of the embodiments of the present application are only used in the third part of the embodiments of the present application used in part.
  • the third part of the embodiments of the present application provides a data storage method, including: a terminal receives data of a first file, and stores the data of the first file in a network protocol stack receiving buffer.
  • the terminal takes out the data of the first file from the receiving buffer of the network protocol stack and writes it directly into the disk.
  • the terminal obtains the remaining buffer capacity of the receiving buffer of the network protocol stack, the amount of data to be transmitted of the first file, and the growth rate of the buffered data of the receiving buffer of the network protocol stack.
  • the terminal shall, according to the remaining buffer capacity of the receiving buffer of the network protocol stack, the amount of data to be transmitted of the first file, and the size of the receiving buffer of the network protocol stack, The buffer data growth rate and the network card receiving rate are used to determine the overflow time of the receiving buffer of the network protocol stack and the remaining transmission time of the first file.
  • the terminal will store it in the receiving buffer of the network protocol stack
  • the data in the area is dumped to the user mode buffer, and the data in the user mode buffer is written to the disk through the kernel mode write buffer.
  • the terminal after receiving the file data, the terminal can receive the watermark in the buffer through the network protocol stack in the kernel state, and adopt different data storage paths. In this way, It can avoid packet loss caused by overflow in the receiving buffer of the network protocol stack, and reduce the packet loss rate while transmitting file data at high speed.
  • Figure 12 shows the basic logic of the congestion control mechanism in the TCP transport protocol.
  • the receiver can count the packet loss rate and feed it back to the sender.
  • the sender can determine whether the packet loss rate has increased. If the packet rate increases, the sender can reduce the sending rate of data packets. For example, the sender reduces the sending rate to half the previous rate. When the sender determines that the packet loss rate does not increase, the sender can increase the sending rate. For example, The sender increases the sending rate by a fixed value ⁇ from the previous sending rate. In this way, the degree of network congestion can be improved. After the degree of network congestion is improved, the packet loss rate counted by the receiver will be affected.
  • the congestion control strategy at the sender cannot improve the effects of air interface co-channel interference and other factors on the packet loss rate. Therefore, under the influence of factors such as co-channel interference on the air interface, the sender reduces the transmission rate to half the previous rate through the congestion control strategy, which cannot improve the influence of co-channel interference on the packet loss rate, and when the packet loss does not increase , the sender increases the sending rate by a fixed value ⁇ over the previous sending rate, which is too conservative to increase the data transmission rate.
  • FIG. 14 shows an architecture diagram of a data storage system provided by an embodiment of the present application.
  • the data storage system on the terminal 100 may adopt a layered architecture.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
  • the data storage system of the terminal 100 may include user mode, kernel mode, and hardware layer.
  • the terminal 100 may include at least three types of physical storage media: a disk (i.e., read only memory (ROM)) 505, a running memory (i.e., random access memory (RAM)), and a network card 504.
  • the disk 505 can still retain data even after the power is turned off, and can be used to save file data such as documents, pictures, music, and videos.
  • Runtime memory can be used for temporary data generated by the operating system and applications while they are running.
  • the terminal 100 can virtually divide the running memory into two parts: user mode and kernel mode.
  • the network card 504 may include a memory, which may be used to temporarily store data frames to be sent or received.
  • the user mode may include a user mode buffer 501 .
  • the kernel state may include a kernel state write buffer 502 and a network protocol stack receive buffer 503 .
  • the hardware layer may include a network card 504 and a hard disk 505 .
  • the terminal 100 can extract the data of the first file from the network card 504 into the network protocol stack receiving buffer 503 in the kernel state.
  • the network protocol stack receiving buffer 503 may be a UDP receiving buffer.
  • the terminal 100 can write the data of the first file buffered in the network protocol stack receiving buffer 503 to the disk 505 through two paths:
  • Path 1 The terminal 100 can retrieve the data of the first file from the network protocol stack receiving buffer 503 and directly write it into the disk 505 .
  • Path 2 The terminal 100 can retrieve the data of the first file from the network protocol stack receiving buffer 503 and transfer the data to the user mode buffer 501 . Then, the terminal 100 fetches and dumps the data in the user mode buffer 501 to the kernel mode write buffer 502 . Next, the terminal 100 writes the data in the kernel state write buffer 502 to the disk 505 .
  • the terminal 100 When the terminal 100 is receiving the data of the first file, the terminal 100 can expand the total buffer capacity of the user mode receiving buffer 501 at any time, while the total buffer capacity of the network protocol stack receiving buffer 503 is fixed.
  • the terminal 100 adopts the above path 1: directly extracting the data of the first file from the network protocol stack receiving buffer 503 and writing it to the disk 505, the number of times the terminal 100 copies the data of the first file is reduced, and the power consumption of the terminal 100 can be saved .
  • the terminal 100 may receive the watermark in the buffer through the network protocol stack in the kernel state, and adopt different data storage paths, thus, It can avoid packet loss caused by overflow in the receiving buffer of the network protocol stack, and reduce the packet loss rate while transmitting file data at high speed.
  • FIG. 15 shows a data storage method provided in the third part of the embodiment of the present application. As shown in Figure 15, the method may include:
  • the terminal 100 receives the data of the first file, and stores the data of the first file in the socket receiving buffer.
  • the sender of the first file may be other terminals or servers.
  • the terminal 100 may be directly connected with other terminals through Wi-Fi (for example, wireless fidelity peer to peer (Wi-Fi P2P)), Wi-Fi softAP, Communication technologies such as ultra-wideband (UWB) transmit the data of the first file.
  • Wi-Fi P2P wireless fidelity peer to peer
  • Wi-Fi softAP Wi-Fi softAP
  • Communication technologies such as ultra-wideband (UWB) transmit the data of the first file.
  • UWB ultra-wideband
  • S1502 The terminal 100 takes out the data of the first file from the network protocol stack receiving buffer and writes it directly into the disk.
  • the terminal 100 After receiving the data of the first file, the terminal 100 can store the data of the first file in the network protocol stack receiving buffer, and the terminal 100 can directly take out the data of the first file from the network protocol stack receiving buffer, and write in the disk.
  • Path 1 in the foregoing embodiment shown in FIG. 4 .
  • the terminal 100 acquires the remaining buffer capacity P of the network protocol stack receiving buffer, the amount of data to be transmitted FLS of the first file, and the buffered data growth rate A of the network protocol stack receiving buffer.
  • the terminal 100 may periodically (for example, the cycle is 1 ms) obtain the remaining capacity P of the receiving buffer of the network protocol stack, the first file The FLS of the data to be transmitted and the buffered data growth rate A of the network protocol stack receiving buffer.
  • the terminal 100 can monitor the buffer watermark of the network protocol stack receiving buffer, and the terminal 100 determines the network protocol stack receiving buffer according to the total buffer capacity and buffer watermark (that is, the buffered data volume) of the network protocol stack receiving buffer. the remaining capacity P.
  • the total buffer capacity Pmax of the receiving buffer of the network protocol stack may be 10 megabytes (megabytes, MB), the buffer water mark may be 6 MB, and the terminal 100 may determine that the remaining capacity P of the receiving buffer of the network protocol stack is 4MB.
  • the examples are merely to explain the application to the user and should not be construed as limitations.
  • the terminal 100 may receive the total data volume of the first file sent by the sending end.
  • the terminal 100 may count the received data volume of the first file, and the terminal 100 may determine the to-be-transmitted data volume FLS of the first file according to the total data volume of the first file and the received data volume of the first file.
  • the total data volume of the first file may be 400MB
  • the terminal 100 can calculate that the received data volume of the first file is 360MB
  • the terminal 100 may determine that the data volume FLS of the first file to be transmitted may be 40MB.
  • the examples are only used to explain the application and should not be construed as limitations.
  • the terminal 100 monitors the change of the buffer water level in the receiving buffer of the network protocol stack, and obtains the buffer data growth rate A of the receiving buffer of the network protocol stack.
  • the terminal 100 may monitor the receiving rate rateNet of the network card and the disk writing rate rateIO of the first file.
  • the terminal 100 may determine the buffer data growth rate A of the network protocol stack receiving buffer according to the receiving rate rateNet of the network card and the disk writing rate rateIO of the first file.
  • the receiving rate rateNet of the network card may be 100 megabytes per second (MBps)
  • the disk writing rate rateIO of the first file may be 90 MBps
  • the terminal 100 may determine the growth of the receiving buffer of the network protocol stack Rate A is 10MBps.
  • the terminal 100 may determine whether the buffered data growth rate A is greater than 0, and if so, perform steps S1505 and S1506.
  • the buffered data growth rate A when the buffered data growth rate A is greater than 0, the amount of buffered data in the receiving buffer of the network protocol stack of the terminal 100 continues to increase. When the buffer growth rate A is less than or equal to 0, the amount of buffered data in the receiving buffer of the network protocol stack of the terminal 100 does not continue to increase.
  • the terminal 100 determines the overflow time of the network protocol stack receiving buffer according to the buffer data growth rate A of the network protocol stack receiving buffer and the remaining buffer capacity P of the network protocol stack receiving buffer.
  • the overflow time T1 of the receiving buffer of the network protocol stack can be determined by the following formula (10):
  • c ⁇ 1 in order to prevent the actual overflow of the receiving buffer of the network protocol stack, c ⁇ 1 can be set. In this way, the overflow time T1 determined by the terminal 100 can be made longer than the actual receiving buffer of the network protocol stack. The overflow time is advanced.
  • the remaining buffer capacity P of the network protocol stack receiving buffer may be 4MB
  • the buffer data growth rate A of the network protocol stack receiving buffer may be 10MBps
  • c may be 0.9. Therefore, the terminal 100 determines that the network protocol stack receives
  • the overflow time T1 of the buffer can be 0.6s.
  • the terminal 100 determines the remaining transmission time of the first file according to the amount of data to be transmitted FLS and the network card transmission rate rateNet of the first file.
  • the remaining transmission time T2 of the first file can be determined by the following formula (11):
  • the data volume FLS of the first file to be transmitted may be 40MB, and the network card transmission rate rateNet may be 100MBps. Therefore, the terminal 100 may determine that the remaining transmission time of the first file is 0.4s.
  • the examples are only used to explain the application and should not be construed as limitations.
  • S1507 The terminal 100 determines whether the overflow time of the network protocol stack's receiving buffer is less than the remaining transmission time of the first file. If so, in S1508, the terminal 100 determines whether the buffered data volume P in the network protocol stack receiving buffer is greater than the specified threshold M1.
  • the terminal 100 can determine, according to the above formula (10) and the above formula (11), that the difference f1 between the overflow time of the receiving buffer of the network protocol stack and the remaining transmission time of the first file is:
  • the terminal 100 may determine that the overflow time of the network protocol stack receiving buffer is less than the remaining transmission time of the first file.
  • the conservative coefficient c is 0.9
  • P may be 4MB
  • the buffer data growth rate A of the network protocol stack receiving buffer may be 10MBps
  • the data volume FLS of the first file to be transmitted may be 80MB
  • the network card transmission rate rateNet may be 100MBps
  • the terminal 100 can calculate that the difference f1 between the overflow time of the network protocol stack receiving buffer and the remaining transmission time of the first file is -0.2s (less than 0). Therefore, the terminal 100 can determine the network protocol stack receiving buffer.
  • the overflow time is less than the remaining time of the first file.
  • the terminal 100 may determine that the overflow time of the network protocol stack receiving buffer is greater than or equal to the remaining transmission time of the first file.
  • c is 0.9
  • P may be 4MB
  • the buffer data growth rate A of the network protocol stack receiving buffer may be 10MBps
  • the FLS of the first file to be transmitted may be 40MB
  • the network card transmission rate rateNet may be 100MBps
  • the terminal 100 can determine that the difference f1 between the overflow time of the network protocol stack's receiving buffer and the remaining transmission time of the first file is 0.2s (greater than 0). Therefore, the terminal 100 can determine the overflow time of the network protocol stack's receiving buffer. greater than the remaining time of the first file.
  • the examples are only used to explain the application and should not be construed as limitations.
  • the specified threshold M1 is less than the total buffer capacity of the network protocol stack receive buffer.
  • the total buffer capacity Pmax of the receiving buffer of the network protocol stack can be 10MB
  • the specified threshold M1 can be 6MB
  • the buffered quantity P of the receiving buffer of the network protocol stack can be 6.1MB. Therefore, the terminal 100 can receive the network protocol stack Buffered data for the buffer.
  • the examples are only used to explain the application and should not be construed as limitations.
  • the terminal 100 stops fetching data from the network protocol stack receiving buffer Write directly to the user mode buffer, and switch from path 1 to path 2 shown in Figure 4 above. Wherein, on path 2, the terminal 100 can dump all the buffered data in the network protocol stack receiving buffer to the user mode buffer, and then the terminal 100 takes data from the user mode buffer and dumps it into the kernel mode write buffer Finally, the terminal 100 writes the buffered data in the kernel state write buffer to the disk.
  • the terminal 100 switches the data storage path from the above path 1 to the path 2. Because the terminal 100 can increase the capacity of the user-mode buffer at any time, and the rate at which the terminal 100 takes out data from the network protocol stack receiving buffer and transfers it to the user-mode buffer is faster than taking out data from the network protocol stack receiving buffer and writing it The disk rate is faster, and therefore, prevents the network stack from receiving buffer overflow packet loss.
  • S1510 After the terminal 100 receives the buffer from the network protocol stack and writes it to the disk through the user-mode buffer and the kernel-mode write buffer, the terminal 100 can increase the buffer data growth rate E according to the user-mode buffer and the remaining buffer in the user-mode buffer.
  • the capacity U determines the overflow time of the user mode buffer.
  • the terminal 100 monitors the change of the buffer water level in the user buffer, and obtains the buffer data growth rate E in the user buffer.
  • the overflow time T3 of the user mode receive buffer can be determined by the following formula (13):
  • d ⁇ 1 can be set, so that the overflow time T3 determined by the terminal 100 can be made earlier than the actual overflow time of the user mode buffer .
  • the remaining buffer capacity U of the user mode buffer may be 10MB
  • the buffer data growth rate E of the user mode buffer may be 10MBps
  • d may be 0.9. Therefore, the terminal 100 determines the overflow time T1 of the user mode buffer. Can be 0.9s.
  • the examples are only used to explain the application and should not be construed as limitations.
  • the terminal 100 determines whether the overflow time of the user mode buffer is less than the remaining transmission time of the first file. If so, in S1512, the terminal 100 sends buffering information to the sending end of the first file, where the buffering information is used to instruct the sending end to reduce the sending rate of the first file.
  • the terminal 100 may determine, according to the above formula (11) and the above formula (12), that the difference f2 between the overflow time of the user mode buffer and the remaining transmission time of the first file is:
  • the terminal 100 may determine that the overflow time of the user mode buffer is less than the remaining transmission time of the first file.
  • the conservative coefficient d is 0.9
  • U can be 10MB
  • the buffer data growth rate E of the user mode buffer can be 10MBps
  • the data volume FLS of the first file to be transmitted can be 100MB
  • the network card transmission rate rateNet can be 100MBps
  • the terminal 100 can calculate that the difference f1 between the overflow time of the user mode buffer and the remaining transmission time of the first file is -0.1s (less than 0). Therefore, the terminal 100 can determine that the overflow time of the user mode buffer is less than that of the first file. remaining time.
  • the examples are only used to explain the application and should not be construed as limitations.
  • the terminal 100 may determine that the overflow time of the user mode buffer is greater than or equal to the remaining transmission time of the first file.
  • d is 0.9
  • U can be 10MB
  • the buffered data growth rate E of the user mode buffer can be 10MBps
  • the FLS of the first file to be transmitted can be 80MB
  • the network card transmission rate rateNet can be 100MBps
  • the terminal 100 can determine that the difference f1 between the overflow time of the user mode buffer and the remaining transmission time of the first file is 0.1s (greater than 0), therefore, the terminal 100 can determine that the overflow time of the user mode buffer is greater than the remaining transmission time of the first file. time.
  • the examples are only used to explain the application and should not be construed as limitations.
  • the terminal 100 determines that the overflow time of the user mode buffer is less than the remaining transmission time of the first file, it means that the terminal user mode buffer is likely to overflow before the first file is transmitted. Therefore, the terminal 100 can send the buffer information To the sending end of the first file, the buffer information is used to instruct the sending end of the first file to reduce the sending rate of the first file.
  • the terminal 100 can receive the buffer according to the network protocol stack.
  • the total buffer capacity Pmax the buffer data growth rate E of the user mode buffer, and determine the maximum overflow time of the network protocol stack receiving buffer.
  • the buffered data in the network protocol stack receiving buffer will be taken out and dumped by the terminal 100 in time. After entering the user mode buffer, the buffered data amount of the network protocol stack receiving buffer will drop to 0.
  • the maximum overflow time Tmax of the receiving buffer of the network protocol stack can be determined by the following formula (15):
  • Pmax may be 10MB
  • E may be 10Mbps
  • Tmax may be 1s according to the above formula (15).
  • the examples are only used to explain the application and should not be construed as limitations.
  • the terminal 100 determines whether the maximum overflow time of the network protocol stack's receiving buffer is greater than or equal to the remaining transmission time of the first file. When the maximum overflow time of the receiving buffer of the network protocol stack is greater than or equal to the remaining transmission time of the first file, the terminal 100 takes out the data of the first file from the receiving buffer of the network protocol stack and writes it directly to the disk.
  • the terminal 100 can determine, according to the above formula (11) and the above formula (15), that the difference f3 between the overflow time of the network protocol stack receiving buffer and the remaining transmission time of the first file is:
  • the terminal 100 may determine that the maximum overflow time of the receiving buffer of the network protocol stack is less than the remaining transmission time of the first file.
  • Pmax may be 10MB
  • the buffered data growth rate E of the user mode buffer may be 10Mbps
  • the amount of data to be transmitted FLS of the first file may be 110MB
  • rateNet may be 100MBps, therefore, the terminal 100 may determine the network protocol.
  • the difference f3 between the overflow time of the stack receiving buffer and the remaining transmission time of the first file is -0.1s (less than 0). Therefore, the terminal 100 can determine that the maximum overflow time of the network protocol stack receiving buffer is less than the remaining transmission time of the first file. time.
  • the terminal 100 may determine that the maximum overflow time of the network protocol stack receiving buffer is greater than or equal to the remaining transmission time of the first file.
  • Pmax may be 10MB
  • the buffered data growth rate E of the user mode buffer may be 10Mbps
  • the amount of data to be transmitted FLS of the first file may be 90MB
  • rateNet may be 100MBps, therefore, the terminal 100 may determine the network protocol.
  • the difference f3 between the overflow time of the stack receiving buffer and the remaining transmission time of the first file is 0.1s (less than 0). Therefore, the terminal 100 can determine that the maximum overflow time of the network protocol stack receiving buffer is greater than or equal to the remaining transmission time of the first file. time.
  • the examples are only used to explain the application and should not be construed as limitations.
  • the terminal 100 stops transferring the buffered data of the receiving buffer of the network protocol stack to the user mode buffer.
  • the user mode buffer No data is entered in the area, only the data is fetched by the terminal 100 and written to the disk through the kernel-mode write buffer.
  • the terminal 100 can wait until all the buffered data in the user mode buffer is written to the disk, and then take out the data from the network protocol stack receiving buffer and write it directly to the disk.
  • the terminal 100 can obtain the total buffer capacity Pmax of the network protocol stack receiving buffer, and the network card
  • the receiving rate is rateNet, the amount of data to be transmitted FLS of the first file, and the buffered data growth rate A in the receiving buffer of the network protocol stack.
  • the terminal 100 can determine the required buffer capacity Pn of the network protocol stack receiving buffer according to the network card receiving rate rateNet, the amount of data to be transmitted FLS of the first file, and the buffered data growth rate A of the network protocol stack receiving buffer.
  • the terminal 100 can simultaneously use the above path 1 and path 2 to write the buffered data in the network protocol stack receiving buffer to the disk.
  • the terminal 100 may store the first part of the data in the network protocol stack receiving buffer, and write the first part of the data to the disk through path 1.
  • the terminal 100 stores the second part of the data in the network protocol stack receiving buffer, and writes the second part of the data to the disk through path 2 .
  • the ratio of the data volume of the first part of the data to the data volume stored in the receiving buffer of the network protocol stack is ⁇ .
  • the terminal 100 can determine the required buffer capacity Pn of the receiving buffer of the network protocol stack by formula (17):
  • the terminal 100 can determine the ratio of the data volume of the first part of the data to the stored data volume of the network protocol stack receiving buffer as ⁇ through formula (18):
  • the terminal 100 may determine that the required buffer capacity Pn of the network protocol stack receiving buffer is greater than the total buffer capacity Pmax of the network protocol stack receiving buffer.
  • the total buffer capacity Pmax of the receiving buffer of the network protocol stack is 8MB
  • the conservative coefficient c can be 0.9
  • the buffer data growth rate A of the receiving buffer of the network protocol stack can be 10MBps
  • the amount of data to be transmitted FLS of the first file. It can be 90MB
  • the network card transfer rate rateNet can be 100MBps.
  • the terminal 100 may determine that ⁇ is 0.2 (greater than 0). Therefore, the terminal 100 can write 20% of the data stored in the network protocol stack receiving buffer to the disk through the above path 2.
  • the examples are only used to explain the present application and should not be limiting.
  • the terminal 100 may determine that the required buffer capacity Pn of the network protocol stack receiving buffer is less than or equal to the total buffer capacity Pmax of the network protocol stack receiving buffer.
  • the total buffer capacity Pmax of the receiving buffer of the network protocol stack is 12MB
  • the conservative coefficient c may be 0.9
  • the buffer data growth rate A of the receiving buffer of the network protocol stack may be 10MBps
  • the network card transfer rate rateNet can be 100MBps.
  • the terminal 100 can determine that ⁇ is -0.17 (less than 0). Therefore, the terminal 100 can directly write the data stored in the receiving buffer of the network protocol stack to the disk through the above path 1.
  • the examples are only used to explain the present application and should not be limiting.
  • the terminal 100 may receive the watermark in the buffer through the network protocol stack in the kernel state, and adopt different data storage paths, thus, It can avoid packet loss caused by overflow in the receiving buffer of the network protocol stack, and reduce the packet loss rate while transmitting file data at high speed.
  • sequence numbers of some terms in the fourth part of the embodiments of the present application do not continue to follow the sequence of the sequence numbers of other parts of the embodiments of the present application, and the nouns in the fourth part of the embodiments of the present application are only in the first used in four parts.
  • terminals with multiple network interfaces are becoming more and more popular.
  • WLAN wireless local area network
  • some smart phones may simultaneously support the networking function of dual mobile cellular networks and/or the networking function of dual WLANs.
  • a notebook computer usually has a limited LAN adapter and a wireless LAN adapter.
  • TCP transmission control protocol
  • the traditional transmission control protocol (TCP) is an end-to-end transmission protocol and cannot use multiple pairs of network connections at the same time. Therefore, the advantages of multiple network interfaces of the current terminal cannot be fully utilized, resulting in a waste of a lot of network bandwidth resources.
  • the terminal can allow wireless fidelity (Wi-Fi) network and cellular network to be used at the same time to improve communication experience.
  • Wi-Fi wireless fidelity
  • the Wi-Fi network and cellular network can be used at the same time to provide more
  • the large aggregate bandwidth enables higher download rates, fewer freezes, and smoother streaming media playback.
  • the multipath transmission control protocol is a transport layer protocol that is based on multi-network interface technology and uses multiple paths to work together and distribute data at the same time. It can make full use of idle resources of multiple network interfaces, improve end-to-end transmission throughput, and increase network resource utilization.
  • the fourth part of the embodiments of the present application provides a multi-path data prefetching method, including: a terminal acquiring a first HTTP request initiated by a first application of the terminal for a first URI, where the first HTTP request is used to request a server first data.
  • the terminal generates L second HTTP requests, where the L second HTTP requests are used to request second data from the server, wherein the second data includes the first data and the data volume of the second data is larger than the first data
  • the amount of data, L is a positive integer.
  • the terminal sends the L second HTTP requests to the server through L network paths respectively.
  • the terminal receives L first HTTP responses sent by the server on the L network paths, where the L first HTTP responses include the second data.
  • the terminal retrieves the first data from the second data, and returns the first data to the first application through an HTTP response.
  • the terminal receives a third HTTP request initiated by the first application for the first URI, where the third HTTP request is used to request third data from the server. If the second data includes the third data, the terminal takes out the third data from the second data, and returns the third data to the first application through an HTTP response.
  • the terminal when the application service requests data of the first data amount, the terminal can prefetch the data of the second data amount from the server, wherein the second data amount is The amount is greater than the first data amount. Then, after receiving the data of the second data volume returned by the server, the terminal may first return the data of the first data volume in the second data volume to the application. Then, the remaining data (the second amount of data - the first amount of data) is stored in the prefetch buffer.
  • the terminal can directly extract the remaining (the second amount of data - the first amount of data) bytes from the prefetch buffer data to the application.
  • the bandwidth utilization rate of the network path between the terminal and the server is improved, and when the application frequently accesses data in different ranges on the same URI address, the time for the application to obtain the data can be saved.
  • both the terminal and the server need to support MPTCP.
  • An application (application, APP) on the terminal 100 may establish multiple TCP connections with the server in multiple network paths respectively through a proxy (Proxy) of MPTCP.
  • a proxy for MPTCP can establish one TCP connection with a server on a cellular network and another TCP connection with a server on a Wi-Fi network.
  • the terminal can simultaneously perform data transmission with the server on the cellular network and the Wi-Fi network.
  • the terminal and the server need to support MPTCP at the same time, which is difficult to deploy.
  • the terminal cannot access based on the simultaneous use of the Wi-Fi network and the cellular network.
  • the multipath hypertext transfer protocol can split the original hypertext transfer protocol (HTTP) request initiated by the application according to the request range of the original HTTP request. Split into multiple sub-HTTP requests.
  • MPHTTP enables the terminal 100 to send the multiple sub-HTTP requests to the server 200 on multiple network paths, so as to provide the maximum aggregated bandwidth. Since both the terminal 100 and the server 200 support HTTP, after receiving the HTTP request, the server 200 will return the data requested by the terminal 100 to the terminal 100 through an HTTP response. Therefore, multipath transmission between the terminal 100 and the server 200 can be realized without modifying the existing server 200 .
  • FIG. 18 shows the system architecture of multi-path transmission between the terminal 100 and the server 200 through MPHTTP.
  • the terminal may include an application layer and a kernel layer.
  • the application layer of the terminal may include an application upper layer business logic module, a multi-path hypertext transfer protocol (MPHTTP) library (for example, a modified library based on the OKHTTP library), and an HTTP request splitting module.
  • MPHTTP multi-path hypertext transfer protocol
  • the terminal can communicate with the server through multiple network paths, such as a cellular network, a wireless local area network (WLAN) 1 and a wireless local area network (WLAN) 2 . in,
  • the upper-layer business logic module of the application can integrate the MPHTTP library.
  • the MPHTTP library can generate the original HTTP request according to the data acquisition request for the first URI address, and Sent to the HTTP request splitting module.
  • the byte range field in the original HTTP request may include the data request range of the original HTTP request, for example, 0-8999.
  • the HTTP request splitting module can split the original HTTP request into multiple HTTP requests based on the byte range of the original HTTP request according to the number of network paths.
  • the terminal can access the server through 3 network paths (eg, cellular network, WLAN 1 and WLAN 2), and the byte range of the original HTTP request can be 0-8999.
  • the HTTP request splitting module can split the original HTTP request into 3 HTTP requests (including HTTP request 1, HTTP request 2 and HTTP request 3).
  • the byte range of HTTP request 1 may be 0-2999
  • the byte range of HTTP request 2 may be 3000-5999
  • the byte range of HTTP request 3 may be 6000-8999.
  • the HTTP request splitting module can encapsulate multiple HTTP requests through the TCP/IP protocol stack respectively through the socket system call, and send them to the server on multiple network paths.
  • the terminal can establish a TCP connection with the server through the cellular network, and then the terminal HTTP request 1 may be sent to the server over the cellular network.
  • the server can encapsulate the data of bytes 0-2999 in the data resource corresponding to the URI address in the HTTP request 1 in the HTTP response 1, and pass the network path of the cellular network. back to the terminal.
  • the terminal receives the HTTP response 1, the TCP connection established between the terminal and the server on the cellular network is disconnected.
  • the terminal can establish a TCP connection with the server through the wireless local area network 1, and then the terminal can send the HTTP request 2 to the server through the cellular network.
  • the server After receiving the HTTP request 2 sent by the terminal through the cellular network, the server can encapsulate the data in the 3000-5999th bytes in the data resource corresponding to the URI address in the HTTP request 2 in the HTTP response 2, and send it through the network of the wireless local area network 1. The path is returned to the terminal. After the terminal receives the HTTP response 2, the TCP connection established on the wireless local area network 1 between the terminal and the server is disconnected.
  • the terminal can establish a TCP connection with the server through the wireless local area network 2, and then the terminal can send the HTTP request 3 to the server through the cellular network.
  • the server After receiving the HTTP request 3 sent by the terminal through the cellular network, the server can encapsulate the 6000-8999th bytes of data in the data resource corresponding to the URI address in the HTTP request 3 in the HTTP response 3, and send it through the network of the wireless local area network 2. The path is returned to the terminal. After the terminal receives the HTTP response 3, the TCP connection established on the wireless local area network 2 between the terminal and the server is disconnected.
  • FIG. 19 shows a schematic flowchart of multi-path transmission between the terminal and the server through MPHTTP.
  • the terminal can access the server through three network paths: cellular network, WLAN 1, and WLAN 2.
  • the process of multi-path transmission between the terminal and the server through MPHTTP can be as follows:
  • An application on the terminal initiates an original HTTP request.
  • the byte range of the original HTTP request may be 0-8999.
  • the application on the terminal splits the original HTTP request into 3 HTTP requests (for example, HTTP request 1, HTTP request 2, and HTTP request 3) based on the byte range of the original HTTP request.
  • the byte range of HTTP request 1 may be 0-2999
  • the byte range of HTTP request 2 may be 3000-5999
  • the byte range of HTTP request 3 may be 6000-8999.
  • the terminal sends the HTTP request 1 to the server through the network path of the cellular network.
  • the terminal sends HTTP request 2 to the server through the network path of WLAN 1.
  • the terminal sends HTTP request 3 to the server through the network path of WLAN 2.
  • the server can send HTTP success status response code 1 (for example, 206 partial content response) to the terminal through the network path of the cellular network.
  • the HTTP success status response code 1 may be used to indicate that the HTTP request 1 has successfully requested data with a content length of 3000 bytes.
  • the server can send the response data 1 (byte range: 0-2999 data) of HTTP request 1 to the terminal.
  • the server can send HTTP success status response code 2 (for example, 206 partial content response) to the terminal through the network path of the WLAN 1 network.
  • the HTTP success status response code 2 may be used to indicate that the HTTP request 2 has successfully requested data with a content length of 3000 bytes.
  • the server can send the response data 2 (byte range: 3000-5999 data) of the HTTP request 2 to the terminal.
  • the server can send HTTP success status response code 3 (for example, 206 partial content response) to the terminal through the network path of the WLAN 2 network.
  • HTTP success status response code 3 can be used to indicate that the HTTP request 3 has successfully requested data with a content length of 3000 bytes.
  • the server can send the response data 3 (byte range: 6000-8999 data) of the HTTP request 2 to the terminal.
  • the application on the terminal requests data such as streaming media from the server, it first establishes a long connection with the server on the specified network path, and then the terminal requests the server for fragmented data of a specified size through HTTP requests each time, for example , the size of the fragmented data can vary from 0.2MB to 2MB.
  • the terminal can simultaneously request data from the server through multiple network paths, which increases the bandwidth of the transmission network between the terminal and the server. For a large bandwidth network environment, when the fragmented data is too small, the bandwidth utilization rate will decrease.
  • an application eg, a video application
  • the terminal may request the server for fragmented data each time with a data volume of 2MB.
  • each time the terminal sends an HTTP request to the server it takes 0.5 round-trip time (round-trip time, RTT).
  • RTT round-trip time
  • the server will return the data requested by the terminal to the terminal.
  • the theoretical bandwidth utilization rate is higher.
  • LTE long term evolution
  • 0.5RTT is 30ms
  • the bandwidth is 5MBps
  • the amount of data that an application on the terminal (such as a video application) requests from the server for fragmented data each time may be 2MB.
  • each time the terminal sends an HTTP request to the server it takes 0.5 round-trip time (round-trip time, RTT).
  • RTT round-trip time
  • the round-trip delay RTT between the terminal and the server can reach 40ms, 0.5 RTT is 20ms.
  • the terminal takes 20ms for the terminal to send the HTTP request 1 (byte range: 0-2MB) initiated by the application to the server, and it takes another 20ms for the server to transmit the fragmented data 1 to the terminal after receiving the HTTP request 1.
  • the terminal can send the HTTP request 2 (byte range: 2MB-4MB) initiated by the application to the server, which takes 20ms.
  • the server After the server receives the HTTP request 2, it takes another 20ms to transmit the fragmented data 2 to the terminal. Therefore, the theoretical bandwidth utilization is 50%.
  • bandwidth utilization As shown in Figure 21, the relationship between bandwidth utilization and the amount of fragmented data, network bandwidth, and network round-trip delay can be as follows:
  • R is the bandwidth utilization rate
  • Trans is the time-consuming of fragmented data transmission
  • M is the data volume of the fragmented data
  • B is the network bandwidth
  • RTT is the round-trip delay of the network.
  • the bandwidth of the network path is constant, the smaller the amount of fragmented data, the lower the theoretical bandwidth utilization rate when the terminal requests fragmented data from the server through the network path.
  • the bandwidth of the network path is larger, and the theoretical bandwidth utilization rate when the terminal requests fragmented data from the server through the network path is lower.
  • Exemplarily take a network path with a network bandwidth of 100 MBps and an RTT of 40 ms as an example.
  • the bandwidth utilization rate is more than 90%
  • the data volume of the fragmented data needs to be ⁇ 18MB
  • the bandwidth utilization rate is more than 75%
  • the data volume of the fragmented data needs to be more than 15MB.
  • the bandwidth utilization rate will not be higher than 50%.
  • the fourth part of the embodiment of the present application provides a multi-path data prefetching method.
  • the terminal can prefetch the data of the second data amount from the server, wherein the second data amount is The amount of data is greater than the first amount of data. Then, after receiving the data of the second data volume returned by the server, the terminal may first return the data of the first data volume in the second data volume to the application. Then, the remaining data (the second amount of data - the first amount of data) is stored in the prefetch buffer.
  • the terminal can directly extract the remaining (the second amount of data - the first amount of data) bytes from the prefetch buffer data to the application.
  • the bandwidth utilization rate of the network path between the terminal and the server is improved, and when the application frequently accesses data in different ranges on the same URI address, the time for the application to obtain the data can be saved.
  • the terminal may retrieve the prefetched data from the server through a network path.
  • the steps include:
  • the application on the terminal sends data request 1 (request range: 1-100) to the network-wide aggregation module (link turbo).
  • the network-wide aggregation module can increase the request range of the data request 1, and then select a suitable network path based on the MPHTTP protocol to send the HTTP request 1 (request range: 1-200) to the server.
  • the server After receiving HTTP request 1, the server returns the requested data (data range: 1-200) through HTTP response 1 to the network-wide aggregation module.
  • the network-wide aggregation module returns the response data 1 to the application, wherein the data range in the response data 1 is 1-100.
  • the network-wide aggregation module stores the remaining data in the local prefetch buffer of the terminal, wherein the data range of the remaining data is 101-200.
  • the application sends data request 2 to the network-wide aggregation module, wherein the data range requested by data request 2 is 101-200.
  • the network-wide aggregation module can judge whether the data requested by the data request 2 exists in the prefetch buffer, and if so, the data request 2 hits the prefetch buffer.
  • the application can directly obtain the response data 2 of the data request 2 from the prefetch buffer (data range: 101-200).
  • the terminal may extract prefetched data from the server through multiple network paths.
  • the steps include:
  • the application on the terminal sends data request 1 (request range: 1-100) to the network-wide aggregation module.
  • the network-wide aggregation module can expand the request range of the data request 1 to 1-200. Then, the network-wide aggregation module can select appropriate multiple (for example, two) network paths based on the MPHTTP protocol, and send HTTP request 1 (request range: 1-50) to the server on network path 1 (for example, cellular network) respectively, Send HTTP request 2 (request range: 51-200) to the server on network path 2 (eg, WLAN network).
  • HTTP request 1 request range: 1-50
  • the server on network path 1 for example, cellular network
  • Send HTTP request 2 (request range: 51-200) to the server on network path 2 (eg, WLAN network).
  • the network-wide aggregation module receives the HTTP response 1 returned by the server through the network path 1, wherein the HTTP response 1 includes data in a data range of 1-50.
  • the network-wide aggregation module receives the HTTP response 2 returned by the server through the network path 2, wherein the HTTP response 1 includes data in a data range of 51-200.
  • the network-wide aggregation module can return response data 1 to the application, where the data range of response data 1 is 1-100.
  • the network-wide aggregation module stores the remaining data in the local prefetch buffer of the terminal, where the data range of the remaining data is 101-200.
  • the application sends data request 2 to the network-wide aggregation module, wherein the data range requested by data request 2 is 101-200.
  • the network-wide aggregation module can judge whether the data requested by the data request 2 exists in the prefetch buffer, and if so, the data request 2 hits the prefetch buffer.
  • the application can directly obtain the response data 2 of the data request 2 from the prefetch buffer (data range: 101-200).
  • the data fragment requested by the terminal from the server is larger than the data fragment requested by the application, the bandwidth utilization rate of the network path between the terminal and the server will be increased, and when the application When frequently accessing data of different scopes on the same URI address, it can save the time for the application to obtain the data. For example, in scenarios such as video playback, the application needs to obtain data streams frequently, and the data prefetching method provided in this application can improve the smoothness of video playback.
  • the following introduces a software system architecture of the terminal 100 provided in the fourth part of the embodiment of the present application.
  • FIG. 23 shows the software system architecture of the terminal 100 provided by the embodiment of the present application.
  • the software system of the terminal 100 may adopt a layered architecture, and the layered architecture may divide the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
  • the software system of the terminal 100 may include an application layer, a user space (user space) and a kernel (kernel) layer.
  • the application layer may include applications 901 .
  • applications 901 For example, video applications, music applications, etc.
  • the application 901 when the application 901 requests fragmented data from the server through the original HTTP request, it can send the original HTTP request to the server through the TCP port 80.
  • the user space may include a plurality of function modules based on buffer pool scheduling, a flow intelligence module 907 .
  • the multiple functional modules based on buffer pool scheduling may include a buffer management module 902 , an intelligent prefetch module 903 , a high-performance service request rearrangement module 904 , a buffer-based multipath scheduling module 905 , and a path affinity analysis module 906 .
  • the buffer management module 902 can be used to divert the original HTTP request sent from the upper-layer application from the TCP port 80 through a software interface (eg, iptables) during the process of filtering the data packets in the TCP port 80 by the network filtering module (eg, netfiler).
  • the buffer management module 902 can also be configured to analyze whether the original HTTP request hits the prefetch buffer (that is, whether the prefetch buffer includes the request of the original HTTP request) after diverting the original HTTP request sent by the upper-layer application in the TCP port 80. The data). When the original HTTP request hits the prefetch buffer, the buffer management module 902 may directly return the data corresponding to the request range of the original HTTP request in the prefetch buffer to the application.
  • the buffer management module 902 can notify the high performance information that the buffer breaks down the original request Service rearrangement module 904 .
  • the buffer management module 902 can also be used to send the raw HTTP request to the intelligent prefetch module 903 .
  • the intelligent prefetching module 903 can send the triggering instruction of the prefetching request to the high-performance service request rearranging module 904 according to information such as the buffer watermark of the prefetching buffer and the number of times the application 901 accesses the same URI address.
  • the high-performance service request rearrangement module 904 can be used to determine the data of this prefetch request according to the previous prefetch value and data such as the bandwidth/latency of the network path after receiving the trigger instruction of the prefetch request request scope.
  • the high-performance service request reordering module 904 can also be used to send the original HTTP request or the reordered HTTP request to the buffer-based multipath scheduling module 905.
  • the path affinity analysis module 906 can be used to analyze the service perception information (such as service flow service quality, service flow type, etc.)/network perception information (for example, the number of network paths and the transmission quality of each network path) sent according to the flow intelligence module 907 ), etc.) to analyze the performance information of each network path on the terminal.
  • service perception information such as service flow service quality, service flow type, etc.
  • network perception information for example, the number of network paths and the transmission quality of each network path
  • the buffer-based multi-path scheduling module 905 can be configured to determine a multi-path scheduling policy (ie, which paths are used to request data, and how much data is requested on each path) according to the performance information of the network paths.
  • the buffer-based multi-path scheduling module 905 can be configured to split the original HTTP request/rearranged HTTP request into multiple sub-HTTP requests through MPHTTP based on the determined multi-path scheduling policy, and split the original HTTP request/reordered HTTP request into multiple sub-HTTP requests through multiple network paths (eg , dual Wi-Fi networks, dual cellular networks, etc.) to the server.
  • the flow intelligence module 907 can be used to perform DNS parsing (DNS parsing), manifest file parsing, flow QoS probing (flow QoS probing), flow classification (flow classification), and obtain service awareness/network awareness information and the like.
  • DNS parsing DNS parsing
  • manifest file parsing manifest file parsing
  • flow QoS probing flow QoS probing
  • flow classification flow classification
  • the flow intelligence module 907 can send the incoming service awareness information/network awareness information to the path affinity analysis module 906 .
  • the kernel layer may include a kernel transmission control protocol/Internet protocol (transmission control protocol/Internet protocol, TCP/IP) protocol stack.
  • TCP/IP protocol stack includes TCP port 80.
  • the multiple functional modules based on buffer pool scheduling may be the network-wide aggregation modules in the embodiment shown in FIG. 22A or FIG. 22B.
  • the textual descriptions for the network-wide aggregation module in the embodiment shown in FIG. 22A or FIG. 22B which will not be repeated here.
  • FIG. 24 shows a schematic flowchart of a method for a first application to obtain data on a server for the first time according to an embodiment of the present application. As shown in Figure 24, the method includes the following steps:
  • a first application on the terminal 100 initiates a first acquisition request for the first fragmented data for the first URI for the first time.
  • the first URI corresponds to a storage location of a data resource (for example, an HTML document, an image, a video clip, a program, etc.) on the server.
  • the structure of the URI includes the naming mechanism for accessing the resource, the host name where the resource is stored, and the name of the resource itself.
  • the naming mechanism for accessing resources may include http, ftp, mailto, file, and so on.
  • the first URI may also be a uniform resource locator (uniform resource locator, URL).
  • the first obtaining request includes the data range of the first fragmented data.
  • the first application may be a video application
  • the first URI may be "http://huawei.himovie.com/movie/RomeoAndJuliet.rmvb”
  • the resource access mechanism corresponding to the first URI may be an HTTP protocol access mechanism
  • the resource corresponding to the first URI is located on the server of "huawei.himovie.com”
  • the name of the resource corresponding to the first URI may be "/movie/RomeoAndJuliet.rmvb”.
  • the data range of the first fragment data may be 0-2MB. The examples are used only to explain the application and should not be construed as limiting.
  • the terminal 100 In response to the first acquisition request, the terminal 100 enables all network communication modules, and sends a DNS request on all network paths according to the domain name of the first URI.
  • the network communication module may include a cellular network communication module and a WLAN communication module.
  • the cellular network communication module can realize single cellular network communication or dual cellular network communication.
  • the WLAN communication module can realize single Wi-Fi network communication or dual Wi-Fi network communication.
  • the terminal 100 can obtain the domain name (ie, the host name) of the first URI, and send DNS requests on all network paths.
  • the DNS request may be used by the terminal 100 to obtain the IP address of the server corresponding to the first URI.
  • the network paths on the terminal 100 may include cellular network path 1, cellular network path 2, Wi-Fi network path 1, and Wi-Fi network path 2.
  • the terminal 100 may send DNS requests on the cellular network path 1, the cellular network path 2, the Wi-Fi network path 1, and the Wi-Fi network path 2, respectively.
  • the terminal 100 receives the DNS responses returned on the N network paths, and resolves the IP addresses corresponding to the servers on the N network paths from the N DNS responses.
  • N is a positive integer.
  • the terminal 100 may determine that the network path for which the DNS response has not been received is unavailable, that is, the terminal 100 cannot pass through the network The path accesses the server corresponding to the first URI.
  • the terminal 100 may determine that the network path on which the DNS response is received is available, that is, the terminal 100 can access the server corresponding to the first URI through the network path.
  • the IP addresses of the servers corresponding to the first URI obtained by the terminal 100 from different network paths may be the same.
  • the IP addresses of the servers corresponding to the first URI obtained by the terminal 100 from different network paths may be different.
  • the IP address of the server corresponding to the first URI obtained by the terminal 100 from the cellular network path 1 may be IP address_1.
  • the IP address of the server corresponding to the first URI obtained by the terminal 100 from the cellular network path 2 may be IP address_2.
  • the IP address of the server corresponding to the first URI obtained by the terminal 100 from the Wi-Fi network path 1 may be IP address_3.
  • the IP address of the server corresponding to the first URI obtained by the terminal 100 from the Wi-Fi network path 2 may be IP address_4.
  • the first application on the terminal 100 initiates an initial HTTP request according to the first URI and the IP address of the server on the default network path.
  • the request scope of the initial HTTP request is the same as the request scope of the first obtaining request.
  • the byte range field of the initial HTTP request may include the request range of the initial HTTP request.
  • the terminal 100 may be preset with a default network path.
  • the destination IP address in the initial HTTP request is the IP address of the server corresponding to the first URI obtained by the terminal 100 on the default network path.
  • the terminal 100 may access the server through the cellular network path 1, the cellular network path 2, the Wi-Fi network path 1, and the Wi-Fi network path 2.
  • the default network path preset on the terminal 100 may be the Wi-Fi network path 1, and the terminal 100 may use the IP address_3 of the server on the Wi-Fi network path 1 as the destination IP address of the initial HTTP request.
  • the terminal 100 splits the request range of the initial HTTP request into N sub-request ranges with the same range length.
  • the request scope of the initial HTTP request is the same as the data scope of the first fragmented data.
  • the request range of the initial HTTP request may be 0-2MB.
  • the terminal 100 can access the server corresponding to the first URI through four network paths, namely, cellular network path 1, cellular network path 2, Wi-Fi network path 1, and Wi-Fi network path 2.
  • the terminal 100 may split the request range of the initial HTTP request into 4 sub-request ranges with the same request range length.
  • Range 3 is 1MB-1.5MB
  • sub-request range 4 is 1.5MB-2MB.
  • the terminal 100 generates N HTTP requests according to the first URI, the N sub-request ranges, and the IP address of the server on the N network paths, and sends the N HTTP requests to the server through the N network paths respectively.
  • N HTTP requests may be referred to as N fifth HTTP requests in this embodiment of the present application.
  • the terminal 100 may access the server corresponding to the first URI through four network paths: cellular network path 1, cellular network path 2, Wi-Fi network path 1, and Wi-Fi network path 2.
  • the IP address of the server on the cellular network path 1 may be IP address_1
  • the IP address of the server on the cellular network path 2 may be IP address_2
  • the IP address of the server on the Wi-Fi network path 1 may be IP address_ 3.
  • the IP address of the server on Wi-Fi network path 2 can be IP address_4.
  • Subrequest range 1 is 0-0.5MB
  • subrequest range 2 is 0.5MB-1MB
  • subrequest range 3 is 1MB-1.5MB
  • subrequest range 4 is 1.5MB-2MB.
  • the terminal 100 can send the HTTP request 1 to the server corresponding to the first URI on the cellular network path 1, wherein the sub-request range 1 of the HTTP request 1 is 0-0.5 MB, and the The destination IP address is IP address_1.
  • the terminal 100 may send the HTTP request 2 to the server corresponding to the first URI on the cellular network path 2, where the sub-request range 2 of the HTTP request 2 is 0.5-1.0 MB, and the destination IP address of the HTTP request 2 is the IP address _2.
  • the terminal 100 may send the HTTP request 3 to the server corresponding to the first URI on the Wi-Fi network path 1, wherein the sub-request range 3 of the HTTP request 3 is the 1st-1.5 MB, and the destination IP address of the HTTP request 3 is IP address_3.
  • the terminal 100 may send the HTTP request 1 to the server corresponding to the first URI on the cellular network path 1, wherein the sub-request range 4 of the HTTP request 4 is 1.5-2 MB, and the destination IP address of the HTTP request 4 is IP address_ 4.
  • the above Table 1 is only used to explain the present application and should not be construed as a limitation.
  • the terminal 100 receives N HTTP responses returned by the server in the N network paths, and returns the first fragmented data in the N HTTP responses to the first application.
  • first fragmented data may be referred to as fifth data in this embodiment of the present application.
  • the server may encapsulate the data requested by the HTTP request in the HTTP response, and return the data to the terminal 100 according to the original path of the HTTP request.
  • the terminal 100 sends HTTP request 1 to the server through cellular network path 1, sends HTTP request 2 to the server through Wi-Fi network path 1, sends HTTP request 3 to the server through Wi-Fi network path 1, and sends HTTP request 4 Send to server via Wi-Fi network path 2.
  • HTTP request 1 is used to request data in the range of 0-0.5MB of the resource corresponding to the first URI
  • HTTP request 2 is used to request data in the range of 0.5MB-1MB of the resource corresponding to the first URI
  • HTTP request 3 is used.
  • the data in the range of 1MB-1.5MB of the resource corresponding to the first URI is requested
  • the HTTP request 4 is used to request the data in the range of 1.5MB-2MB of the resource corresponding to the first URI.
  • the server may encapsulate the 0-0.5 MB data of the resource corresponding to the first URI in the HTTP response 1, and return the HTTP response 1 to the terminal 100 through the cellular network path 1.
  • the server may encapsulate the 0.5MB-1MB data of the resource corresponding to the first URI in the HTTP response 2, and return the HTTP request 2 to the terminal 100 through the cellular network path 2.
  • the server may encapsulate the 1 MB-1.5 MB data of the resource corresponding to the first URI in the HTTP response 3, and return the HTTP request 3 to the terminal 100 through the Wi-Fi network path 1.
  • the server may encapsulate the 1.5MB-2MB data of the resource corresponding to the first URI in the HTTP response 4, and return the HTTP request 4 to the terminal 100 through the Wi-Fi network path 2.
  • the terminal 100 After receiving the HTTP response 1, the terminal 100 can retrieve the 0-0.5 MB data of the resource corresponding to the first URI from the HTTP response 1. After the terminal 100 responds with HTTP 2, the terminal 100 can retrieve the 0.5MB-1MB data of the resource corresponding to the first URI from the HTTP response 2. After the HTTP response 3, the terminal 100 may extract the 1MB-1.5MB data of the resource corresponding to the first URI from the HTTP response 3. After the HTTP response 4, the terminal 100 may retrieve the 1.5MB-2MB data of the resource corresponding to the first URI from the HTTP response 4.
  • the terminal 100 may combine the 0-0.5 MB data, the 0.5 MB-1 MB, the 1 MB-1.5 MB data, and the 1.5 MB-2.0 MB data of the resource corresponding to the first URI into the first fragmented data, Return to the first application.
  • the above examples are only used to explain the present application and should not be construed as limitations.
  • the terminal 100 measures key performance indicator (key performance indication, KPI) information of the N network paths.
  • KPI key performance indication
  • the key performance indicator information may include real bandwidth, round-trip delay RTT, flow completion time (FCT), and the like.
  • the terminal 100 can measure the real bandwidth of the N network paths according to the following formula:
  • the terminal 100 has four network paths, namely, a cellular network path 1, a cellular network path 2, a Wi-Fi network path 1, and a Wi-Fi network path 2.
  • the amount of data requested by the terminal 100 on the four network paths may all be 5MB.
  • the respective throughputs X i , data transmission time-consuming TransTime i , round-trip delay RTT i , and requested data volume U i of these four network paths can be shown in Table 2 below:
  • the throughput X 1 of the cellular network path 1 is 10MBps
  • the requested data volume U 1 is 0.5MB
  • the round-trip delay RTT 1 is 50ms
  • the data transmission time TransTime 1 is 25ms.
  • the throughput X 2 of the cellular network path 2 is 5.88 MBps
  • the requested data amount U 2 is 0.5 MB
  • the round-trip delay RTT 2 is 70 ms
  • the data transmission time TransTime 2 is 20 ms.
  • the throughput X 3 of the Wi-Fi network path 1 is 20MBps
  • the requested data volume U 3 is 0.5MB
  • the round-trip delay RTT 3 is 40ms
  • the data transmission time TransTime 3 is 20ms.
  • the throughput X 4 of the Wi-Fi network path 2 is 15MBps
  • the requested data amount U 4 is 0.5MB
  • the round-trip delay RTT 4 is 60ms
  • the data transmission time TransTime 4 is 30ms.
  • the bandwidth utilization rate of the cellular network path 1 is 50%
  • the real bandwidth of cellular network path 1 is 20MBps.
  • Bandwidth Utilization of Cellular Network Path 2 is 58.82%
  • the true bandwidth of cellular network path 2 is 10MBps.
  • the bandwidth utilization of Wi-Fi network path 1 is 50%
  • the real bandwidth of Wi-Fi network path 1 is 40MBps.
  • the bandwidth utilization of Wi-Fi network path 2 is 50%, and the real bandwidth of Wi-Fi network path 2 is 30MBps.
  • FIG. 25 shows a schematic flowchart of a method for the first application to obtain data on the server again provided in the fourth part of the embodiment of the present application. As shown in Figure 25, the method includes the following steps:
  • the first application of the terminal 100 initiates an initial HTTP request for the first fragmented data with respect to the first URI.
  • step S2404 in the above-mentioned embodiment shown in FIG. 24 , which will not be repeated here.
  • the terminal 100 records time information when the first application initiates the initial HTTP request, and creates a first prefetch buffer corresponding to the first URI (which is initially empty).
  • the terminal 100 may record the time information when the first application initiates the HTTP request for the fragmented data of the resource corresponding to the first URI.
  • the time at which the first application initiates the first HTTP request (ie, the first HTTP request) for the first URI is "June 18, 2020 15:26:2:30 ms".
  • the terminal 100 When the first application of the terminal 100 initiates an initial HTTP request for acquiring the first fragmented data for the first URI for the first time, the terminal 100 locally creates a first prefetch buffer corresponding to the first URI. Wherein, the initial water level of the first prefetch buffer is empty.
  • the first application of the terminal 100 initiates a first HTTP request for acquiring the second fragment data with respect to the first URI.
  • the first fragmented data may be referred to as the first data in this embodiment of the present application.
  • the first HTTP request may refer to any HTTP request initiated by the first application for fragmented data on the resource corresponding to the first URI after the first application initiates the above-mentioned initial HTTP request.
  • the second fragmented data may be data in the range of 2MB-4MB in the resource (eg, video resource) corresponding to the first URI.
  • the second obtaining request includes the data range of the second fragmented data.
  • the second fragmented data may be data in the range of 4MB-6MB in the resource (eg, video resource) corresponding to the first URI.
  • the terminal 100 records time information when the first application initiates the first HTTP request.
  • the terminal 100 may record the time when the first application requests the first URI.
  • the terminal 100 may record the time when the first HTTP request is initiated. For example, the time at which the first application initiates the first HTTP request is "June 18, 2020 15:26:3 seconds 200 milliseconds".
  • the terminal 100 determines whether the first prefetch buffer includes the second fragment data. If yes, execute S2506; if the terminal 100 determines that the data requested in the first HTTP request is not included in the first prefetch buffer, execute S2510.
  • the terminal 100 returns the second fragmented data in the first prefetch buffer to the first application.
  • the terminal 100 After the terminal 100 returns the second fragment data in the first prefetch buffer pool to the first application, the terminal 100 deletes the second fragment data in the first prefetch buffer to release the first prefetch buffer The storage space of the second fragment data in the zone.
  • the terminal 100 may obtain the first HTTP request, and parse out the request range in the first HTTP request (ie, the data range of the second fragmented data). The terminal 100 can determine whether the second fragment data is included in the first prefetch buffer.
  • the data in the first prefetch buffer comes from the data prefetch process for the resource corresponding to the first URI in the subsequent embodiment shown in FIG. 26 , and the specific content can refer to the subsequent embodiment shown in FIG.
  • the terminal 100 may return the second fragment data in the first prefetch buffer to the first application. Then, the terminal 100 may delete the second fragment data in the first prefetch buffer to release the storage space of the second fragment data in the first prefetch buffer.
  • the first prefetch buffer may store data in the range of 6MB-10MB in the resource corresponding to the first URI.
  • the second fragmented data requested by the first HTTP request is data in the range of 6MB-8MB in the resource corresponding to the first URI.
  • the terminal 100 may determine that the second fragment data is included in the first prefetch buffer.
  • the terminal 100 may return the second fragment data in the first prefetch buffer to the first application, delete the second fragment data in the first prefetch buffer, and release the storage space of the second fragment data.
  • the first prefetch buffer stores data in the range of 8MB-10MB in the resource corresponding to the first URI.
  • the terminal 100 determines whether the remaining buffer amount in the first prefetch buffer is lower than the watermark threshold. If so, S2509 is performed, and the terminal 100 may initiate a data prefetching process for the resource corresponding to the first URI.
  • the terminal 100 may determine whether the amount of buffered data in the first prefetch buffer is lower than the watermark threshold. When the terminal 100 determines that the amount of buffered data in the first prefetch buffer is lower than the watermark threshold, the terminal 100 may trigger a prefetch process for the data on the first URL. For the data prefetching process of the resource corresponding to the first URI, reference may be made to the subsequent embodiment shown in FIG. 26 , and details are not repeated here.
  • the first prefetch buffer stores data in the range of 8MB-10MB in the resource corresponding to the first URI, that is, the buffered amount of the first prefetch buffer is 2MB. .
  • the above watermark threshold may be 4MB.
  • the terminal 100 may determine that the buffered amount of the first prefetch buffer is lower than the watermark threshold, and the terminal 100 may trigger the data prefetching process for the resource corresponding to the first URI.
  • the terminal 100 may judge whether the number of times the first application requests to obtain the resource corresponding to the first URI within the specified time period is greater than the number of times threshold according to the time information of each time the first application initiates the initial HTTP request, and if so, execute the above steps S2509, The terminal 100 triggers a data prefetching process for the resource corresponding to the first URI.
  • the terminal 100 splits the request range of the second original request according to the key indicator information of the N network paths, obtains R HTTP requests, and sends the R HTTP requests to the server through the R network paths respectively.
  • N is greater than or equal to R
  • R is a positive integer.
  • the terminal 100 determines that the number of times the first application requests the resource corresponding to the first URI within the specified time period is greater than the number of times threshold according to the time information of each time the first application initiates the HTTP request for the first URI, the terminal 100 triggers the request for the resource corresponding to the first URI data prefetching process.
  • the data prefetching process of the resource corresponding to the first URI reference may be made to the subsequent embodiment shown in FIG. 26 , and details are not repeated here.
  • the terminal 100 may determine whether the number of times the first application requests the resource corresponding to the first URI within the last 3s (that is, within the 3s before this step S2510) is greater than 3 times, when the first application requests the first URI within the last 3s When the number of times of the resource corresponding to the URI is 5 times (more than 3 times), the terminal 100 may trigger the data prefetching process for the resource corresponding to the first URI.
  • the terminal 100 determines, according to the time information of each time the first application initiates an HTTP request for the first URI, the number of times the first application requests to obtain the resource corresponding to the first URI within the specified time period is less than or equal to the number of times threshold, the terminal 100 according to the N network R network paths are selected from the key performance indicator information of the path and the request range of the first HTTP request. Then, the terminal 100 may split the request scope of the first HTTP request into R sub-request scopes according to the key performance indicator information of the R network paths. Next, the terminal 100 may determine the R HTTP requests according to the first URI, the IP address of the server on the R network paths, and the R sub-request ranges, and send the R HTTP requests to the server through the R network paths respectively.
  • the terminal 100 may first establish a TCP connection with the server on the R network paths. Then, the terminal 100 can determine the respective sub-request ranges corresponding to the R network paths by the following formula according to the request range of the first HTTP request, the actual bandwidth and the round-trip delay of the R network paths.
  • M can be used to represent the data length requested by the terminal 100 from the server
  • U i can be used to represent the length of the sub-request range corresponding to the ith network path among the R network paths, 1 ⁇ i ⁇ R .
  • FCT i can be used to represent the time required for the ith network path in the R network paths to transmit the data of length U i .
  • the terminal 100 takes 0.5*RTT i for the terminal 100 to send the HTTP request to the server on the ith network path, and it takes U i /Z i for the server to return the data stream requested by the terminal 100 on the ith network path, where Z i can be used to represent the true bandwidth of the ith network path among the R network paths.
  • the terminal 100 needs to make the transmission time on each network path the same (that is, the FCT i on each network path is a fixed value c).
  • the above formulas are only used to explain the present application and should not be construed as limitations.
  • the N network paths on the terminal 100 may include cellular network path 1, cellular network path 2, Wi-Fi network path 1, and Wi-Fi network path 2.
  • cellular network path 1 cellular network path 2
  • Wi-Fi network path 1 Wi-Fi network path 2
  • Wi-Fi network path 2 Wi-Fi network path 2.
  • Table 3 the real bandwidth, round-trip delay RTT and obtained server IP address of these four network paths can be shown in Table 3 below:
  • the real bandwidth Z 1 of the cellular network path 1 may be 20 MBps, and the round-trip delay RTT 1 of the cellular network path 1 may be 50 ms.
  • the real bandwidth Z 2 of the cellular network path 2 may be 10 MBps, and the round-trip delay RTT 2 of the cellular network path 2 may be 60 ms.
  • the real bandwidth Z 3 of the Wi-Fi network path 1 may be 40 MBps, and the round-trip delay RTT 3 of the Wi-Fi network path 1 may be 40 ms.
  • the real bandwidth Z 4 of the Wi-Fi network path 2 may be 20 MBps, and the round-trip delay RTT 4 of the Wi-Fi network path 2 may be 60 ms.
  • Table 3 above are only for explaining the present application and should not be construed as a limitation.
  • the request range of the first HTTP request may be 6MB-8MB, and the data length M requested by the terminal 100 from the server is 2MB.
  • Scope 1, sub-request scope 2, sub-request scope 3, and sub-request scope 4 are four sub-request scopes.
  • the request range length U 1 of cellular network path 1 may be 0.35MB
  • the request range length U 2 of cellular network path 2 may be 0.075MB
  • the request range length U 3 of Wi-Fi network path 1 may be 0.9MB
  • the cellular network path 1 request range length U 3 may be 0.9MB.
  • the request range length U4 for network path 2 may be 0.675MB. Therefore, sub-request range 1 may be 6MB-6.35MB, and sub-request range 1 corresponds to cellular network path 1.
  • Sub-request range 2 may be 6.35MB-6.425MB, and sub-request range 2 corresponds to cellular network path 2.
  • Sub-request range 3 can be 6.425MB-7.325MB, and sub-request range 3 corresponds to Wi-Fi network path 3.
  • Sub-request range 4 may be 7.325MB-8MB, and sub-request range 4 corresponds to Wi-Fi network path 4.
  • the terminal 100 can determine the HTTP request 1 according to the IP address_1 of the server on the cellular network path 1, the first URI and the sub-request range 1, and send the HTTP request 1 to the server through the cellular network path 1.
  • the terminal 100 may determine the HTTP request 2 according to the IP address_2 of the server on the cellular network path 2, the first URI and the sub-request range 2, and send the HTTP request 2 to the server through the cellular network path 2.
  • the terminal 100 can determine the HTTP request 3 according to the IP address_3 of the server on the Wi-Fi network path 1, the first URI and the sub-request range 3, and send the HTTP request 3 to the server through the Wi-Fi network path 1.
  • the terminal 100 can determine the HTTP request 4 according to the IP address_4 of the server on the Wi-Fi network path 2, the first URI and the sub-request range 3, and send the HTTP request 4 to the server through the Wi-Fi network path 2.
  • the terminal 100 may, according to the request range of the first HTTP request, the actual bandwidth of the R network paths, and the round-trip Delay, determine the sub-request range corresponding to each of the R network paths. Then, the terminal 100 establishes a TCP connection with the server on the R network paths. At this time, the terminal 100 handshakes three times with the server on the ith network path to establish a TCP connection, which takes 1.5*RTT i .
  • the terminal 100 can determine the sub-request ranges corresponding to each of the R network paths by using the above formula (24), formula (26) and formula (27).
  • the terminal 100 receives the R HTTP responses returned by the server on the R network paths, and returns the second fragmented data in the R HTTP responses to the first application.
  • the server may encapsulate the data requested by the HTTP request in the HTTP response, and return the data to the terminal 100 according to the network path sent by the HTTP request.
  • the terminal 100 fetches the second fragmented data from the R HTTP responses in the order of the request range, and returns the data to the first application.
  • the terminal 100 sends the HTTP request 1 to the server through the cellular network path 1, sends the HTTP request 2 to the server through the cellular network path 2, sends the HTTP request 3 to the server through the Wi-Fi network path 1, and sends the HTTP request 4 Send to server via Wi-Fi network path 2.
  • HTTP request 1 is used to request data in the range of 6MB-6.35MB of the resource corresponding to the first URI
  • HTTP request 2 is used to request data in the range of 6.35MB-6.425MB of the resource corresponding to the first URI
  • HTTP request 3 is used For requesting data in the range of 6.425MB-7.325MB of the resource corresponding to the first URI
  • HTTP request 4 is used to request data in the range of 7.325MB-8MB of the resource corresponding to the first URI.
  • the server may encapsulate the data in the range of 6-6.35 MB of the resource corresponding to the first URI in the HTTP response 1, and return the HTTP response 1 to the terminal 100 through the cellular network path 1.
  • the server may encapsulate the data in the range of 6.35MB-6.425MB of the resource corresponding to the first URI in the HTTP response 2, and return the HTTP request 2 to the terminal 100 through the cellular network path 2.
  • the server can encapsulate the data in the range of 6.425MB-7.325MB of the resource corresponding to the first URI in the HTTP response 3, and return the HTTP request 3 to the terminal 100 through the Wi-Fi network path 1 .
  • the server may encapsulate the data in the range of 7.325MB-8MB of the resource corresponding to the first URI in the HTTP response 4, and return the HTTP request 4 to the terminal 100 through the Wi-Fi network path 2.
  • the terminal 100 After receiving the HTTP response 1, the terminal 100 can retrieve the data in the range of 6MB-6.35MB of the resource corresponding to the first URI from the HTTP response 1. After the terminal 100 responds with HTTP 2, the terminal 100 can retrieve the data in the range of 6.35MB-6.425MB of the resource corresponding to the first URI from the HTTP response 2. After receiving the HTTP response 3, the terminal 100 can retrieve data in the range of 6.425MB-7.325MB of the resource corresponding to the first URI from the HTTP response 3. After receiving the HTTP response 4, the terminal 100 may retrieve the data in the range of 7.325MB-8MB of the resource corresponding to the first URI from the HTTP response 4.
  • the terminal 100 may assign data in the range of 6MB-6.35MB, data in the range of 6.35MB-6.425MB, data in the range of 6.425MB-7.325MB, and data in the range of 7.325MB-8MB of the resource corresponding to the first URI.
  • the data is combined into the above-mentioned second fragmented data according to the range order (the byte order is arranged from small to large), and is returned to the first application.
  • the following describes the process of the data prefetching method for the resource corresponding to the first URI provided in the fourth part of the embodiment of the present application.
  • FIG. 26 shows a schematic flowchart of a data prefetching method provided by an embodiment of the present application. As shown in Figure 26, the method includes the following steps:
  • the terminal 100 acquires the last acquired data amount K and the end byte position for the resource corresponding to the first URI.
  • the amount of data acquired by the terminal 100 for the resource corresponding to the first URI last time is 2MB
  • the last request range for the resource corresponding to the first URI is 4MB-6MB
  • the last byte position of the resource corresponding to the first URI requested last time may be the 6th MB byte.
  • the terminal 100 judges whether the total bandwidth utilization rate of the N network paths exceeds the specified threshold P when the set prefetch amount is a*K (a is an integer greater than 1), and if so, executes S2603, and the terminal 100 determines that The corresponding first prefetch value when the total bandwidth utilization of the N network paths is the specified threshold P. If the bandwidth utilization of the available network path does not exceed the specified threshold P, step S2607 is executed.
  • the terminal 100 can determine when the set prefetch amount is a*K (a is an integer greater than 1) according to the prefetch amount being a*K, the total bandwidth of the N network paths, and the average round-trip delay of the N network paths. , the total bandwidth utilization of N network paths.
  • the terminal 100 may determine the first prefetch value according to the specified threshold P, the total bandwidth of the N network paths, and the average round-trip delay of the N network paths.
  • the network paths on the terminal 100 may include cellular network path 1, cellular network path 2, Wi-Fi network path 1 and Wi-Fi network path 2.
  • the bandwidth of the cellular network path 1 may be 20MBps, and the round-trip delay may be 50ms.
  • the bandwidth of the cellular network path 2 may be 10MBps, and the round-trip delay may be 70ms.
  • the bandwidth of the Wi-Fi network path 1 may be 40MBps, and the round-trip delay may be 40ms.
  • the bandwidth of the Wi-Fi network path 2 may be 30MBps, and the round-trip delay may be 60ms. Therefore, the total bandwidth of the N network paths on the terminal 100 may be 100 MBps, and the average round-trip delay of the N network paths may be 55 ms.
  • the specified threshold P may be 80%.
  • the last data prefetch amount K is 8MB, and the terminal 100 sets the prefetch amount a*K to be 16MB, the total number of N network paths is determined through the above formula (19) and formula (20).
  • the bandwidth utilization is 87.67%, which is greater than P (eg, 80%). Therefore, the terminal 100 may determine that the first prefetch value is 9MB according to the specified threshold P (for example, 80%), the total bandwidth of the N network paths (for example, 100 MBps), and the average round-trip delay of the N network paths (for example, 55 ms). .
  • the network paths on the terminal 100 may include cellular network path 1, cellular network path 2, Wi-Fi network path 1, and Wi-Fi network path 2.
  • the bandwidth of the cellular network path 1 may be 20MBps, and the round-trip delay may be 50ms.
  • the bandwidth of the cellular network path 2 may be 10MBps, and the round-trip delay may be 70ms.
  • the bandwidth of the Wi-Fi network path 1 may be 40MBps, and the round-trip delay may be 40ms.
  • the bandwidth of the Wi-Fi network path 2 may be 30MBps, and the round-trip delay may be 60ms. Therefore, the total bandwidth of the N network paths on the terminal 100 may be 100 MBps, and the average round-trip delay of the N network paths may be 55 ms.
  • a can be 2
  • P can be 90%
  • the last data prefetch amount K is 2MB
  • the terminal 100 sets the prefetch amount a*K to 4MB, through the above formula (19) and formula (20), it is determined that The total bandwidth utilization of the N network paths is 64%, which is less than the specified threshold P (eg, 80%). Therefore, the terminal 100 can perform the following step S2607.
  • the terminal 100 determines whether the remaining capacity in the first prefetch buffer is greater than the first prefetch value, and if so, executes S2605, and the terminal 100 determines that the current prefetch value is the first prefetch value. If the remaining capacity in the first prefetch buffer is less than or equal to the first prefetch value, S2606 is executed, and the terminal 100 determines that the current prefetch value is the previous prefetch value K.
  • the remaining buffer capacity in the first prefetch buffer may be 20MB
  • the first prefetch value may be 9MB
  • the remaining buffer capacity in the first prefetch buffer is greater than the first prefetch value. Therefore, the terminal 100 may This prefetch value is determined as the first prefetch value determination.
  • the remaining buffer capacity in the first prefetch buffer may be 8.5MB
  • the first prefetch value may be 9MB
  • the remaining buffer capacity in the first prefetch buffer is less than the first prefetch value. Therefore, the terminal 100
  • the current prefetch value may be determined as the previous prefetch value K.
  • the terminal 100 determines whether the remaining buffer capacity in the first prefetch buffer is greater than or equal to a*K, and if so, executes S2608, and the terminal 100 determines that the current prefetch value is a*K. If the remaining buffer capacity in the first prefetch buffer is less than a*K, S2606 is executed, and the terminal 100 determines that the prefetch value of this time is the data amount K of the last request.
  • a may be 2
  • the last requested data amount K may be 2MB
  • a*K may be 4MB
  • the remaining buffer capacity in the first prefetch buffer may be 8.5MB, which is greater than a*K. Therefore, the terminal 100 can determine that the amount of data requested this time is a*K.
  • a may be 2
  • the last requested data amount may be 2MB
  • a*K may be 4MB
  • the remaining buffer capacity in the first prefetch buffer may be 3MB, which is less than a*K. Therefore, the terminal 100 may determine that the data amount requested this time is the data amount K (for example, 2MB) requested last time.
  • the terminal 100 may directly determine whether the remaining buffer capacity in the first prefetch buffer is greater than or equal to after obtaining the last requested data amount K and the last requested end byte position for the resource corresponding to the first URI a*K, if yes, the terminal 100 determines that a*K is the amount of data requested this time. If the remaining buffer capacity in the first prefetch buffer is less than a*K, the terminal 100 determines that the data amount requested this time is the data amount K requested last time.
  • the terminal 100 determines the scope of the current request according to the first URI, the data volume of the current request, and the position of the last byte of the previous request.
  • the terminal 100 After the terminal 100 determines the amount of data requested this time, it can determine the range of the current request according to the position of the end byte of the previous request.
  • the amount of data requested this time may be 8MB, and the position of the last byte of the last request may be the 6th MB. Therefore, the range of this request may be the 6th MB to the 14th MB.
  • the terminal 100 selects L network paths according to the key indicator information of the N network paths and the current request range, and divides the current request range into L sub-request ranges. Among them, L is less than or equal to N.
  • the terminal 100 determines L HTTP requests according to the L sub-request ranges, the server IP addresses on the L network paths, and the first URI, and sends the L HTTP requests to the server through the L network paths respectively.
  • the terminal 100 may select L network paths according to the key performance indicator information of the N network paths and the range of the current request. Then, the terminal 100 may split the current request range into L sub-request ranges according to the key performance indicator information of the L network paths. Next, the terminal 100 may determine L HTTP requests according to the first URI, the IP address of the server on the L network paths, and the L sub-request ranges, and send the L HTTP requests to the server through the L network paths respectively. Among them, one network path corresponds to one HTTP request.
  • step S2511 shown in FIG. 25 , which will not be repeated here.
  • the terminal 100 receives the L HTTP responses returned by the server on the L network paths, obtains the response data in the L HTTP responses, returns the second fragmented data in the response data to the first application, and returns the response data in the response data to the first application.
  • Prefetch data is stored in the first prefetch buffer.
  • the server may encapsulate the data requested by the HTTP request in the HTTP response, and return the data to the terminal 100 according to the network path sent by the HTTP request.
  • the terminal 100 retrieves response data in the order of the request range from the L HTTP responses.
  • the response data may include the second fragment data and prefetch data requested by the first application.
  • the terminal 100 may retrieve the second fragmented data requested by the first application from the response data, return it to the first application, and store the remaining prefetched data in the response data into the first prefetch buffer. In this way, when the first application requests fragmented data next time, the terminal 100 can directly return the fragmented data requested by the first application to the first application from the first prefetch buffer, reducing the number of fragmented data requested by the first application waiting time.
  • the current request range for the resource corresponding to the first URI may be the 6th MB to the 14th MB.
  • the terminal 100 may obtain, from the L HTTP responses, data in the range of the 6th MB to the 14th MB of the resource corresponding to the first URI.
  • the second fragmented data obtained by the first application through the first HTTP request is data in the range of the 6th MB to the 8th MB.
  • the terminal 100 may return the data in the range of the 6th MB to the 8th MB to the first application, and store the data in the range of the 8th MB to the 14th MB in the first prefetch buffer corresponding to the first URI.
  • the selected network paths may be the same or different.
  • the terminal 100 may select L network paths, and in the next prefetching process, the terminal 100 may select S network paths, where S is less than or equal to N, and S is a positive integer.
  • the terminal 100 may obtain the first HTTP request initiated by the first application for the first URI, and the first HTTP request may be used to request the first data from the server.
  • the terminal 100 may generate L second HTTP requests, and the second HTTP requests may be used to request second data from the server, wherein the second data includes the first data and the data volume of the second data is larger than that of the first data amount of data.
  • the terminal 100 may send the L second HTTP requests to the server through the L network paths respectively.
  • the terminal 100 may receive L first HTTP responses sent by the server on the L network paths, where the L first HTTP responses include second data.
  • the terminal 100 may extract the first data from the second data, and return the first data to the first application through an HTTP response.
  • the terminal 100 may store the remaining data in the second data into the first prefetch buffer.
  • the first application of the terminal 100 may download resource data such as videos from the server.
  • the terminal 100 may acquire the HTTP request 1 issued by the first application for requesting the fragmented data 1 in the resource corresponding to the first URI. If the terminal 100 determines that the number of times that the first application obtains the resource corresponding to the first URI through the HTTP request is greater than the number of times threshold, the terminal 100 can obtain the byte range of the remaining data in the resource corresponding to the first URI, and according to the remaining data in the resource corresponding to the first URI The byte range of data generates r HTTP requests, where r is less than or equal to N, and r is a positive integer.
  • the terminal 100 may send the r HTTP requests to the server through r network paths respectively, and request the server for the remaining data in the resource corresponding to the first URI (ie, directly download all data of the resource corresponding to the first URI). After receiving the remaining data in the resource corresponding to the first URI returned by the server on the r network paths, the terminal 100 may return the fragmented data 1 in the remaining data in the resource corresponding to the first URI to the first application. If the first application next sends an HTTP request 2 for requesting fragmented data 2 in the resource corresponding to the first URI, the first terminal 100 may directly extract fragmented data 2 from the remaining data in the resource corresponding to the first URI and return it to the first application.
  • the terminal 100 can access the server through the cellular network path and the Wi-Fi network path at the same time.
  • the IP address of the terminal 100 may be "189.100.3.195”
  • the IP address of the server may be "211.91.160.241”.
  • the IP address of the terminal 100 may be "11.240.22.56”
  • the IP address of the server may be "58.216.88.125”.
  • the HTTP request 1 is used to request data in the range of 0-14163 bytes of the resource corresponding to the first URI.
  • the terminal 100 can obtain the HTTP request 1 from port 80, change the destination port number in the HTTP request 1 from “80” to the port number "9091” corresponding to the first application, and change the destination port number in the HTTP request 1 from "80” to the port number "9091” corresponding to the first application.
  • the destination IP address is changed to the IP address "127.0.0.1" of the local prefetch processing module of the terminal 100.
  • the terminal 100 determines not to perform the prefetching process. Therefore, the terminal 100 can directly send the HTTP request 1 to the server through the Wi-Fi network.
  • the terminal 100 can receive the HTTP response 1 sent by the server on the Wi-Fi network path, wherein the source IP address (Src) in the HTTP response 1 is "58.216.88.125", the destination IP address is "11.240.22.56", and the content range is (content range) is "bytes 0-14163/90982601".
  • “90982601" in the content range (content range) indicates that the total size of the resource corresponding to the first URI is 90982601 bytes.
  • the HTTP response 1 includes data in the range of 0-14163 bytes of the resource corresponding to the first URI.
  • the terminal 100 may return HTTP response 1 to the first application.
  • the first application initiates an HTTP request 2 for the first URI for the second time at time t2, where the URI in the HTTP request 2 may be: "/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4",
  • the source IP address (Src) is "11.240.22.56”
  • the destination IP address (Dst) is "58.216.88.125”
  • the destination port number is "80".
  • the HTTP request 2 is used to request data in the range of 14164-95757 bytes of the resource corresponding to the first URI.
  • the terminal 100 can intercept the HTTP request 2 from port 80, change the destination port number in the HTTP request 2 from “80” to the port number "9091” corresponding to the first application, and change the destination port number in the HTTP request 2 from "80” to the port number "9091” corresponding to the first application.
  • the destination IP address is changed to the IP address "127.0.0.1" of the local prefetch processing module of the terminal 100.
  • the terminal 100 determines not to perform the prefetching process, therefore, the terminal 100 can directly send the HTTP request 2 to the server through the Wi-Fi network.
  • the terminal 100 can receive the HTTP response 2 sent by the server on the Wi-Fi network path, wherein the source IP address (Src) in the HTTP response 2 is "58.216.88.125", the destination IP address is "11.240.22.56", and the content range is (content range) is "bytes 14164-95757/90982601".
  • “90982601" in the content range (content range) indicates that the total size of the resource corresponding to the first URI is 90982601 bytes.
  • the HTTP response 2 includes data in the range of 14164-95757 bytes of the resource corresponding to the first URI.
  • the terminal 100 may return the HTTP response 2 to the first application.
  • the first application initiates HTTP request 3 for the first URI for the third time at time t3, where the URI in the HTTP request 3 may be: "/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4",
  • the source IP address (Src) is "11.240.22.56”
  • the destination IP address (Dst) is "58.216.88.125”
  • the destination port number is "80”.
  • the HTTP request 3 is used to request data in the range of 95758-177720 bytes of the resource corresponding to the first URI.
  • the terminal 100 may obtain the HTTP request 3 from port 80, change the destination port number in the HTTP request 3 from “80” to the port number "9091” corresponding to the first application, and change the destination port number in the HTTP request 3 from "80” to the port number "9091” corresponding to the first application.
  • the destination IP address is changed to the IP address "127.0.0.1" of the local network-wide aggregation module of the terminal 100.
  • the terminal 100 determines to perform the prefetching process (for example, the number of times that the first application requests the resource corresponding to the first URI within 3 seconds reaches 3 times). Therefore, the terminal 100 can generate an HTTP request based on the requested byte range in HTTP request 3 4 and HTTP request 5.
  • the HTTP request 4 is used to request data in the range of 95758-45539187 bytes of the resource corresponding to the first URI.
  • the HTTP request 5 is used to request data in the range of 45539178-90982600 bytes of the resource corresponding to the first URI.
  • the terminal 100 can send the HTTP request 4 to the server through the cellular network path, and send the HTTP request 4 to the server through the cellular network path.
  • the terminal 100 may receive the HTTP response 4 sent by the server in the cellular network path.
  • the source IP address (Src) in HTTP response 4 is "211.91.160.241”
  • the destination IP address is "189.100.3.195”
  • the content range is "bytes 95758-45539187/90982601".
  • “90982601” in the content range (content range) indicates that the total size of the resource corresponding to the first URI is 90982601 bytes.
  • the HTTP response 4 includes data in the range of 95758-45539187 bytes of the resource corresponding to the first URI.
  • the terminal 100 may send the HTTP request 5 to the server through the cellular network path, and send the HTTP request 5 to the server through the Wi-Fi network path.
  • the terminal 100 may receive the HTTP response 5 sent by the server on the Wi-Fi network path.
  • the source IP address (Src) in HTTP response 5 is "58.216.88.125”
  • the destination IP address is "11.240.22.56”
  • the content range (content range) is "bytes 45539178-90982600/90982601”.
  • the HTTP response 5 includes data in the range of 45539178-90982600 bytes of the resource corresponding to the first URI.
  • the byte range in the HTTP request 4 and the byte range in the HTTP request 5 can have overlapping byte ranges.
  • the byte range in HTTP request 4 is "95758-45539187”
  • the byte range in HTTP request 5 is "45539178-90982600”
  • the end of the byte range in HTTP request 4 and the end of the byte range in HTTP request 5 10 bytes are repeated at the beginning (the repeated bytes range from "45539178-45539187").
  • the data obtained on the cellular network path and the data obtained on the Wi-Fi network path can be better combined.
  • the terminal 100 In the process of receiving HTTP response 4 and HTTP response 5, if the terminal 100 receives the data in the range of 95758-177720 bytes of the resource corresponding to the first URI, it can convert the 95758-177720 bytes of the resource corresponding to the first URI.
  • the data within the scope is encapsulated into an HTTP response 6, and the HTTP response 6 is returned to the first application.
  • the source IP address (Src) in HTTP response 6 is "211.91.160.241”
  • the destination IP address (Dst) is "189.100.3.195”
  • the content range (content range) is "bytes95758-177720/90982601".
  • the HTTP response 6 includes data in the range of 95758-177720 bytes of the resource corresponding to the first URI.
  • the fourth part of the embodiments of the present application provides a multi-path data prefetching method.
  • the terminal can prefetch the data of the second data amount from the server, wherein the second data amount is The amount of data is greater than the first amount of data. Then, after receiving the data of the second data volume returned by the server, the terminal may first return the data of the first data volume in the second data volume to the application. Then, the remaining data (the second amount of data - the first amount of data) is stored in the prefetch buffer.
  • the terminal can directly extract the remaining (the second amount of data - the first amount of data) bytes from the prefetch buffer data to the application.
  • the bandwidth utilization rate of the network path between the terminal and the server is improved, and when the application frequently accesses data in different ranges on the same URI address, the time for the application to obtain the data can be saved.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A buffer management method and a related device. A terminal receives data of a first file, and writes same into a disk by means of a first buffer. The terminal may adjust the size of the first buffer according to buffered data in the first buffer, available memory, network card receiving rate, disk writing rate and the frequency of reception of a user interaction operation. In this way, the probability of buffer overflow in a terminal during high-speed transmission of file data can be reduced, thereby reducing the packet loss rate.

Description

一种缓冲区管理方法及相关装置A buffer management method and related device
本申请要求于2020年07月25日提交中国专利局、申请号为202010726657.1、申请名称为“一种缓冲区管理方法及相关装置”,于2020年07月25日提交中国专利局、申请号为202010726671.1、申请名称为“一种数据传输方法及相关装置”,于2020年07月25日提交中国专利局、申请号为202010726638.9、申请名称为“一种数据存储方法及相关装置”,于2020年07月27日提交中国专利局、申请号为202010734674.X、申请名称为“一种多路径数据预取方法及相关装置”,以及于2021年07月22日提交中国专利局、申请号为202110832128.4、申请名称为“一种缓冲区管理方法及相关装置”,的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application is required to be submitted to the China Patent Office on July 25, 2020, the application number is 202010726657.1, the application name is "A buffer management method and related devices", and it was submitted to the China Patent Office on July 25, 2020. The application number is 202010726671.1, the application name is "A data transmission method and related device", submitted to the Chinese Patent Office on July 25, 2020, the application number is 202010726638.9, the application name is "A data storage method and related device", filed in 2020 Submitted to the China Patent Office on July 27, the application number is 202010734674.X, the application name is "a multi-path data prefetching method and related device", and submitted to the China Patent Office on July 22, 2021, the application number is 202110832128.4 , the application title is "a buffer management method and related device", the priority of the Chinese patent application, the entire content of which is incorporated in this application by reference.
技术领域technical field
本申请涉及通信技术领域,尤其涉及一种缓冲区管理方法及相关装置。The present application relates to the field of communication technologies, and in particular, to a buffer management method and related devices.
背景技术Background technique
随着移动终端技术的发展以及移动终端功能多样化,移动终端可以接收到其他移动终端或服务器传输的文件数据。With the development of mobile terminal technology and the diversification of functions of the mobile terminal, the mobile terminal can receive file data transmitted by other mobile terminals or servers.
随着移动终端技术的发展以及移动终端功能多样化,移动终端可以与其他移动终端进行文件传输,以满足用户对文件(如照片、音视频等)共享的需求。With the development of mobile terminal technology and the diversification of functions of the mobile terminal, the mobile terminal can transfer files with other mobile terminals to meet the user's requirement for sharing files (such as photos, audio and video, etc.).
目前,移动终端可以基于传输控制协议(transmission control protocol,TCP)或用户数据包协议(user datagram protocol,UDP),将文件数据传输到对端。传统的TCP传输协议是针对低速、低延迟的网络而设计的。针对端到端的近距离传输场景中,由于两个移动终端无需通过中间节点进行数据的转发,两个移动终端之间的网络基本上不会有抖动,使用TCP传输文件数据时,发送端与接收端需要先建立连接,并引入了窗口拥塞控制机制保证可靠性和有序性,这样会影响文件传输的速率。而UDP是一个非连接协议,当使用UDP传输文件数据时,虽然可以增大文件的传输速率,但是无法保证可靠的数据传输,可能会导致接收端接收到的文件不完整。因此,在端到端近距离的大文件数据传输场景中,传统的传输协议无法同时满足高传输速率和可靠性的需求。At present, the mobile terminal can transmit the file data to the opposite end based on the transmission control protocol (transmission control protocol, TCP) or the user datagram protocol (user datagram protocol, UDP). The traditional TCP transport protocol is designed for low-speed, low-latency networks. In the end-to-end short-range transmission scenario, since the two mobile terminals do not need to forward data through an intermediate node, there is basically no network jitter between the two mobile terminals. When using TCP to transmit file data, the sender and the receiver The end needs to establish a connection first, and a window congestion control mechanism is introduced to ensure reliability and order, which will affect the rate of file transfer. UDP is a non-connection protocol. When using UDP to transmit file data, although the transmission rate of the file can be increased, reliable data transmission cannot be guaranteed, which may result in incomplete files received by the receiver. Therefore, in the end-to-end close-range large file data transmission scenario, traditional transmission protocols cannot meet the requirements of high transmission rate and reliability at the same time.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种缓冲区管理方法及相关装置,实现了可以实现终端接收文件数据的过程中,根据缓冲区的已缓冲数据、可用内存、网卡接收速率、磁盘写入速率、可用内存以及接收到用户交互操作的频繁程度,对缓冲区的大小进行调整。这样,可以降低高速传输文件数据时终端中缓冲区的溢出几率,减小丢包率。The present application provides a buffer management method and a related device, which can realize that in the process of receiving file data by a terminal, according to the buffered data, available memory, network card receiving rate, disk writing rate, available memory and receiving rate of the buffer Adjust the size of the buffer to the frequency of user interaction. In this way, the overflow probability of the buffer in the terminal during high-speed transmission of file data can be reduced, and the packet loss rate can be reduced.
第一方面,本申请提供了一种缓冲区管理方法,包括:终端接收第一文件的数据,并将该第一文件的数据存入第一缓冲区中,并将该第一缓冲区中的数据写入磁盘中。该终端监测该第一缓冲区的已缓冲数据量、第一文件的待传输数据量、第一缓冲区的缓冲数据增长速率、可用内存容量。若该第一缓冲区的缓冲数据增长速率大于0,该终端根据该第一缓冲区的已缓冲数据量、第一文件的待传输数据量、第一缓冲区的缓冲数据增长速率和网 卡接收速率,确定出第一缓冲区的所需总容量值。若该第一缓冲区的所需总容量值大于等于第二值且小于等于第一值,且该第一缓冲区的剩余缓冲容量小于该第一文件的待传输数据量,该终端将该第一缓冲区的大小调整为该第一缓冲区的所需总容量值,该第一值大于该第二值。In a first aspect, the present application provides a buffer management method, comprising: a terminal receiving data of a first file, storing the data of the first file in a first buffer, and storing data in the first buffer Data is written to disk. The terminal monitors the amount of buffered data in the first buffer, the amount of data to be transmitted in the first file, the growth rate of buffered data in the first buffer, and the available memory capacity. If the buffered data growth rate of the first buffer is greater than 0, the terminal determines the buffered data volume of the first buffer, the to-be-transmitted data volume of the first file, the buffered data growth rate of the first buffer, and the network card reception rate according to the first buffer. , and determine the required total capacity value of the first buffer. If the required total capacity of the first buffer is greater than or equal to the second value and less than or equal to the first value, and the remaining buffer capacity of the first buffer is less than the amount of data to be transmitted in the first file, the terminal The size of a buffer is adjusted to the required total capacity value of the first buffer, the first value being greater than the second value.
通过本申请提供一种缓冲区管理方法,可以实现终端接收文件数据的过程中,根据缓冲区的已缓冲数据、可用内存、网卡接收速率、磁盘写入速率、可用内存容量等因素以及接收到用户交互操作的频繁程度,对缓冲区的大小进行调整。在不同场景下,调整缓冲区的大小,尽可能的为缓冲区申请到更多的存储空间。这样,可以降低高速传输文件数据时缓冲区的溢出几率,减小丢包率。The application provides a buffer management method, which can realize that in the process of receiving file data by a terminal, according to factors such as buffered data in the buffer, available memory, network card receiving rate, disk writing rate, available memory capacity and other factors, and receiving user data The frequency of interactive operations, adjust the size of the buffer. In different scenarios, adjust the size of the buffer and apply for more storage space for the buffer as much as possible. In this way, the overflow probability of the buffer during high-speed transmission of file data can be reduced, and the packet loss rate can be reduced.
在一种可能的实现方式中,若该第一缓冲区的所需总容量值大于该第一值,该终端将该第一缓冲区的大小调整为第一缓冲容量,其中,该第一缓冲容量与该可用内存容量的比值为第一值。In a possible implementation manner, if the required total capacity value of the first buffer is greater than the first value, the terminal adjusts the size of the first buffer to the first buffer capacity, wherein the first buffer The ratio of the capacity to the available memory capacity is the first value.
在一种可能的实现方式中,若该第一缓冲区的所需总容量值小于该第二值,该终端将该第一缓冲区的大小调整为该第一缓冲区的所需总容量值。In a possible implementation manner, if the required total capacity value of the first buffer is smaller than the second value, the terminal adjusts the size of the first buffer to the required total capacity value of the first buffer .
在一种可能的实现方式中,在该终端将该第一缓冲区的大小调整为该第一缓冲区的所需总容量值之后,该方法还包括:若该终端在指定时间段内接收到用户输入的次数大于次数阈值,且第一缓冲区的已缓冲数据量小于等于第二缓冲容量,该终端根据该第二缓冲容量、该第一缓冲区的已缓冲数据量、该第一文件的剩余数据量、该第一缓冲区的缓冲数据增长速率,确定出安全发送速率,该第二缓冲容量与该可用内存容量的比值为该第二值。该终端发送第一速率信息给该第一文件的发送端,该第一速率信息用于指示该发送端调整该第一文件的发送速率为该安全发送速率。该终端接收到该发送端发送的确认信息。响应于该确认信息,该终端将该第一缓冲区的大小调整为该第二缓冲容量。In a possible implementation manner, after the terminal adjusts the size of the first buffer to the required total capacity value of the first buffer, the method further includes: if the terminal receives the The number of times input by the user is greater than the number of times threshold, and the amount of buffered data in the first buffer is less than or equal to the second buffer capacity. The remaining data volume and the buffered data growth rate of the first buffer zone determine a safe sending rate, and the ratio of the second buffer capacity to the available memory capacity is the second value. The terminal sends first rate information to the sender of the first file, where the first rate information is used to instruct the sender to adjust the sending rate of the first file to the safe sending rate. The terminal receives the acknowledgment information sent by the sender. In response to the confirmation information, the terminal adjusts the size of the first buffer to the second buffer capacity.
在一种可能的实现方式中,若该第一缓冲区的所需总容量大于等于第二值且小于等于该第一值,该第二值小于该第一值,在该终端将该第一缓冲区的大小调整为该第一缓冲区的所需总容量值之后,该方法还包括:若该终端在指定时间段内接收到用户输入的次数大于次数阈值,且第一缓冲区的已缓冲数据量大于第二缓冲容量,该终端发送第二速率信息给该发送端,该第二速率信息用于指示该发送端调整第一文件的发送速率小于等于速率阈值,该第二缓冲容量与该可用内存容量的比值为该第二值。若该第一缓冲区的已缓冲数据量小于该第二缓冲容量,该终端将该第一缓冲区的大小调整为该第二缓冲容量。In a possible implementation manner, if the required total capacity of the first buffer is greater than or equal to a second value and less than or equal to the first value, and the second value is less than the first value, the terminal will set the first value at the terminal. After the size of the buffer is adjusted to the required total capacity value of the first buffer, the method further includes: if the number of times the terminal receives user input within a specified time period is greater than the number of times a threshold, and the buffered first buffer has been buffered If the amount of data is greater than the second buffer capacity, the terminal sends second rate information to the sender, where the second rate information is used to instruct the sender to adjust the sending rate of the first file to be less than or equal to the rate threshold, and the second buffer capacity is the same as the rate threshold. The ratio of the available memory capacity is the second value. If the buffered data volume of the first buffer is smaller than the second buffer capacity, the terminal adjusts the size of the first buffer to the second buffer capacity.
在一种可能的实现方式中,在该终端将该第一缓冲区的大小调整为该第二缓冲容量后,该方法还包括:该终端根据该第一缓冲区的剩余缓冲容量、该第一文件的剩余数据量、该第一缓冲区的缓冲数据增长速率,确定出安全发送速率。该终端发送第一速率信息给该第一文件的发送端,该第一速率信息用于指示该发送端调整该第一文件的发送速率为该安全发送速率。In a possible implementation manner, after the terminal adjusts the size of the first buffer to the second buffer capacity, the method further includes: the terminal according to the remaining buffer capacity of the first buffer, the first buffer The remaining data volume of the file and the growth rate of the buffered data of the first buffer zone determine the safe sending rate. The terminal sends first rate information to the sender of the first file, where the first rate information is used to instruct the sender to adjust the sending rate of the first file to the safe sending rate.
在一种可能的实现方式中,在该终端将该第一缓冲区的大小调整为该第一缓冲容量之后,该方法还包括:若该终端在指定时间段内接收到用户输入的次数大于次数阈值,且第一缓冲区的已缓冲数据量小于等于第二缓冲容量,该终端根据该第二缓冲容量、该第一缓 冲区的已缓冲数据量、该第一文件的剩余数据量、该第一缓冲区的缓冲数据增长速率,确定出安全发送速率,该第二缓冲容量与该可用内存容量的比值为该第二值。该终端发送第一速率信息给该第一文件的发送端,该第一速率信息用于指示该发送端调整该第一文件的发送速率为该安全发送速率。该终端接收到该发送端发送的确认信息。响应于该确认信息,该终端将该第一缓冲区的大小调整为该第二缓冲容量。In a possible implementation manner, after the terminal adjusts the size of the first buffer to the first buffer capacity, the method further includes: if the number of times the terminal receives user input within a specified time period is greater than the number of times threshold, and the amount of buffered data in the first buffer is less than or equal to the second buffer capacity, the terminal determines according to the second buffer capacity, the amount of buffered data in the first buffer, the remaining data in the first file, the The buffered data growth rate of a buffer determines the safe sending rate, and the ratio of the second buffer capacity to the available memory capacity is the second value. The terminal sends first rate information to the sender of the first file, where the first rate information is used to instruct the sender to adjust the sending rate of the first file to the safe sending rate. The terminal receives the acknowledgment information sent by the sender. In response to the confirmation information, the terminal adjusts the size of the first buffer to the second buffer capacity.
在一种可能的实现方式中,在该终端将该第一缓冲区的大小调整为该第一缓冲容量之后,该方法还包括:若该终端在指定时间段内接收到用户输入的次数大于次数阈值,且第一缓冲区的已缓冲数据量大于第二缓冲容量,该终端发送第二速率信息给该发送端,该第二速率信息用于指示该发送端调整第一文件的发送速率小于等于速率阈值,该第二缓冲容量与该可用内存容量的比值为该第二值。若该第一缓冲区的已缓冲数据量小于该第二缓冲容量,该终端将该第一缓冲区的大小调整为该第二缓冲容量。In a possible implementation manner, after the terminal adjusts the size of the first buffer to the first buffer capacity, the method further includes: if the number of times the terminal receives user input within a specified time period is greater than the number of times threshold, and the amount of buffered data in the first buffer is greater than the second buffer capacity, the terminal sends second rate information to the sender, where the second rate information is used to instruct the sender to adjust the sending rate of the first file to be less than or equal to a rate threshold, and the ratio of the second buffer capacity to the available memory capacity is the second value. If the buffered data volume of the first buffer is smaller than the second buffer capacity, the terminal adjusts the size of the first buffer to the second buffer capacity.
在一种可能的实现方式中,在该终端将该第一缓冲区的大小调整为该第一缓冲容量之后,该方法还包括:若该终端在指定时间段内接收到用户输入的次数大于次数阈值,且第一缓冲区的已缓冲数据量大于第二缓冲容量,该终端发送第二速率信息给该发送端,该第二速率信息用于指示该发送端调整第一文件的发送速率小于等于速率阈值,该第二缓冲容量与该可用内存容量的比值为该第二值。若该第一缓冲区的已缓冲数据量小于该第二缓冲容量,该终端将该第一缓冲区的大小调整为该第二缓冲容量。In a possible implementation manner, after the terminal adjusts the size of the first buffer to the first buffer capacity, the method further includes: if the number of times the terminal receives user input within a specified time period is greater than the number of times threshold, and the amount of buffered data in the first buffer is greater than the second buffer capacity, the terminal sends second rate information to the sender, where the second rate information is used to instruct the sender to adjust the sending rate of the first file to be less than or equal to a rate threshold, and the ratio of the second buffer capacity to the available memory capacity is the second value. If the buffered data volume of the first buffer is smaller than the second buffer capacity, the terminal adjusts the size of the first buffer to the second buffer capacity.
在一种可能的实现方式中,在该终端将该第一缓冲区的大小调整为该第一缓冲区的所需总容量值之后,该方法还包括:当终端确定出该第一缓冲区的缓冲数据增长速率小于0时,该终端将该第一缓冲区的大小减小指定容量。In a possible implementation manner, after the terminal adjusts the size of the first buffer to the required total capacity value of the first buffer, the method further includes: when the terminal determines that the size of the first buffer is When the growth rate of the buffered data is less than 0, the terminal reduces the size of the first buffer by a specified capacity.
在一种可能的实现方式中,该终端根据如下公式确定出该第一缓冲区的所需容量值:In a possible implementation manner, the terminal determines the required capacity value of the first buffer according to the following formula:
c*(H-W)/A-FLS/rateNet=0c*(H-W)/A-FLS/rateNet=0
其中,c为保守系数,0<c≤1,H为该第一缓冲区的所需总容量值,W为该第一缓冲区的已缓冲数据量,A为该第一缓冲区的缓冲数据增长速率,FLS为该第一文件的待传输数据量,rateNet为该网卡接收速率。Among them, c is a conservative coefficient, 0<c≤1, H is the required total capacity value of the first buffer, W is the buffered data volume of the first buffer, and A is the buffered data of the first buffer Growth rate, FLS is the amount of data to be transmitted in the first file, and rateNet is the receiving rate of the network card.
在一种可能的实现方式中,该终端根据如下公式确定出该安全发送速率:In a possible implementation manner, the terminal determines the safe sending rate according to the following formula:
c*(X-W)/A-FLS/V1=0c*(X-W)/A-FLS/V1=0
其中,c为保守系数,0<c≤1,X为该第二缓冲容量,W为该第一缓冲区的已缓冲数据量,A为该第一缓冲区的缓冲数据增长速率,FLS为该第一文件的待传输数据量,V1为该安全发送速率。Among them, c is a conservative coefficient, 0<c≤1, X is the second buffer capacity, W is the buffered data volume of the first buffer, A is the buffer data growth rate of the first buffer, and FLS is the The amount of data to be transmitted in the first file, and V1 is the safe sending rate.
在一种可能的实现方式中,该终端根据该第一缓冲区的剩余缓冲容量、该第一文件的剩余数据量、该第一缓冲区的缓冲数据增长速率,确定出安全发送速率,具体包括:In a possible implementation manner, the terminal determines the safe sending rate according to the remaining buffer capacity of the first buffer, the remaining data volume of the first file, and the buffered data growth rate of the first buffer, which specifically includes :
该终端根据如下公式确定出该安全发送速率:The terminal determines the safe transmission rate according to the following formula:
c*P/A-FLS/V1=0c*P/A-FLS/V1=0
其中,c为保守系数,0<c≤1,P为该第一缓冲区的剩余缓冲容量,A为该第一缓冲区的缓冲数据增长速率,FLS为该第一文件的待传输数据量,V1为该安全发送速率。Among them, c is a conservative coefficient, 0<c≤1, P is the remaining buffer capacity of the first buffer, A is the buffer data growth rate of the first buffer, FLS is the amount of data to be transmitted in the first file, V1 is the safe sending rate.
在一种可能的实现方式中,若该第一文件的待传输数据量占该第一文件的总数据量的比值小于指定比例值,该终端调整该第一缓冲区的大小为第三缓冲容量,该第三缓冲容量 占该可用内存容量的比例为第三值,该第三值大于该第一值。In a possible implementation manner, if the ratio of the data volume of the first file to be transmitted to the total data volume of the first file is less than a specified ratio value, the terminal adjusts the size of the first buffer to the third buffer capacity , the ratio of the third buffer capacity to the available memory capacity is a third value, and the third value is greater than the first value.
在一种可能的实现方式中,该终端获取该第一缓冲区的缓冲数据增速率,具体包括:In a possible implementation manner, the terminal acquires the buffered data increment rate of the first buffer, specifically including:
该终端通过监测该第一缓冲区中的已缓冲数据量的变化,获取到该第一缓冲区的缓冲数据增长速率。The terminal obtains the buffered data growth rate of the first buffer by monitoring the change of the buffered data amount in the first buffer.
在一种可能的实现方式中,该终端获取该第一缓冲区的缓冲数据增速率,具体包括:该终端获取该第一文件的数据写入该磁盘的写入速率。该终端根据该网卡接收速率和该写入速率,确定出该第一缓冲区的缓冲数据增长速率。In a possible implementation manner, the terminal acquiring the buffered data increment rate of the first buffer zone specifically includes: acquiring, by the terminal, the writing rate of the data of the first file written to the disk. The terminal determines the growth rate of the buffered data of the first buffer according to the receiving rate and the writing rate of the network card.
第二方面,本申请提供了一种数据传输方法,包括:第一终端与第二终端建立文件传输连接,该文件传输连接用于传输第一文件。该第一终端获取网卡的物理层发送速率上限。该第一终端根据该物理层发送速率上限确定出第一速率。该第一终端以该第一速率向MAC层发送缓冲区qdisk_buffer写入该第一文件的第一数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的第一数据发送给该第二终端。当该第一终端确定该MAC层发送缓冲区的已缓冲数据量大于等于第一预警水位线时,该第一终端以第二速率向该MAC层发送缓冲区写入该第一文件的第二数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的第二数据发送给该第二终端,其中,该第一速率大于该第二速率。In a second aspect, the present application provides a data transmission method, including: establishing a file transmission connection between a first terminal and a second terminal, where the file transmission connection is used to transmit a first file. The first terminal acquires the upper limit of the transmission rate of the physical layer of the network card. The first terminal determines the first rate according to the upper limit of the transmission rate of the physical layer. The first terminal writes the first data of the first file to the MAC layer sending buffer qdisk_buffer at the first rate, and sends the first data of the first file in the MAC layer sending buffer to the MAC layer through the network card second terminal. When the first terminal determines that the buffered data volume of the MAC layer sending buffer is greater than or equal to the first warning water level, the first terminal writes the second data of the first file to the MAC layer sending buffer at the second rate data, and send the second data of the first file in the MAC layer sending buffer to the second terminal through the network card, wherein the first rate is greater than the second rate.
通过本申请实施例提供的一种数据传输的方法,可以通过设置发送端210的MAC层发送缓冲区(qdisk_buffer)的缓冲容量和第一预警水位线,并根据MAC层发送缓冲区(qdisk_buffer)的已缓冲数据量决定发送端210写入第一文件的数据至MAC层发送缓冲区的发送速率,实现文件的传输速度接近物理信道极限速率且降低丢包率。According to the data transmission method provided by the embodiment of the present application, the buffer capacity and the first warning water level of the MAC layer sending buffer (qdisk_buffer) of the sending end 210 can be set, and according to the data of the MAC layer sending buffer (qdisk_buffer) The amount of buffered data determines the sending rate of the data written by the sending end 210 into the first file to the sending buffer of the MAC layer, so that the file transmission speed is close to the limit rate of the physical channel and the packet loss rate is reduced.
在一种可能的实现方式中,该第一终端获取到MAC层上报的第一水位线信息,该第一水位线信息用于指示该MAC层发送缓冲区的已缓冲数据量大于等于该第一预警水位线。这样,MAC层发送缓冲区的已缓冲数据量超过第一预警水位线时,MAC层可以主动上报告警信息,及时降低第一文件的数据写入MAC层发送缓冲区的速率。In a possible implementation manner, the first terminal acquires first watermark information reported by the MAC layer, where the first watermark information is used to indicate that the buffered data amount in the MAC layer's transmission buffer is greater than or equal to the first watermark Warning water level. In this way, when the amount of buffered data in the MAC layer's sending buffer exceeds the first warning water level, the MAC layer can actively report the warning information to reduce the rate at which the data of the first file is written into the MAC layer's sending buffer in time.
在一种可能的实现方式中,当该第一终端确定该MAC层发送缓冲区的已缓冲数据量大于等于该第一预警水位线且该MAC层发送缓冲区的剩余容量小于该第一文件的待发送数据量时,该第一终端以该第二速率向该MAC层发送缓冲区写入该第一文件的该第二数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的该第二数据发送给该第二终端。In a possible implementation manner, when the first terminal determines that the buffered data volume of the MAC layer sending buffer is greater than or equal to the first warning watermark and the remaining capacity of the MAC layer sending buffer is less than the size of the first file When the amount of data to be sent, the first terminal sends the second data written in the first file to the MAC layer sending buffer at the second rate, and sends the first file in the buffer to the MAC layer through the network card The second data is sent to the second terminal.
在一种可能的实现方式中,在该第一终端以第一速率向MAC层发送缓冲区写入该第一文件的第一数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的第一数据发送给该第二终端之后,该方法还包括:当该第一终端确定该MAC层发送缓冲区的已缓冲数据量大于等于该第一预警水位线且该MAC层发送缓冲区的剩余容量大于等于该第一文件的待发送数据量时,该第一终端以该第一速率向该MAC层发送缓冲区写入该第一文件的该第二数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的该第二数据发送给该第二终端。这样,在MAC层发送缓冲区的剩余容量足够容纳第一文件的剩余发送数据时, 第一终端以大速率传输第一文件的数据,提高了文件传输速率。In a possible implementation manner, the first terminal sends the first data of the first file to the MAC layer sending buffer at a first rate, and sends the first data in the MAC layer through the network card After the first data of the file is sent to the second terminal, the method further includes: when the first terminal determines that the buffered data amount of the MAC layer transmission buffer is greater than or equal to the first warning water level and the MAC layer transmission buffer When the remaining capacity of the first file is greater than or equal to the amount of data to be sent in the first file, the first terminal writes the second data of the first file to the MAC layer sending buffer at the first rate, and sends the second data of the first file through the network card. The MAC layer sends the second data of the first file in the buffer to the second terminal. In this way, when the remaining capacity of the MAC layer sending buffer is sufficient to accommodate the remaining sending data of the first file, the first terminal transmits the data of the first file at a high rate, which improves the file transfer rate.
在一种可能的实现方式中,在该第一终端以第二速率向该MAC层发送缓冲区写入该第一文件的第二数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的第二数据发送给该第二终端之后,该方法还包括:当该第一终端确定该第一缓冲区中的已缓冲数据量小于等于第一指定阈值时,该第一终端以该第一速率向该MAC层发送缓冲区写入该第一文件的第三数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的第三数据发送给该第二终端,其中,该第一指定阈值小于该第一预警水位线。这样,在MAC层发送缓冲区已缓冲数据量减低到第一指定阈值以下时,第一终端可以以大速率传输第一文件的数据,提高了文件传输速率。In a possible implementation manner, the first terminal sends the second data of the first file to the MAC layer sending buffer at a second rate, and the MAC layer sends the first data in the buffer through the network card. After the second data of a file is sent to the second terminal, the method further includes: when the first terminal determines that the amount of buffered data in the first buffer is less than or equal to a first specified threshold, the first terminal uses the The first rate writes the third data of the first file into the MAC layer sending buffer, and sends the third data of the first file in the MAC layer sending buffer to the second terminal through the network card, wherein, The first specified threshold is less than the first warning water level. In this way, when the amount of buffered data in the sending buffer of the MAC layer is reduced below the first specified threshold, the first terminal can transmit the data of the first file at a high rate, thereby increasing the file transmission rate.
在一种可能的实现方式中,在该第一终端以第一速率向MAC层发送缓冲区写入该第一文件的数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的数据发送给该第二终端,该方法还包括:该第一终端接收该第二终端在确定该第二终端上的第一缓冲区的缓冲水位线大于等于第二预警水位线时发送的第一反馈信息。响应于该第一反馈信息,该第一终端以第三速率向该MAC层发送缓冲区写入该第一文件的第四数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的该第四数据发送给该第二终端,其中,该第一速率大于该第三速率。In a possible implementation manner, the first terminal sends the data of the first file in the buffer to the MAC layer at a first rate, and sends the data of the first file in the buffer to the MAC layer through the network card. Sending data to the second terminal, and the method further includes: receiving, by the first terminal, the first message sent by the second terminal when it is determined that the buffer water level of the first buffer on the second terminal is greater than or equal to the second early warning water level Feedback. In response to the first feedback information, the first terminal sends the fourth data written to the first file in the buffer to the MAC layer at a third rate, and sends the first file in the buffer to the MAC layer through the network card The fourth data is sent to the second terminal, wherein the first rate is greater than the third rate.
在一种可能的实现方式中,该第一缓冲区包括:该第二终端上的IP分片重组缓冲区ip_defrag_buffer、该第二终端上的写缓冲区write_buffer中的任一个。In a possible implementation manner, the first buffer includes: any one of the IP fragmentation reassembly buffer ip_defrag_buffer on the second terminal and the write buffer write_buffer on the second terminal.
这样,可以进一步通过监控第二终端的IP分片重组缓冲区(ip_defrag_buffer)和第二端的写缓冲区(write_buffer)的已缓冲数据量,决定第一终端的发送速率,实现文件的传输速度接近物理信道极限速率且降低丢包率。In this way, the transmission rate of the first terminal can be further determined by monitoring the buffered data volume of the IP fragmentation reassembly buffer (ip_defrag_buffer) of the second terminal and the write buffer (write_buffer) of the second terminal, so that the transmission speed of the file is close to the physical Channel limit rate and reduce packet loss rate.
在一种可能的实现方式中,在该第一终端以第三速率向该MAC层发送缓冲区写入该第一文件的第四数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的数据发送给该第二终端之后,该方法还包括:该第一终端接收该第二终端在确定该第一缓冲区的已缓冲数据量小于等于第二指定阈值时发送的第二反馈信息,该第二指定阈值小于该第二预警水位线。响应于该第二反馈信息,该第一终端以该第一速率向该MAC层发送缓冲区写入该第一文件的第五数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的第五数据发送给该第二终端,其中,该第一速率大于该第三速率。这样,在第一缓冲区的已缓冲数据量减低到第二指定阈值以下时,第一终端可以以大速率传输第一文件的数据,提高了文件传输速率。In a possible implementation manner, the first terminal sends the fourth data of the first file to the MAC layer sending buffer at a third rate, and sends the fourth data in the MAC layer through the network card to the buffer. After the data of a file is sent to the second terminal, the method further includes: the first terminal receives a second feedback sent by the second terminal when it is determined that the amount of buffered data in the first buffer is less than or equal to a second specified threshold information, the second specified threshold is less than the second warning water level. In response to the second feedback information, the first terminal sends the fifth data written in the first file to the MAC layer sending buffer at the first rate, and sends the first data in the first file to the MAC layer through the network card. Fifth data of the file is sent to the second terminal, wherein the first rate is greater than the third rate. In this way, when the amount of buffered data in the first buffer area is reduced below the second specified threshold, the first terminal can transmit the data of the first file at a high rate, thereby increasing the file transmission rate.
在一种可能的实现方式中,在该第一终端以第一速率向MAC层发送缓冲区写入该第一文件的数据之前,该方法还包括:该第一终端获取MAC层上报的测量数据包,该测量数据包包括该MAC层上报该测量数据包的时间。该第一终端根据该MAC层上报该测量数据包的时间和该第一终端获取到该测量数据包的时间,确定出该MAC层的反馈时间。该 第一终端根据该物理层发送速率上限和该MAC层的反馈时间,确定该MAC层发送缓冲区的缓冲容量和该第一预警水位线。In a possible implementation manner, before the first terminal sends the data written in the first file in the buffer to the MAC layer at the first rate, the method further includes: acquiring, by the first terminal, measurement data reported by the MAC layer packet, the measurement data packet includes the time when the MAC layer reports the measurement data packet. The first terminal determines the feedback time of the MAC layer according to the time when the MAC layer reports the measurement data packet and the time when the first terminal obtains the measurement data packet. The first terminal determines, according to the upper limit of the transmission rate of the physical layer and the feedback time of the MAC layer, the buffer capacity of the transmission buffer of the MAC layer and the first warning water level.
其中,该第一终端确定出该MAC层发缓冲区的缓冲容量和该第一预警水位线的公式为:The formula for the first terminal to determine the buffer capacity of the MAC layer sending buffer and the first warning water level is:
((1-A)*M)/Vmax≥Ts((1-A)*M)/Vmax≥Ts
(A*M)/Vmax≥2*Ts(A*M)/Vmax≥2*Ts
其中,M为该MAC层发送缓冲区的缓冲容量,A为该预警水位线,Vmax为该物理层发送速率上限,Ts为该反馈时间,M取满足该公式中的最小值。Among them, M is the buffer capacity of the sending buffer of the MAC layer, A is the warning water level, Vmax is the upper limit of the sending rate of the physical layer, Ts is the feedback time, and M is the minimum value that satisfies the formula.
在一种可能的实现方式中,该文件传输连接包括:Wi-Fi直连、Wi-FisoftAP、超宽带通信连接、蓝牙连接中的任一种。In a possible implementation manner, the file transfer connection includes any one of Wi-Fi direct connection, Wi-FisoftAP, ultra-wideband communication connection, and Bluetooth connection.
在一种可能的实现方式中,第二终端根据该物理层发送速率上限和文件传输连接上的往返时延,确定该第一缓冲区的缓冲容量和该第二预警水位线。In a possible implementation manner, the second terminal determines the buffer capacity of the first buffer and the second early warning water level according to the upper limit of the transmission rate of the physical layer and the round-trip delay on the file transmission connection.
其中,该第二终端确定出该第一缓冲区的缓冲容量和该第二预警水位线的公式为:The formula for the second terminal to determine the buffer capacity of the first buffer and the second early warning water level is:
((1-a)*m)/Vmax≥0.5*RTT((1-a)*m)/Vmax≥0.5*RTT
(a*m)/Vmax≥0.5*RTT+0.5*RTT(a*m)/Vmax≥0.5*RTT+0.5*RTT
其中,m为该MAC层发送缓冲区的缓冲容量,a为该预警水位线,Vmax为该物理层发送速率上限,RTT为该往返时延,m取满足该公式中的最小值。Among them, m is the buffer capacity of the sending buffer of the MAC layer, a is the warning water level, Vmax is the upper limit of the sending rate of the physical layer, RTT is the round-trip delay, and m is the minimum value that satisfies the formula.
第三方面,本申请提供了一种数据存储方法,包括:终端接收第一文件的数据,并将该第一文件的数据存入网络协议栈接收缓冲区中。该终端从网络协议栈接收缓冲区中取出第一文件的数据直接写入磁盘中。该终端获取该网络协议栈接收缓冲区的剩余缓冲容量、第一文件的待传输数据量、该网络协议栈接收缓冲区的缓冲数据增长速率。若该网络协议栈接收缓冲区的缓冲数据增速率大于0,该终端根据该网络协议栈接收缓冲区的剩余缓冲容量、该第一文件的待传输数据量、该网络协议栈接收缓冲区的缓冲数据增长速率和网卡接收速率,确定出该网络协议栈接收缓冲区的溢出时间和该第一文件的剩余传输时间。若该网络协议栈接收缓冲区的溢出时间小于该第一文件的剩余传输时间,且该网络协议栈接收缓冲区的已缓冲数据量大于第一阈值,该终端将存入该网络协议栈接收缓冲区中的数据转存到用户态缓冲区,并将该用户态缓冲区中的数据经过内核态写缓冲区写入该磁盘中。In a third aspect, the present application provides a data storage method, comprising: a terminal receiving data of a first file, and storing the data of the first file in a network protocol stack receiving buffer. The terminal takes out the data of the first file from the receiving buffer of the network protocol stack and writes it directly into the disk. The terminal obtains the remaining buffer capacity of the receiving buffer of the network protocol stack, the amount of data to be transmitted of the first file, and the growth rate of the buffered data of the receiving buffer of the network protocol stack. If the buffered data increment rate of the receiving buffer of the network protocol stack is greater than 0, the terminal shall, according to the remaining buffer capacity of the receiving buffer of the network protocol stack, the amount of data to be transmitted of the first file, and the size of the receiving buffer of the network protocol stack, The buffer data growth rate and the network card receiving rate are used to determine the overflow time of the receiving buffer of the network protocol stack and the remaining transmission time of the first file. If the overflow time of the receiving buffer of the network protocol stack is less than the remaining transmission time of the first file, and the amount of buffered data in the receiving buffer of the network protocol stack is greater than the first threshold, the terminal will store it in the receiving buffer of the network protocol stack The data in the area is dumped to the user mode buffer, and the data in the user mode buffer is written to the disk through the kernel mode write buffer.
本申请提供的一种数据存储方法,终端可以在接收到文件数据后,通过内核态的网络协议栈接收缓冲区中的水位线,采取不同的数据存储路径,这样,可以避免网络协议栈接收缓冲区中溢出而导致丢包,在高速传输文件数据的同时,降低丢包率。In the data storage method provided by the present application, after receiving the file data, the terminal can receive the watermark in the buffer through the network protocol stack in the kernel state, and adopt different data storage paths, so as to avoid the network protocol stack receiving buffering Packet loss is caused by overflow in the area, and the packet loss rate is reduced while transferring file data at high speed.
在一种可能的实现方式中,该终端根据该网络协议栈接收缓冲区的缓冲数据增长速率和该网络协议接收缓冲区的剩余缓冲容量,确定出该网路协议栈接收缓冲区的溢出时间。该终端根据该第一文件的待传输数据量和网卡接收速率,确定第一文件的剩余传输时间。In a possible implementation manner, the terminal determines the overflow time of the receiving buffer of the network protocol stack according to the growth rate of the buffered data of the receiving buffer of the network protocol stack and the remaining buffer capacity of the receiving buffer of the network protocol. The terminal determines the remaining transmission time of the first file according to the amount of data to be transmitted and the receiving rate of the network card of the first file.
在一种可能的实现方式中,在该终端将该网络协议栈接收缓冲区中的已缓冲数据转存到用户态缓冲区,并从该用户态缓冲区中取出该第一文件的数据经过内核态写缓冲区写入 该磁盘中之后,该方法还包括:该终端根据该用户态缓冲区的缓冲数据增长速率和该用户态缓冲区的剩余缓冲容量,确定出该用户态缓冲区的溢出时间。若该用户态缓冲区的溢出时间小于该第一文件的剩余传输时间时,该终端发送缓冲信息给该第一文件的发送端,该缓冲信息用于指示该发送端降低该第一文件的发送速率。这样,可以在用户态缓冲区的溢出时间小于该第一文件的剩余传输时间时,及时让发送端降低发送速率,防止用户态缓冲区溢出。In a possible implementation manner, the terminal dumps the buffered data in the receiving buffer of the network protocol stack to the user mode buffer, and takes out the data of the first file from the user mode buffer and passes through the kernel. After the state write buffer is written into the disk, the method further includes: determining, by the terminal, the overflow time of the user state buffer according to the buffer data growth rate of the user state buffer and the remaining buffer capacity of the user state buffer . If the overflow time of the user mode buffer is less than the remaining transmission time of the first file, the terminal sends buffer information to the sender of the first file, and the buffer information is used to instruct the sender to reduce the transmission of the first file. rate. In this way, when the overflow time of the user-mode buffer is less than the remaining transmission time of the first file, the sender can be made to reduce the sending rate in time to prevent the user-mode buffer from overflowing.
在一种可能的实现方式中,若该用户态缓冲区的溢出时间大于等于第一文件的剩余传输时间,该方法还包括:若该网络协议栈接收缓冲区的已缓冲数据量低于第二阈值,该终端根据该网络协议栈接收缓冲区的总缓冲容量、该用户态缓冲区的缓冲数据增长速率,确定出该网络协议栈接收缓冲区的最大溢出时间。若该网络协议栈接收缓冲区的最大溢出时间大于等于该第一文件的剩余传输时间,该终端从该网络协议栈接收缓冲区中取出该第一文件的数据直接写入该磁盘中。这样,网络协议栈接收缓冲区的空余容量较多时,直接从网络协议栈接收缓冲区将第一文件的数据写入至磁盘中,节约处理器的处理功耗。In a possible implementation manner, if the overflow time of the user mode buffer is greater than or equal to the remaining transmission time of the first file, the method further includes: if the amount of buffered data in the network protocol stack receiving buffer is lower than the second Threshold, the terminal determines the maximum overflow time of the receiving buffer of the network protocol stack according to the total buffer capacity of the receiving buffer of the network protocol stack and the buffer data growth rate of the user mode buffer. If the maximum overflow time of the receiving buffer of the network protocol stack is greater than or equal to the remaining transmission time of the first file, the terminal takes out the data of the first file from the receiving buffer of the network protocol stack and writes it directly to the disk. In this way, when the free capacity of the receiving buffer of the network protocol stack is large, the data of the first file is directly written to the disk from the receiving buffer of the network protocol stack, thereby saving processing power consumption of the processor.
在一种可能的实现方式中,该终端将存入该网络协议栈接收缓冲区中的数据转存到用户态缓冲区,具体包括:该终端将存入该网络协议栈接收缓冲区中的所有数据转存到该用户态缓冲区。In a possible implementation manner, the terminal dumps the data stored in the receiving buffer of the network protocol stack to the user mode buffer, which specifically includes: the terminal transfers all data stored in the receiving buffer of the network protocol stack Data is dumped to this user mode buffer.
在一种可能的实现方式中,该终端将存入该网络协议栈接收缓冲区中的数据转存到用户态缓冲区,具体包括:该终端将存入该网络协议栈接收缓冲区中的第一部分数据转存到该用户态缓冲区。该方法还包括:该终端将该存入该网络协议栈接收缓冲区中的第二部分数据直接写入该磁盘中。In a possible implementation manner, the terminal transfers the data stored in the receiving buffer of the network protocol stack to the user mode buffer, which specifically includes: the terminal transfers the first data stored in the receiving buffer of the network protocol stack A portion of the data is dumped into this user mode buffer. The method further includes: the terminal directly writes the second part of data stored in the network protocol stack receiving buffer into the disk.
在一种可能的实现方式中,该终端获取网络协议栈接收缓冲区的缓冲数据增长速率,具体包括:该终端通过监测该网络协议栈接收缓冲区中的已缓冲数据量的变化,获取到该网络协议栈接收缓冲区的缓冲数据增长速率。In a possible implementation manner, the terminal acquires the buffered data growth rate of the receiving buffer of the network protocol stack, which specifically includes: the terminal acquires the buffered data amount by monitoring the change of the buffered data amount in the receiving buffer of the network protocol stack. The buffered data growth rate of the network stack receive buffer.
在一种可能的实现方式中,该终端获取网络协议栈接收缓冲区的缓冲数据增长速率,具体包括:该终端获取该第一文件的数据写入该磁盘的写入速率。该终端根据该网卡接收速率和该写入速率,确定出该网络协议栈接收缓冲区的缓冲数据增长速率。In a possible implementation manner, the terminal acquiring the buffered data growth rate of the receiving buffer of the network protocol stack specifically includes: acquiring the writing rate of the data of the first file into the disk by the terminal. The terminal determines, according to the receiving rate of the network card and the writing rate, the growth rate of the buffered data of the receiving buffer of the network protocol stack.
在一种可能的实现方式中,该网络协议栈接收缓冲区包括:用户数据报协议UDP接收缓冲区。In a possible implementation manner, the network protocol stack receiving buffer includes: a user datagram protocol UDP receiving buffer.
第四方面,本申请提供了一种多路径数据预取方法,包括:终端获取该终端的第一应用针对第一URI发起的第一HTTP请求,该第一HTTP请求用于向服务器请求第一数据。该终端生成L个第二HTTP请求,该L个第二HTTP请求用于向该服务器请求第二数据,其中,该第二数据包括该第一数据且该第二数据的数据量大于该第一数据的数据量,L为正整数。该终端将该L个第二HTTP请求分别通过L个网络路径发送给该服务器。该终端接收该服务器在该L个网络路径上发送的L个第一HTTP响应,该L个第一HTTP响应包括有该第二数据。该终端从该第二数据中取出该第一数据,并将该第一数据通过HTTP响应返回给该第一应用。该终端接收到该第一应用针对该第一URI发起的第三HTTP请求,该第三HTTP请求用于向该服务器请求第三数据。若该第二数据包括该第三数据,该终端 从该第二数据中取出该第三数据,并将该第三数据通过HTTP响应返回给该第一应用。In a fourth aspect, the present application provides a multi-path data prefetching method, including: a terminal acquiring a first HTTP request initiated by a first application of the terminal for a first URI, where the first HTTP request is used to request a server for the first HTTP request. data. The terminal generates L second HTTP requests, where the L second HTTP requests are used to request second data from the server, wherein the second data includes the first data and the data volume of the second data is larger than the first data The amount of data, L is a positive integer. The terminal sends the L second HTTP requests to the server through L network paths respectively. The terminal receives L first HTTP responses sent by the server on the L network paths, where the L first HTTP responses include the second data. The terminal retrieves the first data from the second data, and returns the first data to the first application through an HTTP response. The terminal receives a third HTTP request initiated by the first application for the first URI, where the third HTTP request is used to request third data from the server. If the second data includes the third data, the terminal extracts the third data from the second data, and returns the third data to the first application through an HTTP response.
通过本申请提供的一种多路径数据预取方法,终端可以当应用业务请求第一数据量的数据时,向服务器预取第二数据量的数据,其中,第二数据量大于第一数据量。然后,终端接收到服务器返回的第二数据量的数据后,可以先将第二数据量中的第一数据量的数据返回给应用。然后,将剩余(第二数据量-第一数据量)的数据存到预取缓冲区。当应用下次请求剩余的(第二数据量-第一数据量)字节的数据时,终端可以直接从预取缓冲区中提取该剩余的(第二数据量-第一数据量)字节的数据给到应用。提高了终端与服务器之间的网络路径的带宽利用率,并且,当应用频繁访问同一URI地址上的不同范围的数据时,可以节省应用获取到数据的时间。With the multi-path data prefetching method provided by the present application, the terminal can prefetch data of the second data amount from the server when the application service requests the data of the first data amount, wherein the second data amount is greater than the first data amount . Then, after receiving the data of the second data volume returned by the server, the terminal may first return the data of the first data volume in the second data volume to the application. Then, the remaining data (the second amount of data - the first amount of data) is stored in the prefetch buffer. When the application requests the remaining (the second amount of data - the first amount of data) bytes of data next time, the terminal can directly extract the remaining (the second amount of data - the first amount of data) bytes from the prefetch buffer data to the application. The bandwidth utilization rate of the network path between the terminal and the server is improved, and when the application frequently accesses data in different ranges on the same URI address, the time for the application to obtain the data can be saved.
在一种可能的实现方式中,若该第三数据的字节范围不在该第二数据的字节范围之内,该终端生成S个第四HTTP请求,该S个第四HTTP请求用于向该服务器请求第四数据,其中,该第四数据与该第二数据的集合包括该第三数据,S为正整数。该终端接收该服务器在该S个网络路径上发送的S个第二HTTP响应,该S个第二HTTP响应包括有该第四数据。该终端从该第四数据和该第二数据中取出该第三数据,并将该第三数据通过HTTP响应返回给该第一应用。这样,可以在终端上次预取的数据量不够满足应用本次的数据量时,向服务器请求更多的数据。In a possible implementation manner, if the byte range of the third data is not within the byte range of the second data, the terminal generates S fourth HTTP requests, and the S fourth HTTP requests are used to send The server requests fourth data, wherein the set of the fourth data and the second data includes the third data, and S is a positive integer. The terminal receives S second HTTP responses sent by the server on the S network paths, where the S second HTTP responses include the fourth data. The terminal takes out the third data from the fourth data and the second data, and returns the third data to the first application through an HTTP response. In this way, when the amount of data prefetched by the terminal last time is not enough to satisfy the data amount of this application, more data can be requested from the server.
在一种可能的实现方式中,在该终端接收到该第一应用针对该第一URI发起的第三HTTP请求之前,该方法还包括:该终端将该第二数据中除该第一数据之外的剩余数据,保存到第一URI对应的第一预取缓冲区中。该若该第二数据包括该第三数据,该终端从该第二数据中取出该第三数据,并将该第三数据通过HTTP响应返回给该第一应用,具体包括:若该第二数据包括该第三数据,该终端从该第一预取缓冲区中取出该第三数据,并将该第三数据通过HTTP响应返回给该第一应用。这样,终端可以将多预取的数据存储到缓冲区中,在应用下次请求数据时,可以及时返回数据给应用。In a possible implementation manner, before the terminal receives the third HTTP request initiated by the first application for the first URI, the method further includes: the terminal excludes the first data from the second data The remaining data outside the URI is stored in the first prefetch buffer corresponding to the first URI. If the second data includes the third data, the terminal takes out the third data from the second data, and returns the third data to the first application through an HTTP response, specifically including: if the second data Including the third data, the terminal fetches the third data from the first prefetch buffer, and returns the third data to the first application through an HTTP response. In this way, the terminal can store the multi-prefetched data in the buffer, and when the application requests data next time, the data can be returned to the application in time.
在一种可能的实现方式中,在该终端生成L个第二HTTP请求之前,该方法还包括:该终端根据该第一应用上一次请求该第一URI对应资源的字节范围,确定出第二数据的字节范围。In a possible implementation manner, before the terminal generates the L second HTTP requests, the method further includes: the terminal determines, according to the byte range of the resource corresponding to the first URI last requested by the first application, the first 2 Byte range of data.
在一种可能的实现方式中,该终端根据该第一应用上一次请求该第一URI对应资源的字节范围,确定出第二数据的字节范围,具体包括:该终端从该第一应用上次请求该第一URI对应资源的字节范围中,获取该第一应用上次请求该第一URI对应资源的上次请求数据量和上次请求末端字节位置。当指定倍数的上次请求数据量小于等于该第一预取缓冲区中的剩余缓冲容量时,该终端确定本次请求数据量为该指定倍数的上次请求数据量。该终端根据该本次请求数据量和该上次请求末端字节位置,确定出该第二数据的字节范围。这样,终端100可以决定每次向服务器预取数据的数据量。In a possible implementation manner, the terminal determines the byte range of the second data according to the byte range of the resource corresponding to the first URI requested by the first application last time, which specifically includes: In the byte range of the last request for the resource corresponding to the first URI, the last requested data amount and the last requested end byte position of the resource corresponding to the first URI requested by the first application last time are obtained. When the last requested data volume of the specified multiple is less than or equal to the remaining buffer capacity in the first prefetch buffer, the terminal determines that the current requested data volume is the specified multiple of the last requested data volume. The terminal determines the byte range of the second data according to the data volume of the current request and the end byte position of the last request. In this way, the terminal 100 can determine the amount of data to be prefetched from the server each time.
在一种可能的实现方式中,该方法还包括:当该指定倍数的上次请求数据量大于该第一预取缓冲区中的剩余缓冲容量时,该终端确定该本次请求数据量为该上次请求数据量。In a possible implementation manner, the method further includes: when the last requested data volume of the specified multiple is greater than the remaining buffer capacity in the first prefetch buffer, the terminal determines that the current requested data volume is the The last requested amount of data.
在一种可能的实现方式中,该终端根据该第一应用上一次请求该第一URI对应资源的字节范围,确定出第二数据的字节范围,具体包括:该终端从该第一应用上次请求该第一URI对应资源的字节范围中,获取该第一应用上次请求该第一URI对应资源的上次请求数 据量和上次请求末端字节位置。该终端根据N个可用网络路径的带宽和往返时延,确定出当请求数据量为指定倍数的上次请求数据量时该终端上N个可用网络路径的第一总带宽利用率,N≥L,N为正整数。当该第一总带宽利用率小于等于指定阈值且该指定倍数的上次请求数据量小于等于该第一预取缓冲区中的剩余缓冲容量时,该终端确定该指定倍数的本次请求数据量为上次请求数据量。该终端根据该本次请求数据量和该上次请求末端字节位置,确定出该第二数据的字节范围。In a possible implementation manner, the terminal determines the byte range of the second data according to the byte range of the resource corresponding to the first URI requested by the first application last time, which specifically includes: In the byte range of the last request for the resource corresponding to the first URI, the last requested data amount and the last requested end byte position of the resource corresponding to the first URI requested by the first application last time are obtained. The terminal determines, according to the bandwidth and round-trip delay of the N available network paths, the first total bandwidth utilization rate of the N available network paths on the terminal when the requested data amount is a specified multiple of the last requested data amount, N≥L , where N is a positive integer. When the first total bandwidth utilization is less than or equal to the specified threshold and the specified multiple of the last requested data volume is less than or equal to the remaining buffer capacity in the first prefetch buffer, the terminal determines the specified multiple of the current requested data volume The amount of data requested last time. The terminal determines the byte range of the second data according to the data volume of the current request and the end byte position of the last request.
其中,本次请求数据量的确定可以如下:The determination of the amount of data requested this time can be as follows:
1、当该第一总带宽利用率小于等于该指定阈值且该指定倍数的上次请求数据量大于该第一预取缓冲区中的剩余缓冲容量时,该终端确定该本次请求数据量为上次请求数据量。1. When the first total bandwidth utilization rate is less than or equal to the specified threshold and the last requested data volume by the specified multiple is greater than the remaining buffer capacity in the first prefetch buffer, the terminal determines that the current requested data volume is The last requested amount of data.
2、当该第一总带宽利用率大于该指定阈值时,该终端根据该N个可用网络的带宽和时延,确定在该N个可用网络路径的总带宽利用率为该指定阈值时对应的第一预取数据量。当该终端确定该第一预取数据量小于等于该第一预取缓冲区中剩余缓冲容量时,该终端确定该本次请求数据量为该第一预取数据量。2. When the first total bandwidth utilization is greater than the specified threshold, the terminal determines, according to the bandwidth and delay of the N available networks, the corresponding bandwidth when the total bandwidth utilization of the N available network paths is the specified threshold. The first amount of prefetched data. When the terminal determines that the first prefetched data volume is less than or equal to the remaining buffer capacity in the first prefetched buffer, the terminal determines that the current requested data volume is the first prefetched data volume.
3、当该终端确定该第一预取数据量大于该第一预取缓冲区中剩余缓冲容量时,该终端确定该本次请求数据量为上次请求数据量。3. When the terminal determines that the first prefetched data volume is greater than the remaining buffer capacity in the first prefetched buffer, the terminal determines that the current requested data volume is the last requested data volume.
在一种可能的实现方式中,该终端根据该终端与该服务器之间的L个网络路径的带宽和往返时延、该L个网络路径上该服务器的IP地址和该第二数据的字节范围,生成该L个第二HTTP请求。这样,终端可以根据各网络路径的网络性能决定每个网络路径上请求的数据量,提高网络路径的带宽利用率并减小数据传输时间。In a possible implementation manner, the terminal is based on the bandwidth and round-trip delay of L network paths between the terminal and the server, the IP address of the server on the L network paths, and the bytes of the second data range, the L second HTTP requests are generated. In this way, the terminal can determine the amount of data requested on each network path according to the network performance of each network path, thereby improving the bandwidth utilization rate of the network path and reducing the data transmission time.
在一种可能的实现方式中,在终端获取第一应用针对第一URI发起的第一HTTP请求之前,该方法还包括:该终端获取该第一应用首次针对该第一URI发起的初次HTTP请求,该初次HTTP请求用于请求第五数据。该终端根据该第五数据的字节范围,生成N个第五HTTP请求,其中,该N个第五HTTP请求中请求范围的长度相同,N大于等于L。该终端将该N个第五HTTP请求分别通过N个可用网络路径发送给该服务器。该终端接收该服务器在该N个可用网络路径上发送的第五数据,并将该第五数据返回给该第一应用。该终端获取该N个可用网络路径上的往返时延和吞吐量。该终端根据该N个可用网络路径上的往返时延和吞吐量,以及该N个第五HTTP请求分别请求的数据量,确定出该N个可用网络路径的带宽。这样,终端可以获取到每个网络路径上的网络性能信息。In a possible implementation manner, before the terminal acquires the first HTTP request initiated by the first application for the first URI, the method further includes: acquiring, by the terminal, the initial HTTP request initiated by the first application for the first URI for the first time , the initial HTTP request is used to request the fifth data. The terminal generates N fifth HTTP requests according to the byte range of the fifth data, wherein the lengths of the request ranges in the N fifth HTTP requests are the same, and N is greater than or equal to L. The terminal sends the N fifth HTTP requests to the server through N available network paths respectively. The terminal receives fifth data sent by the server on the N available network paths, and returns the fifth data to the first application. The terminal obtains the round-trip delay and throughput on the N available network paths. The terminal determines the bandwidths of the N available network paths according to the round-trip delay and throughput on the N available network paths and the data amounts respectively requested by the N fifth HTTP requests. In this way, the terminal can obtain network performance information on each network path.
其中,在该终端获取该第一应用首次针对该第一URI发起的初次HTTP请求后,该终端创建该第一URI对应的该第一预取缓冲区。Wherein, after the terminal obtains the first HTTP request initiated by the first application for the first URI for the first time, the terminal creates the first prefetch buffer corresponding to the first URI.
其中,该终端通过如下公式,确定出该N个可用网络路径的带宽:The terminal determines the bandwidth of the N available network paths through the following formula:
Figure PCTCN2021108275-appb-000001
Figure PCTCN2021108275-appb-000001
Figure PCTCN2021108275-appb-000002
Figure PCTCN2021108275-appb-000002
TransTime i=max{U i/Z i,0.5*RTT i} TransTime i =max{U i /Z i ,0.5*RTT i }
其中,
Figure PCTCN2021108275-appb-000003
表示第i个可用网络路径的理论带宽利用率,Z i表示第i个网络路径的真实带宽,X i表示第i个网络路径的吞吐量,TransTime i表示第i个可用网络路径上的数据传输耗时,U i表示第i个可用网络路径上对应的第五HTTP请求所请求的数据量,RTT i表示第i 个可用网络路径上的往返时延,i≤N。
in,
Figure PCTCN2021108275-appb-000003
represents the theoretical bandwidth utilization of the ith available network path, Z i represents the real bandwidth of the ith network path, X i represents the throughput of the ith network path, TransTime i represents the data transmission on the ith available network path Time-consuming, U i represents the amount of data requested by the corresponding fifth HTTP request on the ith available network path, RTT i represents the round-trip delay on the ith available network path, i≤N.
在一种可能的实现方式中,在该终端获取该第一应用首次针对该第一URI发起的初次HTTP请求之前,该终端根据该第一URI的域名在所有网络路径上发送DNS请求。该终端在该N个可用网络路径上接收到N个DNS响应。该终端从该N个DNS响应中,获取到该N个可用网络路径中每一个网络路径上对应的该服务器的IP地址。这样,终端可以获取到每个网路路径上服务器的IP地址。In a possible implementation manner, before the terminal obtains the initial HTTP request initiated by the first application for the first URI for the first time, the terminal sends a DNS request on all network paths according to the domain name of the first URI. The terminal receives N DNS responses on the N available network paths. The terminal obtains, from the N DNS responses, the IP address of the server corresponding to each of the N available network paths. In this way, the terminal can obtain the IP address of the server on each network path.
在一种可能的实现方式中,该终端根据该终端与服务器之间的L个网络路径的带宽和往返时延、该第二数据的字节范围确定出该L个网络路径各自对应的请求数据量。该终端根据该L个网络路径各自对应的请求数据量,和该第二数据的字节范围确定出该L个第二HTTP请求各自对应的请求范围。该终端根据该服务器的IP地址和该L个第二HTTP请求各自对应的请求范围,生成该L个第二HTTP请求。In a possible implementation manner, the terminal determines the request data corresponding to each of the L network paths according to the bandwidth and round-trip delay of the L network paths between the terminal and the server, and the byte range of the second data quantity. The terminal determines the respective request ranges corresponding to the L second HTTP requests according to the respective request data volumes corresponding to the L network paths and the byte range of the second data. The terminal generates the L second HTTP requests according to the IP address of the server and the respective request ranges corresponding to the L second HTTP requests.
其中,在该终端根据该终端与服务器之间的L个网络路径的带宽和往返时延、该L个网络路径上该服务器的IP地址和该第二数据的字节范围生成L个第二HTTP请求之前,该终端分别在该L个网络路径上与该服务器建立TCP连接。Wherein, the terminal generates L second HTTPs according to the bandwidth and round-trip delay of L network paths between the terminal and the server, the IP address of the server on the L network paths, and the byte range of the second data Before the request, the terminal establishes a TCP connection with the server on the L network paths respectively.
其中,该终端通过如下公式,确定该L个网络路径各自对应的请求数据量:The terminal determines the amount of requested data corresponding to each of the L network paths through the following formula:
Figure PCTCN2021108275-appb-000004
Figure PCTCN2021108275-appb-000004
FCT i=U i/Z i+0.5*RTT i FCT i =U i /Z i +0.5*RTT i
FCT i=c FCT i = c
其中,M为该第二数据的数据量,U i用于表示该L个网络路径中第i个网络路径对应的子请求数据量,FCT i用于表示该L个网络路径中第i个网络路径的传输完U i长度的数据所需时间。Z i用于表示该L个网络路径中第i个网络路径的带宽,c为固定值,1≤i≤L。 Wherein, M is the data volume of the second data, U i is used to represent the sub-request data volume corresponding to the ith network path in the L network paths, and FCT i is used to represent the ith network in the L network paths The time required for the path to transmit data of length U i . Z i is used to represent the bandwidth of the ith network path in the L network paths, c is a fixed value, 1≤i≤L.
在一种可能的实现方式中,在该终端根据该终端与服务器之间的L个网络路径的带宽和往返时延、该L个网络路径上该服务器的IP地址和该第二数据的字节范围生成L个第二HTTP请求之后,该终端分别在该L个网络路径上与该服务器建立TCP连接。In a possible implementation manner, at the terminal, according to the bandwidth and round-trip delay of L network paths between the terminal and the server, the IP address of the server on the L network paths, and the bytes of the second data After the scope generates L second HTTP requests, the terminal establishes a TCP connection with the server on the L network paths respectively.
其中,该终端通过如下公式,确定该L个网络路径各自对应的请求数据量:The terminal determines the amount of requested data corresponding to each of the L network paths through the following formula:
Figure PCTCN2021108275-appb-000005
Figure PCTCN2021108275-appb-000005
FCT i=U i/Z i+2*RTT i FCT i =U i /Z i +2*RTT i
FCT i=c FCT i = c
其中,M为该第二数据的数据量,U i用于表示该L个网络路径中第i个网络路径对应的子请求数据量,FCT i用于表示该L个网络路径中第i个网络路径的传输完U i长度的数据所需时间。Z i用于表示该L个网络路径中第i个网络路径的带宽,c为固定值,1≤i≤L。 Wherein, M is the data volume of the second data, U i is used to represent the sub-request data volume corresponding to the ith network path in the L network paths, and FCT i is used to represent the ith network in the L network paths The time required for the path to transmit data of length U i . Z i is used to represent the bandwidth of the ith network path in the L network paths, c is a fixed value, 1≤i≤L.
在一种可能的实现方式中,在该终端根据该终端与服务器之间的L个网络路径的带宽和往返时延、该L个网络路径上该服务器的IP地址和该第二数据的字节范围,生成L个第二HTTP请求之前,该终端从N个可用网络路径中,选出该L个网络路径。In a possible implementation manner, at the terminal, according to the bandwidth and round-trip delay of L network paths between the terminal and the server, the IP address of the server on the L network paths, and the bytes of the second data range, before generating the L second HTTP requests, the terminal selects the L network paths from the N available network paths.
在一种可能的实现方式中,当终端确定指定时间段内所述第一应用请求该第一URI对应资源的次数大于指定次数阈值时,所述终端生成上述L个第二HTTP请求。In a possible implementation manner, when the terminal determines that the number of times the first application requests the resource corresponding to the first URI within a specified time period is greater than a specified number of times threshold, the terminal generates the above-mentioned L second HTTP requests.
在一种可能的实现方式中,当终端确定指定时间段内所述第一应用请求该第一URI对应资源的次数大于指定次数阈值时且第一URI对应的第一预取缓冲区中不包括上述第一数据时,该终端生成上述L个第二HTTP请求。In a possible implementation manner, when the terminal determines that the number of times the first application requests the resource corresponding to the first URI within the specified time period is greater than the specified number of times threshold, and the first prefetch buffer corresponding to the first URI does not include When the above-mentioned first data is used, the terminal generates the above-mentioned L second HTTP requests.
第五方面,本申请提供了一种终端,包括一个或多个处理器和一个或多个存储器。该一个或多个存储器与一个或多个处理器耦合,一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,当一个或多个处理器执行计算机指令时,使得终端执行上述任一方面任一项可能的实现方式中的缓冲区管理方法或数据传输方法或数据存储方法或多路径数据预取方法。In a fifth aspect, the present application provides a terminal including one or more processors and one or more memories. The one or more memories are coupled with one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, when the one or more processors execute the computer instructions, the terminal can execute the above A buffer management method or a data transmission method or a data storage method or a multi-path data prefetching method in any possible implementation manner of any aspect.
第六方面,本申请实施例提供了一种计算机存储介质,包括计算机指令,当计算机指令在终端上运行时,使得终端执行上述任一方面任一项可能的实现方式中的缓冲区管理方法或数据传输方法或数据存储方法或多路径数据预取方法。In a sixth aspect, the embodiments of the present application provide a computer storage medium, including computer instructions, when the computer instructions are executed on the terminal, the terminal is made to execute the buffer management method or Data transfer method or data storage method or multi-path data prefetching method.
第七方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行上述任一方面任一项可能的实现方式中的缓冲区管理方法或数据传输方法或数据存储方法或多路径数据预取方法。In a seventh aspect, an embodiment of the present application provides a computer program product that, when the computer program product runs on a computer, enables the computer to execute the buffer management method or the data transmission method in any of the possible implementations of any of the above aspects Or data storage method or multi-path data prefetch method.
第八方面,本申请提供了一种终端,包括:一个或多个功能模块,该一个或多个功能模块用于执行上述任一方面任一项可能的实现方式中的缓冲区管理方法或数据传输方法或数据存储方法或多路径数据预取方法。In an eighth aspect, the present application provides a terminal, comprising: one or more functional modules, the one or more functional modules are used to execute the buffer management method or data in any possible implementation manner of any of the above aspects Transmission method or data storage method or multi-path data prefetching method.
附图说明Description of drawings
图1为本申请实施例的第一部分提供的一种数据传输的场景示意图;FIG. 1 is a schematic diagram of a data transmission scenario provided by the first part of the embodiment of the present application;
图2为本申请实施例的第一部分提供的一种内存占用率与用户交互操作频繁程度的关系示意图;FIG. 2 is a schematic diagram of the relationship between a memory occupancy rate and the frequency of user interaction operations provided in the first part of the embodiment of the present application;
图3为本申请实施例的第一部分提供的一种缓冲区管理策略的示意图;3 is a schematic diagram of a buffer management strategy provided in the first part of the embodiment of the present application;
图4为本申请实施例的第一部分提供的一种终端的硬件结构示意图;FIG. 4 is a schematic diagram of the hardware structure of a terminal provided in the first part of the embodiment of the present application;
图5为本申请实施例的第一部分提供的一种缓冲区管理方法的流程示意图;5 is a schematic flowchart of a buffer management method provided in the first part of the embodiment of the present application;
图6为本申请实施例的第二部分提供的一种数据传输***的架构示意图;6 is a schematic diagram of the architecture of a data transmission system provided in the second part of the embodiment of the present application;
图7为本申请实施例的第二部分提供的一种数据传输***的缓冲区示意图;7 is a schematic diagram of a buffer area of a data transmission system provided in the second part of the embodiment of the present application;
图8为本申请实施例的第二部分提供的一种数据传输方法的流程示意图;8 is a schematic flowchart of a data transmission method provided in the second part of the embodiment of the present application;
图9为本申请实施例的第二部分提供的一种缓冲区的模型示意图;9 is a schematic diagram of a buffer model provided by the second part of the embodiment of the present application;
图10为本申请实施例的第二部分提供的一种数据传输方法的流程示意图;10 is a schematic flowchart of a data transmission method provided in the second part of the embodiment of the present application;
图11为本申请实施例的第二部分提供的MAC层发送缓冲区的缓冲水位线变化示意图;FIG. 11 is a schematic diagram of the change of the buffer water level of the MAC layer transmission buffer provided in the second part of the embodiment of the present application;
图12为本申请实施例的第三部分提供的传输控制协议TCP中拥塞控制机制的基本逻 辑示意图;Fig. 12 is the basic logic schematic diagram of the congestion control mechanism in the transmission control protocol TCP that the third part of the embodiment of the application provides;
图13为本申请实施例的第三部分提供的传输控制协议TCP中拥塞控制机制的问题示意图;13 is a schematic diagram of the problem of the congestion control mechanism in the transmission control protocol TCP provided by the third part of the embodiment of the present application;
图14为本申请实施例的第三部分提供的一种数据存储***的架构示意图;14 is a schematic diagram of the architecture of a data storage system provided in the third part of the embodiment of the present application;
图15为本申请实施例的第三部分提供的一种数据存储方法的流程示意图;15 is a schematic flowchart of a data storage method provided in the third part of the embodiment of the present application;
图16为本申请实施例的第四部分提供的多路劲传输控制协议MPTCP的原理示意图;16 is a schematic diagram of the principle of the multi-channel transmission control protocol MPTCP provided in the fourth part of the embodiment of the application;
图17为本申请实施例的第四部分提供的多路径超文本传输协议MPHTTP的原理示意图;17 is a schematic diagram of the principle of the multi-path hypertext transfer protocol MPHTTP provided in the fourth part of the embodiment of the present application;
图18为本申请实施例的第四部分提供的多径传输的***架构示意图;FIG. 18 is a schematic diagram of a system architecture of multipath transmission provided in the fourth part of the embodiment of the present application;
图19为本申请实施例的第四部分提供的基于多路径超文本传输协MPHTTP进行多径传输的流程示意图;19 is a schematic flowchart of multi-path transmission based on the multi-path hypertext transmission protocol MPHTTP provided in the fourth part of the embodiment of the present application;
图20为本申请实施例的第四部分提供的终端通过HTTP请求向服务器请求数据的时序示意图;20 is a schematic time sequence diagram of a terminal requesting data from a server through an HTTP request provided by the fourth part of the embodiment of the present application;
图21为本申请实施例的第四部分提供的带宽利用率与分片大小和网络带宽的关系示意图;21 is a schematic diagram of the relationship between bandwidth utilization, fragment size, and network bandwidth provided by the fourth part of the embodiment of the present application;
图22A为本申请实施例的第四部分提供的多路径数据预取方法的原理示意图;FIG. 22A is a schematic schematic diagram of the principle of the multi-path data prefetching method provided in the fourth part of the embodiment of the present application;
图22B为本申请实施例的第四部分提供的另一多路径数据预取方法的原理示意图;FIG. 22B is a schematic schematic diagram of another multi-path data prefetching method provided in the fourth part of the embodiment of the present application;
图23为本申请实施例的第四部分提供的终端的软件架构示意图;23 is a schematic diagram of the software architecture of the terminal provided in the fourth part of the embodiment of the present application;
图24为本申请实施例的第四部分提供的第一应用首次获取服务器上数据的方法流程示意图;24 is a schematic flowchart of a method for a first application to obtain data on a server for the first time provided in the fourth part of the embodiment of this application;
图25为本申请实施例的第四部分提供的第一应用再次获取服务器上数据的方法流程示意图;25 is a schematic flowchart of a method for the first application to obtain data on the server again provided in the fourth part of the embodiment of the present application;
图26为本申请实施例的第四部分提供的多路径数据预取方法的流程示意图;26 is a schematic flowchart of a multi-path data prefetching method provided in the fourth part of the embodiment of the present application;
图27为本申请实施例的第四部分提供的多路径数据预取方法的交互流程示意图。FIG. 27 is a schematic diagram of an interaction flow of the multi-path data prefetching method provided in the fourth part of the embodiment of the present application.
具体实施方式detailed description
下面将结合附图对本申请实施例中的技术方案进行清楚、详尽地描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;文本中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,另外,在本申请实施例的描述中,“多个”是指两个或多于两个。The technical solutions in the embodiments of the present application will be described clearly and in detail below with reference to the accompanying drawings. Wherein, in the description of the embodiments of the present application, unless otherwise specified, “/” means or, for example, A/B can mean A or B; “and/or” in the text is only a description of an associated object The association relationship indicates that there can be three kinds of relationships, for example, A and/or B can indicate that A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of this application , "plurality" means two or more than two.
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。Hereinafter, the terms "first" and "second" are only used for descriptive purposes, and should not be construed as implying or implying relative importance or implying the number of indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, the "multiple" The meaning is two or more.
下面结合图1-图5介绍本申请实施例的第一部分提供的一种缓冲区管理方法及相关内容。The following describes a buffer management method and related content provided in the first part of the embodiment of the present application with reference to FIG. 1 to FIG. 5 .
在本申请实施例的第一部分中一些名词的序号不继续沿用本申请实施例其他部分中的序号的顺序,在本申请实施例的第一部分中的名词仅仅在在本申请实施例第一部分中使用。The sequence numbers of some nouns in the first part of the embodiments of the present application do not continue to follow the sequence of the sequence numbers of other parts of the embodiments of the present application, and the nouns in the first part of the embodiments of the present application are only used in the first part of the embodiments of the present application .
在大带宽传输场景中,高速传输的主要矛盾是信道极限速率与终端内部处理速率不匹配。发送端传输文件数据给接收端时,若发送太快,容易丢数据包,若发送太慢,文件传输速率无法接近信道极限速率,浪费带宽,也无法满足用户的需求。例如,采用通用闪存存储(universal flash storage,UFS)3.0标准的终端,在空闲时的顺序写入速率可以达到2.4Gbps。采用通用闪存存储(universal flash storage,UFS)2.0标准的终端,在空闲时的顺序写入速率可以达到1.2Gbps。机械硬盘7200在空闲时的顺序写入速率可以达到1.2Gbps。固态硬盘(solid state disk,SSD)在空闲时的顺序写入速率可以达到3Gbps。而配置有2x2多输入多输出(muti-input muti-output,MIMO)天线的终端基于无线高保真(wireless fidelity,Wi-Fi)5的无线局域网络的信道发送速率可以达到1.7Gbps,基于WiFi 6的无线局域网络的信道传输速率可以达到信道发送速率可以达到2.4Gbps。In the large-bandwidth transmission scenario, the main contradiction of high-speed transmission is that the channel limit rate does not match the internal processing rate of the terminal. When the sender transmits file data to the receiver, if the transmission is too fast, it is easy to lose data packets. If the transmission is too slow, the file transmission rate cannot approach the channel limit rate, wastes bandwidth, and cannot meet the needs of users. For example, a terminal using the universal flash storage (UFS) 3.0 standard can achieve a sequential write rate of 2.4 Gbps when idle. The terminal using the universal flash storage (UFS) 2.0 standard can achieve a sequential write rate of 1.2Gbps when idle. The sequential write rate of the mechanical hard disk 7200 when idle can reach 1.2Gbps. The sequential write rate of a solid state disk (SSD) when idle can reach 3Gbps. The channel transmission rate of the wireless local area network based on wireless fidelity (Wi-Fi) 5 for terminals equipped with 2x2 multiple-input multiple-output (MIMO) antennas can reach 1.7Gbps, based on WiFi 6 The channel transmission rate of the wireless local area network can reach the channel transmission rate can reach 2.4Gbps.
其中,信道极限发送速率与终端内部处理速率存在静态不匹配。当发送端和接收端的中央处理单元(central processing unit,CPU)算力或存储器输入/输出(input/output,I/O)算力不对称时,I/O或CPU算力高的发送设备给I/O或CPU算力低的接收设备高速发送数据时,I/O或CPU算力低的接收设备内核态接收缓冲区容易溢出,从而导致丢包。这样,会导致在端到端近距离大带宽的传输场景中,发送端传输文件数据时的速率太慢。There is a static mismatch between the channel limit transmission rate and the terminal internal processing rate. When the computing power of the central processing unit (CPU) or memory input/output (I/O) computing power of the sending end and the receiving end is asymmetric, the sending device with high I/O or CPU computing power will When a receiving device with low I/O or CPU computing power sends data at high speed, the kernel-mode receive buffer of a receiving device with low I/O or CPU computing power is prone to overflow, resulting in packet loss. In this way, in an end-to-end short-range and large-bandwidth transmission scenario, the transmission rate of the file data at the sending end is too slow.
信道极限发送速率与终端内部处理速率还存在动态不匹配。当接收端的负载动态变化,会引发I/O算力或CPU算力的动态变化,从而影响接收端从内核态接收缓冲区中取出数据的速率,可能会导致丢包率升高。There is still a dynamic mismatch between the channel limit transmission rate and the internal processing rate of the terminal. When the load on the receiving end changes dynamically, it will cause dynamic changes in I/O computing power or CPU computing power, which affects the rate at which the receiving end fetches data from the kernel-mode receive buffer, which may lead to an increase in the packet loss rate.
如图1所示,数据包发送端(packet sender)可以通过网络(network)发送文件数据给数据包接收端(packet receiver)。数据包接收端在接收到数据包后可以将数据包先存入缓冲区中,然后,数据包接收端的数据包处理模块(packet handler)可以从缓冲区中顺序取出数据包进行处理,并释放缓冲区中已取出数据所占用的存储空间。例如,假设上述缓冲区可以为用户态缓冲区,数据包处理模块从用户态缓冲区取出数据的处理速率Vsrv与CPU的算力以及I/O算力有关,用户态缓冲区的接收速率Vrerv与信道有关。默用户态缓冲区的容量仅为131Kb,假设Vsrv比Vrerv的瞬时速率少1%,对于1Gbps传输链路,用户态缓冲区从空到溢出大约只需花费0.1s,溢出的所有数据包将必须全部丢弃。这样,会导致发送端发送数据包太快,丢包率过高,发送端发送数据包太慢,不满足端对端近距离大带宽传输场景的高速传输需求。As shown in Figure 1, the packet sender can send file data to the packet receiver through the network. After receiving the data packet, the data packet receiving end can store the data packet in the buffer first, and then the data packet processing module (packet handler) of the data packet receiving end can sequentially take out the data packets from the buffer for processing, and release the buffer. The storage space occupied by the fetched data in the area. For example, assuming that the above buffer can be a user-mode buffer, the processing rate Vsrv of the data packet processing module fetching data from the user-mode buffer is related to the computing power and I/O computing power of the CPU, and the receiving rate Vrerv of the user-mode buffer is related to channel related. The capacity of the default user mode buffer is only 131Kb. Assuming that Vsrv is 1% less than the instantaneous rate of Vrerv, for a 1Gbps transmission link, it only takes about 0.1s for the user mode buffer to overflow from empty. All packets that overflow will have to All discarded. In this way, the sender sends data packets too fast, the packet loss rate is too high, and the sender sends data packets too slowly, which cannot meet the high-speed transmission requirements of end-to-end close-range large-bandwidth transmission scenarios.
图2示出了本申请实施例的第一部分中提供的一种内存占用率与用户交互操作频繁程度的关系图。如图2所示,当终端频繁接收到用户交互操作时,即表示终端需要占用较高的内存,响应用户交互操作,处理用户交互操作对应的功能事项。因此,当终端频繁接收到用户交互操作时,终端的内存占用率(使用内存占总内存的比值)会较高。FIG. 2 shows a relationship diagram between the memory occupancy rate and the frequency of user interaction operations provided in the first part of the embodiment of the present application. As shown in FIG. 2 , when the terminal frequently receives user interaction operations, it means that the terminal needs to occupy a relatively high memory, respond to the user interaction operations, and process functional matters corresponding to the user interaction operations. Therefore, when the terminal frequently receives user interaction operations, the memory occupancy rate (the ratio of the used memory to the total memory) of the terminal will be high.
图3示出了本申请实施例的第一部分中提供的一种缓冲区管理策略的示意图。如图3所示,终端在确定出缓冲区的缓冲容量后,可以判断缓冲区的缓冲容量占可用内存的比例在风险区、安全区和临界区的中的哪个取值区间。其中,风险区为大于第一值(例如50%), 临界区为小于等于第一值且大于等于第二值(例如20%),安全区为小于第二值,第一值大于第二值。当缓冲区的缓冲容量在安全区中时,终端可以一次性快速的在可用内存中为缓冲区申请到缓冲容量的存储空间,之后当终端确定缓冲区的缓冲容量过大时,终端可以分多次减小缓冲区的缓冲容量到指定值。当缓冲区的缓冲容量在在临界区和风险区中时,终端可以一次性快速的在可用内存中为缓冲区申请到缓冲容量的存储空间,之后当终端确定有交互场景下时,终端可以一次性减小缓冲区的缓冲容量到指定值。这样,尽可能的为缓冲区申请到更多的存储空间,以保证文件数据的高速传输,但在用户交互场景下,可以及时释放缓冲区的存储空间,为终端处理用户交互对应功能事项,提供更多的可用内存。FIG. 3 shows a schematic diagram of a buffer management strategy provided in the first part of the embodiment of the present application. As shown in FIG. 3 , after determining the buffer capacity of the buffer, the terminal can determine which value range of the risk area, the safe area and the critical area is in the ratio of the buffer capacity of the buffer to the available memory. The risk zone is greater than the first value (eg 50%), the critical zone is less than or equal to the first value and greater than or equal to the second value (eg 20%), the safety zone is less than the second value, and the first value is greater than the second value . When the buffer capacity of the buffer is in the safe area, the terminal can quickly apply for the buffer capacity storage space for the buffer in the available memory at one time, and then when the terminal determines that the buffer capacity of the buffer is too large, the terminal can divide more Decrease the buffer size of the buffer to the specified value. When the buffer capacity of the buffer is in the critical area and the risk area, the terminal can quickly apply for the buffer capacity storage space for the buffer in the available memory at one time, and then when the terminal determines that there is an interactive scene, the terminal can once Decreases the buffer capacity of the buffer to the specified value. In this way, as much storage space as possible is applied for the buffer to ensure high-speed transmission of file data, but in the case of user interaction, the storage space of the buffer can be released in time to provide the terminal with functions corresponding to user interaction. more available memory.
因此,本申请实施例的第一部分提供一种缓冲区管理方法,可以实现接收终端接收文件数据的过程中,根据缓冲区的已缓冲数据、可用内存、网卡接收速率、磁盘写入速率、可用内存以及接收到用户交互操作的频繁程度,对缓冲区的大小进行调整,在不同场景下,管理缓冲区的大小,尽可能的为缓冲区申请到更多的存储空间。这样,可以降低高速传输文件数据时缓冲区的溢出几率,减小丢包率。Therefore, the first part of the embodiments of the present application provides a buffer management method, which can realize that in the process of receiving file data by a receiving terminal, according to the buffered data, available memory, network card receiving rate, disk writing rate, and available memory in the buffer And the frequency of receiving user interaction, adjust the size of the buffer, manage the size of the buffer in different scenarios, and apply for as much storage space as possible for the buffer. In this way, the overflow probability of the buffer during high-speed transmission of file data can be reduced, and the packet loss rate can be reduced.
图4示出了终端100的结构示意图。FIG. 4 shows a schematic structural diagram of the terminal 100 .
下面以终端100为例对实施例进行具体说明。应该理解的是,图4所示终端100仅是一个范例,并且终端100可以具有比图4中所示的更多的或者更少的部件,可以组合两个或多个的部件,或者可以具有不同的部件配置。图4中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。The embodiment will be specifically described below by taking the terminal 100 as an example. It should be understood that the terminal 100 shown in FIG. 4 is only an example, and the terminal 100 may have more or less components than those shown in FIG. 4 , may combine two or more components, or may have Different part configurations. The various components shown in FIG. 4 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
终端100可以包括:处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等中的一种或多种。The terminal 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. One or more of sensor 180L, bone conduction sensor 180M, and the like.
可以理解的是,本发明实施例示意的结构并不构成对终端100的具体限定。在本申请另一些实施例中,终端100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that, the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the terminal 100 . In other embodiments of the present application, the terminal 100 may include more or less components than shown, or some components may be combined, or some components may be separated, or different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或 多个处理器中。The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Among them, different processing units can be independent devices, or can be integrated in one or more processors.
其中,控制器可以是终端100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the terminal 100 . The controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了***的效率。A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, the processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
充电管理模块140用于从充电器接收充电输入。The charging management module 140 is used to receive charging input from the charger.
终端100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the terminal 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
天线1和天线2用于发射和接收电磁波信号。终端100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。 Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
移动通信模块150可以提供应用在终端100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 may provide a wireless communication solution including 2G/3G/4G/5G, etc. applied on the terminal 100 . The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 . In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 . In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Wherein, the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and passed to the application processor. The application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 . In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
无线通信模块160可以提供应用在终端100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星***(global navigation satellite system,GNSS),调频(frequency modulation,FM), 近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide applications on the terminal 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
在一些实施例中,终端100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得终端100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯***(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位***(global positioning system,GPS),全球导航卫星***(global navigation satellite system,GLONASS),北斗卫星导航***(beidou navigation satellite system,BDS),准天顶卫星***(quasi-zenith satellite system,QZSS)和/或星基增强***(satellite based augmentation systems,SBAS)。In some embodiments, the antenna 1 of the terminal 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the terminal 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc. The GNSS may include global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou navigation satellite system (beidou navigation satellite system, BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
终端100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The terminal 100 implements a display function through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,终端100可以包括1个或N个显示屏194,N为大于1的正整数。Display screen 194 is used to display images, videos, and the like. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light). emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on. In some embodiments, the terminal 100 may include one or N display screens 194 , where N is a positive integer greater than one.
终端100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The terminal 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展终端100的存储能力。内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行终端100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作***,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储终端100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal 100. Internal memory 121 may be used to store computer executable program code, which includes instructions. The processor 110 executes various functional applications and data processing of the terminal 100 by executing the instructions stored in the internal memory 121 . The internal memory 121 may include a storage program area and a storage data area. The storage program area can store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like. The storage data area may store data (such as audio data, phone book, etc.) created during the use of the terminal 100 and the like. In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like.
终端100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。扬声器170A,也称“喇叭”, 用于将音频电信号转换为声音信号。终端100可以通过扬声器170A收听音乐,或收听免提通话。受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。耳机接口170D用于连接有线耳机。压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。陀螺仪传感器180B可以用于确定终端100的运动姿态。气压传感器180C用于测量气压。磁传感器180D包括霍尔传感器。加速度传感器180E可检测终端100在各个方向上(一般为三轴)加速度的大小。距离传感器180F,用于测量距离。终端100可以通过红外或激光测量距离。接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。环境光传感器180L用于感知环境光亮度。指纹传感器180H用于采集指纹。温度传感器180J用于检测温度。触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于终端100的表面,与显示屏194所处的位置不同。骨传导传感器180M可以获取振动信号。按键190包括开机键,音量键等。马达191可以产生振动提示。指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。SIM卡接口195用于连接SIM卡。The terminal 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. The audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Speaker 170A, also referred to as "speaker", is used to convert audio electrical signals into sound signals. The terminal 100 can listen to music through the speaker 170A, or listen to a hands-free call. The receiver 170B, also referred to as "earpiece", is used to convert audio electrical signals into sound signals. The microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. The earphone jack 170D is used to connect wired earphones. The pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be provided on the display screen 194 . The gyro sensor 180B may be used to determine the motion attitude of the terminal 100 . The air pressure sensor 180C is used to measure air pressure. The magnetic sensor 180D includes a Hall sensor. The acceleration sensor 180E can detect the magnitude of the acceleration of the terminal 100 in various directions (generally three axes). Distance sensor 180F for measuring distance. The terminal 100 can measure the distance through infrared or laser. Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes. The ambient light sensor 180L is used to sense ambient light brightness. The fingerprint sensor 180H is used to collect fingerprints. The temperature sensor 180J is used to detect the temperature. Touch sensor 180K, also called "touch panel". The touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”. The touch sensor 180K is used to detect a touch operation on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to touch operations may be provided through display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the terminal 100 , which is different from the position where the display screen 194 is located. The bone conduction sensor 180M can acquire vibration signals. The keys 190 include a power-on key, a volume key, and the like. Motor 191 can generate vibrating cues. The indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like. The SIM card interface 195 is used to connect a SIM card.
终端100设备类型可以包括手机、电视、平板电脑、音箱、手表、桌面型计算机、膝上型计算机、手持计算机、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本,以及个人数字助理(personal digital assistant,PDA)、增强现实(Augmented reality,AR)\虚拟现实(virtual reality,VR)设备等,本申请实施例对终端的具体类型不作特殊限制。 Terminal 100 device types may include cell phones, televisions, tablet computers, speakers, watches, desktop computers, laptop computers, handheld computers, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, and personal computers A digital assistant (personal digital assistant, PDA), an augmented reality (Augmented reality, AR)\virtual reality (virtual reality, VR) device, etc., the specific type of the terminal is not particularly limited in this embodiment of the present application.
本申请实施例的第一部分介绍了一种缓冲区管理方法,提供了一种缓冲区管理方法,包括:终端接收第一文件的数据,并将该第一文件的数据存入第一缓冲区中,并将该第一缓冲区中的数据写入磁盘中。该终端监测该第一缓冲区的已缓冲数据量、第一文件的待传输数据量、第一缓冲区的缓冲数据增长速率、可用内存容量。若该第一缓冲区的缓冲数据增长速率大于0,该终端根据该第一缓冲区的已缓冲数据量、第一文件的待传输数据量、第一缓冲区的缓冲数据增长速率和网卡接收速率,确定出第一缓冲区的所需总容量值。若该第一缓冲区的所需总容量值大于等于第二值且小于等于第一值,且该第一缓冲区的剩余缓冲容量小于该第一文件的待传输数据量,该终端将该第一缓冲区的大小调整为该第一缓冲区的所需总容量值,该第一值大于该第二值。The first part of the embodiments of the present application introduces a buffer management method, and provides a buffer management method, including: a terminal receives data of a first file, and stores the data of the first file in a first buffer , and write the data in the first buffer to the disk. The terminal monitors the amount of buffered data in the first buffer, the amount of data to be transmitted in the first file, the growth rate of buffered data in the first buffer, and the available memory capacity. If the buffered data growth rate of the first buffer is greater than 0, the terminal determines the buffered data volume of the first buffer, the to-be-transmitted data volume of the first file, the buffered data growth rate of the first buffer, and the network card reception rate according to the first buffer. , and determine the required total capacity value of the first buffer. If the required total capacity of the first buffer is greater than or equal to the second value and less than or equal to the first value, and the remaining buffer capacity of the first buffer is less than the amount of data to be transmitted in the first file, the terminal The size of a buffer is adjusted to the required total capacity value of the first buffer, the first value being greater than the second value.
通过本申请实施例的第一部分提供的一种缓冲区管理方法,可以实现终端接收文件数据的过程中,根据缓冲区的已缓冲数据、可用内存、网卡接收速率、磁盘写入速率、可用内存容量等因素以及接收到用户交互操作的频繁程度,对缓冲区的大小进行调整。在不同场景下,调整缓冲区的大小,尽可能的为缓冲区申请到更多的存储空间。这样,可以降低高速传输文件数据时缓冲区的溢出几率,减小丢包率。With the buffer management method provided in the first part of the embodiment of the present application, in the process of receiving file data by a terminal, it can be implemented according to the buffered data, available memory, network card receiving rate, disk writing rate, and available memory capacity of the buffer. Adjust the size of the buffer based on factors such as the frequency with which user interaction is received. In different scenarios, adjust the size of the buffer and apply for more storage space for the buffer as much as possible. In this way, the overflow probability of the buffer during high-speed transmission of file data can be reduced, and the packet loss rate can be reduced.
请参考图5,图5示出了本申请实施例提供的一种缓冲区管理方法的流程示意图。如图5所示,该方法可包括:Please refer to FIG. 5, which shows a schematic flowchart of a buffer management method provided by an embodiment of the present application. As shown in Figure 5, the method may include:
S501、终端100可以与第一文件的发送端建立文件传输连接,设置第一缓冲区的大小为默认值。S501. The terminal 100 may establish a file transmission connection with the sending end of the first file, and set the size of the first buffer as a default value.
第一文件的发送端可以是其他终端或服务器。当第一文件的发送方为其他终端时,终端100可以与其他终端通过Wi-Fi直连(例如,无线高保真点对点(wireless fidelity peer to peer,Wi-Fi P2P))、Wi-Fi softAP、超宽带(ultra-wideband,UWB)等通信技术传输第一文件的数据。当发送端为服务器时,终端100可以通过因特网接收到服务器传输第一文件的数据。The sender of the first file may be other terminals or servers. When the sender of the first file is another terminal, the terminal 100 may be directly connected with other terminals through Wi-Fi (for example, wireless fidelity peer to peer (Wi-Fi P2P)), Wi-Fi softAP, Communication technologies such as ultra-wideband (UWB) transmit the data of the first file. When the sending end is the server, the terminal 100 may receive the data of the first file transmitted by the server through the Internet.
在终端100与第一文件的发送端建立文件传输连接之后,终端100可以接收到发送端发送的第一文件的总数据量。终端100可以设置第一缓冲区的大小为默认值。示例性的,第一文件的总数据量可以为3000兆字节(megabytes,MB),默认值可以为20MB。示例仅仅用于解释本申请,不应构成限定。After the terminal 100 establishes a file transmission connection with the sending end of the first file, the terminal 100 may receive the total data volume of the first file sent by the sending end. The terminal 100 may set the size of the first buffer as a default value. Exemplarily, the total data volume of the first file may be 3000 megabytes (megabytes, MB), and the default value may be 20MB. The examples are only used to explain the application and should not be construed as limitations.
S502、终端100接收第一文件的数据,将第一文件的数据存入第一缓冲区中,并将第一缓冲区中的数据写入磁盘中。S502. The terminal 100 receives the data of the first file, stores the data of the first file in the first buffer, and writes the data in the first buffer to the disk.
在一些实施例中,终端100可以从第一缓冲区取出第一文件的数据直接写入磁盘中,在另一些实施例中,终端100可以从第一缓冲区取出第一文件的数据间接通过其他缓冲区写入磁盘中。In some embodiments, the terminal 100 may fetch the data of the first file from the first buffer and write it directly into the disk. In other embodiments, the terminal 100 may fetch the data of the first file from the first buffer indirectly through other The buffer is written to disk.
S503、终端100可以监测第一缓冲区的已缓冲数据量、第一文件的待传输数据量、网卡接收速率、第一缓冲区的缓冲数据增长速率、可用内存容量。S503. The terminal 100 may monitor the amount of buffered data in the first buffer, the amount of data to be transmitted in the first file, the reception rate of the network card, the growth rate of buffered data in the first buffer, and the available memory capacity.
其中,终端100可以周期性获取到第一缓冲区的已缓冲数据量、第一文件的待传输数据量、第一缓冲区的缓冲数据量增长速率。由于在后续整个文件传输过程中,第一缓冲区的已缓冲数据量、第一文件的待传输数据量、第一缓冲区的缓冲数据量增长速率和可用内存容量,都是在不断变化的。因此,终端100每次使用到缓冲区的已缓冲数据量、第一文件的待传输数据量和缓冲区的缓冲数据量增长速率之前,都需要重新获取第一缓冲区的已缓冲数据量、第一文件的待传输数据量、第一缓冲区的缓冲数据增长速率和可用内存容量。The terminal 100 may periodically acquire the buffered data volume of the first buffer, the to-be-transmitted data volume of the first file, and the growth rate of the buffered data volume of the first buffer. During the entire subsequent file transfer process, the buffered data volume of the first buffer, the to-be-transmitted data volume of the first file, the growth rate of the buffered data volume of the first buffer, and the available memory capacity are constantly changing. Therefore, before the terminal 100 uses the buffered data volume of the buffer, the to-be-transmitted data volume of the first file, and the growth rate of the buffered data volume of the buffer, it needs to re-acquire the buffered data volume of the first buffer, the first buffer The amount of data to be transmitted of a file, the growth rate of the buffered data of the first buffer, and the available memory capacity.
终端100上的总内存容量是固定的,例如,8吉字节(gigabyte,GB),终端100可以监测已占用的内存容量。然后,终端100可以根据总内存容量和已占用的内存容量,确定出可用内存容量。例如,可用内存容量为总内存容量与已占用的内存容量之差。The total memory capacity on the terminal 100 is fixed, for example, 8 gigabytes (gigabyte, GB), and the terminal 100 can monitor the occupied memory capacity. Then, the terminal 100 may determine the available memory capacity according to the total memory capacity and the occupied memory capacity. For example, the available memory capacity is the difference between the total memory capacity and the occupied memory capacity.
S504、当第一缓冲区的缓冲数据增长速率大于0时,终端100根据第一缓冲区的已缓冲数据量(此时值为W1)、第一文件的待传输数据量(此时值为FLS1)、网卡接收速率(此时值为rateNet1)第一缓冲区的缓冲数据增长速率(此时值为A1),确定出第一缓冲区的所需总容量值。S504. When the growth rate of the buffered data of the first buffer is greater than 0, the terminal 100 determines the amount of buffered data in the first buffer (the value at this time is W1) and the amount of data to be transmitted in the first file (the value at this time is FLS1). ), the receiving rate of the network card (the value is rateNet1 at this time), the buffered data growth rate of the first buffer (the value is A1 at this time), and the required total capacity value of the first buffer is determined.
终端100可以通过监测第一缓冲区中的缓冲水位线变化,获取到第一缓冲区的缓冲数据增长速率。The terminal 100 can obtain the buffer data growth rate of the first buffer by monitoring the change of the buffer water level in the first buffer.
在一种可能的实现方式中,终端100可以监测网卡接收速率和第一文件的磁盘写入速率。终端100可以根据网卡接收速率和第一文件的磁盘写入速率,确定出第一缓冲区的缓冲数据增长速率。其中,第一缓冲区的缓冲数据增长速率可以为网卡的接收速率与第一文件的磁盘写入速率之差。In a possible implementation manner, the terminal 100 may monitor the receiving rate of the network card and the disk writing rate of the first file. The terminal 100 may determine the growth rate of the buffered data of the first buffer according to the receiving rate of the network card and the disk writing rate of the first file. The buffer data growth rate of the first buffer may be the difference between the receiving rate of the network card and the disk writing rate of the first file.
示例性的,网卡的接收速率可以为100兆字节每秒(megabytes per second,MBps),第一文件的磁盘写入速率可以为90MBps,终端100可以确定出第一缓冲区的缓冲数据增长速率为10MBps。示例仅仅用于解释本申请,不应构成限定。Exemplarily, the receiving rate of the network card may be 100 megabytes per second (megabytes per second, MBps), the disk writing rate of the first file may be 90 MBps, and the terminal 100 may determine the buffer data growth rate of the first buffer. 10MBps. The examples are only used to explain the application and should not be construed as limitations.
其中,终端100通过如下公式确定出第一缓冲区的所需总容量值:Wherein, the terminal 100 determines the required total capacity value of the first buffer zone by the following formula:
c*(H-W)/A-FLS/rateNet=0   公式(1)c*(H-W)/A-FLS/rateNet=0 Formula (1)
其中,上述公式(1)中,0<c≤1,c为保守系数,为了防止第一缓冲区真正溢出,可以让c<1,这样,可以使得终端100预计第一缓冲区的溢出时间比实际的溢出时间提前。H为第一缓冲区的所需总容量值,W可以指第一缓冲区的已缓冲数据量,A可以指第一缓冲区的缓冲数据增长速率,FLS指第一文件的待传输数据量,rateNet可以指网卡接收速率。Among them, in the above formula (1), 0<c≤1, c is a conservative coefficient, in order to prevent the first buffer from overflowing, c<1 can be set, so that the terminal 100 can predict the overflow time ratio of the first buffer The actual overflow time is advanced. H is the required total capacity value of the first buffer, W can refer to the buffered data volume of the first buffer, A can refer to the buffered data growth rate of the first buffer, FLS refers to the amount of data to be transmitted in the first file, rateNet can refer to the network card receiving rate.
其中,终端100在执行上述步骤S504时,测量得到第一缓冲区的已缓冲数据量的值为W1、第一缓冲区的缓冲数据增长速率的值可以为A1、第一文件的待传输数据量的值为FLS1、网卡接收速率的值为rateNet1。Wherein, when the terminal 100 executes the above step S504, the value of the buffered data volume of the first buffer zone is measured to be W1, the value of the buffered data growth rate of the first buffer zone can be A1, and the value of the data volume to be transmitted of the first file. The value of is FLS1, and the value of the network card receiving rate is rateNet1.
示例性的,保守系数c可以取0.8,第一缓冲区的已缓冲数据量的值W1可以为12.5MB,第一缓冲区的缓冲数据增长速率的值A1可以为17MBps,第一文件的待传输数据量的值FLS1可以为2000MB,网卡接收速率的值rateNet1可以为200MBps。因此,终端100可以通过上述公式(1)确定出第一缓冲区的所需总容量值H为200MB。上述示例仅仅用于解释本申请,不应构成限定。Exemplarily, the conservative coefficient c may be 0.8, the value W1 of the buffered data amount of the first buffer may be 12.5MB, the value A1 of the growth rate of the buffered data of the first buffer may be 17MBps, and the value of the first file to be transmitted may be 17MBps. The value of the data volume FLS1 can be 2000MB, and the value of the network card receiving rate rateNet1 can be 200MBps. Therefore, the terminal 100 can determine that the required total capacity value H of the first buffer zone is 200MB through the above formula (1). The above examples are only used to explain the present application and should not be construed as limitations.
S505、终端100判断第一缓冲区的所需总容量值与终端100上可用内存容量(此时为R1)的比值是否小于第二值。S505. The terminal 100 determines whether the ratio of the required total capacity value of the first buffer to the available memory capacity (R1 in this case) on the terminal 100 is smaller than the second value.
其中,终端100在执行上述步骤S504时,可以测得终端100上可用内存容量的值为R1。示例性的,第二值可以为0.2。Wherein, when the terminal 100 performs the foregoing step S504, the value of the available memory capacity on the terminal 100 may be measured as R1. Exemplarily, the second value may be 0.2.
S506、当第一缓冲区的所需总容量值与终端100上可用内存容量(此时为R1)的比值小于第二值时,终端100可以将第一缓冲区的大小立即调整为所需总容量值。S506. When the ratio of the required total capacity value of the first buffer to the available memory capacity on the terminal 100 (R1 in this case) is less than the second value, the terminal 100 can immediately adjust the size of the first buffer to the required total capacity value.
示例性的,第二值可以为0.2,终端100可以确定出第一缓冲区的所需总容量值为200MB,此时,可用内存容量的值R1可以为2000MB,所需总容量值与可用内存容量的比值可以为0.1(小于0.2)。因此,终端100可以将第一缓冲区的大小设置为200MB,即,终端100从可用内存中为第一缓冲区申请到200MB的存储空间。示例仅仅用于解释本申请,不应构成限定。Exemplarily, the second value may be 0.2, and the terminal 100 may determine that the required total capacity value of the first buffer is 200MB. At this time, the value R1 of the available memory capacity may be 2000MB, and the required total capacity value is related to the available memory. The ratio of capacity may be 0.1 (less than 0.2). Therefore, the terminal 100 may set the size of the first buffer to 200MB, that is, the terminal 100 applies for 200MB of storage space for the first buffer from the available memory. The examples are only used to explain the application and should not be construed as limitations.
S507、终端100可以判断缓冲区的缓冲数据增长速率是否小于等于0,若是,则执行S508、终端100可以缓慢减小第一缓冲区的大小。S507, the terminal 100 can determine whether the buffered data growth rate of the buffer is less than or equal to 0, and if so, execute S508, and the terminal 100 can slowly reduce the size of the first buffer.
在第一缓冲区的所需总容量值与终端100上可用内存容量(此时为R1)的比值小于第二值(例如0.2),终端100将第一缓冲区的大小立即调整为所需总容量值之后,终端100可以周期性(例如周期可以为2ms)判断第一缓冲区的缓冲数据增长速率是否小于等于0,若是,则终端100可以缓慢减小第一缓冲区的大小;若否,则终端100可以重新执行上述步骤S504。If the ratio of the required total capacity value of the first buffer to the available memory capacity on the terminal 100 (R1 at this time) is smaller than the second value (for example, 0.2), the terminal 100 immediately adjusts the size of the first buffer to the required total After the capacity value, the terminal 100 can periodically (for example, the period can be 2ms) determine whether the buffered data growth rate of the first buffer is less than or equal to 0, if so, the terminal 100 can slowly reduce the size of the first buffer; if not, Then the terminal 100 can perform the above step S504 again.
在一种可能的实现方式中,终端100缓慢减小第一缓冲区的大小可以包括当终端100每次确定出第一缓冲区的缓冲数据增长速率小于等于0时,将第一缓冲区的大小减少指定容量。In a possible implementation manner, the terminal 100 slowly reducing the size of the first buffer may include, when the terminal 100 determines that the buffered data growth rate of the first buffer is less than or equal to 0 each time, reducing the size of the first buffer Decrease the specified capacity.
示例性的,终端100确定出第一缓冲区的所需总容量值可以为200MB,此时,可用内存容量的值R1可以为2000MB,终端100从可用内存中为第一缓冲区申请到200MB的存储空间。之后,终端100周期性判断第一缓冲区的缓冲数据增长速率是否小于等于0,在每次终端100确定出第一缓冲区的缓冲数据增长速率小于等于0时,可以将第一缓冲区的大小减小10MB,即,每次释放第一缓冲区10MB的存储空间。示例仅仅用于解释本申请,不应构成限定。Exemplarily, the terminal 100 determines that the required total capacity value of the first buffer may be 200MB, and at this time, the value R1 of the available memory capacity may be 2000MB, and the terminal 100 applies for the first buffer from the available memory to 200MB. storage. After that, the terminal 100 periodically determines whether the growth rate of the buffered data of the first buffer is less than or equal to 0, and each time the terminal 100 determines that the growth rate of the buffered data of the first buffer is less than or equal to 0, the size of the first buffer may be Decrease 10MB, that is, release 10MB of storage space of the first buffer each time. The examples are only used to explain the application and should not be construed as limitations.
S509、当终端100判断第一缓冲区的所需总容量值与终端100上可用内存容量的比值大于等于第二值时,终端100可以判断第一缓冲区的所需缓冲容量与终端100上可用内存容量的比值是否大于第一值。S509. When the terminal 100 determines that the ratio of the required total capacity value of the first buffer to the available memory capacity on the terminal 100 is greater than or equal to the second value, the terminal 100 can determine that the required buffer capacity of the first buffer is equal to the available memory on the terminal 100. Whether the ratio of memory capacity is greater than the first value.
S510、当第一缓冲区的所需缓冲总容量值与终端100上可用内存容量的比值大于第一值时,终端100可以判断第一缓冲区的剩余缓冲容量是否小于第一文件的待传输数据量。S510. When the ratio of the required total buffer capacity of the first buffer to the available memory capacity on the terminal 100 is greater than the first value, the terminal 100 may determine whether the remaining buffer capacity of the first buffer is smaller than the data to be transmitted of the first file quantity.
S511、当第一缓冲区的剩余缓冲容量小于第一文件的待传输数据,则S511、终端100可以将第一缓冲区的大小设置为第一缓冲容量,第一缓冲容量与可用内存容量的比值为第一值。S511. When the remaining buffer capacity of the first buffer is smaller than the data to be transmitted of the first file, then S511. The terminal 100 may set the size of the first buffer to the first buffer capacity, the ratio of the first buffer capacity to the available memory capacity is the first value.
其中,第一值(例如0.5)大于第二值(例如0.2)。Wherein, the first value (eg, 0.5) is greater than the second value (eg, 0.2).
示例性的,第一值可以为0.5,终端100可以确定出第一缓冲区的所需总容量值为200MB,此时,可用内存容量的值R1可以为300MB,第一文件的待传输数据量的值FLS1为2000MB,第一缓冲区的剩余缓冲容量的值P1为7.5MB,终端100可以确定第一缓冲区的所需总容量值与可用内存容量的比值可以为2/3(大于0.5),第一缓冲区的剩余缓冲容量小于第一文件的待传输数据量,第一缓冲容量为150MB。终端100可以将第一缓冲区的大小立即调整为150MB。上述示例仅仅用于解释本申请,不应构成限定。Exemplarily, the first value may be 0.5, and the terminal 100 may determine that the required total capacity of the first buffer is 200MB. In this case, the value R1 of the available memory capacity may be 300MB, and the amount of data to be transmitted in the first file. The value of FLS1 is 2000MB, the value P1 of the remaining buffer capacity of the first buffer zone is 7.5MB, and the terminal 100 can determine that the ratio of the required total capacity value of the first buffer zone to the available memory capacity can be 2/3 (greater than 0.5) , the remaining buffer capacity of the first buffer is less than the amount of data to be transmitted of the first file, and the first buffer capacity is 150MB. The terminal 100 may immediately adjust the size of the first buffer to 150MB. The above examples are only used to explain the present application and should not be construed as limitations.
S512、当第一缓冲区的所需缓冲总容量值与终端100上可用内存容量的比值小于等于第一值且大于等于第二值时,终端100可以将第一缓冲区的大小设置为所需总容量值。S512. When the ratio of the required total buffer capacity of the first buffer to the available memory capacity on the terminal 100 is less than or equal to the first value and greater than or equal to the second value, the terminal 100 may set the size of the first buffer to the required size total capacity value.
示例性的,第一值可以为0.5,第二值可以为0.2,终端100可以确定出第一缓冲区的所需总容量值为200MB,此时,可用内存容量的值R1可以500MB,终端100可以确定第一缓冲区的所需总容量值与可用内存容量的比值可以为0.4(大于等于0.2且小于等于0.5)。终端100可以将第一缓冲区的大小立即调整为200MB。上述示例仅仅用于解释本申请,不应构成限定。Exemplarily, the first value may be 0.5, the second value may be 0.2, the terminal 100 may determine that the required total capacity of the first buffer is 200MB, and at this time, the value R1 of the available memory capacity may be 500MB, and the terminal 100 It can be determined that the ratio of the required total capacity value of the first buffer to the available memory capacity can be 0.4 (greater than or equal to 0.2 and less than or equal to 0.5). The terminal 100 may immediately adjust the size of the first buffer to 200MB. The above examples are only used to explain the present application and should not be construed as limitations.
S513、当第一缓冲区的所需总容量值与终端100上可用内存容量的比值大于第一值,终端100立即调整完第一缓冲区的大小之后,终端100可以判断指定时间段内接收到用户输入的次数是否大于次数阈值。S513. When the ratio of the required total capacity of the first buffer to the available memory capacity on the terminal 100 is greater than the first value, and after the terminal 100 adjusts the size of the first buffer immediately, the terminal 100 can determine that the Whether the number of user input is greater than the number of times threshold.
其中,用户输入可以包括针对触摸屏的触控输入、针对实体按键的输入、语音输入等等中的一种或多种。指定时间段的长度可以指终端100接收到某一用户输入之后的一定时长内(例如3秒),例如,终端100接收到用户的连续输入,终端100可以判断在该连续输入中是否有3秒时间内终端100接收到用户输入的次数大于5次。The user input may include one or more of touch input for a touch screen, input for physical keys, voice input, and the like. The length of the specified time period may refer to a certain period of time (for example, 3 seconds) after the terminal 100 receives a certain user input. For example, when the terminal 100 receives continuous input from the user, the terminal 100 can determine whether there are 3 seconds in the continuous input. The number of times the terminal 100 receives user input is greater than 5 times within the time period.
S514、当终端100在指定时间段内接收到用户输入的次数阈值大于次数阈值时,终端100可以判断第一缓冲区的已缓冲数据量是否小于等于第二缓冲容量,其中,第二缓冲容量与可用内存容量(此时为R2)的比值为第二值。S514. When the number of times the terminal 100 receives the user input threshold within the specified time period is greater than the number of times threshold, the terminal 100 can determine whether the amount of buffered data in the first buffer is less than or equal to the second buffer capacity, where the second buffer capacity and The ratio of the available memory capacity (R2 in this case) is the second value.
S515、当第一缓冲区的已缓冲数据量(此时为W2)小于等于第二缓冲容量时,终端100可以根据第二缓冲容量、第一缓冲区的已缓冲数据量(此时为W2)、第一文件的待传输数据量(此时为FLS2)和第一缓冲区的缓冲数据增长速率(此时为A2),确定出安全发送速率。S515. When the amount of buffered data in the first buffer (W2 at this time) is less than or equal to the second buffer capacity, the terminal 100 can use the second buffer capacity and the amount of buffered data in the first buffer (W2 at this time) , the amount of data to be transmitted in the first file (in this case, FLS2) and the buffered data growth rate in the first buffer (in this case, A2) to determine the safe sending rate.
S516、终端100可以发送第一速率信息给第一文件的发送端,用于指示发送端立即调整第一文件的发送速率为安全发送速率。S516. The terminal 100 may send the first rate information to the sending end of the first file, to instruct the sending end to immediately adjust the sending rate of the first file to a safe sending rate.
当终端100在指定时间段内接收到用户输入的次数阈值大于次数阈值,且第一缓冲区的已缓冲数据量的值W2小于等于第二缓冲容量时,终端100可以根据第二缓冲容量、第一缓冲区的已缓冲数据量(此时值为W2)、第一文件的待传输数据量(此时为FLS2)和第一缓冲区的缓冲数据量增长速率(此时值为A2),确定出安全发送速率。When the threshold for the number of times the terminal 100 receives user input within the specified time period is greater than the threshold for the number of times, and the value W2 of the buffered data amount in the first buffer is less than or equal to the second buffer capacity, the terminal 100 The amount of buffered data in a buffer (this time is W2), the amount of data to be transmitted in the first file (this time is FLS2) and the growth rate of the buffered data volume of the first buffer (this time is A2), determine out the safe sending rate.
终端100可以根据如下公式(2)确定出安全发送速率。The terminal 100 can determine the safe transmission rate according to the following formula (2).
c*(X1-W2)/A2-FLS2/V1=0   公式(2)c*(X1-W2)/A2-FLS2/V1=0 Formula (2)
其中,上述公式(2)中,0<c≤1,c为保守系数,为了防止第一缓冲区真正溢出,可以让c<1,这样,可以使得终端100预计第一缓冲区的溢出时间比实际的溢出时间提前。X1为第二缓冲容量,W2指第一缓冲区的已缓冲数据量,A2为第一缓冲区的缓冲数据增长速率,FLS2指第一文件的待传输数据量、V1可以指安全发送速率。上述公式(2)仅仅用于解释本申请,不应构成限定。Among them, in the above formula (2), 0<c≤1, c is a conservative coefficient, in order to prevent the first buffer from overflowing, c<1 can be set, so that the terminal 100 can predict the overflow time ratio of the first buffer The actual overflow time is advanced. X1 is the second buffer capacity, W2 is the amount of buffered data in the first buffer, A2 is the growth rate of the buffered data in the first buffer, FLS2 is the amount of data to be transmitted in the first file, and V1 can be the safe sending rate. The above formula (2) is only used to explain the present application and should not be construed as a limitation.
在一种可能的实现方式中,终端100可以监测网卡接收速率和第一文件的磁盘写入速率。终端100可以根据网卡接收速率和第一文件的磁盘写入速率,确定出第一缓冲区的缓冲数据增长速率。因此,上述公式(2)可以替换为如下公式(3):In a possible implementation manner, the terminal 100 may monitor the receiving rate of the network card and the disk writing rate of the first file. The terminal 100 may determine the growth rate of the buffered data of the first buffer according to the receiving rate of the network card and the disk writing rate of the first file. Therefore, the above formula (2) can be replaced by the following formula (3):
c*(X1-W2)/(Vt-rateIO1)-FLS2/V1=0    公式(3)c*(X1-W2)/(Vt-rateIO1)-FLS2/V1=0 Formula (3)
其中,rateIO1为第一文件的磁盘写入速率。上述公式(3)仅仅用于解释本申请,不应构成限定。Among them, rateIO1 is the disk write rate of the first file. The above formula (3) is only used to explain the present application and should not be construed as a limitation.
示例性的,次数阈值为5,终端100在指定时间段内接收到用户输入的次数阈值为8次,c可以为0.8,第一缓冲区的已缓冲数据量的值W2可以为100MB,可用内存容量的值R2可以为1000MB,第二值可以为0.2,第一文件的待传输数据量的值FLS2可以为1000MB,磁盘写入速率rateIO1可以为180MBps。终端100可以确定出第二缓冲容量可以为200MB。 其中,在指定时间段内接收到用户输入的次数阈值大于次数阈值且第一缓冲区的已缓冲数据量小于第二缓冲容量。因此,终端100可以确定出安全发送速率V1为195.65MBps。上述示例仅仅用于解释本申请,不应构成限定。Exemplarily, the number of times the threshold is 5, the threshold of the number of times the terminal 100 receives user input within a specified time period is 8, c may be 0.8, the value W2 of the buffered data amount of the first buffer may be 100MB, and the available memory is 100MB. The value R2 of the capacity may be 1000MB, the second value may be 0.2, the value FLS2 of the amount of data to be transmitted of the first file may be 1000MB, and the disk write rate rateIO1 may be 180MBps. The terminal 100 may determine that the second buffer capacity may be 200MB. Wherein, the threshold for the number of times the user input is received within the specified time period is greater than the threshold for the number of times and the amount of buffered data in the first buffer is smaller than the second buffer capacity. Therefore, the terminal 100 can determine that the safe transmission rate V1 is 195.65MBps. The above examples are only used to explain the present application and should not be construed as limitations.
终端100在确定出安全发送速率后,可以将第一速率信息发送给第一文件的发送端。该第一速率信息用于指示发送端立即调整第一文件的发送速率为该安全发送速率。After determining the safe sending rate, the terminal 100 may send the first rate information to the sending end of the first file. The first rate information is used to instruct the sender to immediately adjust the sending rate of the first file to the safe sending rate.
S517、终端100接收到发送端返回的确认信息,响应于确认信息将第一缓冲区的大小设置为第二缓冲容量(值为X1)。S517. The terminal 100 receives the confirmation information returned by the sender, and in response to the confirmation information, sets the size of the first buffer to the second buffer capacity (the value is X1).
其中,发送端在将第一文件的发送速率立即调整为上述安全发送速率后,可以发送确认信息给终端100。终端100接收到该确认信息后,可以响应于该确认信息将第一缓冲区的大小设置为第二缓冲容量(值为X1)。The sending end may send confirmation information to the terminal 100 after immediately adjusting the sending rate of the first file to the above-mentioned safe sending rate. After receiving the confirmation information, the terminal 100 may set the size of the first buffer to the second buffer capacity (the value is X1) in response to the confirmation.
S518、当第一缓冲区的已缓冲数据量(此时为W2)大于第二缓冲容量(此时为X1)时,终端100可以发送第二速率信息给第一文件的发送端,第二速率信息用于指示发送端调整第一文件的发送速率小于等于速率阈值。S518. When the amount of buffered data in the first buffer (W2 at this time) is greater than the second buffer capacity (X1 at this time), the terminal 100 can send the second rate information to the sender of the first file, the second rate The information is used to instruct the sender to adjust the sending rate of the first file to be less than or equal to the rate threshold.
S519、终端100可以判断第一缓冲区的已缓冲数据量是否小于第二缓冲容量。若是,则S520、终端100将第一缓冲区的大小立即调整为第二缓冲容量(此时值为X2)。S519. The terminal 100 may determine whether the buffered data volume of the first buffer is smaller than the second buffer capacity. If so, in S520, the terminal 100 immediately adjusts the size of the first buffer to the second buffer capacity (the value at this time is X2).
在发送第二速率信息给第一文件的发送端之后,发送端可以根据第二速率信息降低第一文件的发送速率。这样,终端100上第一缓冲区中的已缓冲数据量会逐渐减少。在发送第二速率信息给第一文件的发送端之后,终端100可以一直监测第一缓冲区的已缓冲数据量是否小于第二缓冲容量。当第一缓冲区的已缓冲数据量小于第二缓冲容量时,终端100可以将第一缓冲区的大小立即调整为第二缓冲容量(此时值为X2)。After sending the second rate information to the sender of the first file, the sender may reduce the sending rate of the first file according to the second rate information. In this way, the amount of buffered data in the first buffer on the terminal 100 will gradually decrease. After sending the second rate information to the sending end of the first file, the terminal 100 may always monitor whether the amount of buffered data in the first buffer is less than the second buffer capacity. When the amount of buffered data in the first buffer is smaller than the second buffer capacity, the terminal 100 may immediately adjust the size of the first buffer to the second buffer capacity (the value at this time is X2).
S521、在终端100将第一缓冲区的大小立即调整为第二缓冲容量之后,终端100根据第一缓冲区的剩余缓冲容量、第一缓冲区的已缓冲数据量(此时值为W3)、第一文件的待传输数据量(此时为FLS3)和第一缓冲区的缓冲数据量增长速率(此时值为A3),确定出安全发送速率。S521. After the terminal 100 immediately adjusts the size of the first buffer to the second buffer capacity, the terminal 100 determines the remaining buffer capacity of the first buffer, the buffered data volume of the first buffer (the value is W3 at this time), The amount of data to be transmitted in the first file (in this case, FLS3) and the growth rate of the buffered data amount in the first buffer area (in this case, the value is A3), determine the safe sending rate.
S522、终端100发送第一速率信息给第一文件的发送端,第一速率信息用于指示发送端立即调整第一文件的发送速率为安全发送速率。S522: The terminal 100 sends first rate information to the sender of the first file, where the first rate information is used to instruct the sender to immediately adjust the sending rate of the first file to a safe sending rate.
终端100可以根据如下公式(4)确定出安全发送速率。The terminal 100 may determine the safe transmission rate according to the following formula (4).
c*P/A3-FLS3/V2=0    公式(4)c*P/A3-FLS3/V2=0 Formula (4)
其中,上述公式(4)中,0<c≤1,c为保守系数,为了防止第一缓冲区真正溢出,可以让c<1,这样,可以使得终端100预计第一缓冲区的溢出时间比实际的溢出时间提前。X2为第二缓冲容量,W3指第一缓冲区的已缓冲数据量,A3为第一缓冲区的缓冲数据增长速率,FLS3指第一文件的待传输数据量、V2可以指安全发送速率。上述公式(4)仅仅用于解释本申请,不应构成限定。Among them, in the above formula (4), 0<c≤1, c is a conservative coefficient, in order to prevent the first buffer from overflowing, c<1 can be set, so that the terminal 100 can predict the overflow time ratio of the first buffer The actual overflow time is advanced. X2 is the second buffer capacity, W3 is the amount of buffered data in the first buffer, A3 is the growth rate of the buffered data in the first buffer, FLS3 is the amount of data to be transmitted in the first file, and V2 can be the safe sending rate. The above formula (4) is only used to explain the present application and should not be construed as a limitation.
在一种可能的实现方式中,终端100可以监测网卡接收速率和第一文件的磁盘写入速率。终端100可以根据网卡接收速率和第一文件的磁盘写入速率,确定出第一缓冲区的缓 冲数据增长速率。因此,上述公式(4)可以替换为如下公式(5):In a possible implementation manner, the terminal 100 may monitor the receiving rate of the network card and the disk writing rate of the first file. The terminal 100 may determine the growth rate of the buffered data of the first buffer according to the receiving rate of the network card and the disk writing rate of the first file. Therefore, the above formula (4) can be replaced by the following formula (5):
c*P/(V2-rateIO2)-FLS3/V2=0    公式(5)c*P/(V2-rateIO2)-FLS3/V2=0 Formula (5)
其中,rateIO2为第一文件的磁盘写入速率。上述公式(5)仅仅用于解释本申请,不应构成限定。Among them, rateIO2 is the disk write rate of the first file. The above formula (5) is only used to explain the present application, and should not be construed as a limitation.
示例性的,在终端100将第一缓冲区的大小立即调整为第二缓冲容量之后,第一缓冲区的剩余缓冲容量的值P可以为100MB,第一文件的待传输数据量的值FLS3可以为800MB,磁盘写入速率rateIO2可以为150MBps。因此,终端100可以确定出安全发送速率V2为166.67MBps。上述示例仅仅用于解释本申请,不应构成限定。Exemplarily, after the terminal 100 immediately adjusts the size of the first buffer to the second buffer capacity, the value P of the remaining buffer capacity of the first buffer may be 100MB, and the value FLS3 of the amount of data to be transmitted of the first file may be 800MB, the disk write rate rateIO2 can be 150MBps. Therefore, the terminal 100 can determine that the safe transmission rate V2 is 166.67MBps. The above examples are only used to explain the present application and should not be construed as limitations.
终端100在确定出安全发送速率后,可以将第一速率信息发送给第一文件的发送端。该第一速率信息用于指示发送端调整第一文件的发送速率为该安全发送速率。After determining the safe sending rate, the terminal 100 may send the first rate information to the sending end of the first file. The first rate information is used to instruct the sender to adjust the sending rate of the first file to the safe sending rate.
在一些实施例中,当第一文件的待传输数据量占第一文件的总数据量的比值小于指定比例值(例如0.1)时,终端100可以立即调整第一缓冲区的大小为第三缓冲容量,其中,第三缓冲容量占可用内存容量的比例为第三值,第三值大于上述第一值大于上述第二值。当终端100调整第一缓冲区的大小为上述第三缓冲容量的指定时间(例如3秒)之后第一文件的待传输数据量大于0,则终端100可以重新执行上述步骤S513。In some embodiments, when the ratio of the amount of data to be transmitted in the first file to the total amount of data in the first file is less than a specified ratio value (for example, 0.1), the terminal 100 may immediately adjust the size of the first buffer to the third buffer capacity, wherein the ratio of the third buffer capacity to the available memory capacity is a third value, and the third value is greater than the first value and greater than the second value. After the terminal 100 adjusts the size of the first buffer to the specified time (for example, 3 seconds) of the third buffer capacity, the amount of data to be transmitted in the first file is greater than 0, the terminal 100 may perform the above step S513 again.
示例性的,上述指定比例值可以为0.1,第一文件的总数据量可以为3000MB,第一文件的待传输数据量可以为100MB,第三值可以为0.8,可用内存容量可以为1000MB。终端100可以确定出第一文件的待传输数据量占第一文件的总数据量的比值为0.03(小于0.1),则终端100可以立即调整第一缓冲区的大小为800MB。当终端100调整第一缓冲区的大小为800MB的3秒钟之后,第一文件的待传输数据量还大于0,则终端100可以重新执行上述步骤S513。上述示例仅仅用于解释本申请,不应构成限定。Exemplarily, the above-mentioned specified ratio value may be 0.1, the total data volume of the first file may be 3000MB, the to-be-transmitted data volume of the first file may be 100MB, the third value may be 0.8, and the available memory capacity may be 1000MB. The terminal 100 can determine that the ratio of the data volume of the first file to be transmitted to the total data volume of the first file is 0.03 (less than 0.1), and the terminal 100 can immediately adjust the size of the first buffer to 800MB. After the terminal 100 adjusts the size of the first buffer to 800MB for 3 seconds, and the amount of data to be transmitted in the first file is still greater than 0, the terminal 100 may perform the above step S513 again. The above examples are only used to explain the present application and should not be construed as limitations.
本申请实施例1提供一种缓冲区管理方法,可以实现终端接收文件数据的过程中,根据缓冲区的已缓冲数据、可用内存、网卡接收速率、磁盘写入速率、可用内存容量等因素以及接收到用户交互操作的频繁程度,对缓冲区的大小进行调整。在不同场景下,调整缓冲区的大小,尽可能的为缓冲区申请到更多的存储空间。这样,可以降低高速传输文件数据时缓冲区的溢出几率,减小丢包率。 Embodiment 1 of the present application provides a buffer management method, which can realize that in the process of receiving file data by a terminal, according to factors such as buffered data in the buffer, available memory, network card reception rate, disk write rate, available memory capacity and other factors, and Adjust the size of the buffer to the frequency of user interaction. In different scenarios, adjust the size of the buffer and apply for more storage space for the buffer as much as possible. In this way, the overflow probability of the buffer during high-speed transmission of file data can be reduced, and the packet loss rate can be reduced.
下面结合图6-图11介绍本申请实施例的第二部分提供的一种数据传输方法及相关内容。The following describes a data transmission method and related content provided in the second part of the embodiment of the present application with reference to FIG. 6 to FIG. 11 .
在本申请实施例的第二部分中一些名词的序号不继续沿用本申请实施例其他部分中的序号的顺序,在本申请实施例的第二部分中的名词仅仅在在本申请实施例第二部分中使用。The sequence numbers of some terms in the second part of the embodiments of the present application do not continue to follow the sequence of the sequence numbers of other parts of the embodiments of the present application, and the nouns in the second part of the embodiments of the present application are only used in the second part of the embodiments of the present application. used in part.
本申请实施例的第二部分提供了一种数据传输方法,包括:第一终端与第二终端建立文件传输连接,该文件传输连接用于传输第一文件。该第一终端获取网卡的物理层发送速率上限。该第一终端根据该物理层发送速率上限确定出第一速率。该第一终端以该第一速率向MAC层发送缓冲区qdisk_buffer写入该第一文件的第一数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的第一数据发送给该第二终端。当该第一终端确定该MAC层发送缓冲区的已缓冲数据量大于等于第一预警水位线时,该第一终端以第二速率向该MAC 层发送缓冲区写入该第一文件的第二数据,并通过该网卡将该MAC层发送缓冲区中该第一文件的第二数据发送给该第二终端,其中,该第一速率大于该第二速率。The second part of the embodiments of the present application provides a data transmission method, including: establishing a file transmission connection between a first terminal and a second terminal, and the file transmission connection is used to transmit a first file. The first terminal acquires the upper limit of the transmission rate of the physical layer of the network card. The first terminal determines the first rate according to the upper limit of the transmission rate of the physical layer. The first terminal writes the first data of the first file to the MAC layer sending buffer qdisk_buffer at the first rate, and sends the first data of the first file in the MAC layer sending buffer to the MAC layer through the network card second terminal. When the first terminal determines that the buffered data volume of the MAC layer sending buffer is greater than or equal to the first warning water level, the first terminal writes the second data of the first file to the MAC layer sending buffer at the second rate. data, and send the second data of the first file in the MAC layer sending buffer to the second terminal through the network card, wherein the first rate is greater than the second rate.
通过本申请实施例的第二部分提供的一种数据传输的方法,可以通过设置发送端210的MAC层发送缓冲区(qdisk_buffer)的缓冲容量和第一预警水位线,并根据MAC层发送缓冲区(qdisk_buffer)的已缓冲数据量决定发送端210写入第一文件的数据至MAC层发送缓冲区的发送速率,实现文件的传输速度接近物理信道极限速率且降低丢包率。According to the data transmission method provided in the second part of the embodiment of the present application, the buffer capacity and the first warning water level of the MAC layer sending buffer (qdisk_buffer) of the sending end 210 can be set, and the buffer is sent according to the MAC layer. The buffered data volume of (qdisk_buffer) determines the sending rate of the data written by the sending end 210 into the first file to the MAC layer sending buffer, so that the file transmission speed is close to the limit rate of the physical channel and the packet loss rate is reduced.
图6示出了***20的架构示意图。FIG. 6 shows a schematic diagram of the architecture of the system 20 .
如图6所示,该***20包括有发送终端210、接收终端220。其中,发送终端210和接收终端220之间可以通过无线网络点对点传输文件数据。其中,发送终端210和接收终端220可以通过Wi-Fi直连(例如,无线高保真点对点(wireless fidelity peer to peer,Wi-Fi P2P))、Wi-Fi softAP、超宽带(ultra-wideband,UWB)等通信技术传输文件数据。发送终端210和接收终端220的设备类型可以包括手机、电视、平板电脑、音箱、手表、桌面型计算机、膝上型计算机、手持计算机、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本,以及个人数字助理(personal digital assistant,PDA)、增强现实(Augmented reality,AR)\虚拟现实(virtual reality,VR)设备等,本申请实施例对终端的具体类型不作特殊限制。As shown in FIG. 6 , the system 20 includes a sending terminal 210 and a receiving terminal 220 . Wherein, the file data may be transmitted point-to-point between the sending terminal 210 and the receiving terminal 220 through a wireless network. The sending terminal 210 and the receiving terminal 220 may be directly connected through Wi-Fi (for example, wireless fidelity peer to peer (Wi-Fi P2P)), Wi-Fi softAP, ultra-wideband (UWB) ) and other communication technologies to transmit file data. The device types of the transmitting terminal 210 and the receiving terminal 220 may include mobile phones, televisions, tablet computers, speakers, watches, desktop computers, laptop computers, handheld computers, notebook computers, ultra-mobile personal computers (UMPCs) ), netbooks, and personal digital assistants (personal digital assistants, PDAs), augmented reality (Augmented reality, AR)\virtual reality (virtual reality, VR) devices, etc., the specific types of terminals are not particularly limited in this embodiment of the present application.
下面介绍本申请实施例的第二部分提供的一种数据传输***的架构图。The following introduces an architecture diagram of a data transmission system provided in the second part of the embodiments of the present application.
请参考图7,图7示出了本申请实施例的第二部分提供的一种数据传输***400的架构图。该数据传输***400中可以包括有发送终端210和接收终端220。本申请实施例中,发送终端210可以被称为第一终端,接收终端220可以被称为第二终端。其中,该发送终端210和接收终端220上的软件***可以采用分层架构,分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。其中,发送终端210和接收终端220的软件***可以包括用户态,内核态,硬件层。其中,该用户态可以包括应用层、极简协议层。内核态可以包括套接字(Socket)抽象层、用户数据协议层(UDP层)/网络层(IP层)、MAC层。硬件层可以包括有网卡(network interface controller,NIC)。Please refer to FIG. 7 , which shows an architecture diagram of a data transmission system 400 provided in the second part of the embodiment of the present application. The data transmission system 400 may include a sending terminal 210 and a receiving terminal 220 . In this embodiment of the present application, the sending terminal 210 may be referred to as a first terminal, and the receiving terminal 220 may be referred to as a second terminal. The software systems on the sending terminal 210 and the receiving terminal 220 may adopt a layered architecture, and the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces. The software systems of the sending terminal 210 and the receiving terminal 220 may include user mode, kernel mode, and hardware layer. The user mode may include an application layer and a minimalist protocol layer. The kernel state may include a socket (Socket) abstraction layer, a user data protocol layer (UDP layer)/network layer (IP layer), and a MAC layer. The hardware layer may include a network interface controller (NIC).
发送终端210的应用层可以包括一个或多个应用。例如,应用211可以为华为分享(huawei share)等数据分享应用。The application layer of the transmitting terminal 210 may include one or more applications. For example, the application 211 may be a data sharing application such as huawei share.
发送终端210的极简协议层可以包括有发送速率调度模块212和读缓冲区(read_buffer)213。其中,该读缓冲区213可用于缓冲发送终端210从磁盘中读取到内存中的文件数据。该发送速率调度模块212可用于设置发送终端210中指定一个或多个缓冲区(例如,MAC层发送缓冲区215)的缓冲容量和预警水位线。发送速率调度模块212还可用于根据发送终端210中一个或多个缓冲区(例如,MAC层发送缓冲区215)的缓冲水位线以及接收终端220上发送速率反馈模块222发送的缓冲信息,调整MAC层发送缓冲区215的数据写入速率。其中,缓冲信息可用于指示接收终端220上一个或多个缓冲区(例如,写缓冲区223和MAC层接收缓冲区226)的缓冲水位线。The minimalist protocol layer of the sending terminal 210 may include a sending rate scheduling module 212 and a read buffer (read_buffer) 213 . The read buffer 213 may be used to buffer the file data read from the disk into the memory by the sending terminal 210 . The sending rate scheduling module 212 can be used to set the buffer capacity and the warning water level of the designated one or more buffers (eg, the MAC layer sending buffer 215 ) in the sending terminal 210 . The sending rate scheduling module 212 may also be configured to adjust the MAC according to the buffer watermark of one or more buffers in the sending terminal 210 (eg, the MAC layer sending buffer 215) and the buffering information sent by the sending rate feedback module 222 on the receiving terminal 220. The data write rate of the layer send buffer 215. The buffer information may be used to indicate the buffer watermark of one or more buffers (eg, the write buffer 223 and the MAC layer receive buffer 226 ) on the receiving terminal 220 .
发送终端210的套接字抽象层可以包括有套接字发送缓冲区(socket_send_buffer)214。 该套接字发送缓冲区214可用于缓冲发送终端210中应用211的进程向对应的socket写入的数据。The socket abstraction layer of the sending terminal 210 may include a socket send buffer (socket_send_buffer) 214 . The socket sending buffer 214 can be used to buffer the data written to the corresponding socket by the process of the application 211 in the sending terminal 210 .
发送终端210的UDP层/IP层可以将套接字抽象层下发的文件数据封装成数据包(例如,UDP数据包或IP数据包),并将数据包下发给MAC层。The UDP layer/IP layer of the sending terminal 210 may encapsulate the file data delivered by the socket abstraction layer into data packets (eg, UDP data packets or IP data packets), and deliver the data packets to the MAC layer.
发送终端210的MAC层可以包括有MAC层发送缓冲区(qdisk_buffer)215。该MAC层发送缓冲区215可用于缓冲UDP层/IP层下发的数据包(例如UDP数据包/IP数据包)。MAC层可用于从MAC层发送缓冲区215中顺序取出数据包,并封装成MAC数据帧下发至网卡中。The MAC layer of the sending terminal 210 may include a MAC layer sending buffer (qdisk_buffer) 215 . The MAC layer sending buffer 215 can be used to buffer data packets (eg, UDP data packets/IP data packets) delivered by the UDP layer/IP layer. The MAC layer can be used to sequentially take out data packets from the MAC layer sending buffer 215, encapsulate them into MAC data frames and send them to the network card.
发送终端210的网卡中可以包括网卡发送缓冲区216,该网卡发送缓冲区216的缓冲区类型可以为环形缓冲区(ring_buffer)。该网卡发送缓冲区216可用于缓冲MAC层下发的MAC数据包。该发送终端210的网卡可用于从网卡发送缓冲区216中顺序取出MAC数据帧并转换为物理帧通过无线网络点对点发送给接收终端220。The network card of the sending terminal 210 may include a network card sending buffer 216, and the buffer type of the network card sending buffer 216 may be a ring buffer (ring_buffer). The network card sending buffer 216 can be used to buffer the MAC data packets delivered by the MAC layer. The network card of the sending terminal 210 can be used to sequentially take out MAC data frames from the network card sending buffer 216, convert them into physical frames, and send them to the receiving terminal 220 point-to-point through the wireless network.
接收终端220的应用层可以包括一个或多个应用。例如,应用221可以为华为分享等数据分享应用。The application layer of the receiving terminal 220 may include one or more applications. For example, the application 221 may be a data sharing application such as Huawei Share.
接收终端220的极简协议层可以包括有发送速率反馈模块222和写缓冲区(write_buffer)223。其中,该写缓冲区223可用于缓冲接收终端220从套接字接收缓冲区224取出的文件数据,接收终端220可以从写缓冲区223中顺序取出文件数据写入磁盘中。该发送速率反馈模块222可用于设置接收终端220上一个或多个缓冲区(例如,写缓冲区223和MAC层接收缓冲区226)的缓冲容量和预警水位线。该发送速率反馈模块222还用于获取接收终端220的上述一个或多个缓冲区的缓冲信息,并发送到发送终端210的发送速率调度模块212上。其中,该缓冲信息可以用于指示接收终端220上一个或多个缓冲区(例如,写缓冲区223和MAC层接收缓冲区226)的缓冲水位线。The minimalist protocol layer of the receiving terminal 220 may include a sending rate feedback module 222 and a write buffer (write_buffer) 223 . The write buffer 223 can be used to buffer the file data retrieved from the socket receive buffer 224 by the receiving terminal 220, and the receiving terminal 220 can sequentially retrieve the file data from the write buffer 223 and write it to the disk. The sending rate feedback module 222 can be used to set the buffer capacity and the warning watermark of one or more buffers (eg, the write buffer 223 and the MAC layer receive buffer 226 ) on the receiving terminal 220 . The sending rate feedback module 222 is further configured to acquire the buffer information of the one or more buffers of the receiving terminal 220 and send it to the sending rate scheduling module 212 of the sending terminal 210 . The buffer information may be used to indicate the buffer watermark of one or more buffers (eg, the write buffer 223 and the MAC layer receive buffer 226 ) on the receiving terminal 220 .
接收终端220的套接字抽象层可以包括有套接字接收缓冲区(socket_receive_buffer)224。该套接字接收缓冲区224可用于缓冲UDP层/IP层上报的文件数据。接收终端220可以从套接字接收缓冲区224中拷贝文件数据到写缓冲区223中。The socket abstraction layer of the receiving terminal 220 may include a socket receive buffer (socket_receive_buffer) 224 . The socket receiving buffer 224 can be used to buffer the file data reported by the UDP layer/IP layer. The receiving terminal 220 may copy the file data from the socket receive buffer 224 to the write buffer 223 .
接收终端220从MAC层直接获取的是IP数据包时,该接收终端220的UDP层/IP层可以包括有IP分片重组缓冲区(ip_defrag_buffer)225。接收终端220从MAC层中获取到解析出来的IP数据包之后,可以将IP数据包依次存入IP分片重组缓冲区225中,然后,接收终端220可以从IP分片重组缓冲区225中依次取出IP数据包并根据分片重组成一个重组数据包,并在对该重组数据包执行UDP层/IP层的逻辑处理之后放到套接字接收缓冲区224中。When the receiving terminal 220 directly obtains an IP data packet from the MAC layer, the UDP layer/IP layer of the receiving terminal 220 may include an IP fragmentation reassembly buffer (ip_defrag_buffer) 225 . After the receiving terminal 220 obtains the parsed IP data packets from the MAC layer, the IP data packets can be sequentially stored in the IP fragmentation and reassembly buffer 225, and then the receiving terminal 220 can sequentially store the IP data packets from the IP fragmentation and reassembly buffer 225. The IP data packet is taken out and reassembled into a reassembled data packet according to the fragmentation, and is placed in the socket receiving buffer 224 after the logical processing of the UDP layer/IP layer is performed on the reassembled data packet.
接收终端220的MAC层可以包括有MAC层接收缓冲区(netdev_backlog_buffer)226。该MAC层接收缓冲区226可用于缓冲从网卡中获取的MAC数据包。该接收终端220可以从MAC层接收缓冲区226中的顺序取出MAC数据帧,并执行MAC层的逻辑处理,将处理完得到的UDP数据包/IP数据包上报给UDP层/IP层。The MAC layer of the receiving terminal 220 may include a MAC layer receive buffer (netdev_backlog_buffer) 226 . The MAC layer receive buffer 226 can be used to buffer the MAC data packets obtained from the network card. The receiving terminal 220 can sequentially take out the MAC data frames from the MAC layer receiving buffer 226, perform logical processing of the MAC layer, and report the UDP data packets/IP data packets obtained after processing to the UDP layer/IP layer.
接收终端220的网卡中可以包括有网卡接收缓冲区227。该网卡接收缓冲区227的缓冲区类型可以为环形缓冲区(ring_buffer)。该网卡接收缓冲区227可用于缓冲接收终端220从接收到的物理帧中解析出来的MAC数据帧。接收终端220可以从网卡接收缓冲区227 中顺序取出MAC数据帧,并进行MAC层的逻辑处理解析出UDP数据包/IP数据包。The network card of the receiving terminal 220 may include a network card receiving buffer 227 . The buffer type of the network card receiving buffer 227 may be a ring buffer (ring_buffer). The network card receiving buffer 227 can be used to buffer the MAC data frame parsed by the receiving terminal 220 from the received physical frame. The receiving terminal 220 can sequentially take out the MAC data frames from the network card receiving buffer 227, and perform logical processing at the MAC layer to parse out the UDP data packets/IP data packets.
下面结合文件传输场景,示例性说明发送终端210和接收终端220的软件工作流程。The software workflow of the sending terminal 210 and the receiving terminal 220 is exemplarily described below with reference to a file transfer scenario.
在发送终端210向接收终端220传输文件数据之前,发送速率调度模块212可以设置发送终端210上多个缓冲区的缓冲容量。其中,发送速率调度模块212可以根据物理信道的最大传输速率以及传输往返时延,设置MAC层发送缓冲区215的缓冲容量和预警水位线。发送速率反馈模块222可以设置接收终端220上多个缓冲区的缓冲容量。其中,发送速率反馈模块222可以根据物理信道的最大传输速率以及传输往返时延,设置MAC层发送缓冲区215和写缓冲区223的缓冲容量和预警水位线。Before the sending terminal 210 transmits the file data to the receiving terminal 220 , the sending rate scheduling module 212 may set the buffer capacity of the multiple buffers on the sending terminal 210 . The sending rate scheduling module 212 may set the buffer capacity and the warning water level of the MAC layer sending buffer 215 according to the maximum transmission rate of the physical channel and the round-trip transmission delay. The sending rate feedback module 222 can set the buffer capacity of the multiple buffers on the receiving terminal 220 . Wherein, the sending rate feedback module 222 can set the buffer capacity and the warning water level of the MAC layer sending buffer 215 and the writing buffer 223 according to the maximum transmission rate of the physical channel and the round-trip delay.
发送终端210的应用211可以下发针对第一文件的文件发送请求到极简协议层,请求极简协议层从磁盘(即,只读存储器(read only memory,ROM))中读取第一文件的文件数据到读缓冲区213中,然后再从读缓冲区213中拷贝文件数据到套接字发送缓冲区214中。例如,应用211通过文件发送调用接口send_file(),调用极简协议层从磁盘中读取文件数据到读缓冲区213中。The application 211 of the sending terminal 210 can issue a file sending request for the first file to the minimalist protocol layer, and request the minimalist protocol layer to read the first file from the disk (ie, read only memory (ROM)) to the read buffer 213, and then copy the file data from the read buffer 213 to the socket send buffer 214. For example, the application 211 calls the interface send_file( ) through the file sending, and calls the minimalist protocol layer to read the file data from the disk into the read buffer 213 .
发送终端210的极简协议层可以通过调用套接字发送接口socket_sendto(),将读缓冲区213中的文件数据拷贝到套接字发送缓冲区214。The minimalist protocol layer of the sending terminal 210 can copy the file data in the read buffer 213 to the socket send buffer 214 by calling the socket sending interface socket_sendto().
发送终端210的套接字抽象层可以调用UDP数据包发送接口(例如,udp_sendmsg()),从套接字发送缓冲区214中取出文件数据,下发至UDP层。The socket abstraction layer of the sending terminal 210 can call the UDP data packet sending interface (for example, udp_sendmsg( )), and extract the file data from the socket sending buffer 214 and deliver it to the UDP layer.
发送终端210的UDP层可以将文件数据封装成UDP数据包,并调用IP数据包发送接口(例如,ip_queue_xmit()),触发IP层设置路由、创建IP协议头和IP选项,将UDP数据包封装成IP数据包。IP层可以将IP数据包下发到MAC层发送缓冲区215中。The UDP layer of the sending terminal 210 can encapsulate the file data into UDP data packets, and call the IP data packet sending interface (for example, ip_queue_xmit()), trigger the IP layer to set routes, create IP protocol headers and IP options, and encapsulate the UDP data packets into IP packets. The IP layer can deliver the IP data packet to the MAC layer sending buffer 215 .
在一种可能的实现方式中,由于发送终端210与接收终端220之间是近距离端对端传输,发送终端210与接收终端220之间的数据传输无需选择路由。发送终端210可以包括UDP层,不包括IP层。发送终端210的UDP层可以将文件数据封装成UDP数据包之后,可以直接下发到MAC层发送缓冲区215中。In a possible implementation manner, since the transmission between the sending terminal 210 and the receiving terminal 220 is close-range end-to-end transmission, the data transmission between the sending terminal 210 and the receiving terminal 220 does not need to select a route. The sending terminal 210 may include the UDP layer, but not the IP layer. After the UDP layer of the sending terminal 210 can encapsulate the file data into a UDP data packet, it can be directly sent to the sending buffer 215 of the MAC layer.
发送终端210的MAC层可以从MAC层发送缓冲区215中取出数据包(例如,UDP数据包或IP数据包),封装成MAC数据包,并调用网卡发送接口(例如,hard_start_xmit()或net_tx_action())将MAC数据包下发至网卡中的网卡发送缓冲区216中。The MAC layer of the sending terminal 210 can take out data packets (for example, UDP data packets or IP data packets) from the MAC layer send buffer 215, encapsulate them into MAC data packets, and call the network card sending interface (for example, hard_start_xmit() or net_tx_action( )) sends the MAC data packet to the network card sending buffer 216 in the network card.
发送终端210的网卡可以从网卡发送缓冲区216中取出MAC数据包,并封装成数据帧发送给接收终端220。The network card of the sending terminal 210 can take out the MAC data packet from the network card sending buffer 216 , encapsulate it into a data frame and send it to the receiving terminal 220 .
接收终端220的网卡在接收到发送终端210发送的数据帧后,可以先存入网卡接收缓冲区227中。接收终端220的网卡可以从数据帧中解析出MAC数据包,并通过网卡接收接口(例如,net_rx_action()或netif_receive_skb())将MAC数据包上发给MAC层接收缓冲区226。After the network card of the receiving terminal 220 receives the data frame sent by the sending terminal 210, it may be stored in the network card receiving buffer 227 first. The network card of the receiving terminal 220 can parse the MAC data packet from the data frame, and send the MAC data packet to the MAC layer receiving buffer 226 through the network card receiving interface (eg, net_rx_action() or netif_receive_skb()).
接收终端220的MAC层可以从MAC层接收缓冲区226中取出MAC数据包,从MAC数据包中解析出IP数据包,然后通过调用IP数据包接收接口(例如,ip_rcv())将IP数据包上发给IP层。The MAC layer of the receiving terminal 220 can take out the MAC data packet from the MAC layer receiving buffer 226, parse the IP data packet from the MAC data packet, and then convert the IP data packet by calling the IP data packet receiving interface (for example, ip_rcv()). sent to the IP layer.
接收终端220的IP层可以将从MAC层获取到的IP数据包先存到IP分片重组缓冲区225然后IP层可以从IP分片重组缓冲区225取出IP数据包,将属于同一分片的IP数据包 重组成一个UDP数据包,上发给到UDP层。The IP layer of the receiving terminal 220 can first store the IP data packets obtained from the MAC layer in the IP fragmentation reassembly buffer 225, and then the IP layer can take out the IP data packets from the IP fragmentation reassembly buffer 225, and store the IP data packets belonging to the same fragment. The IP data packet is reassembled into a UDP data packet and sent to the UDP layer.
接收终端220的UDP层可以从UDP数据包解析出文件数据,并通过调用UDP接收接口(例如,udp_rcv()),将文件数据上发到套接字抽象层的套接字接收缓冲区224中。The UDP layer of the receiving terminal 220 can parse the file data from the UDP data packet, and send the file data to the socket receiving buffer 224 of the socket abstraction layer by calling the UDP receiving interface (for example, udp_rcv()). .
接收终端220的套接字抽象层可以将套接字接收缓冲区224中的文件数据拷贝到极简协议层的写缓冲区223中。The socket abstraction layer of the receiving terminal 220 may copy the file data in the socket receive buffer 224 to the write buffer 223 of the minimalist protocol layer.
接收终端220的应用221可以通过调用文件写入接口(例如,write_file()),从写缓冲区223中取出文件数据,写入到接收终端220的磁盘中。The application 221 of the receiving terminal 220 can retrieve the file data from the write buffer 223 by calling the file writing interface (for example, write_file( )), and write it into the disk of the receiving terminal 220 .
在上述数据传输***400中,对于发送终端210和接收终端220,都可以包括有至少三类物理存储介质:磁盘(即,ROM)、运行内存(即,随机存储器(random access memory,RAM))、网卡存储。其中,该磁盘中可以在断电后依然保留数据,可用于保存文档、图片、音乐、视频等文件数据。运行内存可用于操作***和应用运行时所产生的临时数据。网卡中可以包括有存储器,可用于临时保存待发送或已接收到的数据帧。其中,发送终端210上的读缓冲区213、套接字发送缓冲区214、MAC层发送缓冲区215建立在发送终端210的运行内存上。发送终端210上的网卡发送缓冲区216建立在发送终端211的网卡上。接收终端220的写缓冲区223、套接字接收缓冲区224、IP分片重组缓冲区225和MAC层接收缓冲区226是建立在接收终端220上。接收终端220的网卡接收缓冲区227是建立在接收终端220的网卡上。In the above data transmission system 400, for both the sending terminal 210 and the receiving terminal 220, at least three types of physical storage media may be included: disk (ie, ROM), running memory (ie, random access memory (random access memory, RAM)) , network card storage. Among them, the disk can still retain data after a power failure, and can be used to save file data such as documents, pictures, music, and videos. Runtime memory can be used for temporary data generated by the operating system and applications while they are running. The network card may include a memory, which can be used to temporarily store data frames to be sent or received. The read buffer 213 , the socket sending buffer 214 , and the MAC layer sending buffer 215 on the sending terminal 210 are established on the running memory of the sending terminal 210 . The network card sending buffer 216 on the sending terminal 210 is established on the network card of the sending terminal 211 . The write buffer 223 , the socket receive buffer 224 , the IP fragmentation reassembly buffer 225 and the MAC layer receive buffer 226 of the receiving terminal 220 are established on the receiving terminal 220 . The network card receiving buffer 227 of the receiving terminal 220 is established on the network card of the receiving terminal 220 .
一般来说对于同一物理存储介质内部两个缓冲区之间的数据传输速率都比较快,要高于物理信道的最大传输速率。例如,发送终端210中套接字发送缓冲区214中的数据取出速率,可以达到物理信道的最大传输速率。发送终端210的UDP层/IP层对数据的处理速率也可以达到物理信道的最大传输速率。又例如,接收终端220中套接字接收缓冲区224中的数据取出速率,可以达到物理信道的最大传输速率。Generally speaking, the data transmission rate between two buffers in the same physical storage medium is relatively fast, which is higher than the maximum transmission rate of the physical channel. For example, the data fetch rate from the socket sending buffer 214 in the sending terminal 210 can reach the maximum transmission rate of the physical channel. The data processing rate of the UDP layer/IP layer of the sending terminal 210 can also reach the maximum transmission rate of the physical channel. For another example, the data fetch rate from the socket receive buffer 224 in the receiving terminal 220 can reach the maximum transmission rate of the physical channel.
但是,当发送终端210的IP层采用IP分片传输时,接收终端220的IP层需要对接收到的IP数据包按照IP数据包的序号整合成一个数据报文,这时接收终端220必须等待一个序号范围内的IP数据包全接收后,才能按顺序整合成一个数据报文。而接收终端220接收IP数据包的时间顺序与IP数据包的序号顺序并不完全相同。因此,接收终端220会花较长时间等待一个序号范围内的所有IP数据包,若有多个序号范围内缺失有IP数据包,IP层无法及时将每个序号范围内的多个IP数据包重组成数据报文,容易造成IP分片重组缓冲区(ip_defrag_buffer)225的溢出。However, when the IP layer of the sending terminal 210 adopts IP fragmentation transmission, the IP layer of the receiving terminal 220 needs to integrate the received IP data packet into a data packet according to the sequence number of the IP data packet, and then the receiving terminal 220 must wait for Only after all IP data packets within a sequence number range are received can they be integrated into one data packet in sequence. However, the time sequence in which the receiving terminal 220 receives the IP data packets is not exactly the same as the sequence number sequence of the IP data packets. Therefore, the receiving terminal 220 will spend a long time waiting for all the IP data packets within a sequence number range. If there are missing IP data packets in multiple sequence number ranges, the IP layer cannot timely transfer the multiple IP data packets within each sequence number range. Reassembly into data packets may easily cause an overflow of IP fragmentation reassembly buffer (ip_defrag_buffer) 225.
对于处于不同物理存储介质中两个缓冲区之间的数据传输速率主要会受到CPU算力以及I/O算力的影响。其中,例如,发送终端210上MAC层发送缓冲区215中数据的积压程度受信道运力和发送终端210的CPU算力的影响,其中,MAC层发送缓冲区215中数据的取出速率,主要受网卡限制,次要受CPU软中断负载的限制。接收终端220的CPU算力会影响内核态从网卡中取出数据放到MAC层接收缓冲区226中的速率,因此,MAC层接收缓冲区226中数据的积压程度会受到接收终端220的CPU算力的影响。接收终端220的I/O算力会影响从写缓冲区223取出数据写入磁盘的速率。The data transfer rate between two buffers in different physical storage media is mainly affected by CPU computing power and I/O computing power. Wherein, for example, the backlog of data in the sending buffer 215 of the MAC layer on the sending terminal 210 is affected by the channel capacity and the computing power of the CPU of the sending terminal 210, and the rate at which the data in the sending buffer 215 of the MAC layer is taken out is mainly affected by the network card Limited, and secondarily limited by the CPU soft interrupt load. The CPU computing power of the receiving terminal 220 will affect the rate at which the kernel state retrieves data from the network card and puts it into the MAC layer receiving buffer 226. Therefore, the backlog of data in the MAC layer receiving buffer 226 will be affected by the CPU computing power of the receiving terminal 220. Impact. The I/O computing power of the receiving terminal 220 will affect the rate at which data is fetched from the write buffer 223 and written to the disk.
因此,在本申请的实施例中,可以基于MAC层发送缓冲区(qdisk_buffer)215、MAC 层接收缓冲区(netdev_backlog_buffer)226、IP分片重组缓冲区(ip_defrag_buffer)225、写缓冲区(write_buffer)223中的一个或多个缓冲区,控制文件数据写入的MAC层发送缓冲区215的速率。其中,在发送终端210向接收终端220传输文件数据的过程中,接收终端220中的发送速率反馈模块222可以将MAC层接收缓冲区226的缓冲水位线以及写缓冲区223的缓冲水位线反馈给发送终端210的发送速率调度模块212。发送速率调度模块212还可以获取MAC层发送缓冲区215的缓冲水位线。发送速率调度模块212可以根据这一个或多个缓冲区的水位线,控制发送终端210从将文件数据写入到MAC层发送缓冲区215的速率。当这一个或多个缓冲均低于预警水位线时,发送终端210以网卡极限速率(例如,物理协商速率90%)将文件数据写入到MAC层发送缓冲区215,并将MAC层发送缓冲区215中文件数据下发至网卡中,通过网卡发送个接收终端220。当这一个或多个缓冲区中的任何一个超过预警水位线时,发送终端210可以降低将文件数据写入到MAC层发送缓冲区215的速率(例如,物理层发送速率上限的10%),等这一个或多个缓冲区中的内容都被消化完,发送终端210再恢复以网卡极限速率(例如,物理层发送速率上限的90%)从机身存储中将文件数据读取到读缓冲区213。这样,可以实现文件的传输速度接近物理信道极限且降低丢包率。Therefore, in this embodiment of the present application, the MAC layer sending buffer (qdisk_buffer) 215, the MAC layer receiving buffer (netdev_backlog_buffer) 226, the IP fragmentation reassembly buffer (ip_defrag_buffer) 225, and the write buffer (write_buffer) 223 may be used. One or more buffers in the MAC layer that control the rate at which file data is written to the send buffer 215 of the MAC layer. Wherein, in the process of transmitting the file data from the sending terminal 210 to the receiving terminal 220, the sending rate feedback module 222 in the receiving terminal 220 may feed back the buffer water level of the MAC layer receive buffer 226 and the buffer water level of the write buffer 223 to the receiving terminal 220. The sending rate scheduling module 212 of the sending terminal 210 . The sending rate scheduling module 212 may also obtain the buffer watermark of the MAC layer sending buffer 215 . The sending rate scheduling module 212 may control the rate at which the sending terminal 210 writes the file data to the MAC layer sending buffer 215 according to the watermarks of the one or more buffers. When the one or more buffers are all below the warning water level, the sending terminal 210 writes the file data into the MAC layer sending buffer 215 at the network card limit rate (eg, 90% of the physical negotiation rate), and buffers the MAC layer sending The file data in the area 215 is delivered to the network card, and the receiving terminal 220 is sent through the network card. When any of the one or more buffers exceeds the warning watermark, the sending terminal 210 may reduce the rate at which file data is written to the MAC layer send buffer 215 (eg, 10% of the upper limit of the physical layer send rate), After the contents in the one or more buffers have been digested, the sending terminal 210 resumes reading the file data from the fuselage storage to the read buffer at the limit rate of the network card (for example, 90% of the upper limit of the sending rate of the physical layer). District 213. In this way, the transmission speed of the file can be achieved close to the physical channel limit and the packet loss rate can be reduced.
下面介绍本申请实施例的第二部分中提供的一种数据传输方法。The following introduces a data transmission method provided in the second part of the embodiment of the present application.
请参考图8,图8示出了本申请实施例的第二部分提供的一种数据传输方法的流程示意图。其中,发送终端210可以被称为第一终端,接收终端220可以被称为第二终端。如图8所示,该方法可以包括如下步骤:Please refer to FIG. 8. FIG. 8 shows a schematic flowchart of a data transmission method provided in the second part of the embodiment of the present application. The sending terminal 210 may be referred to as the first terminal, and the receiving terminal 220 may be referred to as the second terminal. As shown in Figure 8, the method may include the following steps:
S801、发送终端210获取到针对第一文件的传输请求。S801. The sending terminal 210 obtains a transmission request for the first file.
第一文件可以是图片、视频、文档等类型的文件。第一文件可以存储在发送终端210的机身存储中。其中,发送终端210可以获取到用户输入的针对第一文件的传输请求,该传输请求可以包括第一文件的存储地址以及接收终端220的地址信息(例如IP地址或MAC地址等)。The first file may be a file of types such as pictures, videos, documents, and the like. The first file may be stored in the body storage of the sending terminal 210 . The sending terminal 210 may obtain a transmission request for the first file input by the user, and the transmission request may include the storage address of the first file and address information (eg, IP address or MAC address, etc.) of the receiving terminal 220 .
例如,用户可以打开发送终端210上针对视频文件的分享界面,该分享界面可以包括发送终端210发现的一个或多个设备的选项,其中,该一个或多个设备可以包括该接收终端220。当发送终端210接收到用户选择接收终端220对应的选项的输入操作时,发送终端210可以获取到针对该视频文件的传输请求。For example, the user may open a sharing interface for video files on the sending terminal 210 , and the sharing interface may include options for one or more devices discovered by the sending terminal 210 , wherein the one or more devices may include the receiving terminal 220 . When the sending terminal 210 receives the user's input operation of selecting an option corresponding to the receiving terminal 220, the sending terminal 210 may acquire a transmission request for the video file.
S802、发送终端210与接收终端220建立文件传输连接。S802 , the sending terminal 210 establishes a file transmission connection with the receiving terminal 220 .
在发送终端210获取到第一文件的传输请求后,发送终端210可以根据接收终端220的地址信息与接收终端220建立文件传输连接。其中,该文件传输连接可以包括Wi-Fi直连(例如,Wi-Fi P2P)、Wi-Fi softAP、超宽带(ultra wide band,UWB)、蓝牙等通信连接。After the sending terminal 210 obtains the transmission request of the first file, the sending terminal 210 may establish a file transmission connection with the receiving terminal 220 according to the address information of the receiving terminal 220 . The file transfer connection may include Wi-Fi direct connection (for example, Wi-Fi P2P), Wi-Fi softAP, ultra wide band (UWB), Bluetooth and other communication connections.
S803、发送终端210获取物理层传输速率上限Vmax和MAC层的反馈时间Ts。S803. The sending terminal 210 obtains the upper limit Vmax of the transmission rate of the physical layer and the feedback time Ts of the MAC layer.
物理层发送速率上限Vmax可以是预设在发送终端210上的。例如,当发送终端210和接收终端220配置的是2x2的MIMO天线,发送终端210和接收终端220之间的连接网络是基于Wi-Fi 5的无线局域网络时,物理层传输速率上限Vmax可以是1Gbps。当发送终端210和接收终端220配置的是2x2的MIMO天线,发送终端210和接收终端220之间的 连接网络是基于Wi-Fi 6的无线局域网络时,物理层传输速率上限Vmax可以是2.4Gbps。The upper limit Vmax of the transmission rate of the physical layer may be preset on the transmission terminal 210 . For example, when the sending terminal 210 and the receiving terminal 220 are configured with 2x2 MIMO antennas, and the connection network between the sending terminal 210 and the receiving terminal 220 is a Wi-Fi 5-based wireless local area network, the upper limit Vmax of the physical layer transmission rate may be 1Gbps. When the transmitting terminal 210 and the receiving terminal 220 are configured with 2x2 MIMO antennas, and the connection network between the transmitting terminal 210 and the receiving terminal 220 is a wireless local area network based on Wi-Fi 6, the upper limit Vmax of the physical layer transmission rate may be 2.4Gbps .
在一种可能的实现方式中,在发送终端210与接收终端220建立文件传输连接后,发送终端210可以与接收终端220协商发送终端210上网卡的物理层发送速率上限Vmax。In a possible implementation manner, after the sending terminal 210 and the receiving terminal 220 establish a file transfer connection, the sending terminal 210 may negotiate with the receiving terminal 220 the upper limit Vmax of the physical layer sending rate of the sending terminal 210's network card.
在发送终端210开始传输第一文件的数据之前,发送终端210的MAC层可以上报测量数据包到上层的发送速率调度模块。其中,该测量数据包中包括有MAC层上报该测量数据包的时间,发送终端210的发送速率调度模块在获取到该测量数据包后可以记录出获取到该测量数据包的时间。发送终端210可以根据MAC层上报该测量数据包的时间和所述第一终端获取到该测量数据包的时间,确定出该MAC层的反馈时间Ts。Before the sending terminal 210 starts to transmit the data of the first file, the MAC layer of the sending terminal 210 may report the measurement data packet to the sending rate scheduling module of the upper layer. The measurement data packet includes the time when the MAC layer reports the measurement data packet, and the transmission rate scheduling module of the sending terminal 210 may record the time when the measurement data packet is acquired after acquiring the measurement data packet. The sending terminal 210 may determine the feedback time Ts of the MAC layer according to the time when the MAC layer reports the measurement data packet and the time when the first terminal obtains the measurement data packet.
S804、发送终端210根据物理层发送速率上限Vmax和MAC层的反馈时间Ts,确定出MAC层发送缓冲区的缓冲容量和第一预警水位线。S804. The sending terminal 210 determines the buffer capacity of the sending buffer of the MAC layer and the first warning water level according to the upper limit Vmax of the sending rate of the physical layer and the feedback time Ts of the MAC layer.
如图9所示,该缓冲区可以是上述MAC层发送缓冲区、接收终端220上的MAC层接收缓冲区、接收终端220上的IP分片重组缓冲区ip_defrag_buffer、接收终端220上的写缓冲区中任一缓冲区的抽象模型。As shown in FIG. 9 , the buffer may be the above-mentioned MAC layer sending buffer, the MAC layer receiving buffer on the receiving terminal 220 , the IP fragmentation reassembly buffer ip_defrag_buffer on the receiving terminal 220 , and the write buffer on the receiving terminal 220 An abstract model for any of the buffers in .
其中,MAC缓冲区的总容量可以为M,第一预警水位线可以为A*M,因此,当缓冲区中的缓冲水位线处于第一预警水位线时,缓冲区的剩余容量为(1-A)*M。其中,0<A<1。The total capacity of the MAC buffer may be M, and the first warning water level may be A*M. Therefore, when the buffer water level in the buffer is at the first warning water level, the remaining capacity of the buffer is (1- A)*M. where 0<A<1.
因为需要尽量保证最高的传输速率,同时又要降低丢包率,所以需要监控MAC层发送缓冲区中的缓冲数据量既不能空,又不能溢出。若在t时刻该MAC层发送缓冲区的已缓冲数据量达到第一预警水位线A*M,且在t+Δt时刻MAC层发送缓冲区的已缓冲数据量还会继续增长,要保证MAC层发送缓冲区不溢出,发送终端210的MAC层需要上报第一指示信息给上层的发送速率调度模块,进而让上层的发送速率调度模块降低第一文件的数据写入至MAC层发送缓冲区的速率。该过程所花费的最大时间为Ts。若在t时刻该缓冲区的已缓冲数据量达到第一预警水位线A*M,且在t+Δt时刻已缓冲数据量继续下降,要保证MAC层给发送速率调度模块一次错误的反馈后(耗时0.5RTT),重新调整回正常的发送速率(又耗时Ts)。Because it is necessary to ensure the highest transmission rate as much as possible, and at the same time to reduce the packet loss rate, it is necessary to monitor the amount of buffered data in the sending buffer of the MAC layer, which can neither be empty nor overflow. If the buffered data volume of the MAC layer sending buffer reaches the first warning water level A*M at time t, and the buffered data volume of the MAC layer sending buffer will continue to increase at time t+Δt, it is necessary to ensure that the MAC layer If the sending buffer does not overflow, the MAC layer of the sending terminal 210 needs to report the first indication information to the sending rate scheduling module of the upper layer, so that the sending rate scheduling module of the upper layer can reduce the rate at which the data of the first file is written into the sending buffer of the MAC layer . The maximum time this process takes is Ts. If the amount of buffered data in the buffer reaches the first warning water level A*M at time t, and the amount of buffered data continues to decrease at time t+Δt, it is necessary to ensure that the MAC layer gives the sending rate scheduling module an erroneous feedback ( It takes 0.5RTT), and readjusts back to the normal sending rate (it takes Ts again).
因此,发送终端210可以根据物理层传输速率上限Vmax和MAC层的反馈时间Ts,通过如下公式(6)和公式(7)确定出MAC层发送缓冲区的缓冲容量和预警水位线。Therefore, the sending terminal 210 can determine the buffer capacity and the warning water level of the MAC layer sending buffer by the following formulas (6) and (7) according to the upper limit Vmax of the physical layer transmission rate and the feedback time Ts of the MAC layer.
((1-A)*M)/Vmax≥Ts 公式(6)((1-A)*M)/Vmax≥Ts Formula (6)
(A*M)/Vmax≥2*Ts 公式(7)(A*M)/Vmax≥2*Ts Formula (7)
其中,缓冲区的缓冲容量M应满足上述公式(6)和公式(7)所限定范围中的最小值。Wherein, the buffer capacity M of the buffer should satisfy the minimum value in the range defined by the above formula (6) and formula (7).
示例性的,Vmax可以为2.4Gbps(300MB/s),Ts可以为2ms,根据上述公式(6)和公式(7)可以计算出M≥1.8MB,A=2/3。因此,发送终端220可以给MAC层发送缓冲区的容量设置为1.8MB,第一预警水位线设置为1.2MB。Exemplarily, Vmax may be 2.4Gbps (300MB/s), Ts may be 2ms, and M≥1.8MB can be calculated according to the above formula (6) and formula (7), and A=2/3. Therefore, the sending terminal 220 can set the capacity of the sending buffer to the MAC layer to be 1.8MB, and the first warning water level to be set to 1.2MB.
在一种可能的实现方式中,缓冲区的缓冲容量的单位可以是最大长度的数据包的个数,在根据上述公式(6)和公式(7)计算出缓冲区的以兆字节(MB)为单位的缓冲容量后,可以根据数据包的最大长度进行换算,得到缓冲区的以数据包的个数为单位的缓冲容量。例如,M为1.2MB,一个数据包的最大可以是1500字节(Byte),则缓冲区的缓冲容量为800个数据包。In a possible implementation manner, the unit of the buffer capacity of the buffer may be the number of data packets with the maximum length, and the buffer is calculated in megabytes (MB) according to the above formula (6) and formula (7). ) as the unit of buffer capacity, it can be converted according to the maximum length of the data packet to obtain the buffer capacity of the buffer in the unit of the number of data packets. For example, if M is 1.2MB, and the maximum size of a data packet can be 1500 bytes (Byte), the buffer capacity of the buffer is 800 data packets.
在一种可能的实现方式中,第一预警水位线可以是预设的,发送终端210可以根据上述公式(6)和公式(7)确定出MAC层缓冲区的缓冲容量。In a possible implementation manner, the first warning water level may be preset, and the sending terminal 210 may determine the buffer capacity of the MAC layer buffer according to the above formula (6) and formula (7).
在一种可能的实现方式中,MAC层缓冲区的缓冲容量可以是预设的,发送终端210可以根据上述公式(6)和公式(7)确定出第一预警水位线。In a possible implementation manner, the buffer capacity of the MAC layer buffer may be preset, and the sending terminal 210 may determine the first warning water level according to the above formula (6) and formula (7).
S805、在发送终端210设置完MAC层发送缓冲区的缓冲容量和第一预警水位线后,发送终端210可以以第一速率向MAC层发送缓冲区中写入第一文件的第一数据。S805. After the sending terminal 210 has set the buffer capacity of the MAC layer sending buffer and the first warning watermark, the sending terminal 210 can send the first data written in the first file to the MAC layer sending buffer at the first rate.
S806、发送终端210通过网卡将MAC层发送缓冲区中第一文件的第一数据发送给接收终端220。S806. The sending terminal 210 sends the first data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
其中,发送终端210可以根据物理层发送速率上限确定出第一速率。第一速率可以为接近物理层发送速率上限的值。物理层发送速率上限,即为发送终端210的网卡可支持的发送速率上限。例如,第一速率可以为物理层最大速率的90%。当物理层发送速率上限为2.4Gbps时,第一速率可以为2.16Gbps。The sending terminal 210 may determine the first rate according to the upper limit of the transmission rate of the physical layer. The first rate may be a value close to the upper limit of the transmission rate of the physical layer. The upper limit of the sending rate of the physical layer is the upper limit of the sending rate that can be supported by the network card of the sending terminal 210 . For example, the first rate may be 90% of the maximum rate of the physical layer. When the upper limit of the transmission rate of the physical layer is 2.4Gbps, the first rate may be 2.16Gbps.
发送终端210以第一速率从磁盘中中读取第一文件的第一数据后,写入至MAC层发送缓冲区的过程可以参考上述图7所示实施例,在此不再赘述。After the sending terminal 210 reads the first data of the first file from the disk at the first rate, the process of writing the first data to the MAC layer sending buffer may refer to the embodiment shown in FIG. 7 , which will not be repeated here.
发送终端210在将第一文件的第一数据下发至MAC层发送缓冲区后,可以通过网卡从MAC层发送缓冲区获取第一文件的第一数据,并封装成数据帧,发送给接收终端220。After sending the first data of the first file to the MAC layer sending buffer, the sending terminal 210 can obtain the first data of the first file from the MAC layer sending buffer through the network card, encapsulate it into a data frame, and send it to the receiving terminal. 220.
接收终端220的网卡在接收到发送终端210发送的数据帧后,可以从数据帧中解析出MAC数据包,并上发给MAC层接收缓冲区,然后,接收终端220可以从MAC层接收缓冲区中取出第一文件的数据,发送至写缓冲区。接着,接收终端220再从写缓冲区中第一文件的数据写入接收终端220的磁盘中。其中,接收终端220从MAC层接收缓冲区中取出第一文件的数据,上发至写缓冲区的过程可以参考上述图7所示实施例,在此不再赘述。After receiving the data frame sent by the sending terminal 210, the network card of the receiving terminal 220 can parse the MAC data packet from the data frame and send it to the MAC layer receiving buffer, and then the receiving terminal 220 can receive the buffer from the MAC layer. Take out the data of the first file and send it to the write buffer. Next, the receiving terminal 220 writes the data of the first file in the write buffer into the disk of the receiving terminal 220 . The process for the receiving terminal 220 to retrieve the data of the first file from the MAC layer receive buffer and send it to the write buffer may refer to the embodiment shown in FIG. 7 , which will not be repeated here.
S807、发送终端210监测MAC层发送缓冲区的已缓冲数据量是否大于等于第一预警水位线。若是,则执行S808、发送终端210可以判断MAC层发送缓冲区的剩余容量是否小于第一文件的待发送数据量。当MAC层发送缓冲区的剩余容量小于第一文件的待发送数据量时,则执行S809、发送终端210以第二速率向MAC层发送缓冲区中写入第一文件的第二数据。S807. The sending terminal 210 monitors whether the buffered data amount in the sending buffer of the MAC layer is greater than or equal to the first warning water level. If yes, then execute S808, and the sending terminal 210 may determine whether the remaining capacity of the MAC layer sending buffer is less than the amount of data to be sent of the first file. When the remaining capacity of the MAC layer sending buffer is less than the amount of data to be sent in the first file, S809 is executed, and the sending terminal 210 sends the second data written in the first file to the MAC layer at the second rate.
S810、发送终端210可以通过网卡将MAC层发送缓冲区中第一文件的第二数据发送给接收终端220。S810. The sending terminal 210 may send the second data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
S811、发送终端210可以通过网卡将MAC层发送缓冲区中第一文件的第二数据发送给接收终端220后,发送终端210可以判断MAC层发送缓冲区中的已缓冲数据量是否小于第一指定阈值,若是,则执行S812、发送终端210以第一速率向MAC层发送缓冲区中写入第一文件的第三数据。S811. After the sending terminal 210 can send the second data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card, the sending terminal 210 can determine whether the buffered data amount in the MAC layer sending buffer is less than the first specified amount If it is the threshold, then execute S812, and the sending terminal 210 sends the third data written in the first file in the buffer to the MAC layer at the first rate.
S813、发送终端210可以通过网卡将MAC层发送缓冲区中第一文件的第三数据发送给接收终端220。S813. The sending terminal 210 may send the third data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
其中,第二速率小于上述第一速率。例如,第一速率可以为物理层发送速率上限的90%,第二速率可以为物理层发送速率上限的10%或0。当第二速率为0时,发送终端210停止 从磁盘中读取第一文件的数据。上述第一指定阈值小于第一预警水位线小于MAC层发送缓冲区的缓冲容量。Wherein, the second rate is smaller than the above-mentioned first rate. For example, the first rate may be 90% of the upper limit of the transmission rate of the physical layer, and the second rate may be 10% or 0 of the upper limit of the transmission rate of the physical layer. When the second rate is 0, the sending terminal 210 stops reading the data of the first file from the disk. The above-mentioned first specified threshold is smaller than the first warning water level and smaller than the buffer capacity of the MAC layer sending buffer.
当发送终端210监测到MAC层发送缓冲区的已缓冲数据量大于等于第一预警水位线,且MAC层发送缓冲区的剩余容量小于第一文件的待发送数据量时,发送终端210以第二速率向MAC层发送缓冲区写入第一文件的第二数据,并通过网卡将MAC层发送缓冲区中第一文件的第二数据发送给接收终端220。发送终端210的网卡尽可能的以最大速率从MAC层发送缓冲区中取出第一文件的数据,发送给接收终端220。之后,当发送终端210监测到MAC层发送缓冲区的数据量小于等于第一指定阈值(例如,MAC层发送缓冲区总容量的10%或0)时,发送终端210可以以第一速率向MAC层发送缓冲区写入第一文件的第三数据,并通过网卡将MAC层发送缓冲区中第一文件的第三数据发送给接收终端220。发送终端210的网卡仍然尽可能的以最大速率从MAC层发送缓冲区中取出第一文件的数据,发送给接收终端220。When the sending terminal 210 monitors that the amount of buffered data in the MAC layer sending buffer is greater than or equal to the first warning watermark, and the remaining capacity of the MAC layer sending buffer is less than the amount of data to be sent in the first file, the sending terminal 210 uses the second The rate writes the second data of the first file into the MAC layer sending buffer, and sends the second data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card. The network card of the sending terminal 210 extracts the data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and sends the data to the receiving terminal 220 . Afterwards, when the sending terminal 210 monitors that the data volume of the MAC layer sending buffer is less than or equal to the first specified threshold (for example, 10% or 0 of the total capacity of the MAC layer sending buffer), the sending terminal 210 may send the MAC layer to the MAC at the first rate The layer sending buffer writes the third data of the first file, and sends the third data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card. The network card of the sending terminal 210 still extracts the data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and sends the data to the receiving terminal 220 .
示例性的,第一文件的数据大小为800MB,物理层发送速率上限Vmax可以为2.4Gbps(300MB/s),MAC层的反馈时间Ts可以为2ms,MAC层发送缓冲区的缓冲容量可以为1.8MB,第一预警水位线可以为1.2MB。第一速率可以为物理层发送速率上限Vmax的90%,即为2.16Gbps(270MB/s),第二速率可以为物理层发送速率上限Vmax的10%,即为0.24Gbps(30MB/s)。上述第一指定阈值可以为MAC层发送缓冲区的缓冲容量的10%,即为0.18MB。Exemplarily, the data size of the first file is 800MB, the upper limit Vmax of the transmission rate of the physical layer may be 2.4Gbps (300MB/s), the feedback time Ts of the MAC layer may be 2ms, and the buffer capacity of the transmission buffer of the MAC layer may be 1.8 MB, the first warning water level can be 1.2MB. The first rate may be 90% of the upper limit Vmax of the transmission rate of the physical layer, that is, 2.16Gbps (270MB/s), and the second rate may be 10% of the upper limit Vmax of the transmission rate of the physical layer, that is, 0.24Gbps (30MB/s). The above-mentioned first specified threshold may be 10% of the buffer capacity of the transmission buffer of the MAC layer, that is, 0.18MB.
在发送终端210设置完MAC层发送缓冲区的缓冲容量和第一预警水位线后,发送终端210可以以2.16Gbps(270MB/s)的速率向MAC层发送缓冲区写入第一文件的第一数据。发送终端210的网卡可以尽可能的以最大速率从MAC层发送缓冲区中取出第一文件的第一数据,发送给接收终端220。After the sending terminal 210 sets the buffer capacity of the MAC layer sending buffer and the first warning watermark, the sending terminal 210 can write the first file of the first file to the MAC layer sending buffer at a rate of 2.16Gbps (270MB/s). data. The network card of the sending terminal 210 can take out the first data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and send it to the receiving terminal 220 .
当发送终端210监测到MAC层发送缓冲区的已缓冲数据量已经达到1.2MB时,MAC层发送缓冲区的剩余容量为0.6MB。若第一文件的待发送数据量为600MB,此时,MAC层发送缓冲区的剩余容量小于第一文件的待发送数据量,发送终端210可以以0.24Gbps(30MB/s)的速率向MAC层发送缓冲区写入第一文件的第二数据。发送终端210的网卡可以尽可能的以最大速率从MAC层发送缓冲区中取出第一文件的第二数据,发送给接收终端220。When the sending terminal 210 monitors that the buffered data amount of the MAC layer sending buffer has reached 1.2MB, the remaining capacity of the MAC layer sending buffer is 0.6MB. If the amount of data to be sent in the first file is 600MB, at this time, the remaining capacity of the MAC layer sending buffer is less than the amount of data to be sent in the first file, and the sending terminal 210 can send the data to the MAC layer at a rate of 0.24Gbps (30MB/s). The send buffer writes the second data to the first file. The network card of the sending terminal 210 can take out the second data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and send it to the receiving terminal 220 .
由于降低了发送终端210读取第一文件的数据的速率,而网卡还在尽可能的以最大速率从MAC层发送缓冲区中取出第一文件的数据,并发送给接收终端220,MAC层发送缓冲区中的数据量会下降。当发送终端210监测到MAC层发送缓冲区中的数据量下降至0.18MB(总容量的10%)时,发送终端210可以以2.16Gbps(270MB/s)的速率向MAC层发送缓冲区写入第一文件的第三数据。发送终端210的网卡可以尽可能的以最大速率从MAC层发送缓冲区中取出第一文件的第三数据,发送给接收终端220。Since the rate at which the sending terminal 210 reads the data of the first file is reduced, the network card is still fetching the data of the first file from the MAC layer sending buffer at the maximum rate as much as possible, and sends it to the receiving terminal 220, and the MAC layer sends The amount of data in the buffer will drop. When the sending terminal 210 monitors that the amount of data in the MAC layer sending buffer drops to 0.18MB (10% of the total capacity), the sending terminal 210 can write to the MAC layer sending buffer at a rate of 2.16Gbps (270MB/s). The third data of the first file. The network card of the sending terminal 210 can take out the third data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and send it to the receiving terminal 220 .
上述示例仅用于解释本申请,不应构成限定。The above examples are only used to explain the present application and should not be construed as limitations.
在一种可能的实现方式中,当发送终端210监测到MAC层发送缓冲区的已缓冲数据量大于等于第一预警水位线,且MAC层发送缓冲区的剩余容量大于等于第一文件的待发 送数据量时,发送终端210可以继续以第一速率向MAC层发送缓冲区写入第一文件的第二数据,并通过网卡将MAC层发送缓冲区中第一文件的第二数据发送给接收终端220。发送终端210的网卡尽可能的以最大速率从MAC层发送缓冲区中取出第一文件的数据,发送给接收终端220。这样,可以在MAC层发送缓冲区的剩余容量足够支撑第一文件的待发送数据量时,发送终端210可以以极限速率读取第一文件的数据并发送给接收终端220,且MAC层发送缓冲区不会溢出丢包。In a possible implementation manner, when the sending terminal 210 monitors that the buffered data volume of the MAC layer sending buffer is greater than or equal to the first warning water level, and the remaining capacity of the MAC layer sending buffer is greater than or equal to the first file to be sent When the amount of data is large, the sending terminal 210 can continue to send the second data written in the first file to the MAC layer sending buffer at the first rate, and send the second data of the first file in the MAC layer sending buffer to the receiving terminal through the network card 220. The network card of the sending terminal 210 extracts the data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and sends the data to the receiving terminal 220 . In this way, when the remaining capacity of the MAC layer sending buffer is sufficient to support the amount of data to be sent of the first file, the sending terminal 210 can read the data of the first file at the limit rate and send it to the receiving terminal 220, and the MAC layer sends the buffer The zone will not overflow and drop packets.
在一种可能的实现方式中,当发送终端210监测到MAC层发送缓冲区的已缓冲数据量小于第一预警水位线时,发送终端210可以继续以第一速率向MAC层发送缓冲区写入第一文件的第二数据,并通过网卡将MAC层发送缓冲区中第一文件的第二数据发送给接收终端220。In a possible implementation manner, when the sending terminal 210 monitors that the amount of buffered data in the sending buffer of the MAC layer is less than the first warning water level, the sending terminal 210 may continue to write to the sending buffer of the MAC layer at the first rate The second data of the first file is sent to the receiving terminal 220 through the network card.
在一些实施例中,发送终端210可以只通过监测MAC层发送缓冲区的已缓冲数据量与第一预警水位线的关系,来决定第一文件的数据写入至MAC层发送缓冲区的速率。具体的,当发送终端210监测到MAC层发送缓冲区的已缓冲数据量大于等于第一预警水位线时,发送终端210可以以第二速率向MAC层发送缓冲区写入第一文件的第二数据,并通过网卡将MAC层发送缓冲区中第一文件的第二数据发送给接收终端220。当发送终端210监测到MAC层发送缓冲区的已缓冲数据量小于第一预警水位线时,发送终端210可以继续以第一速率向MAC层发送缓冲区写入第一文件的第二数据,并通过网卡将MAC层发送缓冲区中第一文件的第二数据发送给接收终端220。In some embodiments, the sending terminal 210 may determine the rate at which the data of the first file is written into the MAC layer sending buffer only by monitoring the relationship between the buffered data amount in the MAC layer sending buffer and the first warning watermark. Specifically, when the sending terminal 210 monitors that the amount of buffered data in the sending buffer of the MAC layer is greater than or equal to the first warning water level, the sending terminal 210 may write the second data of the first file to the sending buffer of the MAC layer at the second rate. data, and send the second data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card. When the sending terminal 210 monitors that the amount of buffered data in the sending buffer of the MAC layer is less than the first warning watermark, the sending terminal 210 may continue to write the second data of the first file to the sending buffer of the MAC layer at the first rate, and The second data of the first file in the MAC layer sending buffer is sent to the receiving terminal 220 through the network card.
通过本申请实施例的第二部分提供的一种数据传输的方法,可以通过设置发送端210的MAC层发送缓冲区(qdisk_buffer)的缓冲容量和第一预警水位线,并根据MAC层发送缓冲区(qdisk_buffer)的已缓冲数据量决定发送端210写入第一文件的数据至MAC层发送缓冲区的发送速率,实现文件的传输速度接近物理信道极限速率且降低丢包率。According to the data transmission method provided in the second part of the embodiment of the present application, the buffer capacity and the first warning water level of the MAC layer sending buffer (qdisk_buffer) of the sending end 210 can be set, and the buffer is sent according to the MAC layer. The buffered data volume of (qdisk_buffer) determines the sending rate of the data written by the sending end 210 into the first file to the MAC layer sending buffer, so that the file transmission speed is close to the limit rate of the physical channel and the packet loss rate is reduced.
请参考图10,图10示出了本申请实施例的第二部分提供的一种数据传输方法的流程示意图。其中,发送终端210可以被称为第一终端,接收终端220可以被称为第二终端。如图10所示,该方法可以包括如下步骤:Please refer to FIG. 10. FIG. 10 shows a schematic flowchart of a data transmission method provided in the second part of the embodiment of the present application. The sending terminal 210 may be referred to as the first terminal, and the receiving terminal 220 may be referred to as the second terminal. As shown in Figure 10, the method may include the following steps:
S1001、发送终端210获取到针对第一文件的传输请求。S1001. The sending terminal 210 obtains a transmission request for the first file.
具体内容,可以参考前述图8所示实施例中的步骤S501,在此不再赘述。For specific content, reference may be made to step S501 in the foregoing embodiment shown in FIG. 8 , which will not be repeated here.
S1002、发送终端210与接收终端220建立文件传输连接。S1002 , the sending terminal 210 establishes a file transmission connection with the receiving terminal 220 .
具体内容,可以参考前述图8所示实施例中的步骤S502,在此不再赘述。For specific content, reference may be made to step S502 in the foregoing embodiment shown in FIG. 8 , which will not be repeated here.
S1003、接收终端220获取发送终端210物理层传输速率上限Vmax和文件传输连接上的往返时延RTT。S1003. The receiving terminal 220 obtains the upper limit Vmax of the transmission rate of the physical layer of the transmitting terminal 210 and the round-trip delay RTT on the file transmission connection.
其中,物理层传输速率上限Vmax可以是预设在接收终端220上的。例如,当发送终端210和接收终端220配置的是2x2的MIMO天线,发送终端210和接收终端220之间的连接网络是基于Wi-Fi 5的无线局域网络时,物理层传输速率上限Vmax可以是1Gbps。当发送终端210和接收终端220配置的是2x2的MIMO天线,发送终端210和接收终端220之间的连接网络是基于Wi-Fi 6的无线局域网络时,物理层传输速率上限Vmax可以是 2.4Gbps。The upper limit Vmax of the physical layer transmission rate may be preset on the receiving terminal 220 . For example, when the sending terminal 210 and the receiving terminal 220 are configured with 2x2 MIMO antennas, and the connection network between the sending terminal 210 and the receiving terminal 220 is a Wi-Fi 5-based wireless local area network, the upper limit Vmax of the physical layer transmission rate may be 1Gbps. When the transmitting terminal 210 and the receiving terminal 220 are configured with 2x2 MIMO antennas, and the connection network between the transmitting terminal 210 and the receiving terminal 220 is a wireless local area network based on Wi-Fi 6, the upper limit Vmax of the physical layer transmission rate may be 2.4Gbps .
接收终端220可以在与发送终端210建立文件传输连接之后,检测接收终端220与发送终端210之间的往返时延。其中,接收终端220可以发送一个ICMP包给发送终端210,发送终端210在接收到ICMP包后,可以向接收终端220返回一个响应包。然后,接收终端220可以通过发送ICMP包的时间以及接收到发送终端210返回的响应包的时间,计算出的往返时延RTT。在一种可能的实现方式中,接收终端220可以多次发送ICMP包给发送终端210,接收终端220可以根据多个发包与收包的时间差,确定出RTT。例如,接收终端210可以将多个发包与收包的时间差,确定出RTT。又例如,接收终端220可以将多个发包与收包的时间差中的最大值,确定为RTT。The receiving terminal 220 may detect the round-trip delay between the receiving terminal 220 and the sending terminal 210 after establishing the file transmission connection with the sending terminal 210 . The receiving terminal 220 may send an ICMP packet to the sending terminal 210, and the sending terminal 210 may return a response packet to the receiving terminal 220 after receiving the ICMP packet. Then, the receiving terminal 220 can calculate the round-trip delay RTT according to the time of sending the ICMP packet and the time of receiving the response packet returned by the sending terminal 210 . In a possible implementation manner, the receiving terminal 220 may send the ICMP packet to the sending terminal 210 multiple times, and the receiving terminal 220 may determine the RTT according to the time difference between the sending and receiving of the multiple packets. For example, the receiving terminal 210 may determine the RTT based on the time difference between the sending and receiving of multiple packets. For another example, the receiving terminal 220 may determine the maximum value of the time differences between multiple packet sending and receiving as the RTT.
S1004、接收终端220根据物理层发送速率上限Vmax和往返时延RTT,确定出IP分片重组缓冲区和写缓冲区各自的缓冲容量和第二预警水位线。S1004. The receiving terminal 220 determines the respective buffer capacities and the second warning water level of the IP fragmentation reassembly buffer and the write buffer according to the upper limit Vmax of the transmission rate of the physical layer and the round-trip delay RTT.
IP分片重组缓冲区和写缓冲区的缓冲容量可以都为m,第二预警水位线可以为a*m,因此,当缓冲区中的缓冲水位线处于第一预警水位线时,缓冲区的剩余容量为(1-a)*m。其中,0<a<1。The buffer capacity of the IP fragmentation reassembly buffer and the write buffer can both be m, and the second warning watermark can be a*m. Therefore, when the buffer watermark in the buffer is at the first warning watermark, the buffer's The remaining capacity is (1-a)*m. where 0<a<1.
因为需要尽量保证最高的传输速率,同时又要降低丢包率,所以需要监控该IP分片重组缓冲区(或写缓冲区)的缓冲数据量既不能空,又不能溢出。若在t时刻该IP分片重组缓冲区(或写缓冲区)的已缓冲数据量达到第二预警水位线a*m,且在t+Δt时刻该IP分片重组缓冲区(或写缓冲区)的已缓冲数据量还会继续增长,要保证该IP分片重组缓冲区(或写缓冲区)不溢出,接收终端220需要发送缓冲信息给发送终端210的发送速率调度模块,进而让发送终端210的发送速率调度模块降低第一文件的数据写入至MAC层发送缓冲区的速率。该过程所花费的最大时间为0.5*RTT。若在t时刻该缓冲区的已缓冲数据量达到第二预警水位线a*m,且在t+Δt时刻已缓冲数据量继续下降,要保证接收终端220发送一次错误的反馈后(耗时0.5RTT),重新调整回正常的发送速率(又耗时0.5*RTT)。Because it is necessary to ensure the highest transmission rate as much as possible, and at the same time to reduce the packet loss rate, it is necessary to monitor the buffered data volume of the IP fragmentation reassembly buffer (or write buffer), which can neither be empty nor overflow. If the amount of buffered data in the IP fragmentation reassembly buffer (or write buffer) reaches the second warning water level a*m at time t, and at time t+Δt, the IP fragmentation reassembly buffer (or write buffer) ) will continue to grow. To ensure that the IP fragmentation reassembly buffer (or write buffer) does not overflow, the receiving terminal 220 needs to send the buffer information to the sending rate scheduling module of the sending terminal 210, so that the sending terminal The sending rate scheduling module of 210 reduces the rate at which the data of the first file is written into the sending buffer of the MAC layer. The maximum time this process takes is 0.5*RTT. If the amount of buffered data in the buffer reaches the second early warning water level a*m at time t, and the amount of buffered data continues to decrease at time t+Δt, it must be ensured that the receiving terminal 220 sends an erroneous feedback (it takes 0.5 RTT), re-adjust back to the normal sending rate (it takes 0.5*RTT again).
因此,发送终端210可以根据物理层传输速率上限Vmax和往返时延RTT,通过如下公式(8)和公式(9)确定出IP分片重组缓冲区和写缓冲区的缓冲容量和第二预警水位线。Therefore, the sending terminal 210 can determine the buffer capacity of the IP fragmentation reassembly buffer and the write buffer and the second early warning water level according to the upper limit Vmax of the physical layer transmission rate and the round-trip delay RTT by the following formulas (8) and (9) String.
((1-a)*m)/Vmax≥0.5*RTT  公式(8)((1-a)*m)/Vmax≥0.5*RTT Formula (8)
(a*m)/Vmax≥0.5*RTT+0.5*RTT  公式(9)(a*m)/Vmax≥0.5*RTT+0.5*RTT Formula (9)
其中,接收终端220可以根据物理层传输速率上限Vmax和往返时延RTT,通过公式(8)和公式(9),设置IP分片重组缓冲区和写缓冲区的缓冲容量和第二预警水位线。Wherein, the receiving terminal 220 can set the buffer capacity of the IP fragmentation reassembly buffer and the write buffer and the second early warning watermark by formula (8) and formula (9) according to the upper limit Vmax of the physical layer transmission rate and the round-trip delay RTT. .
示例性的,Vmax可以为2.4Gbps(300MB/s),RTT可以为16ms,根据上述公式(8)和公式(9)可以计算出m≥7.2MB,a=2/3。因此,接收终端220可以给MAC层接收缓冲区的容量和写缓冲区的容量都设置为7.2MB,第二预警水位线设置为4.8MB。Exemplarily, Vmax may be 2.4Gbps (300MB/s), and RTT may be 16ms. According to the above formula (8) and formula (9), m≧7.2MB can be calculated, and a=2/3. Therefore, the receiving terminal 220 may set both the capacity of the MAC layer's receive buffer and the capacity of the write buffer to 7.2MB, and the second early warning water level to be 4.8MB.
在一种可能的实现方式中,缓冲区的缓冲容量的单位可以是最大长度的数据包的个数,在根据上述公式(8)和公式(9)计算出缓冲区的以兆字节(MB)为单位的缓冲容量后,可以根据数据包的最大长度进行换算,得到缓冲区的以数据包的个数为单位的缓冲容量。例如,M为7.2MB,一个数据包的最大可以是1500字节(Byte),则缓冲区的缓冲容量为4800个数据包。In a possible implementation manner, the unit of the buffer capacity of the buffer may be the number of data packets with the maximum length, and the buffer is calculated in megabytes (MB) according to the above formula (8) and formula (9). ) as the unit of buffer capacity, it can be converted according to the maximum length of the data packet to obtain the buffer capacity of the buffer in the unit of the number of data packets. For example, if M is 7.2MB, and the maximum size of a data packet can be 1500 bytes (Byte), the buffer capacity of the buffer is 4800 data packets.
在一种可能的实现方式中,第二预警水位线可以是预设的,发送终端210可以根据上述公式(8)和公式(9)确定出IP分片重组缓冲区和写缓冲区的缓冲容量。In a possible implementation manner, the second early warning water level may be preset, and the sending terminal 210 may determine the buffer capacity of the IP fragmentation reassembly buffer and the write buffer according to the above formula (8) and formula (9). .
在一种可能的实现方式中,IP分片重组缓冲区和写缓冲区的缓冲容量可以是预设的,发送终端210可以根据上述公式(8)和公式(9)确定出第二预警水位线。In a possible implementation manner, the buffer capacity of the IP fragmentation reassembly buffer and the write buffer may be preset, and the sending terminal 210 may determine the second warning water level according to the above formula (8) and formula (9). .
S1005、在接收终端220设置完IP分片重组缓冲区的缓冲容量和写缓冲区这两个缓冲区的缓冲容量和第二预警水位线后,发送终端210可以以第一速率向MAC层发送缓冲区中写入第一文件的第一数据。S1005. After the receiving terminal 220 has set the buffer capacity of the IP fragmentation reassembly buffer and the buffer capacity of the write buffer and the second warning water level, the sending terminal 210 can send the buffer to the MAC layer at the first rate The first data of the first file is written in the area.
S1006、发送终端210通过网卡将MAC层发送缓冲区中第一文件的第一数据,并传输给接收终端220。S1006 , the sending terminal 210 transmits the first data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
其中,发送终端210可以根据物理层发送速率上限确定出第一速率。第一速率可以为接近物理层发送速率上限的值。物理层发送速率上限,即为发送终端210的网卡可支持的发送速率上限。例如,第一速率可以为物理层最大速率的90%。当物理层发送速率上限为2.4Gbps时,第一速率可以为2.16Gbps。The sending terminal 210 may determine the first rate according to the upper limit of the transmission rate of the physical layer. The first rate may be a value close to the upper limit of the transmission rate of the physical layer. The upper limit of the sending rate of the physical layer is the upper limit of the sending rate that can be supported by the network card of the sending terminal 210 . For example, the first rate may be 90% of the maximum rate of the physical layer. When the upper limit of the transmission rate of the physical layer is 2.4Gbps, the first rate may be 2.16Gbps.
发送终端210以第一速率从磁盘中中读取第一文件的第一数据后,写入至MAC层发送缓冲区的过程可以参考上述图7所示实施例,在此不再赘述。After the sending terminal 210 reads the first data of the first file from the disk at the first rate, the process of writing the first data to the MAC layer sending buffer may refer to the embodiment shown in FIG. 7 , which will not be repeated here.
发送终端210在将第一文件的第一数据下发至MAC层发送缓冲区后,可以通过网卡从MAC层发送缓冲区获取第一文件的第一数据,并封装成数据帧,发送给接收终端220。After sending the first data of the first file to the MAC layer sending buffer, the sending terminal 210 can obtain the first data of the first file from the MAC layer sending buffer through the network card, encapsulate it into a data frame, and send it to the receiving terminal. 220.
接收终端220的网卡在接收到发送终端210发送的数据帧后,可以从数据帧中解析出MAC数据包,并上发给MAC层接收缓冲区,然后,接收终端220可以从MAC层接收缓冲区中取出第一文件的数据,发送至写缓冲区。接着,接收终端220再从写缓冲区中第一文件的数据写入接收终端220的磁盘中。其中,接收终端220从MAC层接收缓冲区中取出第一文件的数据,上发至写缓冲区的过程可以参考上述图7所示实施例,在此不再赘述。After receiving the data frame sent by the sending terminal 210, the network card of the receiving terminal 220 can parse the MAC data packet from the data frame and send it to the MAC layer receiving buffer, and then the receiving terminal 220 can receive the buffer from the MAC layer. Take out the data of the first file and send it to the write buffer. Next, the receiving terminal 220 writes the data of the first file in the write buffer into the disk of the receiving terminal 220 . The process for the receiving terminal 220 to retrieve the data of the first file from the MAC layer receive buffer and send it to the write buffer may refer to the embodiment shown in FIG. 7 , which will not be repeated here.
S1007、接收终端220可以监测IP分片重组缓冲区和写缓冲区中是否存在已缓冲数据量大于等于第二预警水位线的第一缓冲区,若是,则执行S1008、接收终端220可以判断第一缓冲区中的剩余容量是否小于第一文件中待发送数据量。若是,则执行S1009、接收终端220可以反馈第一缓冲信息给发送终端210。S1007, the receiving terminal 220 can monitor whether there is a first buffer with the amount of buffered data greater than or equal to the second early warning water level in the IP fragmentation reassembly buffer and the write buffer, and if so, execute S1008, and the receiving terminal 220 can determine the first buffer Whether the remaining capacity in the buffer is less than the amount of data to be sent in the first file. If yes, perform S1009 , and the receiving terminal 220 may feed back the first buffer information to the sending terminal 210 .
S1010、发送终端210在接收到第一缓冲信息后,可以响应于该第一缓冲信息,以第三速率(例如物理层发送速率上限的10%或0)向MAC层发送缓冲区写入第一文件的第四数据。S1010. After receiving the first buffer information, the sending terminal 210 may write the first buffer to the MAC layer sending buffer at a third rate (for example, 10% or 0 of the upper limit of the physical layer sending rate) in response to the first buffer information. The fourth data of the file.
S1011、发送终端210通过网卡将MAC层发送缓冲区中第一文件的第四数据,发给接收终端220。S1011. The sending terminal 210 sends the fourth data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
第三速率小于第一速率。例如,第三速率可以为发送端210的物理层发送速率上限的10%,等等。The third rate is less than the first rate. For example, the third rate may be 10% of the upper limit of the transmission rate of the physical layer of the transmitter 210, and so on.
其中,在发送终端210与接收终端220建立文件传输连接时,发送终端210可以将第一文件的总数据量发送给接收终端220。接收终端220可以统计第一文件的已接收数据量,然后,接收终端220可以根据第一文件的总数据量和已接收数据量,确定出第一文件的待 发送数据量。Wherein, when the sending terminal 210 establishes a file transmission connection with the receiving terminal 220, the sending terminal 210 may send the total data volume of the first file to the receiving terminal 220. The receiving terminal 220 may count the received data volume of the first file, and then the receiving terminal 220 may determine the to-be-sent data volume of the first file according to the total data volume and the received data volume of the first file.
接收终端220可以监测IP分片重组缓冲区和写缓冲区的已缓冲数据量,当监测到IP分片重组缓冲区和写缓冲区中的第一缓冲区的已缓冲数据量大于等于预警水位线,且第一缓冲区的剩余容量小于第一文件的待发送数据量时,接收终端220可以向发送终端210反馈第一缓冲信息,其中,该第一缓冲信息可用于指示发送终端210以第三速率向MAC层发送缓冲区中写入第一文件的第四数据。发送终端210在接收到该第一缓冲信息后,可以以第三速率向MAC层发送缓冲区写入第一文件的第四数据,并通过网卡将MAC层发送缓冲区中第一文件的第四数据发送给接收终端220。这样,可以在接收终端220的MAC层接收缓冲区或写缓冲区的缓冲水位线超过第二预警水位线,且IP分片重组缓冲区或写缓冲区的剩余容量不足以支撑第一文件的待发送数据量时,让发送终端210降低读取第一文件的数据,接着,发送终端210网卡的发送速率就会降低,接收终端220上的IP分片重组缓冲区或写缓冲区不会溢出丢包。The receiving terminal 220 can monitor the buffered data volume of the IP fragmentation reassembly buffer and the write buffer, and when it is detected that the buffered data volume of the first buffer in the IP fragmentation reassembly buffer and the write buffer is greater than or equal to the warning watermark , and when the remaining capacity of the first buffer is less than the amount of data to be sent in the first file, the receiving terminal 220 may feed back the first buffering information to the sending terminal 210, where the first buffering information may be used to instruct the sending terminal 210 to use the third The rate sends the fourth data written in the first file in the buffer to the MAC layer. After receiving the first buffer information, the sending terminal 210 can send the fourth data written in the first file to the MAC layer sending buffer at the third rate, and send the fourth data of the first file in the MAC layer sending buffer through the network card. The data is sent to the receiving terminal 220 . In this way, the buffer watermark of the receiving buffer or the write buffer at the MAC layer of the receiving terminal 220 may exceed the second warning watermark, and the remaining capacity of the IP fragmentation reassembly buffer or the write buffer is not enough to support the waiting of the first file. When sending the amount of data, let the sending terminal 210 reduce the data read in the first file, then, the sending rate of the network card of the sending terminal 210 will be reduced, and the IP fragmentation reassembly buffer or write buffer on the receiving terminal 220 will not overflow and be lost. Bag.
当接收终端220监测到MAC层和写缓冲区中第一缓冲区的已缓冲数据量大于等于第二预警水位线,且第一缓冲区的剩余容量大于等于第一文件的待发送数据量时,接收终端220无需通知发送终端210,发送终端210继续以第一速率向MAC层发送缓冲区写入第一文件的第四数据,并通过网卡将MAC层发送缓冲区中第一文件的第四数据发送给接收终端220。这样,可以在IP分片重组缓冲区和写缓冲区的剩余容量足够支撑第一文件的待发送数据量时,发送终端210可以以极限速率读取第一文件的数据并发送给接收终端220,且接收终端220上的IP分片重组缓冲区和写缓冲区不会溢出丢包。When the receiving terminal 220 monitors that the buffered data volume of the first buffer in the MAC layer and the write buffer is greater than or equal to the second warning watermark, and the remaining capacity of the first buffer is greater than or equal to the data volume to be sent of the first file, The receiving terminal 220 does not need to notify the sending terminal 210, and the sending terminal 210 continues to send the fourth data of the first file in the buffer to the MAC layer at the first rate, and sends the fourth data of the first file in the buffer to the MAC layer through the network card. sent to the receiving terminal 220 . In this way, when the remaining capacity of the IP fragmentation reassembly buffer and the write buffer is sufficient to support the amount of data to be sent of the first file, the sending terminal 210 can read the data of the first file at the limit rate and send it to the receiving terminal 220, In addition, the IP fragmentation reassembly buffer and the write buffer on the receiving terminal 220 will not overflow and lose packets.
在一种可能的实现方式中,当接收终端220监测到MAC层和写缓冲区中第一缓冲区的已缓冲数据量小于等于第二预警水位线时,接收终端220无需通知发送终端210,发送终端210继续以第一速率向MAC层发送缓冲区写入第一文件的第四数据,并通过网卡将MAC层发送缓冲区中第一文件的第四数据发送给接收终端220。In a possible implementation manner, when the receiving terminal 220 monitors that the amount of buffered data in the first buffer in the MAC layer and the write buffer is less than or equal to the second early warning water level, the receiving terminal 220 does not need to notify the sending terminal 210 to send the The terminal 210 continues to write the fourth data of the first file in the MAC layer sending buffer at the first rate, and sends the fourth data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
在一些实施例中,接收终端220可以只通过监测第一缓冲区的已缓冲数据量与第二预警水位线的关系,来决定是否触发发送终端210降低第一文件的数据写入至MAC层发送缓冲区的速率。具体的,当接收终端220监测到第一缓冲区的已缓冲数据量大于等于第一预警水位线时,接收终端220发送第一缓冲信息给发送终端210。发送终端210可以响应于第一缓冲信息以第三速率向MAC层发送缓冲区写入第一文件的第四数据,并通过网卡将MAC层发送缓冲区中第一文件的第四数据发送给接收终端220。当接收终端220监测到第一缓冲区的已缓冲数据量小于第二预警水位线时,接收终端220无需发送第一缓冲信息给发送终端210。发送终端210可以继续以第一速率向MAC层发送缓冲区写入第一文件的第四数据,并通过网卡将MAC层发送缓冲区中第一文件的第四数据发送给接收终端220。In some embodiments, the receiving terminal 220 may determine whether to trigger the sending terminal 210 to reduce the writing of the data of the first file to the MAC layer for sending only by monitoring the relationship between the amount of buffered data in the first buffer and the second warning water level The rate of the buffer. Specifically, when the receiving terminal 220 monitors that the amount of buffered data in the first buffer is greater than or equal to the first warning water level, the receiving terminal 220 sends the first buffering information to the sending terminal 210 . The sending terminal 210 may write the fourth data of the first file to the MAC layer sending buffer at a third rate in response to the first buffer information, and send the fourth data of the first file in the MAC layer sending buffer to the receiver through the network card. Terminal 220. When the receiving terminal 220 monitors that the amount of buffered data in the first buffer is less than the second early warning water level, the receiving terminal 220 does not need to send the first buffering information to the sending terminal 210 . The sending terminal 210 may continue to write the fourth data of the first file in the MAC layer sending buffer at the first rate, and send the fourth data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
S1012、接收终端220在向发送终端210反馈第一缓冲信息后,接收终端220可以判断第一缓冲区中的已缓冲数据量是否小于第二指定阈值。若是,则执行步骤S1013、接收终端220向发送终端210反馈第二缓冲信息。S1012. After the receiving terminal 220 feeds back the first buffering information to the sending terminal 210, the receiving terminal 220 may determine whether the amount of buffered data in the first buffer is less than the second specified threshold. If so, step S1013 is executed, and the receiving terminal 220 feeds back the second buffer information to the transmitting terminal 210 .
S1014、发送终端210接收到接收终端220反馈的第二缓冲信息后,可以响应于该第二缓冲信息,以第一速率向MAC层发送缓冲区中写入第一文件的第五数据。S1014. After receiving the second buffering information fed back by the receiving terminal 220, the sending terminal 210 may, in response to the second buffering information, send the fifth data written in the first file in the buffer to the MAC layer at the first rate.
S1015、发送终端210通过网卡将MAC层发送缓冲区中第一文件的第五数据,发给接收终端220。S1015. The sending terminal 210 sends the fifth data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
在接收终端220向发送终端210反馈第一缓冲信息之后,当接收终端220检测到第一缓冲区中的已缓冲数据量小于等于第二指定阈值(例如IP分片重组缓冲区或写缓冲区总容量的10%或0)时,接收终端220可以向发送终端210反馈第二缓冲信息。其中,该第二缓冲信息可用于指示发送终端210以第一速率向MAC层发送缓冲区中写入第一文件的第五数据。发送终端210在接收到接收终端220反馈的第二缓冲信息后,可以以第一速率向MAC层发送缓冲区中写入第一文件的第五数据,并通过网卡将MAC层发送缓冲区中第一文件的第五数据,发给接收终端220。After the receiving terminal 220 feeds back the first buffering information to the sending terminal 210, when the receiving terminal 220 detects that the amount of buffered data in the first buffer is less than or equal to the second specified threshold (for example, the IP fragment reassembly buffer or the total write buffer When the capacity is 10% or 0), the receiving terminal 220 may feed back the second buffer information to the transmitting terminal 210. The second buffer information may be used to instruct the sending terminal 210 to send the fifth data written in the first file in the buffer to the MAC layer at the first rate. After receiving the second buffer information fed back by the receiving terminal 220, the sending terminal 210 can send the fifth data written in the first file to the MAC layer at the first rate, and send the first data in the MAC layer to the buffer through the network card. The fifth data of a file is sent to the receiving terminal 220 .
在一种可能的实现方式中,当发送终端210在接收到接收终端220反馈的第二缓冲信息后,若MAC层发送缓冲区的缓冲水位线大于等于第一预警水位线,且MAC层发送缓冲区的剩余容量小于等于第一文件的待发送数据量,发送终端210以第二速率向MAC层发送缓冲区中写入第一文件的数据,并通过网卡将MAC层发送缓冲区中第一文件的数据,发给接收终端220。In a possible implementation manner, after the sending terminal 210 receives the second buffer information fed back by the receiving terminal 220, if the buffer water level of the MAC layer sending buffer is greater than or equal to the first warning water level, and the MAC layer sends the buffer If the remaining capacity of the area is less than or equal to the amount of data to be sent in the first file, the sending terminal 210 sends the data written in the first file in the buffer to the MAC layer at the second rate, and sends the first file in the buffer to the MAC layer through the network card. The data is sent to the receiving terminal 220.
在一种可能的实现方式中,当发送终端210在接收到接收终端220反馈的第二缓冲信息后,若MAC层发送缓冲区的缓冲水位线大于等于第一预警水位线,且MAC层发送缓冲区的剩余容量小于第一文件的待发送数据量,发送终端210以第一速率从向MAC层发送缓冲区中写入第一文件的数据,并通过网卡将MAC层发送缓冲区中第一文件的数据,发给接收终端220。In a possible implementation manner, after the sending terminal 210 receives the second buffer information fed back by the receiving terminal 220, if the buffer water level of the MAC layer sending buffer is greater than or equal to the first warning water level, and the MAC layer sends the buffer The remaining capacity of the area is less than the amount of data to be sent in the first file, and the sending terminal 210 writes the data of the first file from the sending buffer to the MAC layer at the first rate, and sends the first file in the sending buffer to the MAC layer through the network card. The data is sent to the receiving terminal 220.
示例性的,第一文件的数据大小为800MB,物理层发送速率上限Vmax可以为2.4Gbps(300MB/s),发送终端210的MAC层反馈时间Ts为2ms,MAC层发送缓冲区、MAC层接收缓冲区和写缓冲区的缓冲容量都可以为1.8MB,第一预警水位线可以为1.2MB。发送终端210与接收终端220之间的往返时延RTT可以为16ms。IP分片重组缓冲区和写缓冲区的缓冲容量可以为7.2MB。第二预警水位线可以为4.8MB。第一速率可以为物理层发送速率上限Vmax的90%,即为2.16Gbps(270MB/s),第二速率可以为物理层发送速率上限Vmax的10%,即为0.24Gbps(30MB/s)。第三速率可以为物理层发送速率上限Vmax的10%,即为0.24Gbps(30MB/s)。上述第一指定阈值可以为MAC层发送缓冲区的缓冲容量的10%,即为0.18MB。上述第二指定阈值可以为IP分片重组缓冲区和写缓冲区的缓冲容量的10%,即为0.72MB。Exemplarily, the data size of the first file is 800MB, the upper limit Vmax of the physical layer transmission rate may be 2.4Gbps (300MB/s), the MAC layer feedback time Ts of the transmitting terminal 210 is 2ms, the MAC layer transmission buffer, the MAC layer reception The buffer capacity of the buffer and the write buffer can both be 1.8MB, and the first warning water level can be 1.2MB. The round-trip delay RTT between the sending terminal 210 and the receiving terminal 220 may be 16 ms. The buffer capacity of the IP fragment reassembly buffer and write buffer can be 7.2MB. The second warning water level can be 4.8MB. The first rate may be 90% of the upper limit Vmax of the transmission rate of the physical layer, that is, 2.16Gbps (270MB/s), and the second rate may be 10% of the upper limit Vmax of the transmission rate of the physical layer, that is, 0.24Gbps (30MB/s). The third rate may be 10% of the upper limit Vmax of the transmission rate of the physical layer, that is, 0.24Gbps (30MB/s). The above-mentioned first specified threshold may be 10% of the buffer capacity of the transmission buffer of the MAC layer, that is, 0.18MB. The above-mentioned second specified threshold may be 10% of the buffer capacity of the IP fragmentation reassembly buffer and the write buffer, that is, 0.72MB.
在发送终端210与接收终端220都设置完各自缓冲区的容量和预警水位线后,发送终端210可以以2.16Gbps(270MB/s)的速率,向MAC层发送缓冲区第一文件的第一数据,发送终端210的网卡可以尽可能的以最大速率从MAC层发送缓冲区中取出第一文件的第一数据,发送给接收终端220。After both the sending terminal 210 and the receiving terminal 220 have set the capacity of their respective buffers and the warning water level, the sending terminal 210 can send the first data of the first file in the buffer to the MAC layer at a rate of 2.16Gbps (270MB/s). , the network card of the sending terminal 210 can extract the first data of the first file from the sending buffer of the MAC layer at the maximum rate as much as possible, and send it to the receiving terminal 220 .
当接收终端220监测到IP分片重组缓冲区(或写缓冲区)的已缓冲数据量已经达到4.8MB时,IP分片重组缓冲区(或写缓冲区)的剩余容量为2.4MB。若第一文件的待发送数据量为600MB,此时,IP分片重组缓冲区(或写缓冲区)的剩余容量小于第一文件的待发送数据量,接收终端220反馈第一缓冲信息给发送终端210。发送终端210在接收到反馈的第一缓冲信息后,可以以0.24Gbps(30MB/s)的速率向MAC层发送缓冲区写入第一 文件的第四数据,并通过该网卡将MAC层发送缓冲区中第一文件的第四数据发送给接收终端220。When the receiving terminal 220 detects that the buffered data volume of the IP fragmentation reassembly buffer (or the write buffer) has reached 4.8MB, the remaining capacity of the IP fragmentation reassembly buffer (or the write buffer) is 2.4MB. If the amount of data to be sent in the first file is 600MB, at this time, the remaining capacity of the IP fragmentation reassembly buffer (or write buffer) is smaller than the amount of data to be sent in the first file, and the receiving terminal 220 feeds back the first buffer information to the sender. Terminal 210. After receiving the feedback first buffer information, the sending terminal 210 can send the fourth data written in the first file to the MAC layer sending buffer at a rate of 0.24Gbps (30MB/s), and send the MAC layer sending buffer through the network card. The fourth data of the first file in the zone is sent to the receiving terminal 220 .
由于降低了发送终端210读取第一文件的数据的速率,也降低了网卡从MAC层发送缓冲区中取出第一文件的数据的速率。IP分片重组缓冲区(或写缓冲区)中的数据量会下降。当接收终端220监测到IP分片重组缓冲区(或写缓冲区)中的数据量下降至0.72MB(总容量的10%)时,接收终端220可以反馈第二缓冲信息给发送终端210。在发送终端210接收到第二缓冲信息时,若发送终端210监测到MAC层发送缓冲区的缓冲水位线为1MB(低于第一预警水位线1.2MB),发送终端210可以以2.16Gbps(270MB/s)的速率向MAC层发送缓冲区写入第一文件的第五数据,并通过该网卡将MAC层发送缓冲区中第一文件的第五数据发送给接收终端220。Since the rate at which the sending terminal 210 reads the data of the first file is reduced, the rate at which the network card takes out the data of the first file from the MAC layer sending buffer is also reduced. The amount of data in the IP fragment reassembly buffer (or write buffer) drops. When the receiving terminal 220 detects that the data volume in the IP fragmentation reassembly buffer (or write buffer) drops to 0.72MB (10% of the total capacity), the receiving terminal 220 may feed back the second buffer information to the sending terminal 210 . When the sending terminal 210 receives the second buffering information, if the sending terminal 210 monitors that the buffer water level of the MAC layer sending buffer is 1 MB (lower than the first warning water level by 1.2 MB), the sending terminal 210 can use 2.16 Gbps (270 MB) /s) to write the fifth data of the first file into the MAC layer sending buffer, and send the fifth data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
若在发送终端210接收到第二缓冲信息时,发送终端210监测到MAC层发送缓冲区的缓冲水位线为1.2MB(达到第一预警水位线1.2MB),且第一文件的待发送数据量为200MB(大于MAC层发送缓冲区的剩余容量2.4MB)时,发送终端210可以以0.24Gbps(30MB/s)的速率向MAC层发送缓冲区写入第一文件的第五数据,并通过该网卡将MAC层发送缓冲区中第一文件的第五数据发送给接收终端220。When the sending terminal 210 receives the second buffer information, the sending terminal 210 monitors that the buffer water level of the MAC layer send buffer is 1.2 MB (reaches the first warning water level of 1.2 MB), and the data volume of the first file to be sent is 1.2 MB. When it is 200MB (larger than the remaining capacity of the MAC layer sending buffer, which is 2.4MB), the sending terminal 210 can write the fifth data of the first file to the MAC layer sending buffer at a rate of 0.24Gbps (30MB/s), and pass the The network card sends the fifth data of the first file in the MAC layer sending buffer to the receiving terminal 220 .
若在发送终端210在接收到接收终端220反馈的第二缓冲信息后,发送终端210监测到MAC层发送缓冲区的缓冲水位线为1.2MB(达到第一预警水位线1.2MB),且第一文件的待发送数据量为2MB(小于MAC层发送缓冲区的剩余容量2.4MB)时,发送终端210以2.16Gbps(270MB/s)的速率向MAC层发送缓冲区写入第一文件的第四数据,并通过该网卡将MAC层发送缓冲区中第一文件的第四数据发送给接收终端220。If, after the sending terminal 210 receives the second buffer information fed back by the receiving terminal 220, the sending terminal 210 monitors that the buffer water level of the MAC layer send buffer is 1.2 MB (reaches the first warning water level of 1.2 MB), and the first When the amount of data to be sent in the file is 2MB (less than the remaining capacity of 2.4MB in the sending buffer of the MAC layer), the sending terminal 210 writes the fourth file of the first file to the sending buffer of the MAC layer at a rate of 2.16Gbps (270MB/s). and send the fourth data of the first file in the MAC layer sending buffer to the receiving terminal 220 through the network card.
上述示例仅仅用于解释本申请,不应构成限定。The above examples are only used to explain the present application and should not be construed as limitations.
在一些实施例中,接收终端220可以将IP分片重组缓冲区的缓冲水位线和写缓冲区的缓冲水位线周期性(例如,周期为2ms)发送给发送终端210。发送终端210可以判断MAC层发送缓冲区、IP分片重组缓冲区、写缓冲区这三个缓冲区中是否存在大于等于预警水位线的第二缓冲区(例如,MAC层发送缓冲区)。若存在,则发送终端210可以判断第二缓冲区的剩余容量是否小于第一文件的待发送数据量。当缓冲区B的剩余容量小于第一文件的待发送数据量时,发送终端210可以以第四速率(例如物理层发送速率上限的10%或0),从机身存储中读取第一文件的数据,并下发至MAC层发送缓冲区。之后,发送终端210可以判断该第二缓冲区中的缓冲水位线是否小于等于指定阈值,若是,则发送终端210可以以第一速率(例如物理层发送速率上限的90%)向MAC层发送缓冲区写入第一文件的第四数据,并通过该网卡将MAC层发送缓冲区中第一文件的第四数据发送给接收终端220。其中,第四速率小于第一速率。In some embodiments, the receiving terminal 220 may send the buffer watermark of the IP fragmentation reassembly buffer and the buffer watermark of the write buffer to the sending terminal 210 periodically (eg, with a period of 2 ms). The sending terminal 210 can determine whether there is a second buffer (eg, the MAC layer sending buffer) that is greater than or equal to the warning water level in the three buffers: the MAC layer sending buffer, the IP fragmentation reassembly buffer, and the write buffer. If it exists, the sending terminal 210 may determine whether the remaining capacity of the second buffer is less than the amount of data to be sent of the first file. When the remaining capacity of the buffer B is less than the amount of data to be sent in the first file, the sending terminal 210 may read the first file from the body storage at a fourth rate (for example, 10% or 0 of the upper limit of the physical layer sending rate). The data is sent to the MAC layer send buffer. Afterwards, the sending terminal 210 can judge whether the buffer watermark in the second buffer is less than or equal to the specified threshold, and if so, the sending terminal 210 can send the buffer to the MAC layer at the first rate (eg, 90% of the upper limit of the physical layer sending rate) The fourth data of the first file is written into the area, and the fourth data of the first file in the MAC layer sending buffer is sent to the receiving terminal 220 through the network card. Wherein, the fourth rate is smaller than the first rate.
需要说明的是,上述图10所示实施例的方法步骤和图8所示实施例的方法步骤可以相互结合。It should be noted that, the method steps of the embodiment shown in FIG. 10 and the method steps of the embodiment shown in FIG. 8 may be combined with each other.
本申请的实施例的第二部分中,不限制只通过监控MAC层发送缓冲区、IP分片重组缓冲区和写缓冲区这三个缓冲区中的缓冲水位线,对发送终端210的发送速率进行控制。In the second part of the embodiment of the present application, it is not limited to monitor the buffer watermarks in the three buffers: the MAC layer sending buffer, the IP fragmentation reassembly buffer and the write buffer, and the sending rate of the sending terminal 210 is not limited Take control.
在一些实施例中,还可以通过监控MAC层发送缓冲区、MAC层接收缓冲区、写缓冲区这三个缓冲区中的缓冲水位线,对发送终端210的发送速率进行控制。在一些实施例中,还可以通过监控MAC层发送缓冲区、IP分片重组缓冲区、MAC层接收缓冲区、写缓冲区这四个缓冲区中的缓冲水位线,对发送终端210的发送速率进行控制。在一些实施例中,还可以通过监控MAC层发送缓冲区和写缓冲区这四个缓冲区中的缓冲水位线,对发送终端210的发送速率进行控制。针对控制发送终端210的发送速率的过程,可以参考前述图7所示实施例,在此不再赘述。In some embodiments, the sending rate of the sending terminal 210 may also be controlled by monitoring buffer watermarks in the three buffers of the MAC layer sending buffer, the MAC layer receiving buffer, and the writing buffer. In some embodiments, the sending rate of the sending terminal 210 may also be monitored by monitoring the buffer watermarks in the four buffers: the MAC layer sending buffer, the IP fragmentation reassembly buffer, the MAC layer receiving buffer, and the writing buffer. Take control. In some embodiments, the sending rate of the sending terminal 210 may also be controlled by monitoring the buffer watermarks in the four buffers, the sending buffer and the writing buffer, of the MAC layer. For the process of controlling the sending rate of the sending terminal 210, reference may be made to the foregoing embodiment shown in FIG. 7, and details are not described herein again.
图11示出了本申请实施例的第二部分中提供的一种数据传输方法中,发送终端210上MAC层发送缓冲区的缓冲水位线随时间变化的示意图。FIG. 11 shows a schematic diagram of the time-varying buffer watermark of the MAC layer transmit buffer on the transmitting terminal 210 in a data transmission method provided in the second part of the embodiment of the present application.
如图11所示,发送终端210上MAC层发送缓冲区(qdisk_buffer)的缓冲容量可以是10000个数据包,预警水位线可以是7500个数据包。其中,在发送终端210向接收终端220传输第一文件的过程中,MAC层发送缓冲区中的一直有数据,且MAC层发送缓冲区中的缓冲水位线未达到10000,说明发送终端210的发送速率达到了硬件的极限,且MAC层发送缓冲区未溢出丢包。根据实验数据可得,采用本申请实施例提供的一种数据传输方法,发送终端210基于Wi-Fi 6网络且开启雷达频段向接收终端220传输20GB的文件时,传输速率平均可以达到210MB/s,可达到网卡物理极限速率的100%,传输速率抖动可以小于10MB/s,丢包数量小于10个。As shown in FIG. 11 , the buffer capacity of the sending buffer (qdisk_buffer) of the MAC layer on the sending terminal 210 may be 10,000 data packets, and the warning watermark may be 7,500 data packets. Wherein, in the process of transmitting the first file from the sending terminal 210 to the receiving terminal 220, there is always data in the sending buffer of the MAC layer, and the buffer water mark in the sending buffer of the MAC layer does not reach 10000, indicating that the sending terminal 210 sends The rate reaches the limit of the hardware, and the MAC layer send buffer does not overflow and lose packets. According to the experimental data, using a data transmission method provided by the embodiment of the present application, when the transmitting terminal 210 transmits a 20 GB file to the receiving terminal 220 based on the Wi-Fi 6 network and the radar frequency band is turned on, the average transmission rate can reach 210 MB/s , can reach 100% of the physical limit rate of the network card, the transmission rate jitter can be less than 10MB/s, and the number of lost packets is less than 10.
本申请实施例的第二部分提供的一种数据传输的方法,可以通过设置发送端和接收端上指定的一个或多个缓冲区的容量和预警水位线,例如,发送端的MAC层发送缓冲区(qdisk_buffer)、接收端的MAC层发送缓冲区(netdev_backlog_buffer)、接收端的IP分片重组缓冲区(ip_defrag_buffer)和接收端的写缓冲区(write_buffer)。然后,可以根据这一个或多个缓冲区中当前的已缓冲数据量决定发送端的发送速率,实现文件的传输速度接近物理信道极限速率且降低丢包率。A data transmission method provided in the second part of the embodiment of the present application can be set by setting the capacity and warning water level of one or more buffers specified on the sending end and the receiving end. For example, the MAC layer of the sending end sends the buffer (qdisk_buffer), the MAC layer send buffer (netdev_backlog_buffer) of the receiver, the IP fragmentation reassembly buffer (ip_defrag_buffer) of the receiver, and the write buffer (write_buffer) of the receiver. Then, the sending rate of the sender can be determined according to the current amount of buffered data in the one or more buffers, so that the transmission speed of the file is close to the limit rate of the physical channel and the packet loss rate is reduced.
下面结合图12-图15介绍本申请实施例的第三部分提供的一种数据存储方法及相关内容。The following describes a data storage method and related content provided in the third part of the embodiment of the present application with reference to FIG. 12 to FIG. 15 .
在本申请实施例的第三部分中一些名词的序号不继续沿用本申请实施例其他部分中的序号的顺序,在本申请实施例的第三部分中的名词仅仅在在本申请实施例第三部分中使用。The sequence numbers of some terms in the third part of the embodiments of the present application do not continue to follow the sequence numbers of other parts of the embodiments of the present application, and the nouns in the third part of the embodiments of the present application are only used in the third part of the embodiments of the present application used in part.
本申请实施例的第三部分提供了一种数据存储方法,包括:终端接收第一文件的数据,并将该第一文件的数据存入网络协议栈接收缓冲区中。该终端从网络协议栈接收缓冲区中取出第一文件的数据直接写入磁盘中。该终端获取该网络协议栈接收缓冲区的剩余缓冲容量、第一文件的待传输数据量、该网络协议栈接收缓冲区的缓冲数据增长速率。若该网络协议栈接收缓冲区的缓冲数据增速率大于0,该终端根据该网络协议栈接收缓冲区的剩余缓冲容量、该第一文件的待传输数据量、该网络协议栈接收缓冲区的缓冲数据增长速率和网卡接收速率,确定出该网络协议栈接收缓冲区的溢出时间和该第一文件的剩余传输时间。若该网络协议栈接收缓冲区的溢出时间小于该第一文件的剩余传输时间,且该网络协议栈 接收缓冲区的已缓冲数据量大于第一阈值,该终端将存入该网络协议栈接收缓冲区中的数据转存到用户态缓冲区,并将该用户态缓冲区中的数据经过内核态写缓冲区写入该磁盘中。The third part of the embodiments of the present application provides a data storage method, including: a terminal receives data of a first file, and stores the data of the first file in a network protocol stack receiving buffer. The terminal takes out the data of the first file from the receiving buffer of the network protocol stack and writes it directly into the disk. The terminal obtains the remaining buffer capacity of the receiving buffer of the network protocol stack, the amount of data to be transmitted of the first file, and the growth rate of the buffered data of the receiving buffer of the network protocol stack. If the buffered data increment rate of the receiving buffer of the network protocol stack is greater than 0, the terminal shall, according to the remaining buffer capacity of the receiving buffer of the network protocol stack, the amount of data to be transmitted of the first file, and the size of the receiving buffer of the network protocol stack, The buffer data growth rate and the network card receiving rate are used to determine the overflow time of the receiving buffer of the network protocol stack and the remaining transmission time of the first file. If the overflow time of the receiving buffer of the network protocol stack is less than the remaining transmission time of the first file, and the amount of buffered data in the receiving buffer of the network protocol stack is greater than the first threshold, the terminal will store it in the receiving buffer of the network protocol stack The data in the area is dumped to the user mode buffer, and the data in the user mode buffer is written to the disk through the kernel mode write buffer.
通过本申请实施例的第三部分提供的一种数据存储方法,终端可以在接收到文件数据后,通过内核态的网络协议栈接收缓冲区中的水位线,采取不同的数据存储路径,这样,可以避免网络协议栈接收缓冲区中溢出而导致丢包,在高速传输文件数据的同时,降低丢包率。Through the data storage method provided in the third part of the embodiment of the present application, after receiving the file data, the terminal can receive the watermark in the buffer through the network protocol stack in the kernel state, and adopt different data storage paths. In this way, It can avoid packet loss caused by overflow in the receiving buffer of the network protocol stack, and reduce the packet loss rate while transmitting file data at high speed.
首先,介绍TCP传输协议中的拥塞控制基本逻辑。First, the basic logic of congestion control in the TCP transport protocol is introduced.
图12示出了TCP传输协议中拥塞控制机制的基本逻辑。如图12所示,在发送端开始将文件数据传输给接收端后,接收端可以统计丢包率,并将丢包率反馈给发送端,发送端可以判断丢包率是否升高,若丢包率升高,则发送端可以降低数据包的发送速率,例如,发送端将发送速率减低为之前的一半,当发送端确定丢包率未升高时,发送端可以提升发送速率,例如,发送端将发送速率比之前的发送速率增加固定值Δ。这样,可以改善网络拥塞程度,网络拥塞程度得到改善后,会影响接收端统计的丢包率。Figure 12 shows the basic logic of the congestion control mechanism in the TCP transport protocol. As shown in Figure 12, after the sender starts to transmit the file data to the receiver, the receiver can count the packet loss rate and feed it back to the sender. The sender can determine whether the packet loss rate has increased. If the packet rate increases, the sender can reduce the sending rate of data packets. For example, the sender reduces the sending rate to half the previous rate. When the sender determines that the packet loss rate does not increase, the sender can increase the sending rate. For example, The sender increases the sending rate by a fixed value Δ from the previous sending rate. In this way, the degree of network congestion can be improved. After the degree of network congestion is improved, the packet loss rate counted by the receiver will be affected.
如图13所示,当遇到因空口同频干扰等因素导致丢包时,发送端的拥塞控制策略无法改善空口同频干扰等因素对丢包率的影响。因此,在空口同频干扰等因素的影响下,发送端通过拥塞控制策略将发送速率降低为之前的一半,也不能改善同频干扰对丢包率的影响,并且,在丢包未升高时,发送端将发送速率比之前的发送速率增加固定值Δ过于保守,无法提高数据传输的速率。As shown in Figure 13, when packets are lost due to factors such as air interface co-channel interference, the congestion control strategy at the sender cannot improve the effects of air interface co-channel interference and other factors on the packet loss rate. Therefore, under the influence of factors such as co-channel interference on the air interface, the sender reduces the transmission rate to half the previous rate through the congestion control strategy, which cannot improve the influence of co-channel interference on the packet loss rate, and when the packet loss does not increase , the sender increases the sending rate by a fixed value Δ over the previous sending rate, which is too conservative to increase the data transmission rate.
下面介绍本申请实施例的第三部分提供的一种数据存储***的架构图。The following introduces an architecture diagram of a data storage system provided in the third part of the embodiments of the present application.
请参考图14,图14示出了本申请实施例提供的一种数据存储***的架构图。如图14所示,终端100上的数据存储***可以采用分层架构,分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。其中,终端100的数据存储***可以包括用户态、内核态、硬件层。Please refer to FIG. 14. FIG. 14 shows an architecture diagram of a data storage system provided by an embodiment of the present application. As shown in FIG. 14 , the data storage system on the terminal 100 may adopt a layered architecture. The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces. The data storage system of the terminal 100 may include user mode, kernel mode, and hardware layer.
终端100可以包括有至少三类物理存储介质:磁盘(即,只读存储器(read only memory,ROM))505、运行内存(即,随机存储器(random access memory,RAM))、网卡504。其中,该磁盘505中可以在断电后依然保留数据,可用于保存文档、图片、音乐、视频等文件数据。运行内存可用于操作***和应用运行时所产生的临时数据。终端100可以将运行内存虚拟划分为用户态和内核态两部分。网卡504中可以包括有存储器,可用于临时保存待发送或已接收到的数据帧。The terminal 100 may include at least three types of physical storage media: a disk (i.e., read only memory (ROM)) 505, a running memory (i.e., random access memory (RAM)), and a network card 504. The disk 505 can still retain data even after the power is turned off, and can be used to save file data such as documents, pictures, music, and videos. Runtime memory can be used for temporary data generated by the operating system and applications while they are running. The terminal 100 can virtually divide the running memory into two parts: user mode and kernel mode. The network card 504 may include a memory, which may be used to temporarily store data frames to be sent or received.
其中,在终端100的数据存储***中,用户态可以包括有用户态缓冲区501。内核态可以包括有内核态写缓冲区502、网络协议栈接收缓冲区503。硬件层可以包括有网卡504和硬盘505。Wherein, in the data storage system of the terminal 100 , the user mode may include a user mode buffer 501 . The kernel state may include a kernel state write buffer 502 and a network protocol stack receive buffer 503 . The hardware layer may include a network card 504 and a hard disk 505 .
当终端100的网卡504接收到发送端传输第一文件的数据后,终端100可以从网卡504中将第一文件的数据提取到内核态中的网络协议栈接收缓冲区503中。在一些实施例中,当终端100采用用户数据包协议(user datagram protocol,UDP)接收第一文件的数据时,该网络协议栈接收缓冲区503可以为UDP接收缓冲区。After the network card 504 of the terminal 100 receives the data of the first file transmitted by the sender, the terminal 100 can extract the data of the first file from the network card 504 into the network protocol stack receiving buffer 503 in the kernel state. In some embodiments, when the terminal 100 uses a user datagram protocol (UDP) to receive data of the first file, the network protocol stack receiving buffer 503 may be a UDP receiving buffer.
终端100可以通过两条路径将网络协议栈接收缓冲区503中缓冲的第一文件的数据,写入至磁盘505中:The terminal 100 can write the data of the first file buffered in the network protocol stack receiving buffer 503 to the disk 505 through two paths:
路径1:终端100可以从网络协议栈接收缓冲区503取出第一文件的数据,直接写入磁盘505中。Path 1: The terminal 100 can retrieve the data of the first file from the network protocol stack receiving buffer 503 and directly write it into the disk 505 .
路径2:终端100可以从网络协议栈接收缓冲区503取出第一文件的数据,转存到用户态缓冲区501中。然后,终端100将用户态缓冲区501中的数据取出转存到内核态写缓冲区502。接着,终端100再将内核态写缓冲区502中数据写入至磁盘505中。Path 2: The terminal 100 can retrieve the data of the first file from the network protocol stack receiving buffer 503 and transfer the data to the user mode buffer 501 . Then, the terminal 100 fetches and dumps the data in the user mode buffer 501 to the kernel mode write buffer 502 . Next, the terminal 100 writes the data in the kernel state write buffer 502 to the disk 505 .
在终端100在接收第一文件的数据的过程中,终端100可以随时扩充用户态接收缓冲区501的总缓冲容量,而网络协议栈接收缓冲区503的总缓冲容量固定。终端100采用上述路径1:直接将网络协议栈接收缓冲区503取出第一文件的数据,写入磁盘505中时,减少了终端100拷贝第一文件的数据的次数,可以节约终端100的功耗。When the terminal 100 is receiving the data of the first file, the terminal 100 can expand the total buffer capacity of the user mode receiving buffer 501 at any time, while the total buffer capacity of the network protocol stack receiving buffer 503 is fixed. The terminal 100 adopts the above path 1: directly extracting the data of the first file from the network protocol stack receiving buffer 503 and writing it to the disk 505, the number of times the terminal 100 copies the data of the first file is reduced, and the power consumption of the terminal 100 can be saved .
本申请实施例的第三部分提供的一种数据存储方法,终端100可以在接收到文件数据后,通过内核态的网络协议栈接收缓冲区中的水位线,采取不同的数据存储路径,这样,可以避免网络协议栈接收缓冲区中溢出而导致丢包,在高速传输文件数据的同时,降低丢包率。In the data storage method provided in the third part of the embodiments of the present application, after receiving the file data, the terminal 100 may receive the watermark in the buffer through the network protocol stack in the kernel state, and adopt different data storage paths, thus, It can avoid packet loss caused by overflow in the receiving buffer of the network protocol stack, and reduce the packet loss rate while transmitting file data at high speed.
下面基于上述图14所示的数据存储***,介绍本申请实施例的第三部分提供的一种数据存储方法。Based on the data storage system shown in FIG. 14, the following describes a data storage method provided in the third part of the embodiment of the present application.
请参照图15,图15示出了本申请实施例的第三部分提供的一种数据存储方法。如图15所示,该方法可以包括:Referring to FIG. 15 , FIG. 15 shows a data storage method provided in the third part of the embodiment of the present application. As shown in Figure 15, the method may include:
S1501、终端100接收第一文件的数据,并将第一文件的存入套接字接收缓冲区中。S1501. The terminal 100 receives the data of the first file, and stores the data of the first file in the socket receiving buffer.
第一文件的发送端可以是其他终端或服务器。当第一文件的发送方为其他终端时,终端100可以与其他终端通过Wi-Fi直连(例如,无线高保真点对点(wireless fidelity peer to peer,Wi-Fi P2P))、Wi-Fi softAP、超宽带(ultra-wideband,UWB)等通信技术传输第一文件的数据。当发送端为服务器时,终端100可以通过因特网接收到服务器传输第一文件的数据。The sender of the first file may be other terminals or servers. When the sender of the first file is another terminal, the terminal 100 may be directly connected with other terminals through Wi-Fi (for example, wireless fidelity peer to peer (Wi-Fi P2P)), Wi-Fi softAP, Communication technologies such as ultra-wideband (UWB) transmit the data of the first file. When the sending end is the server, the terminal 100 may receive the data of the first file transmitted by the server through the Internet.
S1502、终端100从网络协议栈接收缓冲区中取出第一文件的数据直接写入磁盘中。S1502: The terminal 100 takes out the data of the first file from the network protocol stack receiving buffer and writes it directly into the disk.
终端100在接收到第一文件的数据后,可以将第一文件的数据存入到网络协议栈接收缓冲区,终端100可以直接从网络协议栈接收缓冲区中取出第一文件的数据,写入磁盘中。具体可以参考前述图4所示实施例中的路径1。After receiving the data of the first file, the terminal 100 can store the data of the first file in the network protocol stack receiving buffer, and the terminal 100 can directly take out the data of the first file from the network protocol stack receiving buffer, and write in the disk. For details, reference may be made to Path 1 in the foregoing embodiment shown in FIG. 4 .
S1503、终端100获取网络协议栈接收缓冲区的剩余缓冲容量P、第一文件的待传输数据量FLS、网络协议栈接收缓冲区的缓冲数据增长速率A。S1503: The terminal 100 acquires the remaining buffer capacity P of the network protocol stack receiving buffer, the amount of data to be transmitted FLS of the first file, and the buffered data growth rate A of the network protocol stack receiving buffer.
在终端100将网络协议栈接收缓冲区中第一文件的数据直接写入磁盘过程中,终端100可以周期性(例如,周期为1ms)获取网络协议栈接收缓冲区的剩余容量P、第一文件的待传输数据FLS、网络协议栈接收缓冲区的缓冲数据增长速率A。During the process that the terminal 100 directly writes the data of the first file in the receiving buffer of the network protocol stack to the disk, the terminal 100 may periodically (for example, the cycle is 1 ms) obtain the remaining capacity P of the receiving buffer of the network protocol stack, the first file The FLS of the data to be transmitted and the buffered data growth rate A of the network protocol stack receiving buffer.
其中,终端100可以监测网络协议栈接收缓冲区的缓冲水位线,终端100根据网络协 议栈接收缓冲区的总缓冲容量和缓冲水位线(即已缓冲数据量),确定出网络协议栈接收缓冲区的剩余容量P。The terminal 100 can monitor the buffer watermark of the network protocol stack receiving buffer, and the terminal 100 determines the network protocol stack receiving buffer according to the total buffer capacity and buffer watermark (that is, the buffered data volume) of the network protocol stack receiving buffer. the remaining capacity P.
示例性的,网络协议栈接收缓冲区的总缓冲容量Pmax可以为10兆字节(megabytes,MB),缓冲水位线可以为6MB,终端100可以确定出网络协议栈接收缓冲区的剩余容量P为4MB。示例仅仅用户解释本申请,不应构成限定。Exemplarily, the total buffer capacity Pmax of the receiving buffer of the network protocol stack may be 10 megabytes (megabytes, MB), the buffer water mark may be 6 MB, and the terminal 100 may determine that the remaining capacity P of the receiving buffer of the network protocol stack is 4MB. The examples are merely to explain the application to the user and should not be construed as limitations.
在发送端开始向终端100传输第一文件之前,终端100可以接收到发送端发送的第一文件的总数据量。终端100可以统计第一文件的已接收数据量,终端100可以根据第一文件的总数据量和第一文件的已接收数据量,确定出第一文件的待传输数据量FLS。Before the sending end starts to transmit the first file to the terminal 100, the terminal 100 may receive the total data volume of the first file sent by the sending end. The terminal 100 may count the received data volume of the first file, and the terminal 100 may determine the to-be-transmitted data volume FLS of the first file according to the total data volume of the first file and the received data volume of the first file.
示例性的,第一文件的总数据量可以为400MB,终端100统计到第一文件的已接收数据量为360MB,终端100可以确定出第一文件的待传输数据量FLS可以为40MB。示例仅仅用于解释本申请,不应构成限定。Exemplarily, the total data volume of the first file may be 400MB, the terminal 100 can calculate that the received data volume of the first file is 360MB, and the terminal 100 may determine that the data volume FLS of the first file to be transmitted may be 40MB. The examples are only used to explain the application and should not be construed as limitations.
终端100监测网络协议栈接收缓冲区中的缓冲水位线变化,获取到网络协议栈接收缓冲区的缓冲数据增长速率A。The terminal 100 monitors the change of the buffer water level in the receiving buffer of the network protocol stack, and obtains the buffer data growth rate A of the receiving buffer of the network protocol stack.
在一种可能的实现方式中,终端100可以监测网卡的接收速率rateNet和第一文件的磁盘写入速率rateIO。终端100可以根据网卡的接收速率rateNet和第一文件的磁盘写入速率rateIO,确定出网络协议栈接收缓冲区的缓冲数据增长速率A。In a possible implementation manner, the terminal 100 may monitor the receiving rate rateNet of the network card and the disk writing rate rateIO of the first file. The terminal 100 may determine the buffer data growth rate A of the network protocol stack receiving buffer according to the receiving rate rateNet of the network card and the disk writing rate rateIO of the first file.
示例性的,网卡的接收速率rateNet可以为100兆字节每秒(megabytes per second,MBps)第一文件的磁盘写入速率rateIO可以为90MBps,终端100可以确定出网络协议栈接收缓冲区的增长速率A为10MBps。示例仅仅用于解释本申请,不应构成限定。Exemplarily, the receiving rate rateNet of the network card may be 100 megabytes per second (MBps), the disk writing rate rateIO of the first file may be 90 MBps, and the terminal 100 may determine the growth of the receiving buffer of the network protocol stack Rate A is 10MBps. The examples are only used to explain the application and should not be construed as limitations.
S1504、终端100可以判断缓冲数据增长速率A是否大于0,若是,则执行步骤S1505和步骤S1506。S1504. The terminal 100 may determine whether the buffered data growth rate A is greater than 0, and if so, perform steps S1505 and S1506.
其中,当缓冲数据增长速率A大于0时,终端100的网络协议栈接收缓冲区中的已缓冲数据量还在继续增大。当缓冲增长速率A小于等于0时,终端100的网络协议栈接收缓冲区中的已缓冲数据量不继续增长。Wherein, when the buffered data growth rate A is greater than 0, the amount of buffered data in the receiving buffer of the network protocol stack of the terminal 100 continues to increase. When the buffer growth rate A is less than or equal to 0, the amount of buffered data in the receiving buffer of the network protocol stack of the terminal 100 does not continue to increase.
S1505、终端100根据网络协议栈接收缓冲区的缓冲数据增长速率A和网络协议栈接收缓冲区的剩余缓冲容量P,确定网络协议栈接收缓冲区的溢出时间。S1505: The terminal 100 determines the overflow time of the network protocol stack receiving buffer according to the buffer data growth rate A of the network protocol stack receiving buffer and the remaining buffer capacity P of the network protocol stack receiving buffer.
网络协议栈接收缓冲区的溢出时间T1可以通过如下公式(10)确定:The overflow time T1 of the receiving buffer of the network protocol stack can be determined by the following formula (10):
T1=c*P/A 公式(10)T1=c*P/A Formula (10)
其中,0<c≤1,c为保守系数,为了防止网络协议栈接收缓冲区真正溢出,可以让c<1,这样,可以使得终端100确定出的溢出时间T1比网络协议栈接收缓冲区实际的溢出时间提前。Among them, 0<c≤1, c is a conservative coefficient, in order to prevent the actual overflow of the receiving buffer of the network protocol stack, c<1 can be set. In this way, the overflow time T1 determined by the terminal 100 can be made longer than the actual receiving buffer of the network protocol stack. The overflow time is advanced.
示例性的,网络协议栈接收缓冲区的剩余缓冲容量P可以为4MB,网络协议栈接收缓冲区的缓冲数据增长速率A可以为10MBps,c可以取0.9,因此,终端100确定出网络协议栈接收缓冲区的溢出时间T1可以为0.6s。示例仅仅用于解释本申请,不应构成限定。Exemplarily, the remaining buffer capacity P of the network protocol stack receiving buffer may be 4MB, the buffer data growth rate A of the network protocol stack receiving buffer may be 10MBps, and c may be 0.9. Therefore, the terminal 100 determines that the network protocol stack receives The overflow time T1 of the buffer can be 0.6s. The examples are only used to explain the application and should not be construed as limitations.
S1506、终端100根据第一文件的待传输数据量FLS和网卡传输速率rateNet,确定第 一文件的剩余传输时间。S1506, the terminal 100 determines the remaining transmission time of the first file according to the amount of data to be transmitted FLS and the network card transmission rate rateNet of the first file.
第一文件的剩余传输时间T2可以通过如下公式(11)确定:The remaining transmission time T2 of the first file can be determined by the following formula (11):
T2=FLS/rateNet 公式(11)T2=FLS/rateNet Formula (11)
示例性的,第一文件的待传输数据量FLS可以为40MB,网卡传输速率rateNet可以为100MBps,因此,终端100可以确定第一文件的剩余传输时间为0.4s。示例仅仅用于解释本申请,不应构成限定。Exemplarily, the data volume FLS of the first file to be transmitted may be 40MB, and the network card transmission rate rateNet may be 100MBps. Therefore, the terminal 100 may determine that the remaining transmission time of the first file is 0.4s. The examples are only used to explain the application and should not be construed as limitations.
S1507、终端100判断网络协议栈接收缓冲区的溢出时间是否小于第一文件的剩余传输时间。若是,则S1508、终端100判断网络协议栈接收缓冲区的已缓冲数据量P是否大于指定阈值M1。S1507: The terminal 100 determines whether the overflow time of the network protocol stack's receiving buffer is less than the remaining transmission time of the first file. If so, in S1508, the terminal 100 determines whether the buffered data volume P in the network protocol stack receiving buffer is greater than the specified threshold M1.
其中,终端100可以根据上述公式(10)和上述公式(11)确定出上述网络协议栈接收缓冲区的溢出时间与第一文件的剩余传输时间之差f1为:The terminal 100 can determine, according to the above formula (10) and the above formula (11), that the difference f1 between the overflow time of the receiving buffer of the network protocol stack and the remaining transmission time of the first file is:
f1=c*P/A-FLS/rateNet 公式(12)f1=c*P/A-FLS/rateNet Formula (12)
其中,当f1<0时,终端100可以确定网络协议栈接收缓冲区的溢出时间小于第一文件的剩余传输时间。示例性的,保守系数c取0.9,P可以为4MB,网络协议栈接收缓冲区的缓冲数据增长速率A可以为10MBps,第一文件的待传输数据量FLS可以为80MB,网卡传输速率rateNet可以为100MBps,终端100可以计算出网络协议栈接收缓冲区的溢出时间与第一文件的剩余传输时间之差f1为-0.2s(小于0),因此,终端100可以确定出网络协议栈接收缓冲区的溢出时间小于第一文件的剩余时间。示例仅仅用于解释本申请,不应构成限定。Wherein, when f1<0, the terminal 100 may determine that the overflow time of the network protocol stack receiving buffer is less than the remaining transmission time of the first file. Exemplarily, the conservative coefficient c is 0.9, P may be 4MB, the buffer data growth rate A of the network protocol stack receiving buffer may be 10MBps, the data volume FLS of the first file to be transmitted may be 80MB, and the network card transmission rate rateNet may be 100MBps, the terminal 100 can calculate that the difference f1 between the overflow time of the network protocol stack receiving buffer and the remaining transmission time of the first file is -0.2s (less than 0). Therefore, the terminal 100 can determine the network protocol stack receiving buffer. The overflow time is less than the remaining time of the first file. The examples are only used to explain the application and should not be construed as limitations.
当f1≥0时,终端100可以确定网络协议栈接收缓冲区的溢出时间大于等于第一文件的剩余传输时间。示例性的,c取0.9,P可以为4MB,网络协议栈接收缓冲区的缓冲数据增长速率A可以为10MBps,第一文件的待传输海事局了FLS可以为40MB,网卡传输速率rateNet可以为100MBps,终端100可以确定出网络协议栈接收缓冲区的溢出时间与第一文件的剩余传输时间之差f1为0.2s(大于0),因此,终端100可以确定出网络协议栈接收缓冲区的溢出时间大于第一文件的剩余时间。示例仅仅用于解释本申请,不应构成限定。When f1≥0, the terminal 100 may determine that the overflow time of the network protocol stack receiving buffer is greater than or equal to the remaining transmission time of the first file. Exemplarily, c is 0.9, P may be 4MB, the buffer data growth rate A of the network protocol stack receiving buffer may be 10MBps, the FLS of the first file to be transmitted may be 40MB, and the network card transmission rate rateNet may be 100MBps , the terminal 100 can determine that the difference f1 between the overflow time of the network protocol stack's receiving buffer and the remaining transmission time of the first file is 0.2s (greater than 0). Therefore, the terminal 100 can determine the overflow time of the network protocol stack's receiving buffer. greater than the remaining time of the first file. The examples are only used to explain the application and should not be construed as limitations.
S1509、当网络协议栈接收缓冲区的溢出时间小于第一文件的剩余传输时间且网络协议栈接收缓冲区的已缓冲数据量P大于指定阈值M1时,终端100将网络协议栈接收缓冲区中的已缓冲数据转存到用户态缓冲区,从用户态缓冲区取出数据经过内核态写缓冲区写入磁盘中。S1509: When the overflow time of the network protocol stack receiving buffer is less than the remaining transmission time of the first file and the buffered data volume P in the network protocol stack receiving buffer is greater than the specified threshold M1, the terminal 100 sends the data in the network protocol stack receiving buffer The buffered data is dumped to the user-mode buffer, and the data is retrieved from the user-mode buffer and written to the disk through the kernel-mode write buffer.
指定阈值M1小于网络协议栈接收缓冲区的总缓冲容量。例如,网络协议栈接收缓冲区的总缓冲容量Pmax可以为10MB,指定阈值M1可以为6MB,网络协议栈接收缓冲区的已缓冲数量P可以为6.1MB,因此,终端100可以将网络协议栈接收缓冲区的已缓冲数据。示例仅仅用于解释本申请,不应构成限定。The specified threshold M1 is less than the total buffer capacity of the network protocol stack receive buffer. For example, the total buffer capacity Pmax of the receiving buffer of the network protocol stack can be 10MB, the specified threshold M1 can be 6MB, and the buffered quantity P of the receiving buffer of the network protocol stack can be 6.1MB. Therefore, the terminal 100 can receive the network protocol stack Buffered data for the buffer. The examples are only used to explain the application and should not be construed as limitations.
当网络协议栈接收缓冲区的溢出时间小于第一文件的剩余传输时间且网络协议栈接收缓冲区的已缓冲数据量P大于指定阈值M1时,终端100停止从网络协议栈接收缓冲区中取出数据直接写入到用户态缓冲区,从上述图4所示的路径1转换至路径2。其中,在路 径2上,终端100可以将网络协议栈接收缓冲区中所有的已缓冲数据转存到用户态缓冲区,然后,终端100从用户态缓冲区中取出数据转存入内核态写缓冲区,最后,终端100再从内核态写缓冲区中的已缓冲数据写入磁盘中。When the overflow time of the network protocol stack receiving buffer is less than the remaining transmission time of the first file and the buffered data volume P in the network protocol stack receiving buffer is greater than the specified threshold M1, the terminal 100 stops fetching data from the network protocol stack receiving buffer Write directly to the user mode buffer, and switch from path 1 to path 2 shown in Figure 4 above. Wherein, on path 2, the terminal 100 can dump all the buffered data in the network protocol stack receiving buffer to the user mode buffer, and then the terminal 100 takes data from the user mode buffer and dumps it into the kernel mode write buffer Finally, the terminal 100 writes the buffered data in the kernel state write buffer to the disk.
在网络协议栈接收缓冲区的溢出时间小于第一文件的剩余传输时间且网络协议栈接收缓冲区的已缓冲数据量P大于指定阈值M1时,终端100将数据存储路径从上述路径1切换至路径2,由于终端100可以随时增大用户态缓冲区的容量,且终端100从网络协议栈接收缓冲区取出数据转存入用户态缓冲区中的速率比从网络协议栈接收缓冲区取出数据写入磁盘的速率要快,因此,可以防止网络协议栈接收缓冲区溢出丢包。When the overflow time of the receiving buffer of the network protocol stack is less than the remaining transmission time of the first file and the buffered data amount P of the receiving buffer of the network protocol stack is greater than the specified threshold M1, the terminal 100 switches the data storage path from the above path 1 to the path 2. Because the terminal 100 can increase the capacity of the user-mode buffer at any time, and the rate at which the terminal 100 takes out data from the network protocol stack receiving buffer and transfers it to the user-mode buffer is faster than taking out data from the network protocol stack receiving buffer and writing it The disk rate is faster, and therefore, prevents the network stack from receiving buffer overflow packet loss.
S1510、在终端100从网络协议栈接收缓冲区经过用户态缓冲区和内核态写缓冲区写入磁盘后,终端100可以根据用户态缓冲区的缓冲数据增长速率E和用户态缓冲区的剩余缓冲容量U,确定用户态缓冲区的溢出时间。S1510: After the terminal 100 receives the buffer from the network protocol stack and writes it to the disk through the user-mode buffer and the kernel-mode write buffer, the terminal 100 can increase the buffer data growth rate E according to the user-mode buffer and the remaining buffer in the user-mode buffer. The capacity U determines the overflow time of the user mode buffer.
终端100监测用户缓冲区中的缓冲水位线变化,获取到用户缓冲区中的缓冲数据增长速率E。The terminal 100 monitors the change of the buffer water level in the user buffer, and obtains the buffer data growth rate E in the user buffer.
用户态接收缓冲区的溢出时间T3可以通过如下公式(13)确定:The overflow time T3 of the user mode receive buffer can be determined by the following formula (13):
T3=d*U/E 公式(13)T3=d*U/E Formula (13)
其中,0<d≤1,d为保守系数,为了防止用户态缓冲区真正溢出,可以让d<1,这样,可以使得终端100确定出的溢出时间T3比用户态缓冲区实际的溢出时间提前。Among them, 0<d≤1, d is a conservative coefficient, in order to prevent the real overflow of the user mode buffer, d<1 can be set, so that the overflow time T3 determined by the terminal 100 can be made earlier than the actual overflow time of the user mode buffer .
示例性的,用户态缓冲区的剩余缓冲容量U可以为10MB,用户态缓冲区的缓冲数据增长速率E可以为10MBps,d可以取0.9,因此,终端100确定出用户态缓冲区的溢出时间T1可以为0.9s。示例仅仅用于解释本申请,不应构成限定。Exemplarily, the remaining buffer capacity U of the user mode buffer may be 10MB, the buffer data growth rate E of the user mode buffer may be 10MBps, and d may be 0.9. Therefore, the terminal 100 determines the overflow time T1 of the user mode buffer. Can be 0.9s. The examples are only used to explain the application and should not be construed as limitations.
S1511、终端100判断用户态缓冲区的溢出时间是否小于第一文件的剩余传输时间。若是,则S1512、终端100发送缓冲信息给第一文件的发送端,该缓冲信息用于指示发送端降低第一文件的发送速率。S1511. The terminal 100 determines whether the overflow time of the user mode buffer is less than the remaining transmission time of the first file. If so, in S1512, the terminal 100 sends buffering information to the sending end of the first file, where the buffering information is used to instruct the sending end to reduce the sending rate of the first file.
其中,终端100可以根据上述公式(11)和上述公式(12)确定出上述用户态缓冲区的溢出时间与第一文件的剩余传输时间之差f2为:The terminal 100 may determine, according to the above formula (11) and the above formula (12), that the difference f2 between the overflow time of the user mode buffer and the remaining transmission time of the first file is:
f2=d*U/E-FLS/rateNet 公式(14)f2=d*U/E-FLS/rateNet Formula (14)
其中,当f2<0时,终端100可以确定用户态缓冲区的溢出时间小于第一文件的剩余传输时间。示例性的,保守系数d取0.9,U可以为10MB,用户态缓冲区的缓冲数据增长速率E可以为10MBps,第一文件的待传输数据量FLS可以为100MB,网卡传输速率rateNet可以为100MBps,终端100可以计算出用户态缓冲区的溢出时间与第一文件的剩余传输时间之差f1为-0.1s(小于0),因此,终端100可以确定出用户态缓冲区的溢出时间小于第一文件的剩余时间。示例仅仅用于解释本申请,不应构成限定。Wherein, when f2<0, the terminal 100 may determine that the overflow time of the user mode buffer is less than the remaining transmission time of the first file. Exemplarily, the conservative coefficient d is 0.9, U can be 10MB, the buffer data growth rate E of the user mode buffer can be 10MBps, the data volume FLS of the first file to be transmitted can be 100MB, and the network card transmission rate rateNet can be 100MBps, The terminal 100 can calculate that the difference f1 between the overflow time of the user mode buffer and the remaining transmission time of the first file is -0.1s (less than 0). Therefore, the terminal 100 can determine that the overflow time of the user mode buffer is less than that of the first file. remaining time. The examples are only used to explain the application and should not be construed as limitations.
当f2≥0时,终端100可以确定用户态缓冲区的溢出时间大于等于第一文件的剩余传输时间。示例性的,d取0.9,U可以为10MB,用户态缓冲区的缓冲数据增长速率E可以为10MBps,第一文件的待传输海事局了FLS可以为80MB,网卡传输速率rateNet可以为100MBps,终端100可以确定出用户态缓冲区的溢出时间与第一文件的剩余传输时间之差 f1为0.1s(大于0),因此,终端100可以确定出用户态缓冲区的溢出时间大于第一文件的剩余时间。示例仅仅用于解释本申请,不应构成限定。When f2≥0, the terminal 100 may determine that the overflow time of the user mode buffer is greater than or equal to the remaining transmission time of the first file. Exemplarily, d is 0.9, U can be 10MB, the buffered data growth rate E of the user mode buffer can be 10MBps, the FLS of the first file to be transmitted can be 80MB, the network card transmission rate rateNet can be 100MBps, and the terminal 100 can determine that the difference f1 between the overflow time of the user mode buffer and the remaining transmission time of the first file is 0.1s (greater than 0), therefore, the terminal 100 can determine that the overflow time of the user mode buffer is greater than the remaining transmission time of the first file. time. The examples are only used to explain the application and should not be construed as limitations.
当终端100确定出用户态缓冲区的溢出时间小于第一文件的剩余传输时间,即表示终端用户态缓冲区在第一文件传输完之前,很有可能会溢出,因此,终端100可以发送缓冲信息给第一文件的发送端,该缓冲信息用于指示第一文件的发送端降低第一文件的发送速率。When the terminal 100 determines that the overflow time of the user mode buffer is less than the remaining transmission time of the first file, it means that the terminal user mode buffer is likely to overflow before the first file is transmitted. Therefore, the terminal 100 can send the buffer information To the sending end of the first file, the buffer information is used to instruct the sending end of the first file to reduce the sending rate of the first file.
S1513、当用户态缓冲区的溢出时间小于第一文件的剩余传输时间,且网络协议栈接收缓冲区的已缓冲数据量为0时,终端100可以根据网络协议栈接收缓冲区的总缓冲容量Pmax、用户态缓冲区的缓冲数据增长速率E,确定出网络协议栈接收缓冲区的最大溢出时间。S1513. When the overflow time of the user mode buffer is less than the remaining transmission time of the first file, and the buffered data volume of the network protocol stack receiving buffer is 0, the terminal 100 can receive the buffer according to the network protocol stack. The total buffer capacity Pmax , the buffer data growth rate E of the user mode buffer, and determine the maximum overflow time of the network protocol stack receiving buffer.
其中,由于终端100将网络协议栈接收缓冲区中的缓冲数据转存入用户态缓冲区的速率比网卡速率rateNet大,因此,网络协议栈接收缓冲区的缓冲数据会及时被终端100取出转存入用户态缓冲区,网络协议栈接收缓冲区的已缓冲数据量会降到0。Wherein, since the rate at which the terminal 100 transfers the buffered data in the network protocol stack receiving buffer into the user mode buffer is higher than the network card rate rateNet, the buffered data in the network protocol stack receiving buffer will be taken out and dumped by the terminal 100 in time. After entering the user mode buffer, the buffered data amount of the network protocol stack receiving buffer will drop to 0.
网络协议栈接收缓冲区的最大溢出时间Tmax可以通过如下公式(15)确定:The maximum overflow time Tmax of the receiving buffer of the network protocol stack can be determined by the following formula (15):
Tmax=Pmax/E 公式(15)Tmax=Pmax/E Formula (15)
示例性的,Pmax可以为10MB,E可以为10Mbps,即终端100可以根据上述公式(15)确定Tmax可以为1s。示例仅仅用于解释本申请,不应构成限定。Exemplarily, Pmax may be 10MB, and E may be 10Mbps, that is, the terminal 100 may determine that Tmax may be 1s according to the above formula (15). The examples are only used to explain the application and should not be construed as limitations.
S1514、终端100判断网络协议栈接收缓冲区的最大溢出时间是否大于等于第一文件的剩余传输时间。当网络协议栈接收缓冲区的最大溢出时间大于等于第一文件的剩余传输时间时,终端100从网络协议栈接收缓冲区中取出第一文件的数据直接写入磁盘中。S1514. The terminal 100 determines whether the maximum overflow time of the network protocol stack's receiving buffer is greater than or equal to the remaining transmission time of the first file. When the maximum overflow time of the receiving buffer of the network protocol stack is greater than or equal to the remaining transmission time of the first file, the terminal 100 takes out the data of the first file from the receiving buffer of the network protocol stack and writes it directly to the disk.
终端100可以根据上述公式(11)和上述公式(15)确定出上述网络协议栈接收缓冲区的溢出时间与第一文件的剩余传输时间之差f3为:The terminal 100 can determine, according to the above formula (11) and the above formula (15), that the difference f3 between the overflow time of the network protocol stack receiving buffer and the remaining transmission time of the first file is:
f3=Pmax/E-FLS/rateNet 公式(16)f3=Pmax/E-FLS/rateNet Formula (16)
当f3<0时,终端100可以确定出网络协议栈接收缓冲区的最大溢出时间小于第一文件的剩余传输时间。示例性的,Pmax可以为10MB,用户态缓冲区的缓冲数据增长速率E可以为10Mbps,第一文件的待传输数据量FLS可以为110MB,rateNet可以为100MBps,因此,终端100可以确定出网络协议栈接收缓冲区的溢出时间与第一文件的剩余传输时间之差f3为-0.1s(小于0),因此,终端100可以确定出网络协议栈接收缓冲区的最大溢出时间小于第一文件的剩余时间。示例仅仅用于解释本申请,不应构成限定。When f3<0, the terminal 100 may determine that the maximum overflow time of the receiving buffer of the network protocol stack is less than the remaining transmission time of the first file. Exemplarily, Pmax may be 10MB, the buffered data growth rate E of the user mode buffer may be 10Mbps, the amount of data to be transmitted FLS of the first file may be 110MB, and rateNet may be 100MBps, therefore, the terminal 100 may determine the network protocol. The difference f3 between the overflow time of the stack receiving buffer and the remaining transmission time of the first file is -0.1s (less than 0). Therefore, the terminal 100 can determine that the maximum overflow time of the network protocol stack receiving buffer is less than the remaining transmission time of the first file. time. The examples are only used to explain the application and should not be construed as limitations.
当f3≥0时,终端100可以确定网络协议栈接收缓冲区的最大溢出时间大于等于第一文件的剩余传输时间。示例性的,Pmax可以为10MB,用户态缓冲区的缓冲数据增长速率E可以为10Mbps,第一文件的待传输数据量FLS可以为90MB,rateNet可以为100MBps,因此,终端100可以确定出网络协议栈接收缓冲区的溢出时间与第一文件的剩余传输时间之差f3为0.1s(小于0),因此,终端100可以确定出网络协议栈接收缓冲区的最大溢出时间大于等于第一文件的剩余时间。示例仅仅用于解释本申请,不应构成限定。When f3≥0, the terminal 100 may determine that the maximum overflow time of the network protocol stack receiving buffer is greater than or equal to the remaining transmission time of the first file. Exemplarily, Pmax may be 10MB, the buffered data growth rate E of the user mode buffer may be 10Mbps, the amount of data to be transmitted FLS of the first file may be 90MB, and rateNet may be 100MBps, therefore, the terminal 100 may determine the network protocol. The difference f3 between the overflow time of the stack receiving buffer and the remaining transmission time of the first file is 0.1s (less than 0). Therefore, the terminal 100 can determine that the maximum overflow time of the network protocol stack receiving buffer is greater than or equal to the remaining transmission time of the first file. time. The examples are only used to explain the application and should not be construed as limitations.
当网络协议栈接收缓冲区的最大溢出时间大于等于第一文件的剩余传输时间时,终端100停止将网络协议栈接收缓冲区的缓冲数据转存到用户态缓冲区中,此时,用户态缓冲区中无数据进入只有数据被终端100取出经过内核态写缓冲区写入到磁盘中。终端100可以等到用户态缓冲区中的已缓冲数据全部写入到磁盘中时,从网络协议栈接收缓冲区中取出数据直接写入到磁盘中。When the maximum overflow time of the receiving buffer of the network protocol stack is greater than or equal to the remaining transmission time of the first file, the terminal 100 stops transferring the buffered data of the receiving buffer of the network protocol stack to the user mode buffer. At this time, the user mode buffer No data is entered in the area, only the data is fetched by the terminal 100 and written to the disk through the kernel-mode write buffer. The terminal 100 can wait until all the buffered data in the user mode buffer is written to the disk, and then take out the data from the network protocol stack receiving buffer and write it directly to the disk.
在一些实施例中,在终端100采用上述路径1从网络协议栈接收缓冲区中取出第一文件的数据写入磁盘后,终端100可以获取网路协议栈接收缓冲区的总缓冲容量Pmax,网卡接收速率rateNet,第一文件的待传输数据量FLS、网络协议栈接收缓冲区的缓冲数据增长速A。终端100可以根据网卡接收速率rateNet第一文件的待传输数据量FLS、网络协议栈接收缓冲区的缓冲数据增长速A,确定出网络协议栈接收缓冲区的所需缓冲容量Pn。In some embodiments, after the terminal 100 uses the above path 1 to extract the data of the first file from the network protocol stack receiving buffer and write it to the disk, the terminal 100 can obtain the total buffer capacity Pmax of the network protocol stack receiving buffer, and the network card The receiving rate is rateNet, the amount of data to be transmitted FLS of the first file, and the buffered data growth rate A in the receiving buffer of the network protocol stack. The terminal 100 can determine the required buffer capacity Pn of the network protocol stack receiving buffer according to the network card receiving rate rateNet, the amount of data to be transmitted FLS of the first file, and the buffered data growth rate A of the network protocol stack receiving buffer.
当所需缓冲容量Pn大于网络协议栈接收缓冲区的总缓冲容量Pmax时,终端100可以同时使用上述路径1和路径2将网络协议栈接收缓冲区中的已缓冲数据写入磁盘中。其中,终端100可以将存入网络协议栈接收缓冲区中第一部分数据,并通过路径1将第一部分数据写入磁盘中。终端100将存入网络协议栈接收缓冲区中第二部分数据,并通过路径2将第二部分数据写入至磁盘中。其中,第一部分数据的数据量占网络协议栈接收缓冲区存入数据量的比例为β。When the required buffer capacity Pn is greater than the total buffer capacity Pmax of the network protocol stack receiving buffer, the terminal 100 can simultaneously use the above path 1 and path 2 to write the buffered data in the network protocol stack receiving buffer to the disk. The terminal 100 may store the first part of the data in the network protocol stack receiving buffer, and write the first part of the data to the disk through path 1. The terminal 100 stores the second part of the data in the network protocol stack receiving buffer, and writes the second part of the data to the disk through path 2 . The ratio of the data volume of the first part of the data to the data volume stored in the receiving buffer of the network protocol stack is β.
终端100可以通过公式(17)确定出网络协议栈接收缓冲区的所需缓冲容量Pn:The terminal 100 can determine the required buffer capacity Pn of the receiving buffer of the network protocol stack by formula (17):
c*Pn/A-FLS/rateNet=0 公式(17)c*Pn/A-FLS/rateNet=0 Formula (17)
终端100可以通过公式(18)确定出第一部分数据的数据量与网络协议栈接收缓冲区的存入数据量的占比为β:The terminal 100 can determine the ratio of the data volume of the first part of the data to the stored data volume of the network protocol stack receiving buffer as β through formula (18):
β=(Pn-Pmax)/Pmax 公式(18)β=(Pn-Pmax)/Pmax Formula (18)
其中,当β>0时,终端100可以确定网络协议栈接收缓冲区的所需缓冲容量Pn大于网络协议栈接收缓冲区的总缓冲容量Pmax。示例性的,网络协议栈接收缓冲区的总缓冲容量Pmax为8MB,保守系数c可以取0.9,网络协议栈接收缓冲区的缓冲数据增长速率A可以为10MBps,第一文件的待传输数据量FLS可以为90MB,网卡传输速率rateNet可以为100MBps。终端100可以确定出β为0.2(大于0)。因此,终端100可以将网络协议栈接收缓冲区的存入数据中20%的数据通过上述路径2写入磁盘中。示例仅仅用于解释本申请,不应限定。Wherein, when β>0, the terminal 100 may determine that the required buffer capacity Pn of the network protocol stack receiving buffer is greater than the total buffer capacity Pmax of the network protocol stack receiving buffer. Exemplarily, the total buffer capacity Pmax of the receiving buffer of the network protocol stack is 8MB, the conservative coefficient c can be 0.9, the buffer data growth rate A of the receiving buffer of the network protocol stack can be 10MBps, and the amount of data to be transmitted FLS of the first file. It can be 90MB, and the network card transfer rate rateNet can be 100MBps. The terminal 100 may determine that β is 0.2 (greater than 0). Therefore, the terminal 100 can write 20% of the data stored in the network protocol stack receiving buffer to the disk through the above path 2. The examples are only used to explain the present application and should not be limiting.
当β≤0时,终端100可以确定网络协议栈接收缓冲区的所需缓冲容量Pn小于等于网络协议栈接收缓冲区的总缓冲容量Pmax。示例性的,网络协议栈接收缓冲区的总缓冲容量Pmax为12MB,保守系数c可以取0.9,网络协议栈接收缓冲区的缓冲数据增长速率A可以为10MBps,第一文件的待传输数据量FLS可以为90MB,网卡传输速率rateNet可以为100MBps。终端100可以确定出β为-0.17(小于0)。因此,终端100可以将网络协议栈接收缓冲区中的存入数据直接通过上述路径1写入至磁盘中。示例仅仅用于解释本申请,不应限定。When β≤0, the terminal 100 may determine that the required buffer capacity Pn of the network protocol stack receiving buffer is less than or equal to the total buffer capacity Pmax of the network protocol stack receiving buffer. Exemplarily, the total buffer capacity Pmax of the receiving buffer of the network protocol stack is 12MB, the conservative coefficient c may be 0.9, the buffer data growth rate A of the receiving buffer of the network protocol stack may be 10MBps, and the amount of data to be transmitted FLS of the first file. It can be 90MB, and the network card transfer rate rateNet can be 100MBps. The terminal 100 can determine that β is -0.17 (less than 0). Therefore, the terminal 100 can directly write the data stored in the receiving buffer of the network protocol stack to the disk through the above path 1. The examples are only used to explain the present application and should not be limiting.
本申请实施例的第三部分提供的一种数据存储方法,终端100可以在接收到文件数据 后,通过内核态的网络协议栈接收缓冲区中的水位线,采取不同的数据存储路径,这样,可以避免网络协议栈接收缓冲区中溢出而导致丢包,在高速传输文件数据的同时,降低丢包率。In the data storage method provided in the third part of the embodiments of the present application, after receiving the file data, the terminal 100 may receive the watermark in the buffer through the network protocol stack in the kernel state, and adopt different data storage paths, thus, It can avoid packet loss caused by overflow in the receiving buffer of the network protocol stack, and reduce the packet loss rate while transmitting file data at high speed.
下面结合图16-图27介绍本申请实施例的第四部分提供的一种多路径数据预取方法及相关内容。The following describes a multi-path data prefetching method and related content provided in the fourth part of the embodiment of the present application with reference to FIG. 16 to FIG. 27 .
在本申请实施例的第四部分中一些名词的序号不继续沿用本申请实施例其他部分中的序号的顺序,在本申请实施例的第四部分中的名词仅仅在在本申请实施例的第四部分中使用。The sequence numbers of some terms in the fourth part of the embodiments of the present application do not continue to follow the sequence of the sequence numbers of other parts of the embodiments of the present application, and the nouns in the fourth part of the embodiments of the present application are only in the first used in four parts.
随着宽带接入技术的发展,具有多个网络接口的终端越来越普及。比如大多数智能手机同时具备无线局域网(wireless local area network,WLAN)和移动蜂窝网络的联网功能。又例如,部分智能手机可以同时支持双移动蜂窝网络的联网功能和/或双WLAN的联网功能。又例如,笔记本电脑通常设有有限局域网适配器和一个无线局域网适配器。但是,传统的传输控制协议(transmission control protocol,TCP)是一种一端对一端的传输协议,不能同时使用多对网络连接。因此,不能充分利用当前终端多网络接口的优势,造成很多网络带宽资源的浪费。With the development of broadband access technology, terminals with multiple network interfaces are becoming more and more popular. For example, most smart phones have both wireless local area network (WLAN) and mobile cellular network networking capabilities. For another example, some smart phones may simultaneously support the networking function of dual mobile cellular networks and/or the networking function of dual WLANs. As another example, a notebook computer usually has a limited LAN adapter and a wireless LAN adapter. However, the traditional transmission control protocol (TCP) is an end-to-end transmission protocol and cannot use multiple pairs of network connections at the same time. Therefore, the advantages of multiple network interfaces of the current terminal cannot be fully utilized, resulting in a waste of a lot of network bandwidth resources.
目前,终端可以允许无线保真(wireless fidelity,Wi-Fi)网络和蜂窝网络同时使用,提升通信体验,例如在观看流媒体视频时,可以通过同时使用Wi-Fi网络和蜂窝网络,以提供更大的聚合带宽,使得下载速率更高,卡顿更少,流媒体播放更流畅。其中,多路径传输控制协议(multipath transmission control protocol,MPTCP)是基于多网络接口技术,同时使用多条路径协同工作和分发数据的传输层协议。它可以充分利用多网络接口的空闲资源,提高端到端的传输吞吐率,增加网络资源利用率。At present, the terminal can allow wireless fidelity (Wi-Fi) network and cellular network to be used at the same time to improve communication experience. For example, when watching streaming video, the Wi-Fi network and cellular network can be used at the same time to provide more The large aggregate bandwidth enables higher download rates, fewer freezes, and smoother streaming media playback. Among them, the multipath transmission control protocol (MPTCP) is a transport layer protocol that is based on multi-network interface technology and uses multiple paths to work together and distribute data at the same time. It can make full use of idle resources of multiple network interfaces, improve end-to-end transmission throughput, and increase network resource utilization.
本申请实施例的第四部分提供了一种多路径数据预取方法,包括:终端获取该终端的第一应用针对第一URI发起的第一HTTP请求,该第一HTTP请求用于向服务器请求第一数据。该终端生成L个第二HTTP请求,该L个第二HTTP请求用于向该服务器请求第二数据,其中,该第二数据包括该第一数据且该第二数据的数据量大于该第一数据的数据量,L为正整数。该终端将该L个第二HTTP请求分别通过L个网络路径发送给该服务器。该终端接收该服务器在该L个网络路径上发送的L个第一HTTP响应,该L个第一HTTP响应包括有该第二数据。该终端从该第二数据中取出该第一数据,并将该第一数据通过HTTP响应返回给该第一应用。该终端接收到该第一应用针对该第一URI发起的第三HTTP请求,该第三HTTP请求用于向该服务器请求第三数据。若该第二数据包括该第三数据,该终端从该第二数据中取出该第三数据,并将该第三数据通过HTTP响应返回给该第一应用。The fourth part of the embodiments of the present application provides a multi-path data prefetching method, including: a terminal acquiring a first HTTP request initiated by a first application of the terminal for a first URI, where the first HTTP request is used to request a server first data. The terminal generates L second HTTP requests, where the L second HTTP requests are used to request second data from the server, wherein the second data includes the first data and the data volume of the second data is larger than the first data The amount of data, L is a positive integer. The terminal sends the L second HTTP requests to the server through L network paths respectively. The terminal receives L first HTTP responses sent by the server on the L network paths, where the L first HTTP responses include the second data. The terminal retrieves the first data from the second data, and returns the first data to the first application through an HTTP response. The terminal receives a third HTTP request initiated by the first application for the first URI, where the third HTTP request is used to request third data from the server. If the second data includes the third data, the terminal takes out the third data from the second data, and returns the third data to the first application through an HTTP response.
通过本申请实施例的第四部分提供的一种多路径数据预取方法,终端可以当应用业务请求第一数据量的数据时,向服务器预取第二数据量的数据,其中,第二数据量大于第一数据量。然后,终端接收到服务器返回的第二数据量的数据后,可以先将第二数据量中的第一数据量的数据返回给应用。然后,将剩余(第二数据量-第一数据量)的数据存到预取缓冲区。当应用下次请求剩余的(第二数据量-第一数据量)字节的数据时,终端可以直接 从预取缓冲区中提取该剩余的(第二数据量-第一数据量)字节的数据给到应用。提高了终端与服务器之间的网络路径的带宽利用率,并且,当应用频繁访问同一URI地址上的不同范围的数据时,可以节省应用获取到数据的时间。With the multi-path data prefetching method provided in the fourth part of the embodiment of the present application, when the application service requests data of the first data amount, the terminal can prefetch the data of the second data amount from the server, wherein the second data amount is The amount is greater than the first data amount. Then, after receiving the data of the second data volume returned by the server, the terminal may first return the data of the first data volume in the second data volume to the application. Then, the remaining data (the second amount of data - the first amount of data) is stored in the prefetch buffer. When the application requests the remaining (the second amount of data - the first amount of data) bytes of data next time, the terminal can directly extract the remaining (the second amount of data - the first amount of data) bytes from the prefetch buffer data to the application. The bandwidth utilization rate of the network path between the terminal and the server is improved, and when the application frequently accesses data in different ranges on the same URI address, the time for the application to obtain the data can be saved.
如图16所示,终端与服务器需要同时支持MPTCP。终端100上的应用(application,APP)可以通过MPTCP的代理(Proxy)与服务器分别在多个网络路径中建立多条TCP连接。例如,MPTCP的代理可以在蜂窝网络上与服务器建立一条TCP连接,同时在Wi-Fi网络中与服务器建立另一条TCP连接。这样,终端可以同时在蜂窝网络和Wi-Fi网络上与服务器进行数据传输。但是,由于使用MPTCP,需要让终端和服务器同时支持MPTCP,部署难度大,对于不支持MPTCP的服务器,终端就无法基于同时使用Wi-Fi网络和蜂窝网络进行访问了。As shown in Figure 16, both the terminal and the server need to support MPTCP. An application (application, APP) on the terminal 100 may establish multiple TCP connections with the server in multiple network paths respectively through a proxy (Proxy) of MPTCP. For example, a proxy for MPTCP can establish one TCP connection with a server on a cellular network and another TCP connection with a server on a Wi-Fi network. In this way, the terminal can simultaneously perform data transmission with the server on the cellular network and the Wi-Fi network. However, due to the use of MPTCP, the terminal and the server need to support MPTCP at the same time, which is difficult to deploy. For a server that does not support MPTCP, the terminal cannot access based on the simultaneous use of the Wi-Fi network and the cellular network.
如图17所示,多路径超文本传输协议(multipath hyper text transfer protocol,MPHTTP)可以将应用发起的原始超文本传输协议(hyper text transfer protocol,HTTP)请求,根据原始HTTP请求的请求范围进行拆分,拆分成多个子HTTP请求。MPHTTP可以让终端100在多个网络路径上将这多个子HTTP请求发给服务器200,以提供最大的聚合带宽。由于终端100和服务器200都支持HTTP,服务器200在接收到HTTP请求后,即会将终端100请求的数据通过HTTP响应返回给终端100。因此,无需改进现有的服务器200,即可实现终端100和服务器200之间的多路径传输。As shown in Figure 17, the multipath hypertext transfer protocol (MPHTTP) can split the original hypertext transfer protocol (HTTP) request initiated by the application according to the request range of the original HTTP request. Split into multiple sub-HTTP requests. MPHTTP enables the terminal 100 to send the multiple sub-HTTP requests to the server 200 on multiple network paths, so as to provide the maximum aggregated bandwidth. Since both the terminal 100 and the server 200 support HTTP, after receiving the HTTP request, the server 200 will return the data requested by the terminal 100 to the terminal 100 through an HTTP response. Therefore, multipath transmission between the terminal 100 and the server 200 can be realized without modifying the existing server 200 .
图18示出了终端100通过MPHTTP与服务器200之间进行多径传输的***架构。FIG. 18 shows the system architecture of multi-path transmission between the terminal 100 and the server 200 through MPHTTP.
如图18所示,终端可以包括应用层和内核层。终端的应用层可以包括应用上层业务逻辑模块、多路径超文本传输协议(MPHTTP)库(例如,基于OKHTTP库的改造库)、HTTP请求拆分模块。终端上可以通过多个网络路径与服务器进行通信,例如,蜂窝网络、无线局域网(WLAN)1和无线局域网(WLAN)2。其中,As shown in FIG. 18, the terminal may include an application layer and a kernel layer. The application layer of the terminal may include an application upper layer business logic module, a multi-path hypertext transfer protocol (MPHTTP) library (for example, a modified library based on the OKHTTP library), and an HTTP request splitting module. The terminal can communicate with the server through multiple network paths, such as a cellular network, a wireless local area network (WLAN) 1 and a wireless local area network (WLAN) 2 . in,
应用上层业务逻辑模块可以集成MPHTTP库。The upper-layer business logic module of the application can integrate the MPHTTP library.
当应用下发针对第一统一资源标识符(uniform resource identifier,URI)地址的数据获取请求下发给MPHTTP库时,MPHTTP库可以根据针对第一URI地址的数据获取请求,生成原始HTTP请求,并下发给HTTP请求拆分模块。其中,原始HTTP请求的中的字节范围(byte range)字段可以包括有该原始HTTP请求的数据请求范围,例如,0-8999。When the application sends the data acquisition request for the first uniform resource identifier (URI) address to the MPHTTP library, the MPHTTP library can generate the original HTTP request according to the data acquisition request for the first URI address, and Sent to the HTTP request splitting module. The byte range field in the original HTTP request may include the data request range of the original HTTP request, for example, 0-8999.
HTTP请求拆分模块可以根据网络路径的数量,基于原始HTTP请求的字节范围将原始HTTP请求拆分成多个HTTP请求。例如,终端可以通过3条网络路径(例如,蜂窝网络、WLAN 1和WLAN 2)可以访问到服务器,原始HTTP请求的字节范围可以为0-8999。HTTP请求拆分模块可以将原始HTTP请求拆分成3个HTTP请求(包括HTTP请求1、HTTP请求2和HTTP请求3)。其中,HTTP请求1的字节范围可以为0-2999,HTTP请求2的字节范围可以为3000-5999,HTTP请求3的字节范围可以为6000-8999。The HTTP request splitting module can split the original HTTP request into multiple HTTP requests based on the byte range of the original HTTP request according to the number of network paths. For example, the terminal can access the server through 3 network paths (eg, cellular network, WLAN 1 and WLAN 2), and the byte range of the original HTTP request can be 0-8999. The HTTP request splitting module can split the original HTTP request into 3 HTTP requests (including HTTP request 1, HTTP request 2 and HTTP request 3). The byte range of HTTP request 1 may be 0-2999, the byte range of HTTP request 2 may be 3000-5999, and the byte range of HTTP request 3 may be 6000-8999.
HTTP请求拆分模块可以通过套接字(socket)***调用将多个HTTP请求分别通过TCP/IP协议栈的封装,在多个网络路径上发送给服务器。The HTTP request splitting module can encapsulate multiple HTTP requests through the TCP/IP protocol stack respectively through the socket system call, and send them to the server on multiple network paths.
例如,HTTP请求拆分模块在将原始HTTP请求拆分成3个HTTP请求(包括HTTP请求1、HTTP请求2和HTTP请求3)后,终端可以通过蜂窝网络与服务器建立一个TCP 连接,然后,终端可以将HTTP请求1通过蜂窝网络发送给服务器。服务器在接收到终端通过蜂窝网络发送的HTTP请求1后,可以将HTTP请求1中URI地址对应的数据资源中第0-2999字节的数据,封装在HTTP响应1中,通过蜂窝网络的网络路径返回给终端。当终端接收到HTTP响应1后,终端与服务器之间在蜂窝网络上建立的TCP连接断开。For example, after the HTTP request splitting module splits the original HTTP request into 3 HTTP requests (including HTTP request 1, HTTP request 2 and HTTP request 3), the terminal can establish a TCP connection with the server through the cellular network, and then the terminal HTTP request 1 may be sent to the server over the cellular network. After receiving the HTTP request 1 sent by the terminal through the cellular network, the server can encapsulate the data of bytes 0-2999 in the data resource corresponding to the URI address in the HTTP request 1 in the HTTP response 1, and pass the network path of the cellular network. back to the terminal. After the terminal receives the HTTP response 1, the TCP connection established between the terminal and the server on the cellular network is disconnected.
终端可以通过无线局域网1与服务器建立一个TCP连接,然后,终端可以将HTTP请求2通过蜂窝网络发送给服务器。服务器在接收到终端通过蜂窝网络发送的HTTP请求2后,可以将HTTP请求2中URI地址对应的数据资源中第3000-5999字节的数据,封装在HTTP响应2中,通过无线局域网1的网络路径返回给终端。当终端接收到HTTP响应2后,终端与服务器之间在无线局域网1上建立的TCP连接断开。The terminal can establish a TCP connection with the server through the wireless local area network 1, and then the terminal can send the HTTP request 2 to the server through the cellular network. After receiving the HTTP request 2 sent by the terminal through the cellular network, the server can encapsulate the data in the 3000-5999th bytes in the data resource corresponding to the URI address in the HTTP request 2 in the HTTP response 2, and send it through the network of the wireless local area network 1. The path is returned to the terminal. After the terminal receives the HTTP response 2, the TCP connection established on the wireless local area network 1 between the terminal and the server is disconnected.
终端可以通过无线局域网2与服务器建立一个TCP连接,然后,终端可以将HTTP请求3通过蜂窝网络发送给服务器。服务器在接收到终端通过蜂窝网络发送的HTTP请求3后,可以将HTTP请求3中URI地址对应的数据资源中第6000-8999字节的数据,封装在HTTP响应3中,通过无线局域网2的网络路径返回给终端。当终端接收到HTTP响应3后,终端与服务器之间在无线局域网2上建立的TCP连接断开。The terminal can establish a TCP connection with the server through the wireless local area network 2, and then the terminal can send the HTTP request 3 to the server through the cellular network. After receiving the HTTP request 3 sent by the terminal through the cellular network, the server can encapsulate the 6000-8999th bytes of data in the data resource corresponding to the URI address in the HTTP request 3 in the HTTP response 3, and send it through the network of the wireless local area network 2. The path is returned to the terminal. After the terminal receives the HTTP response 3, the TCP connection established on the wireless local area network 2 between the terminal and the server is disconnected.
图19示出了终端与服务器通过MPHTTP进行多径传输的流程示意图。FIG. 19 shows a schematic flowchart of multi-path transmission between the terminal and the server through MPHTTP.
如图19所示,终端可以通过蜂窝网络、WLAN 1、WLAN 2这三个网络路径访问到服务器。终端与服务器通过MPHTTP进行多径传输的流程可以如下:As shown in Figure 19, the terminal can access the server through three network paths: cellular network, WLAN 1, and WLAN 2. The process of multi-path transmission between the terminal and the server through MPHTTP can be as follows:
1、终端上的应用发起原始HTTP请求,例如,该原始HTTP请求的字节范围可以为0-8999。1. An application on the terminal initiates an original HTTP request. For example, the byte range of the original HTTP request may be 0-8999.
2、终端上的应用基于原始HTTP请求的字节范围,将原始HTTP请求拆分为3个HTTP请求(例如,HTTP请求1、HTTP请求2和HTTP请求3)。其中,HTTP请求1的字节范围可以为0-2999,HTTP请求2的字节范围可以为3000-5999,HTTP请求3的字节范围可以为6000-8999。2. The application on the terminal splits the original HTTP request into 3 HTTP requests (for example, HTTP request 1, HTTP request 2, and HTTP request 3) based on the byte range of the original HTTP request. The byte range of HTTP request 1 may be 0-2999, the byte range of HTTP request 2 may be 3000-5999, and the byte range of HTTP request 3 may be 6000-8999.
3、终端将HTTP请求1通过蜂窝网络的网络路径发送给服务器。3. The terminal sends the HTTP request 1 to the server through the network path of the cellular network.
4、终端将HTTP请求2通过WLAN 1的网络路径发送给服务器。4. The terminal sends HTTP request 2 to the server through the network path of WLAN 1.
5、终端将HTTP请求3通过WLAN 2的网络路径发送给服务器。5. The terminal sends HTTP request 3 to the server through the network path of WLAN 2.
6、服务器在接收到HTTP请求1后,可以发送HTTP成功状态响应码1(例如,206 partial content response)通过蜂窝网络的网络路径发送给终端。其中,该HTTP成功状态响应码1可用于表示该HTTP请求1已请求内容长度为3000字节的数据成功。6. After receiving HTTP request 1, the server can send HTTP success status response code 1 (for example, 206 partial content response) to the terminal through the network path of the cellular network. The HTTP success status response code 1 may be used to indicate that the HTTP request 1 has successfully requested data with a content length of 3000 bytes.
7、服务器可以将HTTP请求1的响应数据1(字节范围:0-2999的数据)发送给终端。7. The server can send the response data 1 (byte range: 0-2999 data) of HTTP request 1 to the terminal.
8、服务器在接收到HTTP请求2后,可以发送HTTP成功状态响应码2(例如,206 partial content response)通过WLAN 1网络的网络路径发送给终端。其中,该HTTP成功状态响应码2可用于表示该HTTP请求2已请求内容长度为3000字节的数据成功。8. After receiving HTTP request 2, the server can send HTTP success status response code 2 (for example, 206 partial content response) to the terminal through the network path of the WLAN 1 network. The HTTP success status response code 2 may be used to indicate that the HTTP request 2 has successfully requested data with a content length of 3000 bytes.
9、服务器可以将HTTP请求2的响应数据2(字节范围:3000-5999的数据)发送给终端。9. The server can send the response data 2 (byte range: 3000-5999 data) of the HTTP request 2 to the terminal.
10、服务器在接收到HTTP请求3后,可以发送HTTP成功状态响应码3(例如,206 partial content response)通过WLAN 2网络的网络路径发送给终端。其中,该HTTP成功 状态响应码3可用于表示该HTTP请求3已请求内容长度为3000字节的数据成功。10. After receiving HTTP request 3, the server can send HTTP success status response code 3 (for example, 206 partial content response) to the terminal through the network path of the WLAN 2 network. Wherein, the HTTP success status response code 3 can be used to indicate that the HTTP request 3 has successfully requested data with a content length of 3000 bytes.
11、服务器可以将HTTP请求2的响应数据3(字节范围:6000-8999的数据)发送给终端。11. The server can send the response data 3 (byte range: 6000-8999 data) of the HTTP request 2 to the terminal.
目前,终端上的应用在向服务器请求流媒体等数据时,先在指定的网络路径上与服务器上建立一个长连接,然后,终端通过HTTP请求每次向服务器请求指定大小的分片数据,例如,分片数据的大小可以为0.2MB-2MB不等。而终端可以同时通过多条网络路径向服务器请求数据,加大了终端与服务器之间传输网络的带宽。而针对大带宽的网络环境,当分片数据太小时,带宽利用率会降低。At present, when the application on the terminal requests data such as streaming media from the server, it first establishes a long connection with the server on the specified network path, and then the terminal requests the server for fragmented data of a specified size through HTTP requests each time, for example , the size of the fragmented data can vary from 0.2MB to 2MB. The terminal can simultaneously request data from the server through multiple network paths, which increases the bandwidth of the transmission network between the terminal and the server. For a large bandwidth network environment, when the fragmented data is too small, the bandwidth utilization rate will decrease.
示例性的,终端上的应用(例如视频应用)每次向服务器请求分片数据的数据量可以是2MB。其中,终端每次发送HTTP请求给服务器需要0.5个往返时延(round-trip time,RTT)。然后,服务器会将终端请求的数据返回给终端。其中,在带宽较小的网络路径,理论带宽利用率较高。例如,长期演进(long term evolution,LTE)网络路径下,0.5RTT为30ms,带宽为5MBps,服务器将2MB的分片数据传输给终端,耗时为400ms,因此,LTE网络路径下的带宽利用率可以为:400/(400+30)=93%。Exemplarily, an application (eg, a video application) on the terminal may request the server for fragmented data each time with a data volume of 2MB. Among them, each time the terminal sends an HTTP request to the server, it takes 0.5 round-trip time (round-trip time, RTT). Then, the server will return the data requested by the terminal to the terminal. Among them, in the network path with smaller bandwidth, the theoretical bandwidth utilization rate is higher. For example, under the long term evolution (LTE) network path, 0.5RTT is 30ms, the bandwidth is 5MBps, and the server transmits 2MB of fragmented data to the terminal, which takes 400ms. Therefore, the bandwidth utilization rate under the LTE network path is 400ms. It can be: 400/(400+30)=93%.
如图20所示,终端上的应用(例如视频应用)每次向服务器请求分片数据的数据量可以是2MB。其中,终端每次发送HTTP请求给服务器需要0.5个往返时延(round-trip time,RTT)。在100MBps(为0.8Gbps)带宽的网络路径下,服务器向终端传输分片数据耗时仅为20ms,其中,在100MBps带宽的网络下,终端与服务器之间的往返时延RTT可以达到40ms,0.5RTT为20ms。例如,终端将应用发起的HTTP请求1(字节范围:0-2MB)发送给服务器,耗时20ms,服务器在接收到HTTP请求1后将分片数据1传输给终端又耗时20ms。接着,终端可以将应用发起的HTTP请求2(字节范围:2MB-4MB)发送给服务器,耗时20ms,服务器在接收到HTTP请求2后将分片数据2传输给终端又耗时20ms。因此,理论带宽利用率为50%。As shown in FIG. 20 , the amount of data that an application on the terminal (such as a video application) requests from the server for fragmented data each time may be 2MB. Among them, each time the terminal sends an HTTP request to the server, it takes 0.5 round-trip time (round-trip time, RTT). Under the network path of 100MBps (0.8Gbps) bandwidth, it takes only 20ms for the server to transmit fragmented data to the terminal. Among them, under the network with 100MBps bandwidth, the round-trip delay RTT between the terminal and the server can reach 40ms, 0.5 RTT is 20ms. For example, it takes 20ms for the terminal to send the HTTP request 1 (byte range: 0-2MB) initiated by the application to the server, and it takes another 20ms for the server to transmit the fragmented data 1 to the terminal after receiving the HTTP request 1. Next, the terminal can send the HTTP request 2 (byte range: 2MB-4MB) initiated by the application to the server, which takes 20ms. After the server receives the HTTP request 2, it takes another 20ms to transmit the fragmented data 2 to the terminal. Therefore, the theoretical bandwidth utilization is 50%.
这意味着对于Gbps级的传输网络路径,一半以上的时间都浪费在HTTP请求发给服务器的过程,带宽利用率低。This means that for Gbps-level transmission network paths, more than half of the time is wasted in the process of sending HTTP requests to the server, resulting in low bandwidth utilization.
如图21所示,带宽利用率与分片数据的数据量、网络带宽和网络的往返时延之间的关系可以如下:As shown in Figure 21, the relationship between bandwidth utilization and the amount of fragmented data, network bandwidth, and network round-trip delay can be as follows:
R=Trans/(Trans+0.5RTT) 公式(19)R=Trans/(Trans+0.5RTT) Formula (19)
Trans=max{M/B,0.5RTT} 公式(20)Trans=max{M/B, 0.5RTT} Formula (20)
其中,上述公式(19)和公式(20)中,R为带宽利用率,Trans为分片数据传输耗时,M为分片数据的数据量,B为网络带宽,RTT为网络的往返时延。Among them, in the above formula (19) and formula (20), R is the bandwidth utilization rate, Trans is the time-consuming of fragmented data transmission, M is the data volume of the fragmented data, B is the network bandwidth, and RTT is the round-trip delay of the network. .
当网络路径的带宽一定,分片数据的数据量越小,终端通过该网络路径向服务器请求分片数据时的理论带宽利用率更低。当分片数据的数据量一定,网络路径的带宽越大,终端通过该网络路径向服务器请求分片数据时的理论带宽利用率更低。When the bandwidth of the network path is constant, the smaller the amount of fragmented data, the lower the theoretical bandwidth utilization rate when the terminal requests fragmented data from the server through the network path. When the amount of fragmented data is constant, the bandwidth of the network path is larger, and the theoretical bandwidth utilization rate when the terminal requests fragmented data from the server through the network path is lower.
示例性的,对于网络带宽为100MBps,RTT为40ms的网络路径为例。当带宽利用率为90%以上时,则分片数据的数据量需要≥18MB,当带宽利用率为75%以上时,则分片数据的数据量需要≥15MB以上。当分片数据的数据量≤10MB时,则带宽利用率不会高于50%。Exemplarily, take a network path with a network bandwidth of 100 MBps and an RTT of 40 ms as an example. When the bandwidth utilization rate is more than 90%, the data volume of the fragmented data needs to be ≥18MB, and when the bandwidth utilization rate is more than 75%, the data volume of the fragmented data needs to be more than 15MB. When the data volume of the fragmented data is less than or equal to 10MB, the bandwidth utilization rate will not be higher than 50%.
因此,本申请实施例的第四部分提供了一种多路径数据预取方法,终端可以当应用业务请求第一数据量的数据时,向服务器预取第二数据量的数据,其中,第二数据量大于第一数据量。然后,终端接收到服务器返回的第二数据量的数据后,可以先将第二数据量中的第一数据量的数据返回给应用。然后,将剩余(第二数据量-第一数据量)的数据存到预取缓冲区。当应用下次请求剩余的(第二数据量-第一数据量)字节的数据时,终端可以直接从预取缓冲区中提取该剩余的(第二数据量-第一数据量)字节的数据给到应用。提高了终端与服务器之间的网络路径的带宽利用率,并且,当应用频繁访问同一URI地址上的不同范围的数据时,可以节省应用获取到数据的时间。Therefore, the fourth part of the embodiment of the present application provides a multi-path data prefetching method. When the application service requests data of the first data amount, the terminal can prefetch the data of the second data amount from the server, wherein the second data amount is The amount of data is greater than the first amount of data. Then, after receiving the data of the second data volume returned by the server, the terminal may first return the data of the first data volume in the second data volume to the application. Then, the remaining data (the second amount of data - the first amount of data) is stored in the prefetch buffer. When the application requests the remaining (the second amount of data - the first amount of data) bytes of data next time, the terminal can directly extract the remaining (the second amount of data - the first amount of data) bytes from the prefetch buffer data to the application. The bandwidth utilization rate of the network path between the terminal and the server is improved, and when the application frequently accesses data in different ranges on the same URI address, the time for the application to obtain the data can be saved.
示例性的,如图22A所示,终端可以通过一条网络路径向服务器提取预取数据。其中,步骤包括:Exemplarily, as shown in FIG. 22A , the terminal may retrieve the prefetched data from the server through a network path. Among them, the steps include:
1、终端上的应用发送数据请求1(请求范围为:1-100)给全网聚合模块(link turbo)。1. The application on the terminal sends data request 1 (request range: 1-100) to the network-wide aggregation module (link turbo).
2、全网聚合模块在接收到数据请求1后,可以加大数据请求1的请求范围,然后基于MPHTTP协议选择合适的一条网络路径发送HTTP请求1(请求范围:1-200)给服务器。2. After receiving the data request 1, the network-wide aggregation module can increase the request range of the data request 1, and then select a suitable network path based on the MPHTTP protocol to send the HTTP request 1 (request range: 1-200) to the server.
3、服务器在接收到HTTP请求1后,通过HTTP响应1返回请求的数据(数据范围:1-200)给到全网聚合模块。3. After receiving HTTP request 1, the server returns the requested data (data range: 1-200) through HTTP response 1 to the network-wide aggregation module.
4、全网聚合模块将响应数据1返回给应用,其中,该响应数据1中的数据范围为1-100。4. The network-wide aggregation module returns the response data 1 to the application, wherein the data range in the response data 1 is 1-100.
5、全网聚合模块将剩余数据存入到终端本地的预取缓冲区,其中,剩余数据的数据范围为101-200。5. The network-wide aggregation module stores the remaining data in the local prefetch buffer of the terminal, wherein the data range of the remaining data is 101-200.
6、应用下发数据请求2给全网聚合模块,其中,数据请求2请求的数据范围为101-200。6. The application sends data request 2 to the network-wide aggregation module, wherein the data range requested by data request 2 is 101-200.
7、当全网聚合模块接收到应用下发的数据请求2时,全网聚合模块可以从判断预取缓冲区中是否存有该数据请求2请求的数据,若是,则数据请求2命中预取缓冲区。7. When the network-wide aggregation module receives the data request 2 sent by the application, the network-wide aggregation module can judge whether the data requested by the data request 2 exists in the prefetch buffer, and if so, the data request 2 hits the prefetch buffer.
8、当数据请求2命中预取缓冲区时,应用可以直接从预取缓冲区中获取到数据请求2的响应数据2(数据范围:101-200)。8. When the data request 2 hits the prefetch buffer, the application can directly obtain the response data 2 of the data request 2 from the prefetch buffer (data range: 101-200).
又示例性的,如图22B所示,终端可以通过多条网络路径向服务器提取预取数据。其中,步骤包括:In another example, as shown in FIG. 22B , the terminal may extract prefetched data from the server through multiple network paths. Among them, the steps include:
1、终端上的应用发送数据请求1(请求范围为:1-100)给全网聚合模块。1. The application on the terminal sends data request 1 (request range: 1-100) to the network-wide aggregation module.
2-3、全网聚合模块在接收到数据请求1后,可以扩大数据请求1的请求范围至1-200。然后,全网聚合模块可以基于MPHTTP协议选择合适的多条(例如两条)网络路径,分别在网络路径1(例如蜂窝网络)上发送HTTP请求1(请求范围:1-50)给服务器,在网络路径2(例如WLAN网络)上发送HTTP请求2(请求范围:51-200)给服务器。2-3. After receiving the data request 1, the network-wide aggregation module can expand the request range of the data request 1 to 1-200. Then, the network-wide aggregation module can select appropriate multiple (for example, two) network paths based on the MPHTTP protocol, and send HTTP request 1 (request range: 1-50) to the server on network path 1 (for example, cellular network) respectively, Send HTTP request 2 (request range: 51-200) to the server on network path 2 (eg, WLAN network).
4、全网聚合模块接收到服务器通过网络路径1返回的HTTP响应1,其中,HTTP响应1中包括有数据范围1-50的数据。4. The network-wide aggregation module receives the HTTP response 1 returned by the server through the network path 1, wherein the HTTP response 1 includes data in a data range of 1-50.
5、全网聚合模块接收到服务器通过网络路径2返回的HTTP响应2,其中,HTTP响应1中包括有数据范围51-200的数据。5. The network-wide aggregation module receives the HTTP response 2 returned by the server through the network path 2, wherein the HTTP response 1 includes data in a data range of 51-200.
6、全网聚合模块在接收到HTTP响应1和HTTP响应2后,可以将响应数据1返回给应用,其中,响应数据1的数据范围为1-100。6. After receiving HTTP response 1 and HTTP response 2, the network-wide aggregation module can return response data 1 to the application, where the data range of response data 1 is 1-100.
7、全网聚合模块将剩余数据存入到终端本地的预取缓冲区,其中,剩余数据的数据范 围为101-200。7. The network-wide aggregation module stores the remaining data in the local prefetch buffer of the terminal, where the data range of the remaining data is 101-200.
8、应用下发数据请求2给全网聚合模块,其中,数据请求2请求的数据范围为101-200。8. The application sends data request 2 to the network-wide aggregation module, wherein the data range requested by data request 2 is 101-200.
9、当全网聚合模块接收到应用下发的数据请求2时,全网聚合模块可以从判断预取缓冲区中是否存有该数据请求2请求的数据,若是,则数据请求2命中预取缓冲区。9. When the network-wide aggregation module receives the data request 2 sent by the application, the network-wide aggregation module can judge whether the data requested by the data request 2 exists in the prefetch buffer, and if so, the data request 2 hits the prefetch buffer.
10、当数据请求2命中预取缓冲区时,应用可以直接从预取缓冲区中获取到数据请求2的响应数据2(数据范围:101-200)。10. When the data request 2 hits the prefetch buffer, the application can directly obtain the response data 2 of the data request 2 from the prefetch buffer (data range: 101-200).
通过本申请提供的一种多路径数据预取方法,终端向服务器请求的数据分片比应用请求的数据分片大,终端与服务器之间的网络路径的带宽利用率会增高,并且,当应用频繁访问同一URI地址上的不同范围的数据时,可以节省应用获取到数据的时间。例如,视频播放等场景,应用需要频繁获取数据流,通过本申请提供的数据预取方法,能够提高视频播放时平滑度。With the multi-path data prefetching method provided by the present application, the data fragment requested by the terminal from the server is larger than the data fragment requested by the application, the bandwidth utilization rate of the network path between the terminal and the server will be increased, and when the application When frequently accessing data of different scopes on the same URI address, it can save the time for the application to obtain the data. For example, in scenarios such as video playback, the application needs to obtain data streams frequently, and the data prefetching method provided in this application can improve the smoothness of video playback.
下面介绍本申请实施例的第四部分提供的一种终端100的软件***架构。The following introduces a software system architecture of the terminal 100 provided in the fourth part of the embodiment of the present application.
请参考图23,图23示出了本申请实施例提供的终端100的软件***架构。如图23所示,该终端100的软件***可以采用分层架构,分层架构可以将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。其中,该终端100的软件***可以包括应用(application)层、用户空间(user space)和内核(kernel)层。Please refer to FIG. 23. FIG. 23 shows the software system architecture of the terminal 100 provided by the embodiment of the present application. As shown in FIG. 23 , the software system of the terminal 100 may adopt a layered architecture, and the layered architecture may divide the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces. The software system of the terminal 100 may include an application layer, a user space (user space) and a kernel (kernel) layer.
应用程序层可以包括应用901。例如,视频应用、音乐应用等。其中,应用901通过原始HTTP请求向服务器请求分片数据时,可以通TCP端口80向服务器发送原始HTTP请求。The application layer may include applications 901 . For example, video applications, music applications, etc. Wherein, when the application 901 requests fragmented data from the server through the original HTTP request, it can send the original HTTP request to the server through the TCP port 80.
用户空间可以包括有基于缓冲池调度的多个功能模块、流智能(flow intelligence)模块907。其中,基于缓冲池调度的多个功能模块可以包括缓冲管理模块902、智能预取模块903、高性能业务请求重排模块904、基于缓冲的多径调度模块905、路径亲和性分析模块906。The user space may include a plurality of function modules based on buffer pool scheduling, a flow intelligence module 907 . The multiple functional modules based on buffer pool scheduling may include a buffer management module 902 , an intelligent prefetch module 903 , a high-performance service request rearrangement module 904 , a buffer-based multipath scheduling module 905 , and a path affinity analysis module 906 .
缓冲管理模块902,可用于在网络过滤模块(例如,netfiler)过滤TCP端口80中数据包的过程中,通过软件接口(例如,iptables)从TCP端口80中导流出上层应用发送的原始HTTP请求。缓冲管理模块902,还可用于在TCP端口80中导流出上层应用发送的原始HTTP请求之后,分析原始HTTP请求是否命中预取缓冲区(即,预取缓冲区中是否包括有原始HTTP请求所请求的数据)。当原始HTTP请求命中预取缓冲区时,缓冲管理模块902可以直接将预取缓冲区中该原始HTTP请求的请求范围对应的数据返回给应用。当原始HTTP请求击穿预取缓冲区(即原始HTTP请求中的请求范围大于预取缓冲区中已缓存的数据量)时,缓冲管理模块902可以将缓冲击穿原始请求的信息通知给高性能业务重排模块904。缓冲管理模块902还可用于将原始HTTP请求发送给智能预取模块903。The buffer management module 902 can be used to divert the original HTTP request sent from the upper-layer application from the TCP port 80 through a software interface (eg, iptables) during the process of filtering the data packets in the TCP port 80 by the network filtering module (eg, netfiler). The buffer management module 902 can also be configured to analyze whether the original HTTP request hits the prefetch buffer (that is, whether the prefetch buffer includes the request of the original HTTP request) after diverting the original HTTP request sent by the upper-layer application in the TCP port 80. The data). When the original HTTP request hits the prefetch buffer, the buffer management module 902 may directly return the data corresponding to the request range of the original HTTP request in the prefetch buffer to the application. When the original HTTP request breaks down the prefetch buffer (that is, the request range in the original HTTP request is larger than the amount of data buffered in the prefetch buffer), the buffer management module 902 can notify the high performance information that the buffer breaks down the original request Service rearrangement module 904 . The buffer management module 902 can also be used to send the raw HTTP request to the intelligent prefetch module 903 .
智能预取模块903可以根据预取缓冲区的缓冲水位线以及应用901访问同一URI地址的次数等信息,将预取请求的触发指令发给高性能业务请求重排模块904。The intelligent prefetching module 903 can send the triggering instruction of the prefetching request to the high-performance service request rearranging module 904 according to information such as the buffer watermark of the prefetching buffer and the number of times the application 901 accesses the same URI address.
高性能业务请求重排模块904,可用于在接收到该预取请求的触发指令后,根据上一次预取值,以及网络路径的带宽/时延等数据,确定出本次预取请求的数据请求范围。高性能业务请求重排模块904,还可用于将原始HTTP请求或重排后的HTTP请求发送给基于 缓冲的多径调度模块905。The high-performance service request rearrangement module 904 can be used to determine the data of this prefetch request according to the previous prefetch value and data such as the bandwidth/latency of the network path after receiving the trigger instruction of the prefetch request request scope. The high-performance service request reordering module 904 can also be used to send the original HTTP request or the reordered HTTP request to the buffer-based multipath scheduling module 905.
路径亲和性分析模块906,可用于将根据流智能模块907发送的业务感知信息(例如业务流服务质量、业务流类型等)/网络感知信息(例如,网络路径数量以及各网络路径的传输质量)等),分析出终端上每条网络路径的性能信息。The path affinity analysis module 906 can be used to analyze the service perception information (such as service flow service quality, service flow type, etc.)/network perception information (for example, the number of network paths and the transmission quality of each network path) sent according to the flow intelligence module 907 ), etc.) to analyze the performance information of each network path on the terminal.
基于缓冲的多径调度模块905,可用于根据网络路径的性能信息,确定出多径调度策略(即使用哪些路径请求数据,每条路径上请求多少数据)。基于缓冲的多径调度模块905,可可用于基于确定出的多径调度策略,通过MPHTTP将原始HTTP请求/重排后的HTTP请求拆分成多个子HTTP请求,并通过多个网络路径(例如,双Wi-Fi网络、双蜂窝网络等等)发送给服务器。The buffer-based multi-path scheduling module 905 can be configured to determine a multi-path scheduling policy (ie, which paths are used to request data, and how much data is requested on each path) according to the performance information of the network paths. The buffer-based multi-path scheduling module 905 can be configured to split the original HTTP request/rearranged HTTP request into multiple sub-HTTP requests through MPHTTP based on the determined multi-path scheduling policy, and split the original HTTP request/reordered HTTP request into multiple sub-HTTP requests through multiple network paths (eg , dual Wi-Fi networks, dual cellular networks, etc.) to the server.
流智能模块907,可用于进行DNS解析(DNS parsing)、manifest文件解析、流服务质量探测(flow QoS probing)、流分类(flow classification),并得到业务感知/网络感知信息等等。流智能模块907,可以将到业务感知信息/网络感知信息发送给路径亲和性分析模块906。The flow intelligence module 907 can be used to perform DNS parsing (DNS parsing), manifest file parsing, flow QoS probing (flow QoS probing), flow classification (flow classification), and obtain service awareness/network awareness information and the like. The flow intelligence module 907 can send the incoming service awareness information/network awareness information to the path affinity analysis module 906 .
内核层可以包括内核传输控制协议/网际协议(transmission control protocol/Internet protocol,TCP/IP)协议栈。其中,TCP/IP协议栈中包括有TCP端口80。The kernel layer may include a kernel transmission control protocol/Internet protocol (transmission control protocol/Internet protocol, TCP/IP) protocol stack. The TCP/IP protocol stack includes TCP port 80.
在本申请实施例中,基于缓冲池调度的多个功能模块可以是上述图22A或图22B所示实施例中的全网聚合模块。对基于缓冲池调度的多个功能模块的其他功能说明,还可以参考前述图22A或图22B所示实施例中针对全网聚合模块的文字说明,在此不再赘述。In this embodiment of the present application, the multiple functional modules based on buffer pool scheduling may be the network-wide aggregation modules in the embodiment shown in FIG. 22A or FIG. 22B. For other functional descriptions of multiple functional modules based on buffer pool scheduling, reference may also be made to the textual descriptions for the network-wide aggregation module in the embodiment shown in FIG. 22A or FIG. 22B , which will not be repeated here.
下面介绍本申请实施例的第四部分提供的一种多路径数据预取方法。The following describes a multi-path data prefetching method provided in the fourth part of the embodiment of the present application.
请参考图24,图24示出了本申请实施例提供的第一应用首次获取服务器上数据的方法流程示意图。如图24所示,该方法包括如下步骤:Please refer to FIG. 24. FIG. 24 shows a schematic flowchart of a method for a first application to obtain data on a server for the first time according to an embodiment of the present application. As shown in Figure 24, the method includes the following steps:
S2401、终端100上的第一应用针对第一URI首次发起针对第一分片数据的第一获取请求。S2401. A first application on the terminal 100 initiates a first acquisition request for the first fragmented data for the first URI for the first time.
其中,第一URI对应服务器上一种数据资源(例如,HTML文档、图像、视频片段、程序等资源)的存储位置。URI的结构组成包括访问资源的命名机制、存放资源的主机名、资源自身的名称。其中,访问资源的命名机制可以包括http、ftp、mailto、file等等。该第一URI具体也可以是一种统一资源定位符(uniform resource locator,URL)。第一获取请求中包括有该第一分片数据的数据范围。The first URI corresponds to a storage location of a data resource (for example, an HTML document, an image, a video clip, a program, etc.) on the server. The structure of the URI includes the naming mechanism for accessing the resource, the host name where the resource is stored, and the name of the resource itself. The naming mechanism for accessing resources may include http, ftp, mailto, file, and so on. Specifically, the first URI may also be a uniform resource locator (uniform resource locator, URL). The first obtaining request includes the data range of the first fragmented data.
示例性的,第一应用可以是视频应用,第一URI可以为“http://huawei.himovie.com/movie/RomeoAndJuliet.rmvb”,第一URI对应的资源访问机制可以是HTTP协议访问机制,第一URI对应的资源位于“huawei.himovie.com”的服务器上,第一URI对应资源的名称可以为“/movie/RomeoAndJuliet.rmvb”。第一分片数据的数据范围可以是0-2MB。示例仅仅用于解释本申请不应构成限定。Exemplarily, the first application may be a video application, the first URI may be "http://huawei.himovie.com/movie/RomeoAndJuliet.rmvb", and the resource access mechanism corresponding to the first URI may be an HTTP protocol access mechanism, The resource corresponding to the first URI is located on the server of "huawei.himovie.com", and the name of the resource corresponding to the first URI may be "/movie/RomeoAndJuliet.rmvb". The data range of the first fragment data may be 0-2MB. The examples are used only to explain the application and should not be construed as limiting.
S2402、响应于第一获取请求,终端100开启所有网络通信模块、并根据第一URI的域名在所有网路路径上发送DNS请求。S2402. In response to the first acquisition request, the terminal 100 enables all network communication modules, and sends a DNS request on all network paths according to the domain name of the first URI.
其中,网络通信模块可以包括蜂窝网络通信模块和WLAN通信模块。其中,蜂窝网络 通信模块可以实现单蜂窝网络通信或双蜂窝网络通信。WLAN通信模块可以实现单Wi-Fi网络通信或双Wi-Fi网络通信。Wherein, the network communication module may include a cellular network communication module and a WLAN communication module. Wherein, the cellular network communication module can realize single cellular network communication or dual cellular network communication. The WLAN communication module can realize single Wi-Fi network communication or dual Wi-Fi network communication.
终端100在开启所有网路模块后,终端100可以获取第一URI的域名(也即主机名),并在所有网络路径上发送DNS请求。该DNS请求可用于终端100获取第一URI对应服务器的IP地址。例如,终端100上的网络路径可以包括有蜂窝网络路径1、蜂窝网络路径2、Wi-Fi网络路径1、Wi-Fi网络路径2。终端100可以分别在蜂窝网络路径1、蜂窝网络路径2、Wi-Fi网络路径1、Wi-Fi网络路径2上发送DNS请求。After the terminal 100 enables all network modules, the terminal 100 can obtain the domain name (ie, the host name) of the first URI, and send DNS requests on all network paths. The DNS request may be used by the terminal 100 to obtain the IP address of the server corresponding to the first URI. For example, the network paths on the terminal 100 may include cellular network path 1, cellular network path 2, Wi-Fi network path 1, and Wi-Fi network path 2. The terminal 100 may send DNS requests on the cellular network path 1, the cellular network path 2, the Wi-Fi network path 1, and the Wi-Fi network path 2, respectively.
S2403、终端100接收到N个网络路径上返回的DNS响应,并从N个DNS响应中解析出服务器在N个网络路径上对应的IP地址。其中,N为正整数。S2403: The terminal 100 receives the DNS responses returned on the N network paths, and resolves the IP addresses corresponding to the servers on the N network paths from the N DNS responses. Among them, N is a positive integer.
在终端100向所有网络路径发送DNS请求后,终端100在某一网络路径上没有接收到DNS响应时,终端100可以确定该没有接收到DNS响应的网络路径不可用,即终端100无法通过该网络路径访问到第一URI对应的服务器。当终端100接收到从某一网络路径返回的DNS响应时,终端100可以确定该接收到DNS响应的网络路径可用,即终端100可以通过该网络路径访问到第一URI对应的服务器。After the terminal 100 sends a DNS request to all network paths, when the terminal 100 does not receive a DNS response on a certain network path, the terminal 100 may determine that the network path for which the DNS response has not been received is unavailable, that is, the terminal 100 cannot pass through the network The path accesses the server corresponding to the first URI. When the terminal 100 receives a DNS response returned from a certain network path, the terminal 100 may determine that the network path on which the DNS response is received is available, that is, the terminal 100 can access the server corresponding to the first URI through the network path.
终端100从不同网络路径上获取到第一URI对应服务器的IP地址可以相同。在一种可能的实现方式中,终端100从不同网络路径上获取到第一URI对应服务器的IP地址可以有不同。例如,终端100从蜂窝网络路径1上获取到的第一URI对应服务器的IP地址可以为IP地址_1。终端100从蜂窝网络路径2上获取到的第一URI对应服务器的IP地址可以为IP地址_2。终端100从Wi-Fi网络路径1上获取到的第一URI对应服务器的IP地址可以为IP地址_3。终端100从Wi-Fi网络路径2上获取到的第一URI对应服务器的IP地址可以为IP地址_4。上述示例仅仅用于解释本申请,不应构成限定。The IP addresses of the servers corresponding to the first URI obtained by the terminal 100 from different network paths may be the same. In a possible implementation manner, the IP addresses of the servers corresponding to the first URI obtained by the terminal 100 from different network paths may be different. For example, the IP address of the server corresponding to the first URI obtained by the terminal 100 from the cellular network path 1 may be IP address_1. The IP address of the server corresponding to the first URI obtained by the terminal 100 from the cellular network path 2 may be IP address_2. The IP address of the server corresponding to the first URI obtained by the terminal 100 from the Wi-Fi network path 1 may be IP address_3. The IP address of the server corresponding to the first URI obtained by the terminal 100 from the Wi-Fi network path 2 may be IP address_4. The above examples are only used to explain the present application and should not be construed as limitations.
S2404、终端100上的第一应用根据第一URI和默认网络路径上服务器的IP地址,发起初次HTTP请求。其中,初次HTTP请求的请求范围与上述第一获取请求的请求范围相同。S2404. The first application on the terminal 100 initiates an initial HTTP request according to the first URI and the IP address of the server on the default network path. The request scope of the initial HTTP request is the same as the request scope of the first obtaining request.
其中,初次HTTP请求的byte range字段可包括有该初次HTTP请求的请求范围。The byte range field of the initial HTTP request may include the request range of the initial HTTP request.
当终端100开启所有网络通信模块后,终端100可以预设有一条默认的网络路径。终端100上的第一应用在发起初次HTTP请求时,初次HTTP请求中的目的IP地址为终端100在该默认的网络路径上获取到第一URI对应服务器的IP地址。After the terminal 100 enables all network communication modules, the terminal 100 may be preset with a default network path. When the first application on the terminal 100 initiates the initial HTTP request, the destination IP address in the initial HTTP request is the IP address of the server corresponding to the first URI obtained by the terminal 100 on the default network path.
示例性的,终端100可以通过蜂窝网络路径1、蜂窝网络路径2、Wi-Fi网络路径1和Wi-Fi网路路径2,访问服务器。终端100上预设的默认网络路径可以是Wi-Fi网路路径1,终端100可以将Wi-Fi网络路径1上的服务器的IP地址_3作为该初次HTTP请求的目的IP地址。Exemplarily, the terminal 100 may access the server through the cellular network path 1, the cellular network path 2, the Wi-Fi network path 1, and the Wi-Fi network path 2. The default network path preset on the terminal 100 may be the Wi-Fi network path 1, and the terminal 100 may use the IP address_3 of the server on the Wi-Fi network path 1 as the destination IP address of the initial HTTP request.
S2405、终端100对初次HTTP请求的请求范围拆分成N个范围长度相同的子请求范围。其中,初次HTTP请求的请求范围与第一分片数据的数据范围相同。S2405, the terminal 100 splits the request range of the initial HTTP request into N sub-request ranges with the same range length. The request scope of the initial HTTP request is the same as the data scope of the first fragmented data.
示例性的,初次HTTP请求的请求范围可以是0-2MB。终端100上可以通过蜂窝网络 路径1、蜂窝网络路径2、Wi-Fi网络路径1和Wi-Fi网络路径2这4个网络路径访问到第一URI对应的服务器。终端100可以将初次HTTP请求的请求范围拆分为4个请求范围长度相同的子请求范围,例如,子请求范围1为第0-0.5MB、子请求范围2为第0.5MB-1MB、子请求范围3为第1MB-1.5MB、子请求范围4为第1.5MB-2MB。上述示例仅仅用于解释本申请,不应构成限定。Exemplarily, the request range of the initial HTTP request may be 0-2MB. The terminal 100 can access the server corresponding to the first URI through four network paths, namely, cellular network path 1, cellular network path 2, Wi-Fi network path 1, and Wi-Fi network path 2. The terminal 100 may split the request range of the initial HTTP request into 4 sub-request ranges with the same request range length. Range 3 is 1MB-1.5MB, and sub-request range 4 is 1.5MB-2MB. The above examples are only used to explain the present application and should not be construed as limitations.
S2406、终端100根据第一URI、N个子请求范围和N个网络路径上服务器的IP地址,生成N个HTTP请求,并将N个HTTP请求分别通过N个网络路径发送给服务器。S2406. The terminal 100 generates N HTTP requests according to the first URI, the N sub-request ranges, and the IP address of the server on the N network paths, and sends the N HTTP requests to the server through the N network paths respectively.
需要说明的是,N个HTTP请求在本申请实施例中可以被称为N个第五HTTP请求。It should be noted that the N HTTP requests may be referred to as N fifth HTTP requests in this embodiment of the present application.
示例性的,终端100上可以通过蜂窝网络路径1、蜂窝网络路径2、Wi-Fi网络路径1和Wi-Fi网络路径2这4个网络路径访问到第一URI对应的服务器。其中,蜂窝网络路径1上服务器的IP地址可以是IP地址_1、蜂窝网络路径2上服务器的IP地址可以是IP地址_2、Wi-Fi网络路径1上服务器的IP地址可以是IP地址_3、Wi-Fi网络路径2上服务器的IP地址可以是IP地址_4。子请求范围1为第0-0.5MB、子请求范围2为第0.5MB-1MB、子请求范围3为第1MB-1.5MB、子请求范围4为第1.5MB-2MB。上述示例仅仅用于解释本申请,不应构成限定。N个HTTP请求、N个子请求范围、服务器IP地址、网路路径之间的对应关系可以如下表1所示:Exemplarily, the terminal 100 may access the server corresponding to the first URI through four network paths: cellular network path 1, cellular network path 2, Wi-Fi network path 1, and Wi-Fi network path 2. Wherein, the IP address of the server on the cellular network path 1 may be IP address_1, the IP address of the server on the cellular network path 2 may be IP address_2, and the IP address of the server on the Wi-Fi network path 1 may be IP address_ 3. The IP address of the server on Wi-Fi network path 2 can be IP address_4. Subrequest range 1 is 0-0.5MB, subrequest range 2 is 0.5MB-1MB, subrequest range 3 is 1MB-1.5MB, and subrequest range 4 is 1.5MB-2MB. The above examples are only used to explain the present application and should not be construed as limitations. The correspondence between N HTTP requests, N sub-request ranges, server IP addresses, and network paths can be shown in Table 1 below:
表1Table 1
Figure PCTCN2021108275-appb-000006
Figure PCTCN2021108275-appb-000006
由上表1可知,终端100可以将HTTP请求1在蜂窝网络路径1上发送给第一URI对应的服务器,其中,该HTTP请求1的子请求范围1为第0-0.5MB,HTTP请求1的目的IP地址为IP地址_1。终端100可以将HTTP请求2在蜂窝网络路径2上发送给第一URI对应的服务器,其中,该HTTP请求2的子请求范围2为第0.5-1.0MB,HTTP请求2的目的IP地址为IP地址_2。终端100可以将HTTP请求3在Wi-Fi网络路径1上发送给第一URI对应的服务器,其中,该HTTP请求3的子请求范围3为第1-1.5MB,HTTP请求3的目的IP地址为IP地址_3。终端100可以将HTTP请求1在蜂窝网络路径1上发送给第一URI对应的服务器,其中,该HTTP请求4的子请求范围4为第1.5-2MB,HTTP请求4的目的IP地址为IP地址_4。上述表1仅仅用于解释本申请,不应构成限定。It can be seen from the above Table 1 that the terminal 100 can send the HTTP request 1 to the server corresponding to the first URI on the cellular network path 1, wherein the sub-request range 1 of the HTTP request 1 is 0-0.5 MB, and the The destination IP address is IP address_1. The terminal 100 may send the HTTP request 2 to the server corresponding to the first URI on the cellular network path 2, where the sub-request range 2 of the HTTP request 2 is 0.5-1.0 MB, and the destination IP address of the HTTP request 2 is the IP address _2. The terminal 100 may send the HTTP request 3 to the server corresponding to the first URI on the Wi-Fi network path 1, wherein the sub-request range 3 of the HTTP request 3 is the 1st-1.5 MB, and the destination IP address of the HTTP request 3 is IP address_3. The terminal 100 may send the HTTP request 1 to the server corresponding to the first URI on the cellular network path 1, wherein the sub-request range 4 of the HTTP request 4 is 1.5-2 MB, and the destination IP address of the HTTP request 4 is IP address_ 4. The above Table 1 is only used to explain the present application and should not be construed as a limitation.
S2407、终端100接收到服务器在N个网络路径返回的N个HTTP响应,并将N个HTTP 响应中的第一分片数据,返回给第一应用。S2407: The terminal 100 receives N HTTP responses returned by the server in the N network paths, and returns the first fragmented data in the N HTTP responses to the first application.
需要说明的是,第一分片数据在本申请实施例中可以被称为第五数据。It should be noted that the first fragmented data may be referred to as fifth data in this embodiment of the present application.
服务器接收到终端100发送的HTTP请求后,可以将该HTTP请求所请求的数据封装在HTTP响应中,按照该HTTP请求的原路径返回给终端100。After receiving the HTTP request sent by the terminal 100, the server may encapsulate the data requested by the HTTP request in the HTTP response, and return the data to the terminal 100 according to the original path of the HTTP request.
例如,终端100将HTTP请求1通过蜂窝网络路径1发送给服务器,将HTTP请求2通过Wi-Fi网络路径1发送给服务器,将HTTP请求3通过Wi-Fi网络路径1发送给服务器,将HTTP请求4通过Wi-Fi网络路径2发送给服务器。其中,HTTP请求1用于请求第一URI对应资源的第0-0.5MB范围内的数据,HTTP请求2用于请求第一URI对应资源的0.5MB-1MB范围内的数据,HTTP请求3用于请求第一URI对应资源的第1MB-1.5MB范围内的数据,HTTP请求4用于请求第一URI对应资源的第1.5MB-2MB范围内的数据。For example, the terminal 100 sends HTTP request 1 to the server through cellular network path 1, sends HTTP request 2 to the server through Wi-Fi network path 1, sends HTTP request 3 to the server through Wi-Fi network path 1, and sends HTTP request 4 Send to server via Wi-Fi network path 2. Among them, HTTP request 1 is used to request data in the range of 0-0.5MB of the resource corresponding to the first URI, HTTP request 2 is used to request data in the range of 0.5MB-1MB of the resource corresponding to the first URI, and HTTP request 3 is used. The data in the range of 1MB-1.5MB of the resource corresponding to the first URI is requested, and the HTTP request 4 is used to request the data in the range of 1.5MB-2MB of the resource corresponding to the first URI.
服务器在接收到HTTP请求1后,可以将第一URI对应资源的第0-0.5MB的数据封装在HTTP响应1中,并通过蜂窝网络路径1将该HTTP响应1返给终端100。服务器在接收到HTTP请求2后,可以将第一URI对应资源的第0.5MB-1MB的数据封装在HTTP响应2中,并将HTTP请求2通过蜂窝网络路径2返回给终端100。服务器在接收到HTTP请求3后,可以将第一URI对应资源的第1MB-1.5MB的数据封装在HTTP响应3中,并将HTTP请求3通过Wi-Fi网络路径1返回给终端100。服务器在接收到HTTP请求4后,可以将第一URI对应资源的第1.5MB-2MB的数据封装在HTTP响应4中,并将HTTP请求4通过Wi-Fi网络路径2返回给终端100。After receiving the HTTP request 1, the server may encapsulate the 0-0.5 MB data of the resource corresponding to the first URI in the HTTP response 1, and return the HTTP response 1 to the terminal 100 through the cellular network path 1. After receiving the HTTP request 2, the server may encapsulate the 0.5MB-1MB data of the resource corresponding to the first URI in the HTTP response 2, and return the HTTP request 2 to the terminal 100 through the cellular network path 2. After receiving the HTTP request 3, the server may encapsulate the 1 MB-1.5 MB data of the resource corresponding to the first URI in the HTTP response 3, and return the HTTP request 3 to the terminal 100 through the Wi-Fi network path 1. After receiving the HTTP request 4, the server may encapsulate the 1.5MB-2MB data of the resource corresponding to the first URI in the HTTP response 4, and return the HTTP request 4 to the terminal 100 through the Wi-Fi network path 2.
终端100在接收到HTTP响应1后,可以从HTTP响应1取出第一URI对应资源的第0-0.5MB的数据。终端100在HTTP响应2后,可以从HTTP响应2取出第一URI对应资源的第0.5MB-1MB的数据。终端100在HTTP响应3后,可以从HTTP响应3中取出第一URI对应资源的第1MB-1.5MB的数据。终端100在HTTP响应4后,可以从HTTP响应4取出第一URI对应资源的第1.5MB-2MB的数据。After receiving the HTTP response 1, the terminal 100 can retrieve the 0-0.5 MB data of the resource corresponding to the first URI from the HTTP response 1. After the terminal 100 responds with HTTP 2, the terminal 100 can retrieve the 0.5MB-1MB data of the resource corresponding to the first URI from the HTTP response 2. After the HTTP response 3, the terminal 100 may extract the 1MB-1.5MB data of the resource corresponding to the first URI from the HTTP response 3. After the HTTP response 4, the terminal 100 may retrieve the 1.5MB-2MB data of the resource corresponding to the first URI from the HTTP response 4.
终端100可以将第一URI对应资源的第0-0.5MB的数据、第0.5MB-1MB、第1MB-1.5MB的数据、第1.5MB-2.0MB的数据,组合成上述第一分片数据,返回给第一应用。上述示例仅仅用于解释本申请,不应构成限定。The terminal 100 may combine the 0-0.5 MB data, the 0.5 MB-1 MB, the 1 MB-1.5 MB data, and the 1.5 MB-2.0 MB data of the resource corresponding to the first URI into the first fragmented data, Return to the first application. The above examples are only used to explain the present application and should not be construed as limitations.
S2408、终端100测量N个网络路径的关键性能指标(key performance indication,KPI)信息。S2408. The terminal 100 measures key performance indicator (key performance indication, KPI) information of the N network paths.
关键性能指标信息可以包括真实带宽、往返时延RTT、流完成时间(FCT)等等。The key performance indicator information may include real bandwidth, round-trip delay RTT, flow completion time (FCT), and the like.
其中,终端100可以根据如下公式测量N个网络路径的真实带宽:The terminal 100 can measure the real bandwidth of the N network paths according to the following formula:
Figure PCTCN2021108275-appb-000007
Figure PCTCN2021108275-appb-000007
Figure PCTCN2021108275-appb-000008
Figure PCTCN2021108275-appb-000008
TransTime i=max{U i/Z i,0.5*RTT i} 公式(23) TransTime i =max{U i /Z i ,0.5*RTT i } Formula (23)
其中,上述公式(21)、公式(22)和公式(23)中,
Figure PCTCN2021108275-appb-000009
表示第i条网络路径的理论带宽利用率,Z i表示第i条网络路径的真实带宽,X i表示第i条网络路径的吞吐量,TransTime i表示第i条网络路径上的数据传输耗时,U i表示第i条网络路径上HTTP请求所请求的数据量,RTT i表示第i条网络路径上的往返时延,i≤N。其中,U i已知,X i和RTT i可测量,因此,通过上述公式(21)、公式(22)和上述公式(23)确定出Z i
Among them, in the above formula (21), formula (22) and formula (23),
Figure PCTCN2021108275-appb-000009
Represents the theoretical bandwidth utilization of the i-th network path, Z i represents the actual bandwidth of the i-th network path, X i represents the throughput of the i-th network path, TransTime i represents the data transmission time on the i-th network path , U i represents the amount of data requested by the HTTP request on the ith network path, RTT i represents the round-trip delay on the ith network path, i≤N. Wherein, U i is known, X i and RTT i are measurable, therefore, Z i is determined by the above formula (21), formula (22) and formula (23).
示例性的,终端100有蜂窝网络路径1、蜂窝网络路径2、Wi-Fi网络路径1和Wi-Fi网络路径2这4条网络路径。其中,终端100在这4条网络路径上请求的数据量可以都为5MB。其中,这4条网络路径各自的吞吐量X i、数据传输耗时TransTime i、往返时延RTT i、请求的数据量U i,可以如下表2所示: Exemplarily, the terminal 100 has four network paths, namely, a cellular network path 1, a cellular network path 2, a Wi-Fi network path 1, and a Wi-Fi network path 2. Wherein, the amount of data requested by the terminal 100 on the four network paths may all be 5MB. Among them, the respective throughputs X i , data transmission time-consuming TransTime i , round-trip delay RTT i , and requested data volume U i of these four network paths can be shown in Table 2 below:
表2Table 2
Figure PCTCN2021108275-appb-000010
Figure PCTCN2021108275-appb-000010
由上述表2可知,蜂窝网络路径1的吞吐量X 1为10MBps、请求的数据量U 1为0.5MB、往返时延RTT 1为50ms、数据传输耗时TransTime 1为25ms。蜂窝网络路径2的吞吐量X 2为5.88MBps、请求的数据量U 2为0.5MB、往返时延RTT 2为70ms、数据传输耗时TransTime 2为20ms。Wi-Fi网络路径1的吞吐量X 3为20MBps、请求的数据量U 3为0.5MB、往返时延RTT 3为40ms、数据传输耗时TransTime 3为20ms。Wi-Fi网络路径2的吞吐量X 4为15MBps、请求的数据量U 4为0.5MB、往返时延RTT 4为60ms、数据传输耗时TransTime 4为30ms。 It can be seen from Table 2 above that the throughput X 1 of the cellular network path 1 is 10MBps, the requested data volume U 1 is 0.5MB, the round-trip delay RTT 1 is 50ms, and the data transmission time TransTime 1 is 25ms. The throughput X 2 of the cellular network path 2 is 5.88 MBps, the requested data amount U 2 is 0.5 MB, the round-trip delay RTT 2 is 70 ms, and the data transmission time TransTime 2 is 20 ms. The throughput X 3 of the Wi-Fi network path 1 is 20MBps, the requested data volume U 3 is 0.5MB, the round-trip delay RTT 3 is 40ms, and the data transmission time TransTime 3 is 20ms. The throughput X 4 of the Wi-Fi network path 2 is 15MBps, the requested data amount U 4 is 0.5MB, the round-trip delay RTT 4 is 60ms, and the data transmission time TransTime 4 is 30ms.
根据上述表2和上述公式(20)、公式(21)和公式(22),可以计算出:蜂窝网路路径1的带宽利用率
Figure PCTCN2021108275-appb-000011
为50%,蜂窝网络路径1的真实带宽为20MBps。蜂窝网路路径2的带宽利用率
Figure PCTCN2021108275-appb-000012
为58.82%,蜂窝网络路径2的真实带宽为10MBps。Wi-Fi网路路径1的带宽利用率为50%,Wi-Fi网络路径1的真实带宽为40MBps。Wi-Fi网路路径2的带宽利用率为50%,Wi-Fi网络路径2的真实带宽为30MBps。上述示例仅仅用于解释本申请,不应构成限定。
According to the above table 2 and the above formula (20), formula (21) and formula (22), it can be calculated: the bandwidth utilization rate of the cellular network path 1
Figure PCTCN2021108275-appb-000011
is 50%, the real bandwidth of cellular network path 1 is 20MBps. Bandwidth Utilization of Cellular Network Path 2
Figure PCTCN2021108275-appb-000012
is 58.82%, the true bandwidth of cellular network path 2 is 10MBps. The bandwidth utilization of Wi-Fi network path 1 is 50%, and the real bandwidth of Wi-Fi network path 1 is 40MBps. The bandwidth utilization of Wi-Fi network path 2 is 50%, and the real bandwidth of Wi-Fi network path 2 is 30MBps. The above examples are only used to explain the present application and should not be construed as limitations.
请参考图25,图25示出了本申请实施例的第四部分提供的第一应用再次获取服务器上数据的方法流程示意图。如图25所示,该方法包括如下步骤:Please refer to FIG. 25. FIG. 25 shows a schematic flowchart of a method for the first application to obtain data on the server again provided in the fourth part of the embodiment of the present application. As shown in Figure 25, the method includes the following steps:
S2501、终端100的第一应用针对第一URI发起针对第一分片数据的初次HTTP请求。S2501. The first application of the terminal 100 initiates an initial HTTP request for the first fragmented data with respect to the first URI.
具体内容,可以参考上述图24所示实施例中的步骤S2404,在此不再赘述。For specific content, reference may be made to step S2404 in the above-mentioned embodiment shown in FIG. 24 , which will not be repeated here.
S2502、终端100记录第一应用发起初次HTTP请求的时间信息,并创建第一URI对应的第一预取缓冲区(初始为空)。S2502. The terminal 100 records time information when the first application initiates the initial HTTP request, and creates a first prefetch buffer corresponding to the first URI (which is initially empty).
其中,第一应用每次请求第一URI对应资源的分片数据时,终端100都可以记录下第一应用针对第一URI对应资源的分片数据发起HTTP请求的时间信息。例如,第一应用针对第一URI发起首次HTTP请求(即初次HTTP请求)的时间为“2020年6月18日15点26分2秒30毫秒”。Wherein, each time the first application requests the fragmented data of the resource corresponding to the first URI, the terminal 100 may record the time information when the first application initiates the HTTP request for the fragmented data of the resource corresponding to the first URI. For example, the time at which the first application initiates the first HTTP request (ie, the first HTTP request) for the first URI is "June 18, 2020 15:26:2:30 ms".
在终端100的第一应用针对第一URI首次发起用于获取第一分片数据的初次HTTP请求时,终端100在本地创建该第一URI对应的第一预取缓冲区。其中,该第一预取缓冲区初始水位线为空。When the first application of the terminal 100 initiates an initial HTTP request for acquiring the first fragmented data for the first URI for the first time, the terminal 100 locally creates a first prefetch buffer corresponding to the first URI. Wherein, the initial water level of the first prefetch buffer is empty.
S2503、终端100的第一应用针对第一URI发起用于获取第二分片数据的第一HTTP请求。S2503. The first application of the terminal 100 initiates a first HTTP request for acquiring the second fragment data with respect to the first URI.
需要说明的是,第一分片数据在本申请实施例中可以被称为第一数据。It should be noted that, the first fragmented data may be referred to as the first data in this embodiment of the present application.
其中,第一HTTP请求可以是指第一应用在发起上述初次HTTP请求后,针对第一URI对应资源上的分片数据发起的任一次HTTP请求。例如,第二分片数据可以是第一URI对应的资源(例如,视频资源)中第2MB-4MB范围内的数据。第二获取请求中包括有该第二分片数据的数据范围。又例如,第二分片数据可以是第一URI对应的资源(例如,视频资源)中第4MB-6MB范围内的数据。The first HTTP request may refer to any HTTP request initiated by the first application for fragmented data on the resource corresponding to the first URI after the first application initiates the above-mentioned initial HTTP request. For example, the second fragmented data may be data in the range of 2MB-4MB in the resource (eg, video resource) corresponding to the first URI. The second obtaining request includes the data range of the second fragmented data. For another example, the second fragmented data may be data in the range of 4MB-6MB in the resource (eg, video resource) corresponding to the first URI.
其中,针对第一URI的文字说明可以参考前述图24所示实施例,在此不再赘述。For the text description of the first URI, reference may be made to the embodiment shown in FIG. 24 , which is not repeated here.
S2504、终端100记录第一应用发起第一HTTP请求的时间信息。S2504. The terminal 100 records time information when the first application initiates the first HTTP request.
其中,第一应用每次发起HTTP请求,请求第一URI对应资源的数据时,终端100都可以记录下第一应用请求第一URI的时间。在第一应用针对第一URI发起用于获取第二分片数据的第一HTTP请求时,终端100可以记录下发起第一HTTP请求的时间。例如,第一应用针对发起第一HTTP请求的时间为“2020年6月18日15点26分3秒200毫秒”。Wherein, every time the first application initiates an HTTP request to request data of the resource corresponding to the first URI, the terminal 100 may record the time when the first application requests the first URI. When the first application initiates the first HTTP request for acquiring the second fragment data with respect to the first URI, the terminal 100 may record the time when the first HTTP request is initiated. For example, the time at which the first application initiates the first HTTP request is "June 18, 2020 15:26:3 seconds 200 milliseconds".
S2505、终端100判断第一预取缓冲区中是否包括有第二分片数据。若是,则执行S2506;若终端100判断第一预取缓冲区中不包括有第一HTTP请求中请求的数据,则执行S2510。S2505. The terminal 100 determines whether the first prefetch buffer includes the second fragment data. If yes, execute S2506; if the terminal 100 determines that the data requested in the first HTTP request is not included in the first prefetch buffer, execute S2510.
S2506、终端100将第一预取缓冲区中第二分片数据返回给上述第一应用。S2506. The terminal 100 returns the second fragmented data in the first prefetch buffer to the first application.
S2507、在终端100将第一预取缓冲池中的第二分片数据返回给第一应用后,终端100将第一预取缓冲区中第二分片数据删除,以释放第一预取缓冲区中该第二分片数据的存储空间。S2507. After the terminal 100 returns the second fragment data in the first prefetch buffer pool to the first application, the terminal 100 deletes the second fragment data in the first prefetch buffer to release the first prefetch buffer The storage space of the second fragment data in the zone.
在第一应用发起第一HTTP请求后,终端100可以获取该第一HTTP请求,并解析出第一HTTP请求中的请求范围(即第二分片数据的数据范围)。终端100可以判断第一预取缓冲区中是否包括有该第二分片数据。After the first application initiates the first HTTP request, the terminal 100 may obtain the first HTTP request, and parse out the request range in the first HTTP request (ie, the data range of the second fragmented data). The terminal 100 can determine whether the second fragment data is included in the first prefetch buffer.
其中,第一预取缓冲区中的数据来源于后续图26所示实施例中针对第一URI对应资源的数据预取流程,具体内容可以参考后续图26所示实施例在此不再赘述。The data in the first prefetch buffer comes from the data prefetch process for the resource corresponding to the first URI in the subsequent embodiment shown in FIG. 26 , and the specific content can refer to the subsequent embodiment shown in FIG.
当终端100确定出该第一预取缓冲区中包括有第二分片数据时,终端100可以将第一预取缓冲区中的第二分片数据返回给第一应用。然后,终端100可以将第一预取缓冲区中的第二分片数据删除,以释放第一预取缓冲区该第二分片数据的存储空间。When the terminal 100 determines that the first prefetch buffer includes the second fragment data, the terminal 100 may return the second fragment data in the first prefetch buffer to the first application. Then, the terminal 100 may delete the second fragment data in the first prefetch buffer to release the storage space of the second fragment data in the first prefetch buffer.
示例性的,第一预取缓冲区中可以存储有第一URI对应资源中第6MB-10MB范围内的数据。第一HTTP请求所请求的第二分片数据为第一URI对应资源中第6MB-8MB范围内的数据。终端100可以确定第一预取缓冲区中包括有第二分片数据。终端100可以将第一预取缓冲区中第二分片数据返回给第一应用,并将第一预取缓冲区中第二分片数据删除,释放第二分片数据的存储空间。在删除第二分片数据之后,第一预取缓冲区中存储有第一URI对应资源中第8MB-10MB范围内的数据。上述示例仅仅用于解释本申请,不应构成限定。Exemplarily, the first prefetch buffer may store data in the range of 6MB-10MB in the resource corresponding to the first URI. The second fragmented data requested by the first HTTP request is data in the range of 6MB-8MB in the resource corresponding to the first URI. The terminal 100 may determine that the second fragment data is included in the first prefetch buffer. The terminal 100 may return the second fragment data in the first prefetch buffer to the first application, delete the second fragment data in the first prefetch buffer, and release the storage space of the second fragment data. After the second fragment data is deleted, the first prefetch buffer stores data in the range of 8MB-10MB in the resource corresponding to the first URI. The above examples are only used to explain the present application and should not be construed as limitations.
S2508、终端100判断第一预取缓冲区中剩余缓冲量是否低于水位线阈值。若是,则执行S2509、终端100可以发起针对第一URI对应资源的数据预取流程。S2508. The terminal 100 determines whether the remaining buffer amount in the first prefetch buffer is lower than the watermark threshold. If so, S2509 is performed, and the terminal 100 may initiate a data prefetching process for the resource corresponding to the first URI.
在终端100将第一预取缓冲区中第二分片数据删除之后,终端100可以判断第一预取缓冲区中已缓冲数据量是否低于水位线阈值。当终端100确定出第一预取缓冲区中已缓冲数据量低于水位线阈值时,终端100可以触发针对第一URL上数据的预取流程。其中,针对第一URI对应资源的数据预取流程,可以参考后续图26所示实施例,在此不再赘述。After the terminal 100 deletes the second fragmented data in the first prefetch buffer, the terminal 100 may determine whether the amount of buffered data in the first prefetch buffer is lower than the watermark threshold. When the terminal 100 determines that the amount of buffered data in the first prefetch buffer is lower than the watermark threshold, the terminal 100 may trigger a prefetch process for the data on the first URL. For the data prefetching process of the resource corresponding to the first URI, reference may be made to the subsequent embodiment shown in FIG. 26 , and details are not repeated here.
示例性的,在删除第二分片数据之后,第一预取缓冲区中存储有第一URI对应资源中第8MB-10MB范围内的数据,即第一预取缓冲区的已缓冲量为2MB。其中,上述水位线阈值可以为4MB。终端100可以确定出第一预取缓冲区的已缓冲量低于水位线阈值,终端100可以触发针对第一URI对应资源的数据预取流程。上述示例仅仅用于解释本申请,不应构成限定。Exemplarily, after deleting the second fragment data, the first prefetch buffer stores data in the range of 8MB-10MB in the resource corresponding to the first URI, that is, the buffered amount of the first prefetch buffer is 2MB. . The above watermark threshold may be 4MB. The terminal 100 may determine that the buffered amount of the first prefetch buffer is lower than the watermark threshold, and the terminal 100 may trigger the data prefetching process for the resource corresponding to the first URI. The above examples are only used to explain the present application and should not be construed as limitations.
S2510、终端100可以根据第一应用每次发起初次HTTP请求的时间信息,判断在指定时间段内第一应用请求获取第一URI对应资源的次数是否大于次数阈值,若是,则执行上述步骤S2509、终端100触发针对第一URI对应资源的数据预取流程。S2510. The terminal 100 may judge whether the number of times the first application requests to obtain the resource corresponding to the first URI within the specified time period is greater than the number of times threshold according to the time information of each time the first application initiates the initial HTTP request, and if so, execute the above steps S2509, The terminal 100 triggers a data prefetching process for the resource corresponding to the first URI.
若在指定时间段内第一应用访问第一URI的次数小于等于次数阈值,则执行:If the number of times the first application accesses the first URI within the specified time period is less than or equal to the number of times threshold, execute:
S2511、终端100根据N个网络路径的关键指标信息,对第二原始请求的请求范围进行拆分,得到R个HTTP请求,并将R个HTTP请求分别通过R个网络路径发送给服务器。其中,N大于等于R,R为正整数。S2511. The terminal 100 splits the request range of the second original request according to the key indicator information of the N network paths, obtains R HTTP requests, and sends the R HTTP requests to the server through the R network paths respectively. Among them, N is greater than or equal to R, and R is a positive integer.
当终端100根据第一应用每次针对第一URI发起HTTP请求的时间信息,确定指定时间段内第一应用请求第一URI对应资源的次数大于次数阈值时,终端100触发针对第一URI对应资源的数据预取流程。其中,针对第一URI对应资源的数据预取流程,可以参考后续图26所示实施例,在此不再赘述。When the terminal 100 determines that the number of times the first application requests the resource corresponding to the first URI within the specified time period is greater than the number of times threshold according to the time information of each time the first application initiates the HTTP request for the first URI, the terminal 100 triggers the request for the resource corresponding to the first URI data prefetching process. For the data prefetching process of the resource corresponding to the first URI, reference may be made to the subsequent embodiment shown in FIG. 26 , and details are not repeated here.
示例性的,终端100可以判断第一应用在最近3s内(即在该步骤S2510之前的3s内)请求第一URI对应资源的次数是否大于3次,当第一应用在最近3s内请求第一URI对应资源的次数为5次(大于3次)时,终端100可以触发针对第一URI对应资源的数据预取流程。Exemplarily, the terminal 100 may determine whether the number of times the first application requests the resource corresponding to the first URI within the last 3s (that is, within the 3s before this step S2510) is greater than 3 times, when the first application requests the first URI within the last 3s When the number of times of the resource corresponding to the URI is 5 times (more than 3 times), the terminal 100 may trigger the data prefetching process for the resource corresponding to the first URI.
当终端100根据第一应用每次针对第一URI发起HTTP请求的时间信息,确定指定时间段内该第一应用请求获取第一URI对应资源的次数小于等于次数阈值时,终端100根据N个网络路径的关键性能指标信息,以及第一HTTP请求的请求范围选取R个网络路径。然后,终端100可以根据R个网络路径的关键性能指标信息,将第一HTTP请求的请求范围拆分成R个子请求范围。接着,终端100可以根据第一URI,R个网络路径上服务器的IP地址,R个子请求范围,确定出R个HTTP请求,并将R个HTTP请求分别通过R个网络路径发送给服务器。When the terminal 100 determines, according to the time information of each time the first application initiates an HTTP request for the first URI, the number of times the first application requests to obtain the resource corresponding to the first URI within the specified time period is less than or equal to the number of times threshold, the terminal 100 according to the N network R network paths are selected from the key performance indicator information of the path and the request range of the first HTTP request. Then, the terminal 100 may split the request scope of the first HTTP request into R sub-request scopes according to the key performance indicator information of the R network paths. Next, the terminal 100 may determine the R HTTP requests according to the first URI, the IP address of the server on the R network paths, and the R sub-request ranges, and send the R HTTP requests to the server through the R network paths respectively.
在一种可能的实现方式中,在终端100选择的R个网络路径传输第一HTTP请求所请求的数据之后,终端100可以先在R个网络路径上与服务器建立TCP连接。然后,终端100可以根据第一HTTP请求的请求范围、R个网络路径的实际带宽和往返时延,通过如下 公式确定出R个网络路径各自对应的子请求范围。In a possible implementation manner, after the R network paths selected by the terminal 100 transmit the data requested by the first HTTP request, the terminal 100 may first establish a TCP connection with the server on the R network paths. Then, the terminal 100 can determine the respective sub-request ranges corresponding to the R network paths by the following formula according to the request range of the first HTTP request, the actual bandwidth and the round-trip delay of the R network paths.
Figure PCTCN2021108275-appb-000013
Figure PCTCN2021108275-appb-000013
FCT i=U i/Z i+0.5*RTT i 公式(25) FCT i =U i /Z i +0.5*RTT i Formula (25)
FCT i=c 公式(26) FCT i = c Equation (26)
其中,在上述公式(24)中,M可用于表示终端100向服务器请求的数据长度,U i可用于表示R个网络路径中第i条网络路径对应的子请求范围长度,1≤i≤R。上述公式(25)中,FCT i可用于表示R个网络路径中第i条网络路径的传输完U i长度的数据所需时间。其中,终端100在第i条网络路径上发送HTTP请求给服务器需要耗时0.5*RTT i,服务器在第i条网络路径上返回终端100请求的数据流耗时U i/Z i,其中,Z i可用于表示R个网络路径中第i条网络路径的真实带宽。上述公式(26)中,终端100需要让每条网络路径上的传输耗时都相同(即每条网络路径上的FCT i都为固定值c)。上述公式仅仅用于解释本申请,不应构成限定。 Wherein, in the above formula (24), M can be used to represent the data length requested by the terminal 100 from the server, and U i can be used to represent the length of the sub-request range corresponding to the ith network path among the R network paths, 1≤i≤R . In the above formula (25), FCT i can be used to represent the time required for the ith network path in the R network paths to transmit the data of length U i . Wherein, it takes 0.5*RTT i for the terminal 100 to send the HTTP request to the server on the ith network path, and it takes U i /Z i for the server to return the data stream requested by the terminal 100 on the ith network path, where Z i can be used to represent the true bandwidth of the ith network path among the R network paths. In the above formula (26), the terminal 100 needs to make the transmission time on each network path the same (that is, the FCT i on each network path is a fixed value c). The above formulas are only used to explain the present application and should not be construed as limitations.
示例性的,终端100上的N个网络路径可以包括蜂窝网络路径1、蜂窝网络路径2、Wi-Fi网络路径1和Wi-Fi网络路径2。其中,这4个网络路径的真实带宽、往返时延RTT和获取到的服务器IP地址可以如下表3所示:Exemplarily, the N network paths on the terminal 100 may include cellular network path 1, cellular network path 2, Wi-Fi network path 1, and Wi-Fi network path 2. Among them, the real bandwidth, round-trip delay RTT and obtained server IP address of these four network paths can be shown in Table 3 below:
表3table 3
Figure PCTCN2021108275-appb-000014
Figure PCTCN2021108275-appb-000014
其中,由上表3可知,蜂窝网络路径1的真实带宽Z 1可以为20MBps,蜂窝网络路径1的往返时延RTT 1可以为50ms。蜂窝网络路径2的真实带宽Z 2可以为10MBps,蜂窝网络路径2的往返时延RTT 2可以为60ms。Wi-Fi网络路径1的真实带宽Z 3可以为40MBps,Wi-Fi网络路径1的往返时延RTT 3可以为40ms。Wi-Fi网络路径2的真实带宽Z 4可以为20MBps,Wi-Fi网络路径2的往返时延RTT 4可以为60ms。上述表3所示示例仅仅用于解释本申请,不应构成限定。 Wherein, as can be seen from Table 3 above, the real bandwidth Z 1 of the cellular network path 1 may be 20 MBps, and the round-trip delay RTT 1 of the cellular network path 1 may be 50 ms. The real bandwidth Z 2 of the cellular network path 2 may be 10 MBps, and the round-trip delay RTT 2 of the cellular network path 2 may be 60 ms. The real bandwidth Z 3 of the Wi-Fi network path 1 may be 40 MBps, and the round-trip delay RTT 3 of the Wi-Fi network path 1 may be 40 ms. The real bandwidth Z 4 of the Wi-Fi network path 2 may be 20 MBps, and the round-trip delay RTT 4 of the Wi-Fi network path 2 may be 60 ms. The examples shown in Table 3 above are only for explaining the present application and should not be construed as a limitation.
第一HTTP请求的请求范围可以为6MB-8MB,终端100向服务器请求的数据长度M为2MB。终端100可以根据这4个网络路径(即R=N=4)的真实带宽,通过上述公式(24)、公式(25)、公式(26)将第一HTTP请求的请求范围拆分为子请求范围1、子请求范围2、子请求范围3、子请求范围4这4个子请求范围。The request range of the first HTTP request may be 6MB-8MB, and the data length M requested by the terminal 100 from the server is 2MB. The terminal 100 can split the request range of the first HTTP request into sub-requests according to the real bandwidths of the four network paths (ie, R=N=4) and the above formula (24), formula (25), and formula (26). Scope 1, sub-request scope 2, sub-request scope 3, and sub-request scope 4 are four sub-request scopes.
其中,蜂窝网络路径1的请求范围长度U 1可以为0.35MB,蜂窝网络路径2的请求范围长度U 2可以为0.075MB,Wi-Fi网络路径1的请求范围长度U 3可以为0.9MB,蜂窝网络路径2的请求范围长度U 4可以为0.675MB。因此,子请求范围1可以为6MB-6.35MB,子请求范围1对应蜂窝网络路径1。子请求范围2可以为6.35MB-6.425MB,子请求范围2对应 蜂窝网络路径2。子请求范围3可以为6.425MB-7.325MB,子请求范围3对应Wi-Fi网络路径3。子请求范围4可以为7.325MB-8MB,子请求范围4对应Wi-Fi网络路径4。 The request range length U 1 of cellular network path 1 may be 0.35MB, the request range length U 2 of cellular network path 2 may be 0.075MB, the request range length U 3 of Wi-Fi network path 1 may be 0.9MB, and the cellular network path 1 request range length U 3 may be 0.9MB. The request range length U4 for network path 2 may be 0.675MB. Therefore, sub-request range 1 may be 6MB-6.35MB, and sub-request range 1 corresponds to cellular network path 1. Sub-request range 2 may be 6.35MB-6.425MB, and sub-request range 2 corresponds to cellular network path 2. Sub-request range 3 can be 6.425MB-7.325MB, and sub-request range 3 corresponds to Wi-Fi network path 3. Sub-request range 4 may be 7.325MB-8MB, and sub-request range 4 corresponds to Wi-Fi network path 4.
终端100可以根据蜂窝网络路径1上服务器的IP地址_1、第一URI和子请求范围1,确定出HTTP请求1,并将HTTP请求1通过蜂窝网络路径1发送给服务器。终端100可以根据蜂窝网络路径2上服务器的IP地址_2、第一URI和子请求范围2,确定出HTTP请求2,并将HTTP请求2通过蜂窝网络路径2发送给服务器。终端100可以根据Wi-Fi网络路径1上服务器的IP地址_3、第一URI和子请求范围3,确定出HTTP请求3,并将HTTP请求3通过Wi-Fi网络路径1发送给服务器。终端100可以根据Wi-Fi网络路径2上服务器的IP地址_4、第一URI和子请求范围3,确定出HTTP请求4,并将HTTP请求4通过Wi-Fi网络路径2发送给服务器。The terminal 100 can determine the HTTP request 1 according to the IP address_1 of the server on the cellular network path 1, the first URI and the sub-request range 1, and send the HTTP request 1 to the server through the cellular network path 1. The terminal 100 may determine the HTTP request 2 according to the IP address_2 of the server on the cellular network path 2, the first URI and the sub-request range 2, and send the HTTP request 2 to the server through the cellular network path 2. The terminal 100 can determine the HTTP request 3 according to the IP address_3 of the server on the Wi-Fi network path 1, the first URI and the sub-request range 3, and send the HTTP request 3 to the server through the Wi-Fi network path 1. The terminal 100 can determine the HTTP request 4 according to the IP address_4 of the server on the Wi-Fi network path 2, the first URI and the sub-request range 3, and send the HTTP request 4 to the server through the Wi-Fi network path 2.
上述示例仅仅用于解释本申请,不应构成限定。The above examples are only used to explain the present application and should not be construed as limitations.
在一种可能的实现方式中,在终端100选择的R个网络路径传输第一HTTP请求所请求的数据之后,终端100可以根据第一HTTP请求的请求范围、R个网络路径的实际带宽和往返时延,确定出R个网络路径各自对应的子请求范围。然后,终端100再在R个网络路径上与服务器建立TCP连接。此时,终端100在第i条网络路径上与服务器三次握手建立TCP连接,需要耗时1.5*RTT i。终端100在第i条网络路径上发送HTTP请求给服务器需要耗时0.5*RTT i,服务器在第i条网络路径上返回终端100请求的数据流耗时U i/Z i。因此,上述公式(25)可以替换为下述公式(27): In a possible implementation manner, after the R network paths selected by the terminal 100 transmit the data requested by the first HTTP request, the terminal 100 may, according to the request range of the first HTTP request, the actual bandwidth of the R network paths, and the round-trip Delay, determine the sub-request range corresponding to each of the R network paths. Then, the terminal 100 establishes a TCP connection with the server on the R network paths. At this time, the terminal 100 handshakes three times with the server on the ith network path to establish a TCP connection, which takes 1.5*RTT i . It takes 0.5*RTT i for the terminal 100 to send the HTTP request to the server on the ith network path, and it takes U i /Z i for the server to return the data stream requested by the terminal 100 on the ith network path. Therefore, the above formula (25) can be replaced by the following formula (27):
FCT i=U i/Z i+2*RTT i 公式(27) FCT i =U i /Z i +2*RTT i Formula (27)
终端100可以通过上述公式(24)、公式(26)和公式(27),确定出R个网络路径各自对应的子请求范围。The terminal 100 can determine the sub-request ranges corresponding to each of the R network paths by using the above formula (24), formula (26) and formula (27).
上述公式仅仅用于解释本申请,不应构成限定。The above formulas are only used to explain the present application and should not be construed as limitations.
S2512、终端100接收到服务器在R个网络路径返回的R个HTTP响应,并将R个HTTP响应中的第二分片数据返回给第一应用。S2512. The terminal 100 receives the R HTTP responses returned by the server on the R network paths, and returns the second fragmented data in the R HTTP responses to the first application.
服务器接收到终端100发送的HTTP请求后,可以将该HTTP请求所请求的数据封装在HTTP响应中,按照该HTTP请求发送的网络路径返回给终端100。终端100在接收到R个HTTP响应后,从R个HTTP响应中按照请求范围顺序取出第二分片数据,并返回给第一应用。After receiving the HTTP request sent by the terminal 100, the server may encapsulate the data requested by the HTTP request in the HTTP response, and return the data to the terminal 100 according to the network path sent by the HTTP request. After receiving the R HTTP responses, the terminal 100 fetches the second fragmented data from the R HTTP responses in the order of the request range, and returns the data to the first application.
示例性的,终端100将HTTP请求1通过蜂窝网络路径1发送给服务器,将HTTP请求2通过蜂窝网络路径2发送给服务器,将HTTP请求3通过Wi-Fi网络路径1发送给服务器,将HTTP请求4通过Wi-Fi网络路径2发送给服务器。其中,HTTP请求1用于请求第一URI对应资源的第6MB-6.35MB范围内的数据,HTTP请求2用于请求第一URI对应资源的6.35MB-6.425MB范围内的数据,HTTP请求3用于请求第一URI对应资源的6.425MB-7.325MB范围内的数据,HTTP请求4用于请求第一URI对应资源的7.325MB-8MB范围内的数据。Exemplarily, the terminal 100 sends the HTTP request 1 to the server through the cellular network path 1, sends the HTTP request 2 to the server through the cellular network path 2, sends the HTTP request 3 to the server through the Wi-Fi network path 1, and sends the HTTP request 4 Send to server via Wi-Fi network path 2. Among them, HTTP request 1 is used to request data in the range of 6MB-6.35MB of the resource corresponding to the first URI, HTTP request 2 is used to request data in the range of 6.35MB-6.425MB of the resource corresponding to the first URI, and HTTP request 3 is used For requesting data in the range of 6.425MB-7.325MB of the resource corresponding to the first URI, HTTP request 4 is used to request data in the range of 7.325MB-8MB of the resource corresponding to the first URI.
服务器在接收到HTTP请求1后,可以将第一URI对应资源的第6-6.35MB范围内的数据封装在HTTP响应1中,并通过蜂窝网络路径1将该HTTP响应1返给终端100。服 务器在接收到HTTP请求2后,可以将第一URI对应资源的第6.35MB-6.425MB范围内的数据封装在HTTP响应2中,并将HTTP请求2通过蜂窝网络路径2返回给终端100。服务器在接收到HTTP请求3后,可以将第一URI对应资源的第6.425MB-7.325MB范围内的数据封装在HTTP响应3中,并将HTTP请求3通过Wi-Fi网络路径1返回给终端100。服务器在接收到HTTP请求4后,可以将第一URI对应资源的第7.325MB-8MB范围内的数据封装在HTTP响应4中,并将HTTP请求4通过Wi-Fi网络路径2返回给终端100。After receiving the HTTP request 1, the server may encapsulate the data in the range of 6-6.35 MB of the resource corresponding to the first URI in the HTTP response 1, and return the HTTP response 1 to the terminal 100 through the cellular network path 1. After receiving the HTTP request 2, the server may encapsulate the data in the range of 6.35MB-6.425MB of the resource corresponding to the first URI in the HTTP response 2, and return the HTTP request 2 to the terminal 100 through the cellular network path 2. After receiving the HTTP request 3, the server can encapsulate the data in the range of 6.425MB-7.325MB of the resource corresponding to the first URI in the HTTP response 3, and return the HTTP request 3 to the terminal 100 through the Wi-Fi network path 1 . After receiving the HTTP request 4, the server may encapsulate the data in the range of 7.325MB-8MB of the resource corresponding to the first URI in the HTTP response 4, and return the HTTP request 4 to the terminal 100 through the Wi-Fi network path 2.
终端100在接收到HTTP响应1后,可以从HTTP响应1取出第一URI对应资源的第6MB-6.35MB范围内的数据。终端100在HTTP响应2后,可以从HTTP响应2取出第一URI对应资源的第6.35MB-6.425MB范围内的数据。终端100在接收到HTTP响应3后,可以从HTTP响应3取出第一URI对应资源的第6.425MB-7.325MB范围内的数据。终端100在接收到HTTP响应4后,可以从HTTP响应4中取出第一URI对应资源的第7.325MB-8MB范围内的数据。After receiving the HTTP response 1, the terminal 100 can retrieve the data in the range of 6MB-6.35MB of the resource corresponding to the first URI from the HTTP response 1. After the terminal 100 responds with HTTP 2, the terminal 100 can retrieve the data in the range of 6.35MB-6.425MB of the resource corresponding to the first URI from the HTTP response 2. After receiving the HTTP response 3, the terminal 100 can retrieve data in the range of 6.425MB-7.325MB of the resource corresponding to the first URI from the HTTP response 3. After receiving the HTTP response 4, the terminal 100 may retrieve the data in the range of 7.325MB-8MB of the resource corresponding to the first URI from the HTTP response 4.
终端100可以将第一URI对应资源的第6MB-6.35MB范围内的数据、第6.35MB-6.425MB范围内的数据、第6.425MB-7.325MB范围内的数据、第7.325MB-8MB范围内的数据,按照范围顺序(字节顺序从小到大排列)组合成上述第二分片数据,返回给第一应用。上述示例仅仅用于解释本申请,不应构成限定。The terminal 100 may assign data in the range of 6MB-6.35MB, data in the range of 6.35MB-6.425MB, data in the range of 6.425MB-7.325MB, and data in the range of 7.325MB-8MB of the resource corresponding to the first URI. The data is combined into the above-mentioned second fragmented data according to the range order (the byte order is arranged from small to large), and is returned to the first application. The above examples are only used to explain the present application and should not be construed as limitations.
下面介绍本申请实施例的第四部分提供的针对第一URI对应资源的数据预取方法流程。The following describes the process of the data prefetching method for the resource corresponding to the first URI provided in the fourth part of the embodiment of the present application.
请参考图26,图26示出了本申请实施例提供的数据预取方法的流程示意图。如图26所示,该方法包括如下步骤:Please refer to FIG. 26. FIG. 26 shows a schematic flowchart of a data prefetching method provided by an embodiment of the present application. As shown in Figure 26, the method includes the following steps:
S2601、终端100获取针对第一URI对应资源的上次获取数据量K和末端字节位置。S2601. The terminal 100 acquires the last acquired data amount K and the end byte position for the resource corresponding to the first URI.
示例性的,终端100针对第一URI对应资源的上次获取数据量为2MB,上次针对第一URI对应资源的请求范围为4MB-6MB。上一次请求第一URI对应资源的末端字节位置可以为第6MB字节。示例仅仅用于解释本申请,不应构成限定。Exemplarily, the amount of data acquired by the terminal 100 for the resource corresponding to the first URI last time is 2MB, and the last request range for the resource corresponding to the first URI is 4MB-6MB. The last byte position of the resource corresponding to the first URI requested last time may be the 6th MB byte. The examples are only used to explain the application and should not be construed as limitations.
S2602、终端100判断当设定预取量为a*K(a为大于1的整数)时,N个网络路径的总带宽利用率是否超过指定阈值P,若是,则执行S2603、终端100确定出当N个网络路径的总带宽利用率为指定阈值P时对应的第一预取值。若可用网络路径的带宽利用率不超过指定阈值P时,则执行步骤S2607。S2602. The terminal 100 judges whether the total bandwidth utilization rate of the N network paths exceeds the specified threshold P when the set prefetch amount is a*K (a is an integer greater than 1), and if so, executes S2603, and the terminal 100 determines that The corresponding first prefetch value when the total bandwidth utilization of the N network paths is the specified threshold P. If the bandwidth utilization of the available network path does not exceed the specified threshold P, step S2607 is executed.
终端100可以根据预取量为a*K,N个网络路径的总带宽、N个网络路径的平均往返时延,确定出当设定预取量为a*K(a为大于1的整数)时,N个网络路径的总带宽利用率。The terminal 100 can determine when the set prefetch amount is a*K (a is an integer greater than 1) according to the prefetch amount being a*K, the total bandwidth of the N network paths, and the average round-trip delay of the N network paths. , the total bandwidth utilization of N network paths.
其中,终端100可以根据指定阈值P、N个网络路径的总带宽、N个网络路径的平均往返时延,确定出第一预取值。The terminal 100 may determine the first prefetch value according to the specified threshold P, the total bandwidth of the N network paths, and the average round-trip delay of the N network paths.
示例性的,终端100上的网络路径可以包括有蜂窝网络路径1、蜂窝网络路径2、Wi-Fi网络路径1和Wi-Fi网络路径2。其中,蜂窝网络路径1的带宽可以是20MBps、往返时延可以为50ms。蜂窝网络路径2的带宽可以是10MBps、往返时延可以为70ms。Wi-Fi网络路径1的带宽可以是40MBps、往返时延可以为40ms。Wi-Fi网络路径2的带宽可以是30MBps,往返时延可以为60ms。因此,终端100上N个网络路径的总带宽可以为100MBps,N个网路路径的平均往返时延可以为55ms。指定阈值P可以为80%。当a为2,上一次数 据预取量K为8MB,终端100设定预取量a*K可以为16MB时,通过上述公式(19)和公式(20),确定出N个网络路径的总带宽利用率为87.67%,大于P(例如80%)。因此,终端100可以根据指定阈值P(例如80%)、N个网络路径的总带宽(例如100MBps)、N个网络路径的平均往返时延(例如55ms),确定出第一预取值为9MB。Exemplarily, the network paths on the terminal 100 may include cellular network path 1, cellular network path 2, Wi-Fi network path 1 and Wi-Fi network path 2. The bandwidth of the cellular network path 1 may be 20MBps, and the round-trip delay may be 50ms. The bandwidth of the cellular network path 2 may be 10MBps, and the round-trip delay may be 70ms. The bandwidth of the Wi-Fi network path 1 may be 40MBps, and the round-trip delay may be 40ms. The bandwidth of the Wi-Fi network path 2 may be 30MBps, and the round-trip delay may be 60ms. Therefore, the total bandwidth of the N network paths on the terminal 100 may be 100 MBps, and the average round-trip delay of the N network paths may be 55 ms. The specified threshold P may be 80%. When a is 2, the last data prefetch amount K is 8MB, and the terminal 100 sets the prefetch amount a*K to be 16MB, the total number of N network paths is determined through the above formula (19) and formula (20). The bandwidth utilization is 87.67%, which is greater than P (eg, 80%). Therefore, the terminal 100 may determine that the first prefetch value is 9MB according to the specified threshold P (for example, 80%), the total bandwidth of the N network paths (for example, 100 MBps), and the average round-trip delay of the N network paths (for example, 55 ms). .
又示例性的,终端100上的网络路径可以包括有蜂窝网络路径1、蜂窝网络路径2、Wi-Fi网络路径1和Wi-Fi网络路径2。其中,蜂窝网络路径1的带宽可以是20MBps、往返时延可以为50ms。蜂窝网络路径2的带宽可以是10MBps、往返时延可以为70ms。Wi-Fi网络路径1的带宽可以是40MBps、往返时延可以为40ms。Wi-Fi网络路径2的带宽可以是30MBps,往返时延可以为60ms。因此,终端100上N个网络路径的总带宽可以为100MBps,N个网路路径的平均往返时延可以为55ms。a可以为2,P可以为90%,上一次数据预取量K为2MB,当终端100设定预取量a*K为4MB时,通过上述公式(19)和公式(20),确定出N个网络路径的总带宽利用率为64%,小于指定阈值P(例如80%)。因此,终端100可以执行下述步骤S2607。In another example, the network paths on the terminal 100 may include cellular network path 1, cellular network path 2, Wi-Fi network path 1, and Wi-Fi network path 2. The bandwidth of the cellular network path 1 may be 20MBps, and the round-trip delay may be 50ms. The bandwidth of the cellular network path 2 may be 10MBps, and the round-trip delay may be 70ms. The bandwidth of the Wi-Fi network path 1 may be 40MBps, and the round-trip delay may be 40ms. The bandwidth of the Wi-Fi network path 2 may be 30MBps, and the round-trip delay may be 60ms. Therefore, the total bandwidth of the N network paths on the terminal 100 may be 100 MBps, and the average round-trip delay of the N network paths may be 55 ms. a can be 2, P can be 90%, the last data prefetch amount K is 2MB, when the terminal 100 sets the prefetch amount a*K to 4MB, through the above formula (19) and formula (20), it is determined that The total bandwidth utilization of the N network paths is 64%, which is less than the specified threshold P (eg, 80%). Therefore, the terminal 100 can perform the following step S2607.
S2604、终端100判断第一预取缓冲区中剩余容量是否大于第一预取值,若是,则执行S2605、终端100确定本次预取值为第一预取值。若第一预取缓冲区中剩余容量小于等于第一预取值时,则执行S2606、终端100确定本次预取值为上一次预取值K。S2604. The terminal 100 determines whether the remaining capacity in the first prefetch buffer is greater than the first prefetch value, and if so, executes S2605, and the terminal 100 determines that the current prefetch value is the first prefetch value. If the remaining capacity in the first prefetch buffer is less than or equal to the first prefetch value, S2606 is executed, and the terminal 100 determines that the current prefetch value is the previous prefetch value K.
示例性的,第一预取缓冲区中剩余缓冲容量可以为20MB,第一预取值可以为9MB,第一预取缓冲区中剩余缓冲容量大于第一预取值,因此,终端100可以将本次预取值确定为第一预取值确定。Exemplarily, the remaining buffer capacity in the first prefetch buffer may be 20MB, the first prefetch value may be 9MB, and the remaining buffer capacity in the first prefetch buffer is greater than the first prefetch value. Therefore, the terminal 100 may This prefetch value is determined as the first prefetch value determination.
又示例性的,第一预取缓冲区中剩余缓冲容量可以为8.5MB,第一预取值可以为9MB,第一预取缓冲区中剩余缓冲容量小于第一预取值,因此,终端100可以将本次预取值确定为上一次预取值K。In another example, the remaining buffer capacity in the first prefetch buffer may be 8.5MB, the first prefetch value may be 9MB, and the remaining buffer capacity in the first prefetch buffer is less than the first prefetch value. Therefore, the terminal 100 The current prefetch value may be determined as the previous prefetch value K.
S2607、终端100判断第一预取缓冲区中剩余缓冲容量是否大于等于a*K,若是,则执行S2608、终端100确定本次预取值为a*K。若第一预取缓冲区中剩余缓冲容量小于a*K,则执行S2606、终端100确定本次预取值为上次请求数据量K。S2607, the terminal 100 determines whether the remaining buffer capacity in the first prefetch buffer is greater than or equal to a*K, and if so, executes S2608, and the terminal 100 determines that the current prefetch value is a*K. If the remaining buffer capacity in the first prefetch buffer is less than a*K, S2606 is executed, and the terminal 100 determines that the prefetch value of this time is the data amount K of the last request.
示例性的,a可以为2,上次请求数据量K可以为2MB,a*K为4MB,第一预取缓冲区中剩余缓冲容量可以为8.5MB,大于a*K。因此,终端100可以确定本次请求数据量为a*K。Exemplarily, a may be 2, the last requested data amount K may be 2MB, a*K may be 4MB, and the remaining buffer capacity in the first prefetch buffer may be 8.5MB, which is greater than a*K. Therefore, the terminal 100 can determine that the amount of data requested this time is a*K.
又示例性的,a可以为2,上次请求数据量可以为2MB,a*K为4MB,第一预取缓冲区中剩余缓冲容量可以为3MB,小于a*K。因此,终端100可以确定本次请求数据量为上次请求数据量K(例如2MB)。In another example, a may be 2, the last requested data amount may be 2MB, a*K may be 4MB, and the remaining buffer capacity in the first prefetch buffer may be 3MB, which is less than a*K. Therefore, the terminal 100 may determine that the data amount requested this time is the data amount K (for example, 2MB) requested last time.
在一种实现方式中,终端100可以在获取针对第一URI对应资源的上次请求数据量K和上次请求末端字节位置之后,直接判断第一预取缓冲区中剩余缓冲容量是否大于等于a*K,若是,则终端100确定a*K为本次请求数据量。若第一预取缓冲区中剩余缓冲容量 小于a*K,则终端100确定本次请求数据量为上次请求数据量K。In an implementation manner, the terminal 100 may directly determine whether the remaining buffer capacity in the first prefetch buffer is greater than or equal to after obtaining the last requested data amount K and the last requested end byte position for the resource corresponding to the first URI a*K, if yes, the terminal 100 determines that a*K is the amount of data requested this time. If the remaining buffer capacity in the first prefetch buffer is less than a*K, the terminal 100 determines that the data amount requested this time is the data amount K requested last time.
S2609、终端100根据第一URI、本次请求数据量,上次请求的末端字节位置,确定出本次请求范围。S2609: The terminal 100 determines the scope of the current request according to the first URI, the data volume of the current request, and the position of the last byte of the previous request.
终端100在确定出本次请求数据量后,可以根据上次请求的末端字节位置,确定出本次请求范围。After the terminal 100 determines the amount of data requested this time, it can determine the range of the current request according to the position of the end byte of the previous request.
示例性的,本次请求数据量可以为8MB,上次请求的末端字节位置可以为第6MB,因此,本次请求范围可以为第6MB-第14MB。Exemplarily, the amount of data requested this time may be 8MB, and the position of the last byte of the last request may be the 6th MB. Therefore, the range of this request may be the 6th MB to the 14th MB.
S2610、终端100根据N个网络路径的关键指标信息,和本次请求范围,选取出L个网络路径,并将本次请求范围拆分成L个子请求范围。其中,L小于等于N。S2610. The terminal 100 selects L network paths according to the key indicator information of the N network paths and the current request range, and divides the current request range into L sub-request ranges. Among them, L is less than or equal to N.
S2611、终端100根据L个子请求范围,L个网络路径上的服务器IP地址,第一URI,确定出L个HTTP请求,并将L个HTTP请求分别通过L个网络路径发送给服务器。S2611. The terminal 100 determines L HTTP requests according to the L sub-request ranges, the server IP addresses on the L network paths, and the first URI, and sends the L HTTP requests to the server through the L network paths respectively.
终端100可以根据N个网络路径的关键性能指标信息,以及本次请求范围选取L个网络路径。然后,终端100可以根据L个网络路径的关键性能指标信息,将本次请求范围拆分成L个子请求范围。接着,终端100可以根据第一URI、L个网络路径上服务器的IP地址、和L个子请求范围,确定出L个HTTP请求,并将L个HTTP请求分别通过L个网络路径发送给服务器。其中,一个网络路径上对应一个HTTP请求。The terminal 100 may select L network paths according to the key performance indicator information of the N network paths and the range of the current request. Then, the terminal 100 may split the current request range into L sub-request ranges according to the key performance indicator information of the L network paths. Next, the terminal 100 may determine L HTTP requests according to the first URI, the IP address of the server on the L network paths, and the L sub-request ranges, and send the L HTTP requests to the server through the L network paths respectively. Among them, one network path corresponds to one HTTP request.
具体内容,可以参考前述图25所示上的步骤S2511,在此不再赘述。For specific content, reference may be made to the aforementioned step S2511 shown in FIG. 25 , which will not be repeated here.
S2612、终端100接收到服务器在L个网络路径返回的L个HTTP响应,获取L个HTTP响应中的响应数据,将响应数据中的第二分片数据返回给第一应用,将响应数据中的预取数据存入第一预取缓冲区。S2612. The terminal 100 receives the L HTTP responses returned by the server on the L network paths, obtains the response data in the L HTTP responses, returns the second fragmented data in the response data to the first application, and returns the response data in the response data to the first application. Prefetch data is stored in the first prefetch buffer.
服务器接收到终端100发送的HTTP请求后,可以将该HTTP请求所请求的数据封装在HTTP响应中,按照该HTTP请求发送的网络路径返回给终端100。终端100在接收到L个HTTP响应后,从L个HTTP响应中按照请求范围顺序取出响应数据。该响应数据可包括第一应用请求的第二分片数据和预取数据。终端100可以从响应数据中取出第一应用请求的第二分片数据,返回给第一应用,将响应数据中的剩余的预取数据存入到第一预取缓冲区中。这样,在第一应用下次请求分片数据时,终端100可以直接从第一预取缓冲区中将第一应用请求的分片数据返回给第一应用,减少了第一应用请求分片数据的等待时间。After receiving the HTTP request sent by the terminal 100, the server may encapsulate the data requested by the HTTP request in the HTTP response, and return the data to the terminal 100 according to the network path sent by the HTTP request. After receiving the L HTTP responses, the terminal 100 retrieves response data in the order of the request range from the L HTTP responses. The response data may include the second fragment data and prefetch data requested by the first application. The terminal 100 may retrieve the second fragmented data requested by the first application from the response data, return it to the first application, and store the remaining prefetched data in the response data into the first prefetch buffer. In this way, when the first application requests fragmented data next time, the terminal 100 can directly return the fragmented data requested by the first application to the first application from the first prefetch buffer, reducing the number of fragmented data requested by the first application waiting time.
示例性的,针对第一URI对应资源的本次请求范围可以为第6MB-第14MB。终端100接收到L个HTTP响应后,可以从这L个HTTP响应中,共获取到第一URI对应资源的第6MB-第14MB范围内的数据。其中,第一应用通过第一HTTP请求获取的第二分片数据为第6MB-第8MB范围内的数据。终端100可以将第6MB-第8MB范围的数据返回给第一应用,将第8MB-第14MB范围内的数据存入第一URI对应的第一预取缓冲区中。上述示例仅仅用于解释本申请,不应构成限定。Exemplarily, the current request range for the resource corresponding to the first URI may be the 6th MB to the 14th MB. After receiving the L HTTP responses, the terminal 100 may obtain, from the L HTTP responses, data in the range of the 6th MB to the 14th MB of the resource corresponding to the first URI. The second fragmented data obtained by the first application through the first HTTP request is data in the range of the 6th MB to the 8th MB. The terminal 100 may return the data in the range of the 6th MB to the 8th MB to the first application, and store the data in the range of the 8th MB to the 14th MB in the first prefetch buffer corresponding to the first URI. The above examples are only used to explain the present application and should not be construed as limitations.
其中,终端100每次发起预取流程时,选出的网络路径都可以相同也可以不同。例如,本次预取流程中,终端100可以选取出L个网络路径,下次预取流程中,终端100可以选 取出S个网络路径,S小于等于N,S为正整数。Wherein, each time the terminal 100 initiates the prefetching process, the selected network paths may be the same or different. For example, in this prefetching process, the terminal 100 may select L network paths, and in the next prefetching process, the terminal 100 may select S network paths, where S is less than or equal to N, and S is a positive integer.
在本次预取流程中,终端100可以获取到第一应用针对第一URI发起的第一HTTP请求,第一HTTP请求可用于向服务器请求第一数据。终端100可以生成L个第二HTTP请求,第二HTTP请求可用于向所述服务器请求第二数据,其中,所述第二数据包括所述第一数据且第二数据的数据量大于第一数据的数据量。终端100可以将L个第二HTTP请求分别通过L个网络路径发送给服务器。终端100可以接收服务器在L个网络路径上发送的L个第一HTTP响应,这L个第一HTTP响应包括有第二数据。终端100可以从第二数据中取出第一数据,并将第一数据通过HTTP响应返回给第一应用。终端100可以将第二数据中剩余的数据存入至第一预取缓冲区中。In this prefetching process, the terminal 100 may obtain the first HTTP request initiated by the first application for the first URI, and the first HTTP request may be used to request the first data from the server. The terminal 100 may generate L second HTTP requests, and the second HTTP requests may be used to request second data from the server, wherein the second data includes the first data and the data volume of the second data is larger than that of the first data amount of data. The terminal 100 may send the L second HTTP requests to the server through the L network paths respectively. The terminal 100 may receive L first HTTP responses sent by the server on the L network paths, where the L first HTTP responses include second data. The terminal 100 may extract the first data from the second data, and return the first data to the first application through an HTTP response. The terminal 100 may store the remaining data in the second data into the first prefetch buffer.
在一些场景中,终端100的第一应用可以从服务器上下载视频等资源数据。终端100可以获取到第一应用下发的用于请求第一URI对应资源中分片数据1的HTTP请求1。若终端100确定出第一应用通过HTTP请求获取第一URI对应资源的次数大于次数阈值时,终端100可以获取第一URI对应资源中剩余数据的字节范围,并根据第一URI对应资源中剩余数据的字节范围生成r个HTTP请求,r小于等于N,r为正整数。终端100可以将这r个HTTP请求分别通过r个网络路径发送给服务器,向服务器请求第一URI对应资源中的剩余数据(即,直接将第一URI对应资源的全部数据下载完)。终端100可以在接收到服务器在r个网络路径返回的第一URI对应资源中的剩余数据后,可以将第一URI对应资源中的剩余数据中的分片数据1返回给第一应用。若第一应用下次下发的用于请求第一URI对应资源中分片数据2的HTTP请求2时,第终端100可以直接从第一URI对应资源中的剩余数据中取出分片数据2返回给第一应用。In some scenarios, the first application of the terminal 100 may download resource data such as videos from the server. The terminal 100 may acquire the HTTP request 1 issued by the first application for requesting the fragmented data 1 in the resource corresponding to the first URI. If the terminal 100 determines that the number of times that the first application obtains the resource corresponding to the first URI through the HTTP request is greater than the number of times threshold, the terminal 100 can obtain the byte range of the remaining data in the resource corresponding to the first URI, and according to the remaining data in the resource corresponding to the first URI The byte range of data generates r HTTP requests, where r is less than or equal to N, and r is a positive integer. The terminal 100 may send the r HTTP requests to the server through r network paths respectively, and request the server for the remaining data in the resource corresponding to the first URI (ie, directly download all data of the resource corresponding to the first URI). After receiving the remaining data in the resource corresponding to the first URI returned by the server on the r network paths, the terminal 100 may return the fragmented data 1 in the remaining data in the resource corresponding to the first URI to the first application. If the first application next sends an HTTP request 2 for requesting fragmented data 2 in the resource corresponding to the first URI, the first terminal 100 may directly extract fragmented data 2 from the remaining data in the resource corresponding to the first URI and return it to the first application.
示例性的,如图27所示,终端100可以同时通过蜂窝网络路径和Wi-Fi网络路径访问到服务器。其中,在蜂窝网络路径上,终端100的IP地址可以为“189.100.3.195”,服务器的IP地址可以为“211.91.160.241”。在Wi-Fi网络路径上,终端100的IP地址可以为“11.240.22.56”,服务器的IP地址可以为“58.216.88.125”。Exemplarily, as shown in FIG. 27 , the terminal 100 can access the server through the cellular network path and the Wi-Fi network path at the same time. Wherein, on the cellular network path, the IP address of the terminal 100 may be "189.100.3.195", and the IP address of the server may be "211.91.160.241". On the Wi-Fi network path, the IP address of the terminal 100 may be "11.240.22.56", and the IP address of the server may be "58.216.88.125".
第一应用在t1时刻第一次针对第一URI发起HTTP请求1,其中,HTTP请求1中的URI可以为:“/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4”、源IP地址(Src)为“11.240.22.56”、目的IP地址(Dst)为“58.216.88.125”、字节范围(range)为“bytes=0-14163”、目的端口号为“80”。该HTTP请求1用于请求第一URI对应资源的0-14163字节范围内的数据。终端100可以将从端口80中获取出该HTTP请求1,并将该HTTP请求1中的目的端口号从“80”改为该第一应用对应的端口号“9091”,将该HTTP请求1中的目的IP地址改为终端100本地的预取处理模块的IP地址“127.0.0.1”。终端100获取到修改后目的IP地址的HTTP请求1,通过抓包软件呈现出修改后的HTTP请求1中的URI为:“/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4”、源IP地址(Src)为“11.240.22.56”、目的IP地址(Dst)为“127.0.0.1”、字节范围(range)为“bytes=0-14163”、目的端口号为“9091”。The first application initiates HTTP request 1 for the first URI for the first time at time t1, where the URI in HTTP request 1 may be: "/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4", source The IP address (Src) is "11.240.22.56", the destination IP address (Dst) is "58.216.88.125", the byte range (range) is "bytes=0-14163", and the destination port number is "80". The HTTP request 1 is used to request data in the range of 0-14163 bytes of the resource corresponding to the first URI. The terminal 100 can obtain the HTTP request 1 from port 80, change the destination port number in the HTTP request 1 from "80" to the port number "9091" corresponding to the first application, and change the destination port number in the HTTP request 1 from "80" to the port number "9091" corresponding to the first application. The destination IP address is changed to the IP address "127.0.0.1" of the local prefetch processing module of the terminal 100. The terminal 100 obtains the modified HTTP request 1 of the destination IP address, and presents the modified URI in the HTTP request 1 through the packet capture software: "/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4" , the source IP address (Src) is "11.240.22.56", the destination IP address (Dst) is "127.0.0.1", the byte range (range) is "bytes=0-14163", and the destination port number is "9091".
此时,终端100确定不进行预取流程,因此,终端100可以直接将HTTP请求1通过Wi-Fi网络发送给服务器。终端100可以接收到服务器在Wi-Fi网络路径发送的HTTP响应1,其中,HTTP响应1中的源IP地址(Src)为“58.216.88.125”、目的IP地址为“11.240.22.56”、内容范围(content range)为“bytes 0-14163/90982601”。其中,内容范围(content range)中的“90982601”表示该第一URI对应资源的总大小为90982601个字节。该HTTP响应1中包括有第一URI对应资源的0-14163字节范围内的数据。终端100可以将HTTP响应1返回给第一应用。At this time, the terminal 100 determines not to perform the prefetching process. Therefore, the terminal 100 can directly send the HTTP request 1 to the server through the Wi-Fi network. The terminal 100 can receive the HTTP response 1 sent by the server on the Wi-Fi network path, wherein the source IP address (Src) in the HTTP response 1 is "58.216.88.125", the destination IP address is "11.240.22.56", and the content range is (content range) is "bytes 0-14163/90982601". Wherein, "90982601" in the content range (content range) indicates that the total size of the resource corresponding to the first URI is 90982601 bytes. The HTTP response 1 includes data in the range of 0-14163 bytes of the resource corresponding to the first URI. The terminal 100 may return HTTP response 1 to the first application.
第一应用在t2时刻第二次针对第一URI发起HTTP请求2,其中,该HTTP请求2中的URI可以为:“/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4”、源IP地址(Src)为“11.240.22.56”、目的IP地址(Dst)为“58.216.88.125”、字节范围(range)为“bytes=14164-95757”、目的端口号为“80”。该HTTP请求2用于请求第一URI对应资源的14164-95757字节范围内的数据。终端100可以将从端口80中截取出该HTTP请求2,并将该HTTP请求2中的目的端口号从“80”改为该第一应用对应的端口号“9091”,将该HTTP请求2中的目的IP地址改为终端100本地的预取处理模块的IP地址“127.0.0.1”。终端100获取到修改后目的IP地址的HTTP请求2,通过抓包软件呈现出修改后的HTTP请求2中的URI为:“/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4”、源IP地址(Src)为“11.240.22.56”、目的IP地址(Dst)为“127.0.0.1”、字节范围(range)为“bytes=14164-95757”、目的端口号为“9091”。The first application initiates an HTTP request 2 for the first URI for the second time at time t2, where the URI in the HTTP request 2 may be: "/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4", The source IP address (Src) is "11.240.22.56", the destination IP address (Dst) is "58.216.88.125", the byte range (range) is "bytes=14164-95757", and the destination port number is "80". The HTTP request 2 is used to request data in the range of 14164-95757 bytes of the resource corresponding to the first URI. The terminal 100 can intercept the HTTP request 2 from port 80, change the destination port number in the HTTP request 2 from "80" to the port number "9091" corresponding to the first application, and change the destination port number in the HTTP request 2 from "80" to the port number "9091" corresponding to the first application. The destination IP address is changed to the IP address "127.0.0.1" of the local prefetch processing module of the terminal 100. The terminal 100 obtains the modified HTTP request 2 of the destination IP address, and presents the modified URI in the HTTP request 2 through the packet capture software: "/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4" , the source IP address (Src) is "11.240.22.56", the destination IP address (Dst) is "127.0.0.1", the byte range (range) is "bytes=14164-95757", and the destination port number is "9091".
此时,终端100确定不进行预取流程,因此,终端100可以直接将HTTP请求2通过Wi-Fi网络发送给服务器。终端100可以接收到服务器在Wi-Fi网络路径发送的HTTP响应2,其中,HTTP响应2中的源IP地址(Src)为“58.216.88.125”、目的IP地址为“11.240.22.56”、内容范围(content range)为“bytes 14164-95757/90982601”。其中,内容范围(content range)中的“90982601”表示该第一URI对应资源的总大小为90982601个字节。该HTTP响应2中包括有第一URI对应资源的14164-95757字节范围内的数据。终端100可以将HTTP响应2返回给第一应用。At this time, the terminal 100 determines not to perform the prefetching process, therefore, the terminal 100 can directly send the HTTP request 2 to the server through the Wi-Fi network. The terminal 100 can receive the HTTP response 2 sent by the server on the Wi-Fi network path, wherein the source IP address (Src) in the HTTP response 2 is "58.216.88.125", the destination IP address is "11.240.22.56", and the content range is (content range) is "bytes 14164-95757/90982601". Wherein, "90982601" in the content range (content range) indicates that the total size of the resource corresponding to the first URI is 90982601 bytes. The HTTP response 2 includes data in the range of 14164-95757 bytes of the resource corresponding to the first URI. The terminal 100 may return the HTTP response 2 to the first application.
第一应用在t3时刻第三次针对第一URI发起HTTP请求3,其中,该HTTP请求3中的URI可以为:“/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4”、源IP地址(Src)为“11.240.22.56”、目的IP地址(Dst)为“58.216.88.125”、字节范围(range)为“bytes=95758-177720”、目的端口号为“80”。该HTTP请求3用于请求第一URI对应资源的95758-177720字节范围内的数据。终端100可以将从端口80中获取到该HTTP请求3,并将该HTTP请求3中的目的端口号从“80”改为该第一应用对应的端口号“9091”,将该HTTP请求3中的目的IP地址改为终端100本地的全网聚合模块的IP地址“127.0.0.1”。终端100获取到修改后目的IP地址的HTTP请求3,通过抓包软件呈现出修改后的HTTP请求3中的URI为:“/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE  AAC1_PVC4.mp4”、源IP地址(Src)为“11.240.22.56”、目的IP地址(Dst)为“127.0.0.1”、字节范围(range)为“bytes=95758-177720”、目的端口号为“9091”。The first application initiates HTTP request 3 for the first URI for the third time at time t3, where the URI in the HTTP request 3 may be: "/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4", The source IP address (Src) is "11.240.22.56", the destination IP address (Dst) is "58.216.88.125", the byte range (range) is "bytes=95758-177720", and the destination port number is "80". The HTTP request 3 is used to request data in the range of 95758-177720 bytes of the resource corresponding to the first URI. The terminal 100 may obtain the HTTP request 3 from port 80, change the destination port number in the HTTP request 3 from "80" to the port number "9091" corresponding to the first application, and change the destination port number in the HTTP request 3 from "80" to the port number "9091" corresponding to the first application. The destination IP address is changed to the IP address "127.0.0.1" of the local network-wide aggregation module of the terminal 100. The terminal 100 obtains the modified HTTP request 3 of the destination IP address, and uses the packet capture software to present the URI in the modified HTTP request 3 as: "/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4" , the source IP address (Src) is "11.240.22.56", the destination IP address (Dst) is "127.0.0.1", the byte range (range) is "bytes=95758-177720", and the destination port number is "9091".
此时,终端100确定进行预取流程(例如3s内第一应用请求第一URI对应资源的次数达到3次),因此,终端100可以基于HTTP请求3中的请求的字节范围,生成HTTP请求4和HTTP请求5。At this time, the terminal 100 determines to perform the prefetching process (for example, the number of times that the first application requests the resource corresponding to the first URI within 3 seconds reaches 3 times). Therefore, the terminal 100 can generate an HTTP request based on the requested byte range in HTTP request 3 4 and HTTP request 5.
其中,HTTP请求4中的URI可以为:“/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4”、源IP地址(Src)为“189.100.3.195”、目的IP地址(Dst)为“211.91.160.241”、字节范围(range)为“bytes=95758-45539187”、目的端口号为“80”。该HTTP请求4用于请求第一URI对应资源的95758-45539187字节范围内的数据。The URI in HTTP request 4 can be: "/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4", the source IP address (Src) is "189.100.3.195", the destination IP address (Dst) It is "211.91.160.241", the byte range (range) is "bytes=95758-45539187", and the destination port number is "80". The HTTP request 4 is used to request data in the range of 95758-45539187 bytes of the resource corresponding to the first URI.
HTTP请求5中的URI可以为:“/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4”、源IP地址(Src)为“11.240.22.56”、目的IP地址(Dst)为“58.216.88.125”、字节范围(range)为“bytes=45539178-90982600”、目的端口号为“80”。该HTTP请求5用于请求第一URI对应资源的45539178-90982600字节范围内的数据。The URI in HTTP request 5 can be: "/P_VT/video_cutover/3F/v3/5B99115D352202788861689856/MP4_H.265_854x480_500_HE AAC1_PVC4.mp4", the source IP address (Src) is "11.240.22.56", the destination IP address (Dst) is " 58.216.88.125", the byte range (range) is "bytes=45539178-90982600", and the destination port number is "80". The HTTP request 5 is used to request data in the range of 45539178-90982600 bytes of the resource corresponding to the first URI.
因此,终端100可以将HTTP请求4通过蜂窝网络路径发送给服务器,将HTTP请求4通过蜂窝网络路径发送给服务器。终端100可以接收到服务器在蜂窝网络路径发送的HTTP响应4。其中,HTTP响应4中的源IP地址(Src)为“211.91.160.241”、目的IP地址为“189.100.3.195”、内容范围(content range)为“bytes 95758-45539187/90982601”。其中,内容范围(content range)中的“90982601”表示该第一URI对应资源的总大小为90982601个字节。该HTTP响应4中包括有第一URI对应资源的95758-45539187字节范围内的数据。Therefore, the terminal 100 can send the HTTP request 4 to the server through the cellular network path, and send the HTTP request 4 to the server through the cellular network path. The terminal 100 may receive the HTTP response 4 sent by the server in the cellular network path. The source IP address (Src) in HTTP response 4 is "211.91.160.241", the destination IP address is "189.100.3.195", and the content range is "bytes 95758-45539187/90982601". Wherein, "90982601" in the content range (content range) indicates that the total size of the resource corresponding to the first URI is 90982601 bytes. The HTTP response 4 includes data in the range of 95758-45539187 bytes of the resource corresponding to the first URI.
终端100可以将HTTP请求5通过蜂窝网络路径发送给服务器,将HTTP请求5通过Wi-Fi网络路径发送给服务器。终端100可以接收到服务器在Wi-Fi网络路径发送的HTTP响应5。其中,HTTP响应5中的源IP地址(Src)为“58.216.88.125”、目的IP地址为“11.240.22.56”、内容范围(content range)为“bytes 45539178-90982600/90982601”。该HTTP响应5中包括有第一URI对应资源的45539178-90982600字节范围内的数据。The terminal 100 may send the HTTP request 5 to the server through the cellular network path, and send the HTTP request 5 to the server through the Wi-Fi network path. The terminal 100 may receive the HTTP response 5 sent by the server on the Wi-Fi network path. Among them, the source IP address (Src) in HTTP response 5 is "58.216.88.125", the destination IP address is "11.240.22.56", and the content range (content range) is "bytes 45539178-90982600/90982601". The HTTP response 5 includes data in the range of 45539178-90982600 bytes of the resource corresponding to the first URI.
其中,由于终端100将该HTTP请求4在蜂窝网络路径上发送给服务器,终端100将该HTTP请求5通过Wi-Fi网路路径发送给服务器,HTTP请求4中的字节范围和HTTP请求5中的字节范围可以有重叠部分。例如,HTTP请求4中的字节范围为“95758-45539187”,HTTP请求5中的字节范围为“45539178-90982600”,HTTP请求4中字节范围的末尾和HTTP请求5中字节范围的开始重复了10个字节(重复的字节范围为“45539178-45539187”)。这样,可以更好让蜂窝网络路径上获取到的数据和Wi-Fi网络路径获取到的数据组合在一起。Wherein, since the terminal 100 sends the HTTP request 4 to the server on the cellular network path, the terminal 100 sends the HTTP request 5 to the server through the Wi-Fi network path, the byte range in the HTTP request 4 and the byte range in the HTTP request 5 can have overlapping byte ranges. For example, the byte range in HTTP request 4 is "95758-45539187", the byte range in HTTP request 5 is "45539178-90982600", the end of the byte range in HTTP request 4 and the end of the byte range in HTTP request 5 10 bytes are repeated at the beginning (the repeated bytes range from "45539178-45539187"). In this way, the data obtained on the cellular network path and the data obtained on the Wi-Fi network path can be better combined.
终端100在接收HTTP响应4和HTTP响应5的过程中,若收到了第一URI对应资源的第95758-177720字节范围内的数据后,可以将第一URI对应资源的第95758-177720字节范围内的数据封装成HTTP响应6,并将HTTP响应6返回给第一应用。其中,HTTP响应6中的源IP地址(Src)为“211.91.160.241”、目的IP地址(Dst)为“189.100.3.195”、内容范围(content range)为“bytes95758-177720/90982601”。其中,内容范围(content range) 中的“90982601”表示该第一URI对应资源的总大小为90982601个字节。该HTTP响应6中包括有第一URI对应资源的95758-177720字节范围内的数据。In the process of receiving HTTP response 4 and HTTP response 5, if the terminal 100 receives the data in the range of 95758-177720 bytes of the resource corresponding to the first URI, it can convert the 95758-177720 bytes of the resource corresponding to the first URI. The data within the scope is encapsulated into an HTTP response 6, and the HTTP response 6 is returned to the first application. The source IP address (Src) in HTTP response 6 is "211.91.160.241", the destination IP address (Dst) is "189.100.3.195", and the content range (content range) is "bytes95758-177720/90982601". Wherein, "90982601" in the content range (content range) indicates that the total size of the resource corresponding to the first URI is 90982601 bytes. The HTTP response 6 includes data in the range of 95758-177720 bytes of the resource corresponding to the first URI.
因此,本申请实施例的第四部分提供了一种多路径数据预取方法,终端可以当应用业务请求第一数据量的数据时,向服务器预取第二数据量的数据,其中,第二数据量大于第一数据量。然后,终端接收到服务器返回的第二数据量的数据后,可以先将第二数据量中的第一数据量的数据返回给应用。然后,将剩余(第二数据量-第一数据量)的数据存到预取缓冲区。当应用下次请求剩余的(第二数据量-第一数据量)字节的数据时,终端可以直接从预取缓冲区中提取该剩余的(第二数据量-第一数据量)字节的数据给到应用。提高了终端与服务器之间的网络路径的带宽利用率,并且,当应用频繁访问同一URI地址上的不同范围的数据时,可以节省应用获取到数据的时间。Therefore, the fourth part of the embodiments of the present application provides a multi-path data prefetching method. When the application service requests data of the first data amount, the terminal can prefetch the data of the second data amount from the server, wherein the second data amount is The amount of data is greater than the first amount of data. Then, after receiving the data of the second data volume returned by the server, the terminal may first return the data of the first data volume in the second data volume to the application. Then, the remaining data (the second amount of data - the first amount of data) is stored in the prefetch buffer. When the application requests the remaining (the second amount of data - the first amount of data) bytes of data next time, the terminal can directly extract the remaining (the second amount of data - the first amount of data) bytes from the prefetch buffer data to the application. The bandwidth utilization rate of the network path between the terminal and the server is improved, and when the application frequently accesses data in different ranges on the same URI address, the time for the application to obtain the data can be saved.
上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。The above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The recorded technical solutions are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims (18)

  1. 一种缓冲区管理方法,其特征在于,包括:A buffer management method, comprising:
    终端接收第一文件的数据,并将所述第一文件的数据存入第一缓冲区中,并将所述第一缓冲区中的数据写入磁盘中;The terminal receives the data of the first file, stores the data of the first file in the first buffer, and writes the data in the first buffer into the disk;
    所述终端监测所述第一缓冲区的已缓冲数据量、第一文件的待传输数据量、第一缓冲区的缓冲数据增长速率、可用内存容量;The terminal monitors the amount of buffered data in the first buffer, the amount of data to be transmitted in the first file, the growth rate of buffered data in the first buffer, and the available memory capacity;
    若所述第一缓冲区的缓冲数据增长速率大于0,所述终端根据所述第一缓冲区的已缓冲数据量、第一文件的待传输数据量、第一缓冲区的缓冲数据增长速率和网卡接收速率,确定出第一缓冲区的所需总容量值;If the growth rate of the buffered data of the first buffer is greater than 0, the terminal determines the buffered data volume of the first buffer, the data volume to be transmitted of the first file, the buffered data growth rate of the first buffer, and The network card receiving rate determines the required total capacity value of the first buffer;
    若所述第一缓冲区的所需总容量值大于等于第二值且小于等于第一值,且所述第一缓冲区的剩余缓冲容量小于所述第一文件的待传输数据量,所述终端将所述第一缓冲区的大小调整为所述第一缓冲区的所需总容量值,所述第一值大于所述第二值。If the required total capacity of the first buffer is greater than or equal to the second value and less than or equal to the first value, and the remaining buffer capacity of the first buffer is less than the amount of data to be transmitted of the first file, the The terminal adjusts the size of the first buffer to a required total capacity value of the first buffer, where the first value is greater than the second value.
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    若所述第一缓冲区的所需总容量值大于所述第一值,所述终端将所述第一缓冲区的大小调整为第一缓冲容量,其中,所述第一缓冲容量与所述可用内存容量的比值为第一值。If the required total capacity value of the first buffer is greater than the first value, the terminal adjusts the size of the first buffer to a first buffer capacity, wherein the first buffer capacity is the same as the first buffer capacity The ratio of the available memory capacity is the first value.
  3. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    若所述第一缓冲区的所需总容量值小于所述第二值,所述终端将所述第一缓冲区的大小调整为所述第一缓冲区的所需总容量值。If the required total capacity value of the first buffer is smaller than the second value, the terminal adjusts the size of the first buffer to the required total capacity value of the first buffer.
  4. 根据权利要求1所述的方法,其特征在于,在所述终端将所述第一缓冲区的大小调整为所述第一缓冲区的所需总容量值之后,所述方法还包括:The method according to claim 1, wherein after the terminal adjusts the size of the first buffer to a required total capacity value of the first buffer, the method further comprises:
    若所述终端在指定时间段内接收到用户输入的次数大于次数阈值,且第一缓冲区的已缓冲数据量小于等于第二缓冲容量,所述终端根据所述第二缓冲容量、所述第一缓冲区的已缓冲数据量、所述第一文件的剩余数据量、所述第一缓冲区的缓冲数据增长速率,确定出安全发送速率,所述第二缓冲容量与所述可用内存容量的比值为所述第二值;If the number of times the terminal receives user input within the specified time period is greater than the number of times threshold, and the amount of buffered data in the first buffer is less than or equal to the second buffer The buffered data volume of a buffer, the remaining data volume of the first file, the buffered data growth rate of the first buffer, determine the safe sending rate, the second buffer capacity and the available memory capacity the ratio is the second value;
    所述终端发送第一速率信息给所述第一文件的发送端,所述第一速率信息用于指示所述发送端调整所述第一文件的发送速率为所述安全发送速率;The terminal sends first rate information to the sender of the first file, where the first rate information is used to instruct the sender to adjust the sending rate of the first file to the safe sending rate;
    所述终端接收到所述发送端发送的确认信息;the terminal receives the acknowledgment information sent by the sender;
    响应于所述确认信息,所述终端将所述第一缓冲区的大小调整为所述第二缓冲容量。In response to the confirmation information, the terminal adjusts the size of the first buffer to the second buffer capacity.
  5. 根据权利要求1所述的方法,其特征在于,若所述第一缓冲区的所需总容量大于等于第二值且小于等于所述第一值,所述第二值小于所述第一值,在所述终端将所述第一缓冲区的大小调整为所述第一缓冲区的所需总容量值之后,所述方法还包括:The method according to claim 1, wherein if the required total capacity of the first buffer is greater than or equal to a second value and less than or equal to the first value, the second value is less than the first value , after the terminal adjusts the size of the first buffer to the required total capacity value of the first buffer, the method further includes:
    若所述终端在指定时间段内接收到用户输入的次数大于次数阈值,且第一缓冲区的已缓冲数据量大于第二缓冲容量,所述终端发送第二速率信息给所述发送端,所述第二速率 信息用于指示所述发送端调整第一文件的发送速率小于等于速率阈值,所述第二缓冲容量与所述可用内存容量的比值为所述第二值;If the number of times the terminal receives user input within a specified time period is greater than the number of times threshold, and the amount of buffered data in the first buffer is greater than the second buffer capacity, the terminal sends the second rate information to the sender, and the The second rate information is used to instruct the sender to adjust the sending rate of the first file to be less than or equal to a rate threshold, and the ratio of the second buffer capacity to the available memory capacity is the second value;
    若所述第一缓冲区的已缓冲数据量小于所述第二缓冲容量,所述终端将所述第一缓冲区的大小调整为所述第二缓冲容量。If the amount of buffered data in the first buffer is smaller than the second buffer capacity, the terminal adjusts the size of the first buffer to the second buffer capacity.
  6. 根据权利要求5所述的方法,其特征在于,在所述终端将所述第一缓冲区的大小调整为所述第二缓冲容量后,所述方法还包括:The method according to claim 5, wherein after the terminal adjusts the size of the first buffer to the second buffer capacity, the method further comprises:
    所述终端根据所述第一缓冲区的剩余缓冲容量、所述第一文件的剩余数据量、所述第一缓冲区的缓冲数据增长速率,确定出安全发送速率;The terminal determines the safe sending rate according to the remaining buffer capacity of the first buffer, the remaining data volume of the first file, and the buffered data growth rate of the first buffer;
    所述终端发送第一速率信息给所述第一文件的发送端,所述第一速率信息用于指示所述发送端调整所述第一文件的发送速率为所述安全发送速率。The terminal sends first rate information to the sender of the first file, where the first rate information is used to instruct the sender to adjust the sending rate of the first file to the safe sending rate.
  7. 根据权利要求2所述的方法,其特征在于,在所述终端将所述第一缓冲区的大小调整为所述第一缓冲容量之后,所述方法还包括:The method according to claim 2, wherein after the terminal adjusts the size of the first buffer to the first buffer capacity, the method further comprises:
    若所述终端在指定时间段内接收到用户输入的次数大于次数阈值,且第一缓冲区的已缓冲数据量小于等于第二缓冲容量,所述终端根据所述第二缓冲容量、所述第一缓冲区的已缓冲数据量、所述第一文件的剩余数据量、所述第一缓冲区的缓冲数据增长速率,确定出安全发送速率,所述第二缓冲容量与所述可用内存容量的比值为所述第二值;If the number of times the terminal receives user input within the specified time period is greater than the number of times threshold, and the amount of buffered data in the first buffer is less than or equal to the second buffer The buffered data volume of a buffer, the remaining data volume of the first file, the buffered data growth rate of the first buffer, determine the safe sending rate, the second buffer capacity and the available memory capacity the ratio is the second value;
    所述终端发送第一速率信息给所述第一文件的发送端,所述第一速率信息用于指示所述发送端调整所述第一文件的发送速率为所述安全发送速率;The terminal sends first rate information to the sender of the first file, where the first rate information is used to instruct the sender to adjust the sending rate of the first file to the safe sending rate;
    所述终端接收到所述发送端发送的确认信息;the terminal receives the acknowledgment information sent by the sender;
    响应于所述确认信息,所述终端将所述第一缓冲区的大小调整为所述第二缓冲容量。In response to the confirmation information, the terminal adjusts the size of the first buffer to the second buffer capacity.
  8. 根据权利要求2所述的方法,其特征在于,在所述终端将所述第一缓冲区的大小调整为所述第一缓冲容量之后,所述方法还包括:The method according to claim 2, wherein after the terminal adjusts the size of the first buffer to the first buffer capacity, the method further comprises:
    若所述终端在指定时间段内接收到用户输入的次数大于次数阈值,且第一缓冲区的已缓冲数据量大于第二缓冲容量,所述终端发送第二速率信息给所述发送端,所述第二速率信息用于指示所述发送端调整第一文件的发送速率小于等于速率阈值,所述第二缓冲容量与所述可用内存容量的比值为所述第二值;If the number of times the terminal receives user input within a specified time period is greater than the number of times threshold, and the amount of buffered data in the first buffer is greater than the second buffer capacity, the terminal sends the second rate information to the sender, and the The second rate information is used to instruct the sender to adjust the sending rate of the first file to be less than or equal to a rate threshold, and the ratio of the second buffer capacity to the available memory capacity is the second value;
    若所述第一缓冲区的已缓冲数据量小于所述第二缓冲容量,所述终端将所述第一缓冲区的大小调整为所述第二缓冲容量。If the amount of buffered data in the first buffer is smaller than the second buffer capacity, the terminal adjusts the size of the first buffer to the second buffer capacity.
  9. 根据权利要求8所述的方法,其特征在于,在所述终端将所述第一缓冲区的大小调整为所述第二缓冲容量后,所述方法还包括:The method according to claim 8, wherein after the terminal adjusts the size of the first buffer to the second buffer capacity, the method further comprises:
    所述终端根据所述第一缓冲区的剩余缓冲容量、所述第一文件的剩余数据量、所述第一缓冲区的缓冲数据增长速率,确定出安全发送速率;The terminal determines the safe sending rate according to the remaining buffer capacity of the first buffer, the remaining data volume of the first file, and the buffered data growth rate of the first buffer;
    所述终端发送第一速率信息给所述第一文件的发送端,所述第一速率信息用于指示所述发送端调整所述第一文件的发送速率为所述安全发送速率。The terminal sends first rate information to the sender of the first file, where the first rate information is used to instruct the sender to adjust the sending rate of the first file to the safe sending rate.
  10. 根据权利要求3所述的方法,其特征在于,在所述终端将所述第一缓冲区的大小调整为所述第一缓冲区的所需总容量值之后,所述方法还包括:The method according to claim 3, wherein after the terminal adjusts the size of the first buffer to a required total capacity value of the first buffer, the method further comprises:
    当终端确定出所述第一缓冲区的缓冲数据增长速率小于0时,所述终端将所述第一缓冲区的大小减小指定容量。When the terminal determines that the buffered data growth rate of the first buffer is less than 0, the terminal reduces the size of the first buffer by a specified capacity.
  11. 根据权利要求1所述的方法,其特征在于,所述终端根据所述第一缓冲区的已缓冲数据量、第一文件的待传输数据量、第一缓冲区的缓冲数据增长速率,网卡接收速率确定出第一缓冲区的所需总容量值,具体包括:The method according to claim 1, wherein, according to the buffered data volume of the first buffer, the to-be-transmitted data volume of the first file, and the buffered data growth rate of the first buffer, the network card receives the The rate determines the required total capacity value of the first buffer, which specifically includes:
    所述终端根据如下公式确定出所述第一缓冲区的所需容量值:The terminal determines the required capacity value of the first buffer according to the following formula:
    c*(H-W)/A-FLS/rateNet=0c*(H-W)/A-FLS/rateNet=0
    其中,c为保守系数,0<c≤1,H为所述第一缓冲区的所需总容量值,W为所述第一缓冲区的已缓冲数据量,A为所述第一缓冲区的缓冲数据增长速率,FLS为所述第一文件的待传输数据量,rateNet为所述网卡接收速率。Among them, c is a conservative coefficient, 0<c≤1, H is the required total capacity value of the first buffer, W is the buffered data volume of the first buffer, and A is the first buffer is the buffer data growth rate, FLS is the amount of data to be transmitted of the first file, and rateNet is the receiving rate of the network card.
  12. 根据权利要求4或7任一项所述的方法,其特征在于,所述终端根据所述第二缓冲容量、所述第一文件的剩余数据量、所述第一缓冲区的缓冲数据增长速率,确定出安全发送速率,具体包括:The method according to any one of claims 4 or 7, characterized in that the terminal is based on the second buffer capacity, the remaining data amount of the first file, and the buffer data growth rate of the first buffer. , to determine the safe sending rate, including:
    所述终端根据如下公式确定出所述安全发送速率:The terminal determines the safe transmission rate according to the following formula:
    c*(X-W)/A-FLS/V1=0c*(X-W)/A-FLS/V1=0
    其中,c为保守系数,0<c≤1,X为所述第二缓冲容量,W为所述第一缓冲区的已缓冲数据量,A为所述第一缓冲区的缓冲数据增长速率,FLS为所述第一文件的待传输数据量,V1为所述安全发送速率。Among them, c is a conservative coefficient, 0<c≤1, X is the second buffer capacity, W is the buffered data volume of the first buffer, A is the buffer data growth rate of the first buffer, FLS is the amount of data to be transmitted of the first file, and V1 is the safe sending rate.
  13. 根据权利要求6或9任一项所述的方法,其特征在于,所述终端根据所述第一缓冲区的剩余缓冲容量、所述第一文件的剩余数据量、所述第一缓冲区的缓冲数据增长速率,确定出安全发送速率,具体包括:The method according to any one of claims 6 or 9, characterized in that the terminal is based on the remaining buffer capacity of the first buffer, the remaining data amount of the first file, the Buffer data growth rate to determine the safe transmission rate, including:
    所述终端根据如下公式确定出所述安全发送速率:The terminal determines the safe transmission rate according to the following formula:
    c*P/A-FLS/V1=0c*P/A-FLS/V1=0
    其中,c为保守系数,0<c≤1,P为所述第一缓冲区的剩余缓冲容量,A为所述第一缓冲区的缓冲数据增长速率,FLS为所述第一文件的待传输数据量,V1为所述安全发送速率。Among them, c is a conservative coefficient, 0<c≤1, P is the remaining buffer capacity of the first buffer, A is the buffer data growth rate of the first buffer, and FLS is the to-be-transmitted first file Data volume, V1 is the safe sending rate.
  14. 根据权利要求4、6、7或9任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 4, 6, 7 or 9, wherein the method further comprises:
    若所述第一文件的待传输数据量占所述第一文件的总数据量的比值小于指定比例值,所述终端调整所述第一缓冲区的大小为第三缓冲容量,所述第三缓冲容量占所述可用内存容量的比例为第三值,所述第三值大于所述第一值。If the ratio of the to-be-transmitted data volume of the first file to the total data volume of the first file is less than a specified ratio value, the terminal adjusts the size of the first buffer to a third buffer capacity, and the third buffer The ratio of the buffer capacity to the available memory capacity is a third value, and the third value is greater than the first value.
  15. 根据权利要求1所述的方法,其特征在于,所述终端获取所述第一缓冲区的缓冲数 据增速率,具体包括:The method according to claim 1, wherein the terminal acquires the buffered data increment rate of the first buffer, specifically comprising:
    所述终端通过监测所述第一缓冲区中的已缓冲数据量的变化,获取到所述第一缓冲区的缓冲数据增长速率。The terminal obtains the buffered data growth rate of the first buffer by monitoring the change of the buffered data amount in the first buffer.
  16. 根据权利要求1所述的方法,其特征在于,所述终端获取所述第一缓冲区的缓冲数据增速率,具体包括:The method according to claim 1, wherein acquiring, by the terminal, a buffered data increment rate of the first buffer, specifically includes:
    所述终端获取所述第一文件的数据写入所述磁盘的写入速率;obtaining, by the terminal, a write rate at which data of the first file is written to the disk;
    所述终端根据所述网卡接收速率和所述写入速率,确定出所述第一缓冲区的缓冲数据增长速率。The terminal determines the growth rate of the buffered data of the first buffer according to the receiving rate and the writing rate of the network card.
  17. 一种终端,其特征在于,包括:一个或多个处理器、一个或多个存储器、网卡;其中,所述网卡、所述一个或多个存储器与所述一个或多个处理器耦合,所述一个或多个存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,当一个或多个处理器在执行所述计算机指令时,使得所述终端执行如权利要求1-16任一项所述的方法。A terminal, characterized by comprising: one or more processors, one or more memories, and a network card; wherein the network card, the one or more memories are coupled with the one or more processors, and the The one or more memories are used to store computer program codes, the computer program codes include computer instructions, when one or more processors are executing the computer instructions, the terminal is made to perform any one of claims 1-16. method described in item.
  18. 一种计算机存储介质,其特征在于,包括计算机指令,当所述计算机指令在终端上运行时,使得所述终端执行上述权利要求1-16任一项所述的方法。A computer storage medium, characterized by comprising computer instructions, which, when the computer instructions are executed on a terminal, cause the terminal to execute the method according to any one of the preceding claims 1-16.
PCT/CN2021/108275 2020-07-25 2021-07-23 Buffer management method and related device WO2022022429A1 (en)

Applications Claiming Priority (10)

Application Number Priority Date Filing Date Title
CN202010726638.9 2020-07-25
CN202010726671 2020-07-25
CN202010726671.1 2020-07-25
CN202010726638 2020-07-25
CN202010726657 2020-07-25
CN202010726657.1 2020-07-25
CN202010734674.X 2020-07-27
CN202010734674 2020-07-27
CN202110832128.4A CN113972962B (en) 2020-07-25 2021-07-22 Buffer management method and related device
CN202110832128.4 2021-07-22

Publications (1)

Publication Number Publication Date
WO2022022429A1 true WO2022022429A1 (en) 2022-02-03

Family

ID=79586495

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/108275 WO2022022429A1 (en) 2020-07-25 2021-07-23 Buffer management method and related device

Country Status (2)

Country Link
CN (1) CN113972962B (en)
WO (1) WO2022022429A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114501114A (en) * 2022-02-11 2022-05-13 福建星网智慧科技有限公司 Audio network self-adaption method and storage device
CN115277589A (en) * 2022-06-30 2022-11-01 北京比特大陆科技有限公司 Control data sending method, device, equipment and storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116582258B (en) * 2023-06-06 2024-04-30 深圳珠宝产业服务有限公司 Enterprise management information sharing system based on Internet and data analysis

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1578516A (en) * 2003-06-26 2005-02-09 日本电气株式会社 Data flow control system, method and program
US20060153078A1 (en) * 2004-12-28 2006-07-13 Kabushiki Kaisha Toshiba Receiver, transceiver, receiving method and transceiving method
US20140012972A1 (en) * 2012-07-05 2014-01-09 A10 Networks, Inc. Method to Allocate Buffer for TCP Proxy Session Based on Dynamic Network Conditions
US20160234078A1 (en) * 2015-02-11 2016-08-11 At&T Intellectual Property I, Lp Method and system for managing service quality according to network status predictions
US10506061B1 (en) * 2015-07-30 2019-12-10 CSC Holdings, LLC Adaptive system and method for dynamically adjusting message rates through a transport

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11273243A (en) * 1998-03-20 1999-10-08 Toshiba Corp Disk device and write buffer control method used in the same
CN101001362B (en) * 2006-01-11 2010-09-08 腾讯科技(深圳)有限公司 Method and terminal of on-line playing flow media
US8787163B1 (en) * 2010-02-24 2014-07-22 Marvell International Ltd. Method and apparatus for adjusting the size of a buffer in a network node based on latency
CN103402136B (en) * 2013-07-29 2016-05-11 重庆大学 Self adaptation is adjusted control method, device and the self adaptation player of buffer memory
CN107247679A (en) * 2017-05-27 2017-10-13 努比亚技术有限公司 Data transmission system and method
CN107333169B (en) * 2017-06-30 2020-03-06 郑州云海信息技术有限公司 Client cache adjusting method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1578516A (en) * 2003-06-26 2005-02-09 日本电气株式会社 Data flow control system, method and program
US20060153078A1 (en) * 2004-12-28 2006-07-13 Kabushiki Kaisha Toshiba Receiver, transceiver, receiving method and transceiving method
US20140012972A1 (en) * 2012-07-05 2014-01-09 A10 Networks, Inc. Method to Allocate Buffer for TCP Proxy Session Based on Dynamic Network Conditions
US20160234078A1 (en) * 2015-02-11 2016-08-11 At&T Intellectual Property I, Lp Method and system for managing service quality according to network status predictions
US10506061B1 (en) * 2015-07-30 2019-12-10 CSC Holdings, LLC Adaptive system and method for dynamically adjusting message rates through a transport

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114501114A (en) * 2022-02-11 2022-05-13 福建星网智慧科技有限公司 Audio network self-adaption method and storage device
CN115277589A (en) * 2022-06-30 2022-11-01 北京比特大陆科技有限公司 Control data sending method, device, equipment and storage medium
CN115277589B (en) * 2022-06-30 2023-08-29 北京比特大陆科技有限公司 Control data sending method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN113972962B (en) 2023-02-03
CN113972962A (en) 2022-01-25

Similar Documents

Publication Publication Date Title
WO2022022429A1 (en) Buffer management method and related device
KR101554398B1 (en) System and method of performing domain name server pre-fetching
JP5878614B2 (en) System and method for optimizing media playback quality in wireless handheld computing devices
KR101150084B1 (en) Energy-aware communications for a multi-radio system
US9992786B2 (en) Facilitation of multipath scheduling
US8117299B2 (en) Method and apparatus for scheduling wireless LAN traffic
US9565681B2 (en) Low power and fast application service transmission
WO2018051189A1 (en) Congestion control based on flow control
TWI762686B (en) Method and related products for data transmission
WO2022100264A1 (en) Data transmission method and apparatus, storage medium and electronic device
JP6643542B2 (en) Data packet transmission method, reception method, transmission device, and reception device
WO2022001175A1 (en) Data packet sending method and apparatus
JP5662582B2 (en) System and method for establishing a transmission control protocol connection
US9794320B2 (en) Method and apparatus for providing web service in wireless communication system
WO2021207114A1 (en) Selection of a radio access technology for communicating data between network devices
WO2022001639A1 (en) Communication method, mobile device and routing device
CN111385223A (en) Flow control method, device, system and storage medium
CN112566262A (en) Data processing method and device, communication equipment and storage medium
WO2023030386A1 (en) Data transmission method, electronic device and apparatus
Bolte et al. Optimized LTE NB-IoT Sensor Node With MQTT
US20180227220A1 (en) Router Cooperation
KR100850514B1 (en) The apparatus and method for media access control of mobile communication system

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21848740

Country of ref document: EP

Kind code of ref document: A1