WO2016023442A1 - Network request method, network fluctuation measurement method and apparatus, and terminal - Google Patents

Network request method, network fluctuation measurement method and apparatus, and terminal Download PDF

Info

Publication number
WO2016023442A1
WO2016023442A1 PCT/CN2015/086350 CN2015086350W WO2016023442A1 WO 2016023442 A1 WO2016023442 A1 WO 2016023442A1 CN 2015086350 W CN2015086350 W CN 2015086350W WO 2016023442 A1 WO2016023442 A1 WO 2016023442A1
Authority
WO
WIPO (PCT)
Prior art keywords
network
request
volatility
time
connection establishment
Prior art date
Application number
PCT/CN2015/086350
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 WO2016023442A1 publication Critical patent/WO2016023442A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/08Testing, supervising or monitoring using real traffic

Abstract

Disclosed are a network request method, a network fluctuation measurement method and apparatus, and a terminal. The network request method comprises: sending a first network request through a first network processing thread; determining a timeout threshold of a current network; when the time of sending the first network request exceeds the timeout threshold, if response data corresponding to the first network request is not received, sending a second network request through a second network processing thread, content of the second network request being the same as that of the first network request; and receiving response data corresponding to the first network request through the first network processing thread, or receiving response data corresponding to the second network request through the second network processing thread. In the network request method in the present application, when a timeout threshold is exceeded, a network request is sent again, the phenomenon in which the network request is not sent in a long time because of a network anomaly in the related art is avoided, and the time delay caused by the network anomaly is effectively reduced.

Description

网络请求方法、网络波动性衡量方法、装置及终端Network request method, network volatility measuring method, device and terminal
本发明要求于2014年8月12日提交中国专利局、申请号为201410395245.9、发明名称为“网络请求方法、网络波动性衡量方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本发明中。The present invention claims the priority of a Chinese patent application filed on August 12, 2014 by the Chinese Patent Office, the application number is 201410395245.9, and the invention is entitled "network request method, network volatility measurement method and device", the entire contents of which are incorporated by reference. In the present invention.
技术领域Technical field
本申请涉及移动通信技术领域,特别是涉及一种网络请求方法、网络波动性衡量方法、装置及终端。The present application relates to the field of mobile communications technologies, and in particular, to a network request method, a network volatility measurement method, apparatus, and a terminal.
背景技术Background technique
现有的相关技术中,浏览器请求网页的过程中,会遇到页面需要等待长时间才能打开甚至不能打开的情况,例如表现为白屏或者出现出错页面。其实际上是响应时间RT(Response Time,即网络线程建立TCP连接的时间,或称三次握手时间)过长甚至超时,造成响应时间超时的大部分的原因可归结为网络异常,如网络丢包导致客户端和服务器两端同时出错。In the related art, in the process of requesting a webpage by a browser, a situation in which a page needs to wait for a long time to be opened or even opened may be encountered, for example, a white screen or an error page. In fact, the response time RT (Response Time, that is, the time when the network thread establishes a TCP connection, or the three-way handshake time) is too long or even timed out, and most of the reasons for the response timeout may be attributed to network anomalies, such as network packet loss. Causes both client and server errors to occur at the same time.
对于该种问题,现有的相关技术中一般是通过重新发送请求的方式进行解决。以上的重新发送请求的技术在网络请求过程中,底层的网络协议栈有自身的重传逻辑,其中网络请求重传的时机相对固定,即应用层只能被动地等待网络请求的生命周期结束后再进行重传,这里重传启动的时机是收到服务器发送的异常状态同步信息时,或者是最后没有接收到任何数据长时间等待时,如发出请求,长时间后浏览器出现白屏显示网络连接异常。For this kind of problem, the related related art generally solves by resending the request. The above technology for resending the request in the network request process, the underlying network protocol stack has its own retransmission logic, wherein the timing of the network request retransmission is relatively fixed, that is, the application layer can only passively wait for the end of the network request life cycle. Then re-transmit, where the retransmission start time is when the abnormal state synchronization information sent by the server is received, or when no data is received for a long time, if the request is made, the browser displays a white screen after a long time. The connection is abnormal.
但是在不同的网络波动状态下,重新发送网络请求获取网络数据的成功率是不同的,较稳定的网络重试的成功率较高,而在恶劣的网络环境下重传可能导致网络重传不及时,从而出现网络请求异常并影响网络响应时间。However, in different network fluctuation states, the success rate of resending the network requesting to obtain network data is different, and the success rate of a relatively stable network retry is higher, and retransmission in a poor network environment may cause network retransmission. Timely, resulting in network request anomalies and affecting network response time.
发明内容Summary of the invention
本申请实施例中提供了一种网络请求方法、网络波动性衡量方法、装置及终端,以解决现有技术中的由于网络不稳定导致网络请求发送延时的问题。In the embodiment of the present application, a network request method, a network volatility measurement method, a device, and a terminal are provided to solve the problem that the network request transmission delay occurs due to network instability in the prior art.
为了解决上述技术问题,本申请实施例公开了如下技术方案: In order to solve the above technical problem, the embodiment of the present application discloses the following technical solutions:
本申请公开了一种网络请求方法,包括:The application discloses a network request method, including:
通过第一网络处理线程发送第一网络请求;Transmitting the first network request by the first network processing thread;
确定当前网络的超时时间阈值;Determine the timeout threshold of the current network;
在发送所述第一网络请求的时间超过所述超时时间阈值时,若未接收到所述第一网络请求对应的响应数据,则通过第二网络处理线程发送第二网络请求;其中,所述第二网络请求与所述第一网络请求的内容相同;And when the time when the first network request is sent exceeds the timeout threshold, if the response data corresponding to the first network request is not received, the second network processing thread sends a second network request, where The second network request is the same as the content requested by the first network;
通过所述第一网络处理线程接收所述第一网络请求的响应数据,或通过所述第二网络处理线程接收所述第二网络请求的响应数据。Receiving, by the first network processing thread, response data of the first network request, or receiving, by the second network processing thread, response data of the second network request.
可选的,所述确定当前网络的超时时间阈值,包括:Optionally, the determining a timeout threshold of the current network includes:
确定当前网络的网络波动性衡量指标;Determine the network volatility metrics of the current network;
根据所述网络波动性衡量指标确定所述当前网络的超时时间阈值。Determining a timeout threshold of the current network according to the network volatility metric.
可选的,所述确定当前网络波动性衡量指标,包括:Optionally, the determining the current network volatility metric includes:
收集当前N次网络连接的连接建立时间,其中,N为自然数;Collecting the connection establishment time of the current N network connections, where N is a natural number;
对所述连接建立时间的最大值做均一化处理,得到当前网络的网络波动性衡量指标。The maximum value of the connection establishment time is uniformly processed to obtain a network volatility measurement index of the current network.
可选的,所述根据所述网络波动性衡量指标确定所述当前网络的超时时间阈值,包括:Optionally, the determining, by the network volatility metric, the timeout threshold of the current network, including:
根据所述网络波动性衡量指标查询双请求动态策略规则表,得到当前网络的网络波动状态;以及与所述网络波动状态对应的所述超时时间阈值。Querying the dual request dynamic policy rule table according to the network volatility metric, obtaining a network fluctuation state of the current network; and the timeout threshold corresponding to the network fluctuation state.
可选的,还包括:Optionally, it also includes:
在通过所述第一网络处理线程接收到所述第一网络请求的响应数据时,关闭所述第二网络处理线程;和/或Turning off the second network processing thread when receiving the response data of the first network request by the first network processing thread; and/or
在通过所述第二网络处理线程接收到所述第二网络请求的响应数据时,关闭所述第一网络处理线程。The first network processing thread is closed when the response data of the second network request is received by the second network processing thread.
可选的,所述第一网络请求为正常发起的主请求,且为非https请求以及非GET请求的网络请求。Optionally, the first network request is a normally initiated primary request, and is a non-https request and a non-GET request network request.
本申请还提供了一种网络请求装置,包括: The application also provides a network requesting device, including:
第一请求发送单元,用于通过第一网络处理线程发送第一网络请求;a first request sending unit, configured to send a first network request by using a first network processing thread;
确定单元,用于确定当前网络的超时时间阈值;a determining unit, configured to determine a timeout threshold of the current network;
判断单元,用于判断所述第一请求发送单元发送所述第一网络请求的时间是否超过所述超时时间阈值;a determining unit, configured to determine whether the time that the first request sending unit sends the first network request exceeds the timeout threshold;
第二请求发送单元,用于在判断单元判断发送所述第一网络请求的时间超过所述超时时间阈值时,且未接收到所述第一网络请求对应的响应数据,则通过第二网络处理线程发送第二网络请求;其中,所述第二网络请求与所述第一网络请求的内容相同;a second request sending unit, configured to: when the determining unit determines that the time for sending the first network request exceeds the timeout threshold, and does not receive the response data corresponding to the first network request, processing by using the second network The thread sends a second network request; wherein the second network request is the same as the content requested by the first network;
数据接收单元,用于通过所述第一网络处理线程接收所述第一网络请求的响应数据,或通过所述第二网络处理线程接收所述第二网络请求的响应数据。And a data receiving unit, configured to receive, by the first network processing thread, response data of the first network request, or receive, by the second network processing thread, response data of the second network request.
可选的,所述确定单元包括:Optionally, the determining unit includes:
第一确定单元,用于确定当前网络的网络波动性衡量指标;a first determining unit, configured to determine a network volatility metric of the current network;
第二确定单元,用于根据所述网络波动性衡量指标确定所述当前网络的超时时间阈值。And a second determining unit, configured to determine a timeout threshold of the current network according to the network volatility metric.
可选的,所述第一确定单元包括:Optionally, the first determining unit includes:
收集单元,用于收集当前N次网络连接的连接建立时间,其中,N为自然数;a collecting unit, configured to collect a connection establishment time of the current N network connections, where N is a natural number;
处理单元,用于对所述连接建立时间的最大值做均一化处理,得到当前网络的网络波动性衡量指标。The processing unit is configured to perform a uniformization process on the maximum value of the connection establishment time to obtain a network volatility measurement indicator of the current network.
可选的,所述第二确定单元,具体用于根据所述网络波动性衡量指标查询双请求动态策略规则表,得到当前网络的网络波动状态;以及与所述网络波动状态对应的所述超时时间阈值。Optionally, the second determining unit is configured to query the dual request dynamic policy rule table according to the network volatility metric to obtain a network fluctuation state of the current network; and the timeout corresponding to the network fluctuation state. Time threshold.
可选的,还包括:Optionally, it also includes:
第一关闭单元,用于在所述数据接收单元通过所述第一网络处理线程接收到所述第一网络请求的响应数据时,关闭所述第二网络处理线程;和/或a first closing unit, configured to: when the data receiving unit receives the response data of the first network request by using the first network processing thread, shutting down the second network processing thread; and/or
第二关闭单元,用于在所述数据接收单元通过所述第二网络处理线程接收到所述第二网络请求的响应数据时,关闭所述第一网络处理线程。a second closing unit, configured to close the first network processing thread when the data receiving unit receives the response data of the second network request by using the second network processing thread.
可选的,所述第一请求发送单元发送的第一网络请求为正常发起的主请求, 且所述第一网络请求为非https请求以及非GET请求。Optionally, the first network request sent by the first request sending unit is a normally initiated primary request, And the first network request is a non-https request and a non-GET request.
本申请还公开了一种网络波动性衡量方法,包括:The application also discloses a method for measuring network volatility, including:
收集当前网络最近N次网络连接的连接建立时间,其中,N为自然数;Collecting the connection establishment time of the last N network connections of the current network, where N is a natural number;
将收集到的所述收集的连接建立时间的最大值做均一化处理,得到当前网络的网络波动性衡量指标;The collected maximum value of the connection establishment time is uniformly processed to obtain a network volatility measurement index of the current network;
根据当前网络的网络波动性衡量指标,确定当前网络的网络波动状态和对应的超时时间阈值。Determine the network fluctuation status of the current network and the corresponding timeout time threshold according to the network volatility measurement indicator of the current network.
可选的,该网络波动性衡量方法还包括:Optionally, the network volatility measurement method further includes:
收集网络连接的连接建立时间和响应时间,得到所述连接建立时间和对应的所述响应时间的对应关系数据集;Collecting a connection establishment time and a response time of the network connection, and obtaining a correspondence data set of the connection establishment time and the corresponding response time;
将对应关系数据集中的所有连接建立时间分为数个阶段,并将每个阶段中所述连接建立时间的最大值和最小值进行均一化处理;All connection establishment time in the correspondence data set is divided into several stages, and the maximum and minimum values of the connection establishment time in each stage are uniformly processed;
将每个阶段的所述连接建立时间的最小均一化值至最大均一化值的范围确定为网络波动性衡量指标的指标范围;Determining, as a range of indicators of the network volatility measure, a range of the minimum uniformization value to the maximum uniformization value of the connection establishment time of each stage;
根据网络波动性衡量指标的指标范围确定对应的网络波动状态和对应的超时时间阈值。The corresponding network fluctuation state and the corresponding timeout time threshold are determined according to the indicator range of the network volatility measurement indicator.
可选的,该网络波动性衡量方法还包括:将网络波动性衡量指标的指标范围、网络波动状态和超时时间阈值相对应的存储于数据库中。Optionally, the method for measuring network volatility further includes: storing, in a database, a metric range of the network volatility metric, a network volatility state, and a timeout threshold.
可选的,该网络波动性衡量方法,还包括:根据当前网络的网络波动性衡量指标去数据库中查找对应的网络波动状态和超时时间阈值,用于确定当前网络的网络波动状态和对应的超时时间阈值。Optionally, the method for measuring network volatility further includes: searching for a corresponding network fluctuation state and a timeout threshold according to a network volatility metric of the current network, and determining a network fluctuation state and a corresponding timeout of the current network. Time threshold.
可选的,该网络波动性衡量方法还包括:Optionally, the network volatility measurement method further includes:
通过聚类算法将对应关系数据集中的所有连接建立时间分为数个阶段;The clustering algorithm divides all connection establishment time in the corresponding relational data set into several stages;
根据所述连接建立时间和所述响应时间之间的对应关系数据集,通过累积分布函数建立每个阶段所述连接建立时间和所述响应时间的累积分布函数;And establishing, according to the correspondence data set between the connection establishment time and the response time, a cumulative distribution function of the connection establishment time and the response time in each phase by using a cumulative distribution function;
根据所述连接建立时间和所述响应时间的累积分布函数,得出每个所述网络波动性衡量指标的指标范围内置信度较高的响应时间; Obtaining a response time with a high built-in reliability of the indicator range of each of the network volatility metrics according to the cumulative distribution function of the connection establishment time and the response time;
将所述置信度较高的响应时间作为所述网络波动性衡量指标的指标范围内对应的网络波动状态下的超时时间阈值。The response time with higher confidence is used as the timeout threshold in the corresponding network fluctuation state in the indicator range of the network volatility metric.
本申请还公开了一种网络波动性衡量装置,包括:The application also discloses a network volatility measuring device, comprising:
数据采集单元,用于收集当前网络最近N次网络连接的连接建立时间,其中,N为自然数;a data collection unit, configured to collect connection establishment time of the last network connection of the current network, where N is a natural number;
网络波动性检测单元,用于根据所述数据采集单元收集的连接建立时间,检测并确定当前网络的网络波动性衡量指标;并根据所述当前网络的网络波动性衡量指标,确定当前网络的网络波动状态和对应的超时时间阈值。a network volatility detecting unit, configured to detect and determine a network volatility metric of the current network according to the connection establishment time collected by the data collecting unit, and determine a network of the current network according to the network volatility metric of the current network The fluctuation state and the corresponding timeout threshold.
可选的,所述网络波动性检测单元包括:Optionally, the network volatility detecting unit includes:
数据分组单元,用于将收集到的连接建立时间和对应的响应时间建立对应的关系数据集,并将所述关系数据集中的连接建立时间分为数个阶段;a data grouping unit, configured to establish a corresponding relationship data set by the collected connection establishment time and the corresponding response time, and divide the connection establishment time in the relational data set into several stages;
数据处理单元,通过所述数据处理单元对每个阶段中的最大值和最小值进行均一化处理,得到最大均一化值和最小均一化值,并将最小均一化值至最大均一化值的范围确定为网络波动性衡量指标的指标范围;a data processing unit, wherein the maximum value and the minimum value in each stage are homogenized by the data processing unit to obtain a maximum uniformization value and a minimum uniformization value, and the minimum uniformization value is to a range of the maximum uniformization value The range of indicators identified as metrics for network volatility;
数据分析单元,根据网络波动性衡量指标的指标范围分析确定对应的网络波动状态和对应的超时时间阈值。The data analysis unit determines the corresponding network fluctuation state and the corresponding timeout time threshold according to the analysis of the indicator range of the network volatility measurement indicator.
本申请还公开了一种终端,包括:The application also discloses a terminal, including:
收发器,用于通过第一网络处理线程发送第一网络请求;a transceiver, configured to send, by using a first network processing thread, a first network request;
处理器,用于确定当前网络的超时时间阈值;并判断收发器发送所述第一网络请求的时间是否超过所述超时时间阈值;a processor, configured to determine a timeout threshold of the current network; and determine whether the time that the transceiver sends the first network request exceeds the timeout threshold;
所述收发器,还用于在处理器判定所述收发器发送所述第一网络请求的时间超过所述超时时间阈值时,若未接收到所述第一网络请求对应的响应数据,则通过第二网络处理线程发送第二网络请求;其中,所述第二网络请求与所述第一网络请求的内容相同;The transceiver is further configured to: when the processor determines that the time when the transceiver sends the first network request exceeds the timeout threshold, if the response data corresponding to the first network request is not received, The second network processing thread sends a second network request; wherein the second network request is the same as the content requested by the first network;
所述收发器,还用于通过所述第一网络处理线程接收所述第一网络请求的响应数据,或通过所述第二网络处理线程接收所述第二网络请求的响应数据。The transceiver is further configured to receive, by the first network processing thread, response data of the first network request, or receive, by the second network processing thread, response data of the second network request.
可选的,所述处理器确定当前网络的超时时间阈值包括: Optionally, the determining, by the processor, a timeout threshold of the current network includes:
所述处理器确定当前网络的网络波动性衡量指标,并根据所述网络波动性衡量指标确定所述当前网络的超时时间阈值。The processor determines a network volatility metric of the current network, and determines a timeout threshold of the current network according to the network volatility metric.
可选的,所述收发器,还用于收集当前N次网络连接的连接建立时间,其中,N为自然数;Optionally, the transceiver is further configured to collect a connection establishment time of the current N times network connection, where N is a natural number;
所述处理器对所述收发器收集的所述连接建立时间的最大值做均一化处理,得到当前网络的网络波动性衡量指标。The processor performs a uniform processing on the maximum value of the connection establishment time collected by the transceiver to obtain a network volatility measurement indicator of the current network.
可选的,所述处理器根据所述网络波动性衡量指标查询双请求动态策略规则表,得到当前网络的网络波动状态;以及与所述网络波动状态对应的所述超时时间阈值。Optionally, the processor queries the dual request dynamic policy rule table according to the network volatility metric to obtain a network fluctuation state of the current network; and the timeout threshold corresponding to the network fluctuation state.
可选的,所述收发器,还用于通过所述第一网络处理线程接收到所述第一网络请求的响应数据;Optionally, the transceiver is further configured to receive response data of the first network request by using the first network processing thread;
所述处理器,还用于在所述收发器通过所述第一网络处理线程接收到所述第一网络请求的响应数据时,关闭所述第二网络处理线程;The processor is further configured to: when the transceiver receives the response data of the first network request by using the first network processing thread, shutting down the second network processing thread;
or
所述收发器,还用于通过所述第二网络处理线程接收到所述第二网络请求的响应数据;The transceiver is further configured to receive response data of the second network request by using the second network processing thread;
所述处理器,还用于在所述收发器通过所述第二网络处理线程接收到所述第二网络请求的响应数据时,关闭所述第一网络处理线程。The processor is further configured to: when the transceiver receives the response data of the second network request by using the second network processing thread, shutting down the first network processing thread.
可选的,所述收发器发送的第一网络请求为正常发起的主请求,且为非https请求以及非GET请求的网络请求。Optionally, the first network request sent by the transceiver is a normally initiated primary request, and is a non-https request and a non-GET request network request.
本申请还公开了一种计算机可读存储介质,包括计算机执行指令,以供计算机的处理器执行所述计算机执行指令时,所述计算机执行上述的网络请求方法,或执行上述的网络波动性衡量方法。The present application also discloses a computer readable storage medium comprising computer executed instructions for executing, by the processor of a computer, the network request method, or performing the network volatility measurement described above, when the computer executes the instructions. method.
由以上技术方案可见,本申请提出的网络请求方法,通过发送网络请求,并在发送网络请求时的网络波动状态下设置其对应的超时时间阈值,即当前网络波动状态下接收到响应数据的正常时间,如果在该超时时间阈值的时间内没有接收到该网络请求对应的响应数据;则超过超时时间阈值的时间后重新发送该网络请求,并且等待接收该两个网络请求中任何一个网络请求对应的响应数据。从而有 效避免在第一次网络请求未接收到响应数据,并在出现网络异常或白屏的情况下,要等待很长时间再发送网络请求;通过本申请的网络请求方法有效节省两次网络请求重传之间的时间差,有效减少网络请求异常引发的延时。It can be seen from the above technical solution that the network request method proposed by the present application sets the corresponding timeout time threshold by sending a network request and in a network fluctuation state when the network request is sent, that is, the normal response data is received under the current network fluctuation state. Time, if the response data corresponding to the network request is not received within the timeout threshold period; the network request is resent after the timeout threshold is exceeded, and waiting to receive any one of the two network requests corresponds to Response data. Thus there is To avoid receiving the response data in the first network request, and in the case of network abnormality or white screen, wait for a long time to send the network request; save the network request twice by the network request method of the present application. The time difference between transmissions effectively reduces the delay caused by network request exceptions.
附图说明DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it will be apparent to those skilled in the art that In other words, other drawings can be obtained based on these drawings without paying for creative labor.
图1为本申请实施例提供的一种网络请求方法的流程示意图;FIG. 1 is a schematic flowchart of a network request method according to an embodiment of the present application;
图2为本申请另一实施例中在确定达到超时时间阈值,未接收到第一网络请求对应的响应数据,则由第二网络处理线程发送第二网络请求步骤的详细流程图;2 is a detailed flowchart of a step of sending a second network request by a second network processing thread after determining that the response time data corresponding to the first network request is not received after determining that the timeout period threshold is reached in another embodiment of the present application;
图3为本申请实施例提供的一种网络请求装置的结构示意图;FIG. 3 is a schematic structural diagram of a network request apparatus according to an embodiment of the present disclosure;
图3A为本申请实施例提供的一种网络请求装置的另一结构示意图;3A is another schematic structural diagram of a network requesting apparatus according to an embodiment of the present application;
图4为本申请实施例提供的另一种网络请求装置的结构示意图;FIG. 4 is a schematic structural diagram of another network request apparatus according to an embodiment of the present disclosure;
图5为本申请实施例提供的一种网络波动性衡量方法的流程示意图;FIG. 5 is a schematic flowchart of a method for measuring network volatility according to an embodiment of the present application;
图6为本申请实施例详提供的一种计算当前网络的网络波动性衡量指标后根据网络波动性衡量指标获得超时时间阈值的流程图;FIG. 6 is a flowchart of obtaining a timeout threshold according to a network volatility measurement indicator after calculating a network volatility measurement indicator of a current network according to an embodiment of the present application;
图7为本申请的一个实施例中确定网络波动状态和对应的超时时间阈值的详细流程图;FIG. 7 is a detailed flowchart of determining a network fluctuation state and a corresponding timeout time threshold in an embodiment of the present application;
图8为本申请实施例提供的一种网络波动性衡量装置的结构示意图;FIG. 8 is a schematic structural diagram of a network volatility measuring apparatus according to an embodiment of the present application;
图9为本申请实施例提供的一种网络波动性衡量方法的衡量标准示意图;FIG. 9 is a schematic diagram of a measurement standard of a network volatility measurement method according to an embodiment of the present application;
图10为本申请实施例提供的一种网络波动性参考标准示意图;FIG. 10 is a schematic diagram of a network volatility reference standard according to an embodiment of the present application;
图11为本申请实施例提供的一种网络波动性衡量方法的连接建立时间和响应时间的累积分布图。 FIG. 11 is a cumulative distribution diagram of connection establishment time and response time of a network volatility measurement method according to an embodiment of the present application.
具体实施方式detailed description
本申请实施例提供一种网络请求方法,通过该网络请求方法有效提高由于网络请求异常引发的延时。The embodiment of the present application provides a network request method, by which the delay caused by a network request exception is effectively improved.
为了使本技术领域的人员更好地理解本申请中的技术方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。The technical solutions in the embodiments of the present application are clearly and completely described in the following, in which the technical solutions in the embodiments of the present application are clearly and completely described. The embodiments are only a part of the embodiments of the present application, and not all of them. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope shall fall within the scope of the application.
首先结合附图1对本申请实施例的网络请求方法进行说明。First, the network request method in the embodiment of the present application will be described with reference to FIG.
图1为本申请实施例提供的一种网络请求方法的流程示意图。FIG. 1 is a schematic flowchart diagram of a network request method according to an embodiment of the present application.
如图1所示,该网络请求方法包括:As shown in FIG. 1, the network request method includes:
S110:通过第一网络处理线程发送第一网络请求;其中,该第一网络请求为正常发起的主请求,且第一网络请求可以为非https请求以及非GET请求的网络请求等,当然,也可以是其他类似的请求,本实施例不作限制;S110: Send a first network request by using a first network processing thread, where the first network request is a normally initiated primary request, and the first network request may be a non-https request and a non-GET request network request, etc., of course, It may be other similar requests, and the embodiment is not limited;
S120:确定当前网络的超时时间阈值;S120: Determine a timeout threshold of the current network.
其一种确定方式为:先确定当前网络的网络波动性衡量指标;在根据所述网络波动性衡量指标确定所述当前网络的超时时间阈值。The determining method is: first determining a network volatility metric of the current network; and determining a timeout threshold of the current network according to the network volatility metric.
其中,所述确定当前网络波动性衡量指标,包括:收集当前N次网络连接的连接建立时间,其中,N为自然数;对所述连接建立时间的最大值做均一化处理,得到当前网络的网络波动性衡量指标。The determining the current network volatility metric includes: collecting the connection establishment time of the current N times network connection, where N is a natural number; performing uniformization on the maximum value of the connection establishment time to obtain a network of the current network Volatility measure.
而根据所述网络波动性衡量指标确定所述当前网络的超时时间阈值的一种确定方式为:根据所述网络波动性衡量指标查询双请求动态策略规则表,得到当前网络的网络波动状态;以及与所述网络波动状态对应的所述超时时间阈值。And determining, according to the network volatility metric, a timeout threshold of the current network, by: querying a dual request dynamic policy rule table according to the network volatility metric to obtain a network volatility state of the current network; The timeout threshold corresponding to the network fluctuation state.
也就是说,该超时时间阈值时根据当前网络波动性衡量指标确定的;其中,该超时时间阈值通过当前网络的网络波动性衡量指标与网络波动性参考标准进行比对,从而确定当前网络下发送第一网络请求的超时时间阈值;That is, the timeout threshold is determined according to the current network volatility metric; wherein the timeout threshold is compared with the network volatility reference standard by the current network volatility metric, thereby determining that the current network is sent. The timeout threshold of the first network request;
该步骤S120中进一步包括:该网络波动性的参考标准为不同阶段下网络波动性衡量指标的指标范围对应的网络波动状态和超时时间阈值;其中,收集大量 网络连接的连接建立时间和响应时间,得到该连接建立时间和对应的响应时间的对应关系数据集;并将对应关系数据集中的所有连接建立时间分为数个阶段,并将每个阶段中所述连接建立时间的最大值和最小值进行均一化处理;将每个阶段处理后得到的最小均一化值至最大均一化值的范围确定为网络波动性衡量指标的指标范围;从而根据网络波动性衡量指标的指标范围确定对应的网络波动状态和对应的超时时间阈值,形成该网络波动性参考标准,并将该网络波动性参考标准存储于数据库中便于网络波动性衡量指标调用对比。The step S120 further includes: the reference standard of the network volatility is a network fluctuation state and a timeout threshold corresponding to the indicator range of the network volatility metric in different stages; wherein, collecting a large amount Establishing a connection establishment time and a response time of the network connection, obtaining a correspondence data set of the connection establishment time and the corresponding response time; and dividing all connection establishment times in the correspondence data set into several stages, and as described in each stage The maximum and minimum values of the connection establishment time are normalized; the range of the minimum uniformization value to the maximum uniformization value obtained after each stage is determined as the index range of the network volatility measure; thus, according to the network volatility measure The indicator range of the indicator determines the corresponding network fluctuation state and the corresponding timeout time threshold, forms the network volatility reference standard, and stores the network volatility reference standard in the database to facilitate comparison of the network volatility measurement indicator call.
S130:在发送所述第一网络请求的时间超过所述超时时间阈值时,若未接收到第一网络请求对应的响应数据,则通过第二网络处理线程发送第二网络请求,其中,所述第二网络请求与所述第一网络请求的内容相同;比如,第二网络请求与所述第一网络请求所请求的网页内容相同等。但该第二网络请求与第一网络请求所携带的端口号,或时间戳信息可能相同,也可能不同,本实施例不作限制。S130: When the time when the first network request is sent exceeds the timeout threshold, if the response data corresponding to the first network request is not received, the second network processing thread sends a second network request, where The second network request is the same as the content requested by the first network; for example, the second network request is the same as the content of the web page requested by the first network request. However, the second network request may be the same as the port number or the timestamp information carried by the first network request, or may be different. This embodiment is not limited.
S140:通过所述第一网络处理线程接收所述第一网络请求的响应数据,或通过所述第二网络处理线程接收所述第二网络请求的响应数据;S140: receiving, by the first network processing thread, response data of the first network request, or receiving, by the second network processing thread, response data of the second network request;
进一步,该实施例中,在发送第二网络请求之后,第一网络处理线程和第二网络处理线程处于等待阶段,等待接收响应数据,且在第一网络处理线程和第二网络处理线程任何一个线程接收到第一网络请求或第二网络请求对应的响应数据,则将该响应数据返回至内核层,同时关闭另外一个未接收到响应数据的网络请求。比如,如果接收到第一网络请求的响应数据,则关闭第二网络处理线程;或者,如果接收到第二网络请求的响应数据,则关闭第一网络处理线程。Further, in this embodiment, after transmitting the second network request, the first network processing thread and the second network processing thread are in a waiting phase, waiting to receive response data, and any one of the first network processing thread and the second network processing thread When the thread receives the response data corresponding to the first network request or the second network request, the thread returns the response data to the kernel layer, and closes another network request that does not receive the response data. For example, if the response data of the first network request is received, the second network processing thread is closed; or, if the response data of the second network request is received, the first network processing thread is closed.
图2为本申请另一实施例中在确定达到超时时间阈值,未接收到第一网络请求对应的响应数据,则由第二网络处理线程发送第二网络请求步骤的详细流程图。FIG. 2 is a detailed flowchart of a step of sending a second network request by a second network processing thread after determining that the timeout time threshold is reached and the response data corresponding to the first network request is not received in another embodiment of the present application.
即上一实施例中步骤S130的详细流程图。That is, the detailed flowchart of step S130 in the previous embodiment.
如图2所示,在优选的实施例中步骤S130包括:As shown in FIG. 2, in a preferred embodiment, step S130 includes:
S121:根据当前网络的网络波动性衡量指标(MA,Measure Amplitude)确定超时时间阈值;S121: Determine a timeout threshold according to a current network volatility measurement indicator (MA, Measure Amplitude);
也就是说,根据当前网络的最近N次网络连接的连接建立时间生成当前网络的网络波动性衡量指标,并根据该网络波动性衡量指标设定超时时间阈值;其中, N大于等于1,一般为多次的连接建立时间,从而使得出的超时时间阈值可靠性高,且该网络波动性衡量指标为N次连接建立时间中最大均一化值;That is, the network volatility metric of the current network is generated according to the connection establishment time of the last N network connections of the current network, and the timeout threshold is set according to the volatility metric of the network; If the value of N is greater than or equal to 1, the connection establishment time is multiple times, so that the timeout threshold is high, and the network volatility metric is the maximum uniformization value of the N connection establishment time;
S122:判断是否在超时时间阈值内,该第一网络请求是否接收到第一网络请求对应的响应数据;S122: Determine whether the first network request receives the response data corresponding to the first network request within the timeout threshold.
如果在超时时间阈值内,接收到第一网络请求对应的响应数据,则结束;If the response data corresponding to the first network request is received within the timeout threshold, the process ends;
如果在超时时间阈值内,未接收到第一网络请求对应的响应数据,则进入步骤S123;If the response data corresponding to the first network request is not received within the timeout threshold, proceed to step S123;
S123:创建第二网络处理线程,由该第二网络处理线程发送第二网络请求,其中,第二网络请求与第一网络请求的内容相同。S123: Create a second network processing thread, where the second network processing thread sends a second network request, where the second network request is the same as the content requested by the first network.
在另一优选实施例中,在步骤S130之前还包括根据一定规则判断是否需要进行步骤S130,而该规则即为:该网络请求均为正常发起的主请求,且为非https请求以及非GET请求的网络请求。因此,通过该网络请求方法使网络异常时能够快速进行二次网络请求的发送,减少网络请求的延时,另外,主请求一般为非后置验证和非预加载的网络请求。In another preferred embodiment, before step S130, it is further included, according to a certain rule, determining whether step S130 needs to be performed, and the rule is: the network request is a normally initiated main request, and is a non-https request and a non-GET request. Network request. Therefore, the network request method can quickly send the secondary network request when the network is abnormal, and reduce the delay of the network request. In addition, the main request is generally a non-post-authentication and a non-preloaded network request.
另外,在实施过程中,该网络请求的次数也并不限制在仅发送第二次网络请求,在网络异常下,如果网络稳定但仍接收不到响应数据,可以在第二次网络请求发送后,根据第二次网络请求发送时网络的MA设定超时时间阈值,并在发送第二网络请求的时间超过该超时时间阈值,若没有接收第二网络请求的响应数据,则通过第三线程发送第三网络请求,其中,第三网络请求与第一网络请求的内容同,之后该第一网络请求、第二网络请求和第三网络请求均等待对应的响应数据,并在任何一个网络请求接收到对应的响应数据后,由内核层关闭其他两个网络请求。不仅避免增加网络请求重传的负担,而且在未接收到第一次网络请求或第二次网络请求的响应数据且未出现网络异常时,发送第三次网络请求,并只接收一个响应数据的回传即可,不必要出现如现有技术中出现网络异常直至接收不到响应数据时才发送下一次网络请求的情况,从而有效减少网络异常引发的延时。In addition, during the implementation process, the number of times the network request is not limited to only sending the second network request. Under the network exception, if the network is stable but still does not receive the response data, the second network request may be sent after the second network request is sent. According to the second network request, the MA of the network sets a timeout threshold, and the time when the second network request is sent exceeds the timeout threshold. If the response data of the second network request is not received, the third thread sends the response data. a third network request, wherein the third network request is the same as the content requested by the first network, and then the first network request, the second network request, and the third network request both wait for corresponding response data, and receive the request in any one of the networks. After the corresponding response data, the other two network requests are closed by the kernel layer. Not only avoiding the burden of re-transmitting the network request, but also transmitting the third network request and receiving only one response data when the response data of the first network request or the second network request is not received and no network abnormality occurs. The backhaul can be performed, and it is not necessary to send the next network request when the network abnormality occurs in the prior art until the response data is received, thereby effectively reducing the delay caused by the network abnormality.
还请参阅图3,图3为本申请实施例提供的一种网络请求装置的结构示意图,所述装置包括:第一请求发送单元31,确定单元32,判断单元33,第二请求发送单元34和数据接收单元35,其中, Referring to FIG. 3, FIG. 3 is a schematic structural diagram of a network requesting apparatus according to an embodiment of the present disclosure. The apparatus includes: a first request sending unit 31, a determining unit 32, a determining unit 33, and a second request sending unit 34. And a data receiving unit 35, wherein
所述第一请求发送单元31,用于通过第一网络处理线程发送第一网络请求;其中,第一网络请求为正常发起的主请求,且所述第一网络请求为非https请求以及非GET请求;The first request sending unit 31 is configured to send, by using a first network processing thread, a first network request, where the first network request is a normally initiated primary request, and the first network request is a non-https request and a non-GET request;
所述确定单元32,用于确定当前网络的超时时间阈值;The determining unit 32 is configured to determine a timeout threshold of the current network;
所述判断单元33,用于判断所述第一请求发送单元发送所述第一网络请求的时间是否超过所述超时时间阈值;The determining unit 33 is configured to determine whether the time that the first request sending unit sends the first network request exceeds the timeout threshold;
所述第二请求发送单元34,用于在判断单元判断发送所述第一网络请求的时间超过所述超时时间阈值时,且未接收到所述第一网络请求对应的响应数据,则通过第二网络处理线程发送第二网络请求;其中,所述第二网络请求与所述第一网络请求的内容相同;The second request sending unit 34 is configured to: when the determining unit determines that the time for sending the first network request exceeds the timeout threshold, and does not receive the response data corresponding to the first network request, The second network processing thread sends a second network request; wherein the second network request is the same as the content requested by the first network;
所述数据接收单元35,用于通过所述第一网络处理线程接收所述第一网络请求的响应数据,或通过所述第二网络处理线程接收所述第二网络请求的响应数据。The data receiving unit 35 is configured to receive, by the first network processing thread, response data of the first network request, or receive, by the second network processing thread, response data of the second network request.
可选的,在另一实施例中,所述确定单元包括:第一确定单元和第二确定单元(图中未示),其中,所述第一确定单元,用于确定当前网络的网络波动性衡量指标;所述第二确定单元,用于根据所述网络波动性衡量指标确定所述当前网络的超时时间阈值。Optionally, in another embodiment, the determining unit includes: a first determining unit and a second determining unit (not shown), wherein the first determining unit is configured to determine network fluctuations of the current network. The second determining unit is configured to determine a timeout threshold of the current network according to the network volatility metric.
其中,第一确定单元包括:收集单元和处理单元(图中未示),其中,所述收集单元,用于收集当前N次网络连接的连接建立时间,其中,N为自然数;所述处理单元,用于对所述连接建立时间的最大值做均一化处理,得到当前网络的网络波动性衡量指标。The first determining unit includes: a collecting unit and a processing unit (not shown), wherein the collecting unit is configured to collect a connection establishment time of the current N network connections, where N is a natural number; And performing uniformization processing on the maximum value of the connection establishment time to obtain a network volatility measurement indicator of the current network.
所述第二确定单元,具体用于根据所述网络波动性衡量指标查询双请求动态策略规则表,得到当前网络的网络波动状态;以及与所述网络波动状态对应的所述超时时间阈值。The second determining unit is configured to query the dual request dynamic policy rule table according to the network volatility measurement indicator to obtain a network fluctuation state of the current network; and the timeout time threshold corresponding to the network fluctuation state.
可选的,在另一实施例中,所述装置还包括:第一关闭单元和/或第二关闭单元(图中未示),其中,Optionally, in another embodiment, the device further includes: a first closing unit and/or a second closing unit (not shown), wherein
所述第一关闭单元,用于在所述数据接收单元通过所述第一网络处理线程接收到所述第一网络请求的响应数据时,关闭所述第二网络处理线程;The first closing unit is configured to close the second network processing thread when the data receiving unit receives the response data of the first network request by using the first network processing thread;
所述第二关闭单元,用于在所述数据接收单元通过所述第二网络处理线程接 收到所述第二网络请求的响应数据时,关闭所述第一网络处理线程。The second closing unit is configured to receive, by the second network processing thread, the data receiving unit When the response data of the second network request is received, the first network processing thread is closed.
需要说明的是,该实施例中,确定当前网络的网络波动性衡量指标,以及确定当前网络的超时时间阈值的具体实现过程,详见上述实施例中对应的实现过程,在此不再赘述。It should be noted that, in this embodiment, the network volatility measurement indicator of the current network and the specific implementation process of determining the timeout threshold of the current network are determined. For details, refer to the corresponding implementation process in the foregoing embodiment, and details are not described herein again.
图3A为本申请实施例提供的一种网络请求装置的结构示意图。FIG. 3A is a schematic structural diagram of a network request apparatus according to an embodiment of the present application.
如图3A所示,本申请实施例的网络请求装置包括:As shown in FIG. 3A, the network requesting apparatus of this embodiment of the present application includes:
第一请求发送单元11,用于通过第一网络处理线程发送第一网络请求;其中,该第一网络请求为正常发送的主请求,且第一网络请求为非https请求以及非GET请求;The first request sending unit 11 is configured to send, by using the first network processing thread, the first network request, where the first network request is a normally sent primary request, and the first network request is a non-https request and a non-GET request;
阈值设定单元14,用于根据当前网络的网络波动性衡量指标设定超时时间阈值;其中,该网络波动性衡量指标为多次网络连接的网络连接的连接建立时间最大值的均一化值,且根据当前网络的网络波动性衡量指标与网络波动性参考标准进行比对,确定当前网络的网络波动状态;The threshold setting unit 14 is configured to set a timeout threshold according to a network volatility metric of the current network, where the network volatility metric is a uniform value of a maximum connection establishment time of a network connection of multiple network connections, And comparing the network volatility measurement index of the current network with the network volatility reference standard to determine the network fluctuation state of the current network;
判断选择单元15,用于判断在达到超时时间阈值且未接收到第一网络请求对应的响应数据时,该判断选择单元15控制第二请求发送单元16工作;The determining selection unit 15 is configured to determine that when the timeout period threshold is reached and the response data corresponding to the first network request is not received, the determining selection unit 15 controls the second request sending unit 16 to operate;
其中,该判断选择单元15具有逻辑判断模块和控制模块,用于判断并识别在达到超时时间阈值时,该第一网络处理线程是否接收到对应的响应数据;如果接收到响应数据,则该判断选择单元15的逻辑判断模块发送给控制模块一控制信号,并通过该控制模块控制第二请求发送单元16发送第二网络请求;如果未接收到响应数据,则判断选择单元15的逻辑判断模块发送一结束信号给内核层,结束操作;The judgment selection unit 15 has a logic determination module and a control module, configured to determine and identify whether the first network processing thread receives the corresponding response data when the timeout threshold is reached; if the response data is received, the determination The logic determining module of the selecting unit 15 sends a control signal to the control module, and controls the second request sending unit 16 to send the second network request through the control module; if the response data is not received, the logic determining module of the selecting unit 15 determines to send An end signal is sent to the kernel layer to end the operation;
第二请求发送单元16,用于通过第二网络处理线程发送第二网络请求;其中,该第二网络请求与第一网络请求的内容相同为请求内容相同的网络请求,比如,所请求的网页内容相同等。但第二网络请求与第一网络请求所携带的端口号,或时间戳信息可能相同,也可能不同,本实施例不作限制。第二网络请求为正常发起的主请求,且第二网络请求为非https请求以及非GET请求;The second request sending unit 16 is configured to send, by the second network processing thread, a second network request, where the second network request is the same as the content requested by the first network, and is the same web request requesting content, for example, the requested webpage. The content is the same. However, the second network request may be the same as the port number or the timestamp information carried by the first network request, or may be different. This embodiment is not limited. The second network request is a normally initiated primary request, and the second network request is a non-https request and a non-GET request;
数据接收单元17,用于接收第一网络请求或第二网络请求对应的响应数据;该数据接收单元17在第二请求发送单元16发出后,控制第一网络处理线程或第二网络处理线程等待接收响应的响应数据,如果任何一个网络处理线程接收到响 应数据,则将响应数据发送至该数据接收单元17,由该数据接收单元17接收响应数据,同时控制并关闭另外未接收到响应数据的网络请求。The data receiving unit 17 is configured to receive response data corresponding to the first network request or the second network request; the data receiving unit 17 controls the first network processing thread or the second network processing thread to wait after the second request sending unit 16 issues the data. Receive response data for the response, if any network processing thread receives the response In response to the data, the response data is sent to the data receiving unit 17, and the data receiving unit 17 receives the response data while controlling and shutting down the network request for which the response data is not otherwise received.
图4为本申请实施的网络请求装置的附图。4 is a drawing of a network requesting device implemented by the present application.
如图4所示,在优选的实施例中,本申请的网络请求装置还包括:As shown in FIG. 4, in a preferred embodiment, the network requesting apparatus of the present application further includes:
请求判断单元12,该请求判断单元12包括逻辑判断模块,用于判断该网络请求是否为正常发起的主请求和网络请求是否为非https请求以及非GET请求;如果第一网络请求为正常发起的主请求,且第一网络请求为非https请求以及非GET请求,则需要在超时时间阈值未接收到第一网络请求对应的相应数据时,由判断选择单元15控制第二请求发送单元16发送第二网络请求;如果第一网络请求不是正常发起的主请求,或者第一网络请求不是非https请求以及非GET请求,则不需要发送第二网络请求;The request judging unit 12 includes a logic judging module, configured to determine whether the network request is a normally initiated main request and whether the network request is a non-https request and a non-GET request; if the first network request is normally initiated If the primary request is a non-https request and a non-GET request, the second request sending unit 16 is required to be sent by the determination selecting unit 15 when the timeout threshold does not receive the corresponding data corresponding to the first network request. Two network requests; if the first network request is not a normally initiated primary request, or the first network request is not a non-https request and a non-GET request, then the second network request does not need to be sent;
网络波动性检测单元13,该网络波动性检测单元13用于检测并得出当前网络的网络波动性衡量指标MA,从而根据当前网络的网络波动性衡量指标与网络波动性参考标准进行比对,确定当前网络下发送网络请求的超时时间阈值。The network volatility detecting unit 13 is configured to detect and obtain a network volatility metric MA of the current network, so as to compare the network volatility metric of the current network with the network volatility reference standard. Determines the timeout threshold for sending network requests on the current network.
通过本申请实施例实施的网络请求装置,包括第一请求发送单元11、请求判断单元12、网络波动性检测单元13、阈值设定单元14、判断选择单元15、第二请求发送单元16和数据接收单元17,通过该阈值设定单元14和判断选择单元15在第一请求发送单元11发送第一网络请求后设定超时时间阈值,并且在达到超时时间阈值如果该数据接收单元17未接收到第一网络请求对应的响应数据,则由判断选择单元15控制该第二请求发送单元16发送第二网络请求,然后通过该数据接收单元17接收任意一个网络请求对应的响应数据,并关闭另外一个没有接收到响应数据的对应的网络请求。从而有效减少因网络异常导致的延时,避免网络异常时网络请求再次发送间隔时间较长。The network requesting device implemented by the embodiment of the present application includes a first request sending unit 11, a request determining unit 12, a network fluctuation detecting unit 13, a threshold setting unit 14, a judgment selecting unit 15, a second request transmitting unit 16, and data. The receiving unit 17 sets the timeout period threshold after the first request transmitting unit 11 sends the first network request by the threshold setting unit 14 and the judgment selecting unit 15, and if the timeout threshold is reached, if the data receiving unit 17 does not receive the The first network request corresponding response data is controlled by the determination selecting unit 15 to send the second network request, and then the response data corresponding to any one of the network requests is received by the data receiving unit 17, and the other one is closed. No corresponding network request was received for the response data. Therefore, the delay caused by the network abnormality is effectively reduced, and the network request re-sending interval is longer when the network is abnormal.
为了使本技术领域的人员更好地理解本申请实施例中的技术方案,并使本申请实施例的上述目的、特征和优点能够更加明显易懂,下面结合附图对本申请实施例中技术方案作进一步详细的说明。The above-mentioned objects, features and advantages of the embodiments of the present application can be more clearly understood and understood by those skilled in the art. Give further details.
图5为本申请实施的网络波动性衡量方法的流程示意图。FIG. 5 is a schematic flowchart diagram of a method for measuring network volatility according to the implementation of the present application.
如图5所示,本申请实施的网络波动性衡量方法包括:As shown in FIG. 5, the network volatility measurement method implemented by the present application includes:
S210:收集当前网络最近N次网络连接的连接建立时间,其中,N为自然数; S210: Collect connection establishment time of the last network connection of the current network, where N is a natural number;
S220:计算得到当前网络的网络波动性衡量指标(MA);其中,通过对步骤S210收集的连接建立时间进行均一化处理,并找出其中连接建立时间最大值的均一化值即为当前网络的网络波动性衡量指标;S220: Calculate a network volatility metric (MA) of the current network, where the connection establishment time collected in step S210 is normalized, and the uniformization value of the maximum connection establishment time is found as the current network. Network volatility measure;
S230:根据得到的当前网络的网络波动性衡量指标确定网络波动状态和对应的超时时间阈值;其中,可根据当前网络的网络波动性衡量指标与网络波动性参考指标进行对比确定网络波动状态以及超时时间阈值。S230: Determine a network fluctuation state and a corresponding timeout time threshold according to the obtained network volatility measurement index of the current network. The network fluctuation state and the network volatility reference indicator may be compared according to the current network volatility measurement indicator to determine the network fluctuation state and the timeout. Time threshold.
通过以上步骤,根据网络波动性衡量指标确定网络波动状态和超时时间阈值,从而避免网络异常时,网络请求能够在达到超时时间阈值未接收到响应数据时,及时进行二次网络请求,减少网络异常导致网络请求的延时;而且,该网络波动性衡量衡量方法能够通过当前网络的网络波动性衡量指标直接确定网络波动状态,从而便于对当前网络的网络波动状态进行评估衡量,使网络波动状态更加直观。Through the above steps, the network fluctuation state and the timeout period threshold are determined according to the network volatility measurement index, so as to avoid the network abnormality, when the network request can not receive the response data when the timeout threshold is reached, the secondary network request is timely performed to reduce the network abnormality. The delay of the network request is caused. Moreover, the measurement method of the network volatility can directly determine the network fluctuation state through the network volatility measurement indicator of the current network, thereby facilitating the evaluation and measurement of the network fluctuation state of the current network, and making the network fluctuation state more Intuitive.
图6为本申请的一个实施例中的计算当前网络的网络波动性衡量指标,然后根据网络波动性衡量指标获得超时时间阈值的详细流程图。FIG. 6 is a detailed flowchart of calculating a network volatility metric of a current network according to an embodiment of the present application, and then obtaining a timeout threshold according to the network volatility metric.
如图6所示,在优选实施例中,本发明的步骤S230包括:As shown in FIG. 6, in a preferred embodiment, step S230 of the present invention includes:
S201:收集大量的网络连接的连接建立时间和响应时间,并得到该连接建立时间和响应时间的对应关系数据集;其中,可大量收集网络连接时的连接建立时间和响应时间,从而根据连接建立时间分别对应的响应时间建立两者之间的对应关系数据集;S201: Collecting a connection establishment time and a response time of a large number of network connections, and obtaining a correspondence data set of the connection establishment time and the response time; wherein the connection establishment time and the response time when the network connection is collected may be collected in a large amount, thereby establishing according to the connection The corresponding response time of the time establishes a corresponding relationship data set between the two;
S202:将对应关系数据集中的所有连接建立时间分为数个阶段,并将每个阶段中连接建立时间的最大值和最小值进行均一化处理;其中,根据实际需要将连接建立时间分为若干分组(即数个阶段),每个分组中均为连接建立时间的范围集合,从而对每个分组中的最大连接建立时间和最小连接建立时间进行均一化处理,得到该分组中连接建立时间的均一化值,同时也为该连接建立时间范围内的最大MA值和最小MA值;S202: The connection establishment time in the corresponding relation data set is divided into several stages, and the maximum value and the minimum value of the connection establishment time in each stage are homogenized; wherein the connection establishment time is divided into several groups according to actual needs. (ie, several stages), each group is a set of range of connection establishment time, so that the maximum connection establishment time and the minimum connection establishment time in each packet are normalized, and the connection establishment time in the packet is uniformed. The value, and also establish the maximum MA value and the minimum MA value in the time range for the connection;
S203:将每个阶段的连接建立时间的最小均一化值至最大均一化值的范围确定为网络波动性衡量指标的指示范围;其中,由于连接建立时间的最小均一化值和最大均一化值均为连接建立时间内的最小MA值和最大MA值,则网络波动性衡量指标的指标范围即为连接建立时间的每个阶段中最小均一化值至最大均一化 值的范围;S203: Determine a range of a minimum uniformization value to a maximum uniformization value of the connection establishment time of each phase as an indication range of the network volatility metric; wherein, the minimum uniformization value and the maximum uniformization value of the connection establishment time are both For the minimum MA value and the maximum MA value during the connection establishment time, the indicator range of the network volatility measure is the minimum uniformization value to the maximum uniformization in each stage of the connection establishment time. Range of values;
S204:根据网络波动性衡量指标的指标范围确定对应的网络波动状态和对应的超时时间阈值;其中,由于根据大数据的网络连接的连接建立时间和响应时间,即可根据采集的不同时期的网络连接时间的响应时间,确定每个阶段下对应的网络波动状态以及对应的超时时间阈值。S204: Determine a corresponding network fluctuation state and a corresponding timeout time threshold according to the indicator range of the network volatility measurement indicator; wherein, according to the connection establishment time and the response time of the network connection according to the big data, the network may be collected according to different periods. The response time of the connection time determines the corresponding network fluctuation state and the corresponding timeout time threshold in each phase.
其中,在本申请实施的网络波动性衡量方法的优选实施例中,根据网络波动性衡量指标的指标范围确定的网络波动状态和对应的超时时间阈值中,每个阶段的网络波动性衡量指标的指标范围对应网络波动状态和超时时间阈值,从而将该网络波动性衡量指标的指标范围、对应的网络波动状态、对应的超时时间阈值存储于数据库中,从而作为网络波动性参考标准,便于直接从数据库中调取和查看。而且,在本申请实施的网络波动性衡量方法的优选实施例中,在步骤S220计算出当前网络的网络波动性衡量指标之后,可根据当前网络的网络波动性衡量指标在数据库中查找对应的网络波动性衡量指标的指标范围、对应的网络波动状态和对应的超时时间阈值存储于数据库,从而确定当前网络的网络波动状态和对应的超时时间阈值。In the preferred embodiment of the network volatility measurement method implemented by the present application, the network volatility metric of each stage is determined according to the network fluctuation state determined by the metric range of the network volatility measurement indicator and the corresponding timeout time threshold. The indicator range corresponds to the network fluctuation state and the timeout period threshold, so that the indicator range of the network volatility measure, the corresponding network fluctuation state, and the corresponding timeout time threshold are stored in the database, thereby serving as a network volatility reference standard, which is convenient for direct Retrieve and view in the database. Moreover, in a preferred embodiment of the network volatility measurement method implemented in the present application, after the network volatility measurement indicator of the current network is calculated in step S220, the corresponding network may be searched in the database according to the network volatility measurement indicator of the current network. The metric range of the volatility metric, the corresponding network volatility state, and the corresponding timeout threshold are stored in the database to determine the current network volatility state and the corresponding timeout threshold.
图7为本申请的又一个实施例中确定网络波动状态和对应的超时时间阈值的详细流程图。FIG. 7 is a detailed flowchart of determining a network fluctuation state and a corresponding timeout time threshold in still another embodiment of the present application.
如图7所示,并参考图11,在本申请实施的网络波动性衡量方法的优选实施例中,该网络波动性衡量方法步中超时时间阈值的确定方法包括:As shown in FIG. 7 and referring to FIG. 11, in a preferred embodiment of the network volatility measurement method implemented in the present application, the method for determining a timeout threshold in the network volatility measurement method step includes:
S205:通过聚类算法将对应关系数据集中的所有连接建立时间分为数个阶段;其中,由于连接建立时间与相应时间对应,即此时对应的响应时间也被分为多个阶段;S205: The clustering algorithm divides all connection establishment time in the corresponding relation data set into several stages; wherein, the connection establishment time corresponds to the corresponding time, that is, the corresponding response time is also divided into multiple stages;
S206:根据连接建立时间和响应时间的对应关系数据集,通过累积分布函数建立每个阶段的连接建立时间和响应时间的累积分布函数;其中,累积分布函数(CDF,Cumulative Distribution Function)表示为:FX(x)=P(X≤x)。S206: Establish a cumulative distribution function of connection establishment time and response time of each stage by using a cumulative distribution function according to a correspondence data set of connection establishment time and response time; wherein a Cumulative Distribution Function (CDF) is expressed as: F X (x) = P ( X ≤ x).
S207:根据连接建立时间和响应时间的累积分布函数,得出每个网络波动性衡量指标的指标范围内置信度较高的响应时间;其中,每个网络波动性衡量指标的指标范围内较高置信度为根据连接建立时间和响应时间建立的累积分布函数中同一响应时间对应的置信度; S207: According to the cumulative distribution function of the connection establishment time and the response time, the response time of the indicator range of each network volatility measure is high, and the response time of each network volatility measure is higher. The confidence level is a confidence level corresponding to the same response time in the cumulative distribution function established according to the connection establishment time and the response time;
S208:将置信度较高的响应时间作为网络波动性衡量指标的指标范围内对应的网络波动状态下的超时时间阈值;其中,通过步骤S207得出每个网络波动性衡量指标的指标范围内的置信度,从而将置信度对应的响应时间作为超时时间阈值,即每个阶段的指标范围对应的超时时间阈值。S208: The response time with higher confidence is used as the timeout threshold in the network fluctuation state corresponding to the network volatility measurement indicator; wherein, in step S207, each network volatility metric is within the indicator range. Confidence, so that the response time corresponding to the confidence is used as the timeout threshold, that is, the timeout threshold corresponding to the indicator range of each phase.
通过本申请实施的网络波动性衡量方法,能够直接通过网络波动性衡量指标MA较有效、便捷地衡量当前网络波动状态,从而可以由该网络波动性衡量指标MA根据网络波动性参考标准确定网络请求重传的超时时间阈值。Through the network volatility measurement method implemented by the present application, the current network fluctuation state can be measured more effectively and conveniently through the network volatility measurement index MA, so that the network volatility measurement index MA can determine the network request according to the network volatility reference standard. Timeout threshold for retransmission.
图8为本申请实施例的网络波动性衡量装置的结构附图。FIG. 8 is a structural diagram of a network volatility measuring apparatus according to an embodiment of the present application.
如图8所述为本申请实施的网络波动性衡量方法对应的网络波动性衡量装置,该网络波动性衡量装置包括:As shown in FIG. 8 , the network volatility measuring device corresponding to the network volatility measurement method implemented by the present application includes:
数据采集单元20,该数据采集单元20用于收集当前网络最近N次网络连接的连接建立时间;其中,数据采集单元20设置在网络层,实时采集网络连接的连接建立时间和响应时间;The data collection unit 20 is configured to collect connection establishment time of the last N times network connection of the current network; wherein the data collection unit 20 is disposed at the network layer, and collects connection establishment time and response time of the network connection in real time;
网络波动性检测单元30,用于根据数据采集单元20收集的连接建立时间,检测并确定当前网络的网络波动性衡量指标;并根据得到的当前网络的网络波动性衡量指标,确定当前网络的网络波动状态和对应的超时时间阈值。其中,该网络波动性衡量指标通过该网络波动性检测单元30根据N次网络连接的连接建立时间计算出其均一化值,并将最大均一化值作为当前网络的网络波动性衡量指标,同时确定对应的超时时间阈值。The network volatility detecting unit 30 is configured to detect and determine a network volatility metric of the current network according to the connection establishment time collected by the data collecting unit 20, and determine the current network network according to the obtained network volatility metric of the current network. The fluctuation state and the corresponding timeout threshold. The network volatility measurement unit calculates the uniformization value according to the connection establishment time of the N network connection by the network volatility detection unit 30, and uses the maximum uniformization value as the network volatility measurement index of the current network, and simultaneously determines Corresponding timeout threshold.
同时,如图8所示的本申请优选的实施例,该网络波动性检测单元30包括数据分组单元31、数据处理单元32和数据分析单元33,其中:Meanwhile, as shown in the preferred embodiment of the present application shown in FIG. 8, the network fluctuation detecting unit 30 includes a data grouping unit 31, a data processing unit 32, and a data analyzing unit 33, wherein:
数据分组单元31,该数据分组单元31用于将收集到的连接建立时间和对应的响应时间建立的对应关系数据集,并将该对应关系数据集中的连接建立时间分为数个阶段;其中,该数据分组单元可通过聚类算法将对应关系数据集中的连接建立时间分为数个阶段,使每个阶段中均为连接建立时间的范围集合;a data grouping unit 31, configured to divide the collected connection establishment time and the corresponding response time established correspondence data set, and divide the connection establishment time in the corresponding relation data set into several stages; wherein The data grouping unit may divide the connection establishment time in the corresponding relation data set into several stages by using a clustering algorithm, so that each stage is a set of ranges of connection establishment time;
数据处理单元32,该数据处理单元32用于对每个阶段中连接建立时间中的最大值的最小值进行均一化处理,从而得到连接建立时间的最大均一化值和最小均一化值,并将最小均一化值到最大均一化值的范围确定为网络波动性衡量指标的指标范围;其中,该数据处理单元32可为中央处理器,从而对每个阶段的连 接建立时间均一化处理为网络波动性衡量指标的指标范围;a data processing unit 32, configured to perform a normalization process on the minimum value of the maximum value in the connection establishment time in each phase, thereby obtaining a maximum uniformization value and a minimum uniformization value of the connection establishment time, and The range of the minimum uniformization value to the maximum uniformization value is determined as a range of indicators of the network volatility metric; wherein the data processing unit 32 can be a central processor, thereby connecting to each stage The establishment time is equalized as the indicator range of the network volatility measure;
数据分析单元33,该数据分析单元33根据网络波动性衡量指标的指标范围分析确定对应的网络波动状态和对应的超时时间阈值。其中,该数据分析单元33将每个阶段的连接建立时间和对应的响应时间建立累积分布函数,根据累积分布函数分析得出每个阶段的超时时间阈值和网络波动状态。The data analyzing unit 33 determines the corresponding network fluctuation state and the corresponding timeout time threshold according to the index range analysis of the network volatility metric. The data analysis unit 33 establishes a cumulative distribution function for the connection establishment time and the corresponding response time of each stage, and analyzes the time-out time threshold and the network fluctuation state of each stage according to the cumulative distribution function analysis.
本申请实施例提出的网络波动性衡量装置通过数据采集单元采集网络层网络连接的连接建立时间和对应的响应时间,分别通过数据分组单元对连接建立时间和对应的响应时间进行分组,通过数据处理单元对每个分组内的连接建立时间进行处理得到网络波动性衡量指标的指标范围,并且由数据分析单元将每个分组内的所得到的指标范围分析确定出对应的网络波动状态和超时时间阈值;而且超时时间阈值为每个分组中置信度较高的响应时间的值。从而能够根据该网络波动性衡量装置得出网络波动性参考标准,便于根据实时计算的网络波动性衡量指标确定当前网络的超时时间阈值和网络波动状态。The network volatility measuring device provided by the embodiment of the present application collects the connection establishment time and the corresponding response time of the network layer network connection by using the data collection unit, and respectively groups the connection establishment time and the corresponding response time by the data grouping unit, and performs data processing through the data processing unit. The unit processes the connection establishment time in each group to obtain a range of indicators of the network volatility metric, and the data analysis unit determines the corresponding network volatility state and the timeout threshold by analyzing the obtained metric range within each packet. And the timeout threshold is the value of the higher confidence response time in each packet. Therefore, the network volatility reference standard can be obtained according to the network volatility measuring device, so that the current network timeout threshold and the network fluctuation state are determined according to the real-time calculated network volatility metric.
另外,在本申请实施的具体实施例中,可通过一具体例子说明本申请提出的网络波动性衡量方法。In addition, in the specific embodiment of the implementation of the present application, the network volatility measurement method proposed by the present application may be described by using a specific example.
图9为本申请实施例的网络波动性衡量标准。FIG. 9 is a measurement standard of network volatility according to an embodiment of the present application.
图10为本申请实施例的网络波动性参考标准。FIG. 10 is a network volatility reference standard according to an embodiment of the present application.
图11为本申请实施例的连接建立时间和对应响应时间的累积分布图。FIG. 11 is a cumulative distribution diagram of connection establishment time and corresponding response time according to an embodiment of the present application.
参考图9至图11可知,例如:在实施过程中,初始化测量评估的默认值,记为A,该默认值可为1000(即网络请求之前的1000次的网络连接次数);先发送一网络请求,同时收集最近5次网络连接的连接建立时间(该阶段可在网络层通过数据采集单元,采集记录所有网络连接建立的耗时,单位为ms,且如果网络连接建立失败,会记录一个设定的最大值);计算收集到的连接建立时间的数据序列的最大值,记为M;将收集到的数据序列的最大值M做均一化处理,具体的,可通过公式MA=(M-MINCT)/(MAXCT-MINCT)*100,使得该网络波动性衡量指标MA变为最大连接建立时间的一个相对值,且取值范围在[0,100],其中在具体应用过程中,设置该MAXCT为10000ms,MINCT为0ms(该连接建立时间CT并不本实施例为限,还可以设置为其他数值)。从而能够得出在发送网络请求时的网络波动性衡量指标,并根据该网络波动性衡量指标对应指出网络波动状态。而且,在 实施过程中,通过对收集到的数据序列的最大值进行处理,目的用于更加合理准确地估计当前的网络波动状态,保证二次网络请求发出时的命中率。且对网络连接的连接建立时间CT在网络连接过程中并不现在本实施例提出的0-10000ms的范围,可根据具体情况进行确认,从而使该网络波动性衡量指标MA的值保持在[0,100],可根据该网络波动性衡量指标MA的大小直接确定网络波动状态的好坏。Referring to FIG. 9 to FIG. 11 , for example, in the implementation process, the default value of the initial measurement evaluation is initialized, denoted as A, and the default value may be 1000 (ie, the number of network connections 1000 times before the network request); Request, collect the connection establishment time of the last 5 network connections at the same time (this stage can collect and record the time taken by all the network connection establishments in the network layer through the data collection unit, the unit is ms, and if the network connection establishment fails, a setting will be recorded. The maximum value of the data sequence for calculating the collected connection establishment time is recorded as M; the maximum value M of the collected data sequence is uniformly processed. Specifically, the formula MA=(M- MINCT)/(MAXCT-MINCT)*100, so that the network volatility measure MA becomes a relative value of the maximum connection establishment time, and the value range is [0, 100], wherein in the specific application process, the MAXCT is set to 10000ms, MINCT is 0ms (the connection establishment time CT is not limited to this embodiment, and can also be set to other values). Therefore, the network volatility metric when the network request is sent can be obtained, and the network volatility state is indicated according to the network volatility metric. And, in During the implementation process, the maximum value of the collected data sequence is processed, and the purpose is to estimate the current network fluctuation state more reasonably and accurately, and ensure the hit rate when the secondary network request is issued. And the connection establishment time CT of the network connection is not in the range of 0-10000 ms proposed by the present embodiment in the network connection process, and can be confirmed according to the specific situation, so that the value of the network fluctuation measure MA is maintained at [0, 100). ], the quality of the network fluctuation can be directly determined according to the size of the network volatility measure MA.
而且,如图9和图10所示,该网络波动状态根据网络波动性进行设定,在本实施例中,将其设定为五个阶段,即该网络波动状态从稳定到波动分为五个状态:网络非常稳定、网络稳定、网络波动小、网络波动大和网络非常波动,且在实施例中,由于该五个阶段的网络波动状态对应网络波动性衡量指标[0,100],且在实施过程中分别对应的网络连接的连接建立时间CT为[0-10000ms]的范围,根据网络连接的连接建立时间与网络的划分,可将其网络波动性衡量指标[0,100]分别划分五个阶段对应于网络波动状态。本申请有效指出网络波动性衡量指标与网络波动状态之间的关系,由于每个网络波动状态均对应一个网络波动性衡量指标的取值范围,因此,可以通过一个实时的网络波动性衡量指标MA值来确定当前网络的网络波动状态。Moreover, as shown in FIG. 9 and FIG. 10, the network fluctuation state is set according to network volatility. In this embodiment, it is set to five stages, that is, the network fluctuation state is divided into five from stable to undulating. Status: the network is very stable, the network is stable, the network fluctuation is small, the network fluctuation is large, and the network is very fluctuating. In the embodiment, the network fluctuation state of the five phases corresponds to the network volatility measurement index [0, 100], and in the implementation process The connection establishment time CT of the corresponding network connection in the middle is [0-10000 ms], and according to the connection establishment time of the network connection and the division of the network, the network volatility measurement index [0, 100] can be divided into five stages respectively. Network fluctuation status. This application effectively points out the relationship between the network volatility measurement index and the network volatility state. Since each network volatility state corresponds to the value range of a network volatility metric, it can pass a real-time cyber volatility metric MA. The value determines the network fluctuation status of the current network.
另外,本申请的实施例,如图9所示,并参考附图8,该网络波动状态根据网络波动性进行设定,在本实施例中,通过聚类算法将网络连接的连接建立时间设定为五个阶段,即该网络波动状态从稳定到波动分为五个状态:网络非常稳定、网络稳定、网络波动小、网络波动大和网络非常波动,且在实施例中,由于该五个阶段的网络波动状态对应网络波动性衡量指标[0,100],且在实施过程中分别对应的网络连接的连接建立时间CT为[0-10000ms]的范围,根据网络连接的网络连接的连接建立时间与网络的划分,可将其网络波动性衡量指标[0,100]分别划分五个阶段对应于网络波动状态。同时根据连接建立时间CT和响应时间RT以及针对该连接建立时间CT和响应时间RT的累积分布函数,可有效得出在较高置信度下的超时时间阈值T。即通过对大量的连接建立时间和响应时间的数据进行分组、建立累积分布函数,从而使其针对不同网络波动性衡量指标MA取值范围下对应的超时时间阈值的时间T,使网络请求在网络正常情况下,该超时时间阈值的时间T内接收到对应的响应数据。In addition, in the embodiment of the present application, as shown in FIG. 9 and referring to FIG. 8, the network fluctuation state is set according to network volatility. In this embodiment, the connection establishment time of the network connection is set by using a clustering algorithm. It is defined as five stages, that is, the network fluctuation state is divided into five states from stable to volatility: the network is very stable, the network is stable, the network fluctuation is small, the network fluctuation is large, and the network is very fluctuating, and in the embodiment, due to the five stages The network fluctuation state corresponds to the network volatility metric [0, 100], and the connection establishment time CT of the corresponding network connection in the implementation process is a range of [0-10000 ms], and the connection establishment time and network according to the network connection of the network connection The division of the network volatility metric [0, 100] can be divided into five phases corresponding to the network fluctuation state. At the same time, according to the connection establishment time CT and the response time RT and the cumulative distribution function for the connection establishment time CT and the response time RT, the timeout threshold T at a higher confidence can be effectively obtained. That is, by grouping a large number of connection establishment time and response time data, and establishing a cumulative distribution function, the network request is made in the network for the time T of the corresponding timeout time threshold under the value range of the different network volatility measurement indicators. Normally, the corresponding response data is received within the time T of the timeout threshold.
如图10所示,该网络波动性衡量指标MA的指标范围[0,100]对应下的五个区间范围分别为[0,2)、[2,4)、[4,10)、[10,30)、[30,100],且其相对应的网络波动状态为:网络非常稳定、网络稳定、网络波动性、网络波动大、网络非 常波动。而该网络波动性衡量指标的指标范围[0,2)、[2,4)、[4,10)、[10,30)、[30,100]分别对应的连接建立时间CT分别为[0,200)、[200,400)、[400,1000)、[1000,3000)、[3000,10000],单位均为ms;且根据连接建立时间CT和响应时间RT的累积分布函数图可知,在连接建立时间CT在[0,200)毫秒时,有约98%的网络请求响应时间RT少于3秒;在连接建立时间CT在[200,400)毫秒时,有约97%的网络请求响应时间RT少于4秒;在连接建立时间CT在[400,1000)毫秒时,有约97%的网络请求响应时间RT少于5秒;在连接建立时间CT在[1000,3000)毫秒时,有约98%的网络请求响应时间RT少于10秒。从而将在该网络波动性衡量指标的指标范围、网络波动状态和超时时间阈值的时间的对应关系中得出超时时间阈值的时间T,可通过设置置信度,根据置信度下的响应时间RT得出该超时时间阈值的时间T;而在实施过程中,该置信度的设置可分别为98%、97%、97%、98%、100%,从而根据置信度与该置信度内的数据响应时间RT与连接建立时间CT得出该超时时间阈值分别为:3秒、4秒、6秒、10秒和60秒。其中,当超时时间阈值的时间T为60秒,即网络波动性衡量指标MA的取值为[30,100]时为客户端设置的网络最长等待时间,即60秒内仍无网络数据返回,则表示超时异常且无法接收到响应数据,即网络非常波动的时候,不会进行二次网络请求增加网络负担。具体的,该网络波动性参考标准可参见图10,如图10所示可知,通过该网络波动性参考标准,能够使网络波动性衡量标准的标准范围与对应的超时时间阈值的时间,以及对应的网络波动状态;而在实施例中,由于该网络波动状态仅为反映在网络波动性衡量标准的标准范围所表示出的此时的网络波动状态,因此,该网络波动状态并不仅仅限于以上实施例提出的几种情况,还可以包括另外一种网络波动状态,同时将网络波动性衡量标准的标准范围再分出一个阶段,同时有效对应网络波动性衡量标准和超时时间阈值的时间。As shown in FIG. 10, the five ranges of the corresponding range of the network volatility measure MA [0, 100] are [0, 2), [2, 4), [4, 10), [10] , 30), [30, 100], and its corresponding network fluctuation status is: network is very stable, network stability, network volatility, network fluctuations, network non- Frequent fluctuations. The connection establishment time CT corresponding to the range of the network volatility measure [0, 2), [2, 4), [4, 10), [10, 30), [30, 100] is [0, 200), respectively. [200,400), [400,1000), [1000,3000), [3000,10000], the unit is ms; and according to the cumulative distribution function graph of the connection establishment time CT and the response time RT, it is known that the connection establishment time When the CT is at [0,200) milliseconds, there are about 98% of the network request response time RT is less than 3 seconds; when the connection establishment time CT is [200,400) milliseconds, about 97% of the network request response time RT is less than 4 seconds; When the connection establishment time CT is [400, 1000) milliseconds, about 97% of the network request response time RT is less than 5 seconds; when the connection establishment time CT is [1000, 3000) milliseconds, there are about 98% of network requests. The response time RT is less than 10 seconds. Therefore, the time T of the timeout threshold is obtained in the correspondence between the indicator range of the network volatility metric, the network volatility state, and the timeout threshold. The confidence time can be set according to the response time RT under the confidence level. The time T of the timeout threshold is exceeded; and during the implementation, the confidence setting may be 98%, 97%, 97%, 98%, 100%, respectively, so as to respond according to the confidence and the data within the confidence. The time RT and the connection establishment time CT result in the timeout thresholds being 3 seconds, 4 seconds, 6 seconds, 10 seconds, and 60 seconds, respectively. The time T of the timeout threshold is 60 seconds, that is, when the value of the network volatility measure MA is [30, 100], the maximum waiting time of the network set by the client, that is, no network data is returned within 60 seconds, Indicates that the timeout is abnormal and the response data cannot be received. That is, when the network is very fluctuating, the secondary network request will not be increased to increase the network load. Specifically, the network volatility reference standard can be seen in FIG. 10. As shown in FIG. 10, the network volatility reference standard can be used to make the standard range of the network volatility metric and the corresponding timeout threshold, and corresponding The network fluctuation state; in the embodiment, since the network fluctuation state is only the network fluctuation state reflected in the standard range of the network fluctuation measure, the network fluctuation state is not limited to the above. In the case of the embodiment, another network fluctuation state may be included, and the standard range of the network volatility metric is further divided into one phase, and the time of the network volatility metric and the timeout threshold is effectively matched.
如图11所示,本申请的实施例,为对网络连接的连接建立时间CT和响应时间RT通过累积分布函数FX(x)=P(X≤x)建立分为多个阶段的连接建立时间CT和对应响应时间RT的累积分布函数,即将每个阶段的连接建立时间CT和对应响应时间RT进行累积分布函数的建立,形成该累积分布函数图,该累积分布函数图如图6中所示,各阶段累积分布函数中沿箭头方向从上到下依次为:(0-2)、(2-4)、(4-6)、(6-8)、(8-10)、(10-20)、(20-30)、(30-40)、(40-60)、(60-80)、(80-100)的由响应时间RT对应连接建立时间CT数对数对的累积分布函数,其中该响应时间RT和连接建立时间CT的单位均为102毫秒,且最小的连接建立时间记为0毫 秒,最大的连接时间记为10000毫秒,从而根据该累积分布函数图分析得出各个阶段下的置信度,并根据该置信度得到其超时时间阈值的时间(可参看其他实施例的相关内容,在此不在赘述)。As shown in FIG. 11, an embodiment of the present application establishes a connection establishment time into multiple stages by using a cumulative distribution function F X (x)=P (X≤x) for the connection establishment time CT and the response time RT of the network connection. The cumulative distribution function of the time CT and the corresponding response time RT, that is, the establishment of the cumulative distribution function by the connection establishment time CT and the corresponding response time RT of each stage, forms the cumulative distribution function diagram, which is shown in FIG. It is shown that the cumulative distribution function of each stage is in the direction of the arrow from top to bottom: (0-2), (2-4), (4-6), (6-8), (8-10), (10) -20), (20-30), (30-40), (40-60), (60-80), (80-100) cumulative distribution of log pairs of CT pairs corresponding to connection establishment time by response time RT a function, wherein the response time RT and the connection establishment time CT are both in units of 10 2 milliseconds, and the minimum connection establishment time is recorded as 0 milliseconds, and the maximum connection time is recorded as 10000 milliseconds, thereby analyzing according to the cumulative distribution function graph The confidence level at each stage, and the time of the timeout threshold is obtained according to the confidence (refer to the relevant content of other embodiments) This is not repeated here).
本申请提出的网络波动性衡量指标MA较有效、便捷地衡量当前网络波动状态,依次推测合理的网络重传时间范围-即超时时间阈值的时间,并且本申请提出的网络波动性衡量方法根据该网络波动性衡量指标为基础,建立衡量网络波动性的参考指标,继而通过实时网络的网络波动性衡量指标MA检测得出网络波动状态和超时时间阈值;且网络请求的方法也可以有效地解决部分请求响应时间过长的问题,提升用户体验。The network volatility measure MA proposed by the present application measures the current network fluctuation state more effectively and conveniently, and infers the reasonable network retransmission time range, that is, the timeout threshold value, and the network volatility measurement method proposed by the present application is based on the Based on the network volatility measurement index, a reference index for measuring network volatility is established, and then the network volatility measurement indicator MA of the real-time network is used to detect the network fluctuation state and the timeout threshold; and the network request method can also effectively solve the part. Requests that the response time is too long, improving the user experience.
本发明实施例还提供一种终端,所述终端包括:收发器和处理器,其中,所述处理器、收发器通过总线相互连接;总线可以是ISA总线、PCI总线或EISA总线等。所述总线可以分为地址总线、数据总线、控制总线等。进一步,该实施例中还可以包括存储器,所述存储器,用于存放程序。具体地,程序可以包括程序代码,所述程序代码包括计算机操作指令。存储器可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。其中,The embodiment of the present invention further provides a terminal, where the terminal includes: a transceiver and a processor, wherein the processor and the transceiver are connected to each other through a bus; the bus may be an ISA bus, a PCI bus, or an EISA bus. The bus can be divided into an address bus, a data bus, a control bus, and the like. Further, the embodiment may further include a memory for storing the program. In particular, the program can include program code, the program code including computer operating instructions. The memory may include a high speed RAM memory and may also include a non-volatile memory such as at least one disk memory. among them,
所述收发器,用于通过第一网络处理线程发送第一网络请求;The transceiver is configured to send a first network request by using a first network processing thread;
所述处理器,用于确定当前网络的超时时间阈值;并判断收发器发送所述第一网络请求的时间是否超过所述超时时间阈值;The processor is configured to determine a timeout threshold of the current network, and determine whether the time for the transceiver to send the first network request exceeds the timeout threshold;
所述收发器,还用于在处理器判定所述收发器发送所述第一网络请求的时间超过所述超时时间阈值时,若未接收到所述第一网络请求对应的响应数据,则通过第二网络处理线程发送第二网络请求;其中,所述第二网络请求与所述第一网络请求的内容相同;The transceiver is further configured to: when the processor determines that the time when the transceiver sends the first network request exceeds the timeout threshold, if the response data corresponding to the first network request is not received, The second network processing thread sends a second network request; wherein the second network request is the same as the content requested by the first network;
所述收发器,还用于通过所述第一网络处理线程接收所述第一网络请求的响应数据,或通过所述第二网络处理线程接收所述第二网络请求的响应数据。The transceiver is further configured to receive, by the first network processing thread, response data of the first network request, or receive, by the second network processing thread, response data of the second network request.
可选的,所述处理器确定当前网络的超时时间阈值包括:Optionally, the determining, by the processor, a timeout threshold of the current network includes:
所述处理器确定当前网络的网络波动性衡量指标,并根据所述网络波动性衡量指标确定所述当前网络的超时时间阈值。The processor determines a network volatility metric of the current network, and determines a timeout threshold of the current network according to the network volatility metric.
可选的,所述收发器,还用于收集当前N次网络连接的连接建立时间,其中,N为自然数; Optionally, the transceiver is further configured to collect a connection establishment time of the current N times network connection, where N is a natural number;
所述处理器对所述收发器收集的所述连接建立时间的最大值做均一化处理,得到当前网络的网络波动性衡量指标。The processor performs a uniform processing on the maximum value of the connection establishment time collected by the transceiver to obtain a network volatility measurement indicator of the current network.
可选的,所述处理器根据所述网络波动性衡量指标查询双请求动态策略规则表,得到当前网络的网络波动状态;以及与所述网络波动状态对应的所述超时时间阈值。Optionally, the processor queries the dual request dynamic policy rule table according to the network volatility metric to obtain a network fluctuation state of the current network; and the timeout threshold corresponding to the network fluctuation state.
可选的,所述收发器,还用于通过所述第一网络处理线程接收到所述第一网络请求的响应数据;Optionally, the transceiver is further configured to receive response data of the first network request by using the first network processing thread;
所述处理器,还用于在所述收发器通过所述第一网络处理线程接收到所述第一网络请求的响应数据时,关闭所述第二网络处理线程;The processor is further configured to: when the transceiver receives the response data of the first network request by using the first network processing thread, shutting down the second network processing thread;
or
所述收发器,还用于通过所述第二网络处理线程接收到所述第二网络请求的响应数据;The transceiver is further configured to receive response data of the second network request by using the second network processing thread;
所述处理器,还用于在所述收发器通过所述第二网络处理线程接收到所述第二网络请求的响应数据时,关闭所述第一网络处理线程。The processor is further configured to: when the transceiver receives the response data of the second network request by using the second network processing thread, shutting down the first network processing thread.
可选的,所述收发器发送的第一网络请求为正常发起的主请求,且为非https请求以及非GET请求的网络请求。Optionally, the first network request sent by the transceiver is a normally initiated primary request, and is a non-https request and a non-GET request network request.
其中,所述收发器和处理器的功能和作用的实现过程详见上述实施例中对应的实现过程,在此不再赘述。The implementation process of the functions and functions of the transceiver and the processor is described in the corresponding implementation process in the foregoing embodiment, and details are not described herein again.
本发明还提供一种计算机可读存储介质,包括计算机执行指令,以供计算机的处理器执行所述计算机执行指令时,所述计算机执行上述的网络请求方法,或执行上述的网络波动性衡量方法。The present invention also provides a computer readable storage medium comprising computer executed instructions for executing, by the processor of a computer, the network request method, or performing the network volatility measurement method described above, when the computer executes the instructions .
通过以上的方法实施例的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:只读存储器(ROM)、随机存取存储器(RAM)、磁碟或者光盘等各种可以存储程序代码的介质。 Through the description of the above method embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is better. Implementation. Based on such understanding, the technical solution of the present application, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium, including a plurality of instructions for making a A computer device (which may be a personal computer, server, or network device, etc.) performs all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes various types of media that can store program codes, such as a read only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于方法实施例,相关之处参见方法实施例的部分说明即可。以上所描述的方法实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。The various embodiments in the specification are described in a progressive manner, and the same or similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for a method embodiment, reference may be made to a part of the description of the method embodiment. The method embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without any creative effort.
需要说明的是,在本文中,诸如“第一”和“第二”等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this context, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these There is any such actual relationship or order between entities or operations. Furthermore, the term "comprises" or "comprises" or "comprises" or any other variations thereof is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device that comprises a plurality of elements includes not only those elements but also Other elements, or elements that are inherent to such a process, method, item, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.
以上所述仅是本申请的具体实施方式,使本领域技术人员能够理解或实现本申请。对这些实施例的多种修改对本领域的技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本申请的精神或范围的情况下,在其它实施例中实现。因此,本申请将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description is only a specific embodiment of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments are obvious to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the application. Therefore, the application is not limited to the embodiments shown herein, but is to be accorded the broadest scope of the principles and novel features disclosed herein.
以上所述仅是本申请的具体实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。 The above description is only a specific embodiment of the present application, and it should be noted that those skilled in the art can also make several improvements and retouchings without departing from the principles of the present application. It should be considered as the scope of protection of this application.

Claims (26)

  1. 一种网络请求方法,其特征在于,包括:A network request method, comprising:
    通过第一网络处理线程发送第一网络请求;Transmitting the first network request by the first network processing thread;
    确定当前网络的超时时间阈值;Determine the timeout threshold of the current network;
    在发送所述第一网络请求的时间超过所述超时时间阈值时,若未接收到所述第一网络请求对应的响应数据,则通过第二网络处理线程发送第二网络请求;其中,所述第二网络请求与所述第一网络请求的内容相同;And when the time when the first network request is sent exceeds the timeout threshold, if the response data corresponding to the first network request is not received, the second network processing thread sends a second network request, where The second network request is the same as the content requested by the first network;
    通过所述第一网络处理线程接收所述第一网络请求的响应数据,或通过所述第二网络处理线程接收所述第二网络请求的响应数据。Receiving, by the first network processing thread, response data of the first network request, or receiving, by the second network processing thread, response data of the second network request.
  2. 根据权利要求1所述的网络请求方法,其特征在于,所述确定当前网络的超时时间阈值,包括:The network request method according to claim 1, wherein the determining a timeout threshold of the current network comprises:
    确定当前网络的网络波动性衡量指标;Determine the network volatility metrics of the current network;
    根据所述网络波动性衡量指标确定所述当前网络的超时时间阈值。Determining a timeout threshold of the current network according to the network volatility metric.
  3. 根据权利要求2所述的网络请求方法,其特征在于,所述确定当前网络波动性衡量指标,包括:The network request method according to claim 2, wherein the determining the current network volatility metric comprises:
    收集当前N次网络连接的连接建立时间,其中,N为自然数;Collecting the connection establishment time of the current N network connections, where N is a natural number;
    对所述连接建立时间的最大值做均一化处理,得到当前网络的网络波动性衡量指标。The maximum value of the connection establishment time is uniformly processed to obtain a network volatility measurement index of the current network.
  4. 根据权利要求2所述的网络请求方法,其特征在于,所述根据所述网络波动性衡量指标确定所述当前网络的超时时间阈值,包括:The network request method according to claim 2, wherein the determining a timeout threshold of the current network according to the network volatility metric comprises:
    根据所述网络波动性衡量指标查询双请求动态策略规则表,得到当前网络的网络波动状态;以及与所述网络波动状态对应的所述超时时间阈值。Querying the dual request dynamic policy rule table according to the network volatility metric, obtaining a network fluctuation state of the current network; and the timeout threshold corresponding to the network fluctuation state.
  5. 根据权利要求1至4任一项所述的网络请求方法,其特征在于,还包括:The network request method according to any one of claims 1 to 4, further comprising:
    在通过所述第一网络处理线程接收到所述第一网络请求的响应数据时,关闭所述第二网络处理线程;和/或Turning off the second network processing thread when receiving the response data of the first network request by the first network processing thread; and/or
    在通过所述第二网络处理线程接收到所述第二网络请求的响应数据时, 关闭所述第一网络处理线程。When the response data of the second network request is received by the second network processing thread, The first network processing thread is closed.
  6. 根据权利要求1至4任一项所述的网络请求方法,其特征在于,所述第一网络请求为正常发起的主请求,且为非https请求以及非GET请求的网络请求。The network request method according to any one of claims 1 to 4, wherein the first network request is a normally initiated primary request, and is a non-https request and a non-GET request network request.
  7. 一种网络请求装置,其特征在于,包括:A network requesting device, comprising:
    第一请求发送单元,用于通过第一网络处理线程发送第一网络请求;a first request sending unit, configured to send a first network request by using a first network processing thread;
    确定单元,用于确定当前网络的超时时间阈值;a determining unit, configured to determine a timeout threshold of the current network;
    判断单元,用于判断所述第一请求发送单元发送所述第一网络请求的时间是否超过所述超时时间阈值;a determining unit, configured to determine whether the time that the first request sending unit sends the first network request exceeds the timeout threshold;
    第二请求发送单元,用于在判断单元判断发送所述第一网络请求的时间超过所述超时时间阈值时,且未接收到所述第一网络请求对应的响应数据,则通过第二网络处理线程发送第二网络请求;其中,所述第二网络请求与所述第一网络请求的内容相同;a second request sending unit, configured to: when the determining unit determines that the time for sending the first network request exceeds the timeout threshold, and does not receive the response data corresponding to the first network request, processing by using the second network The thread sends a second network request; wherein the second network request is the same as the content requested by the first network;
    数据接收单元,用于通过所述第一网络处理线程接收所述第一网络请求的响应数据,或通过所述第二网络处理线程接收所述第二网络请求的响应数据。And a data receiving unit, configured to receive, by the first network processing thread, response data of the first network request, or receive, by the second network processing thread, response data of the second network request.
  8. 根据权利要求7所述的网络请求装置,其特征在于,所述确定单元包括:The network requesting device according to claim 7, wherein the determining unit comprises:
    第一确定单元,用于确定当前网络的网络波动性衡量指标;a first determining unit, configured to determine a network volatility metric of the current network;
    第二确定单元,用于根据所述网络波动性衡量指标确定所述当前网络的超时时间阈值。And a second determining unit, configured to determine a timeout threshold of the current network according to the network volatility metric.
  9. 根据权利要求8所述的网络请求装置,其特征在于,所述第一确定单元包括:The network requesting device according to claim 8, wherein the first determining unit comprises:
    收集单元,用于收集当前N次网络连接的连接建立时间,其中,N为自然数;a collecting unit, configured to collect a connection establishment time of the current N network connections, where N is a natural number;
    处理单元,用于对所述连接建立时间的最大值做均一化处理,得到当前网络的网络波动性衡量指标。 The processing unit is configured to perform a uniformization process on the maximum value of the connection establishment time to obtain a network volatility measurement indicator of the current network.
  10. 根据权利要求8所述的网络请求装置,其特征在于,所述第二确定单元,具体用于根据所述网络波动性衡量指标查询双请求动态策略规则表,得到当前网络的网络波动状态;以及与所述网络波动状态对应的所述超时时间阈值。The network requesting apparatus according to claim 8, wherein the second determining unit is configured to query the dual request dynamic policy rule table according to the network volatility metric to obtain a network fluctuation state of the current network; The timeout threshold corresponding to the network fluctuation state.
  11. 根据权利要求7至10任一项所述的网络请求装置,其特征在于,还包括:The network requesting device according to any one of claims 7 to 10, further comprising:
    第一关闭单元,用于在所述数据接收单元通过所述第一网络处理线程接收到所述第一网络请求的响应数据时,关闭所述第二网络处理线程;和/或a first closing unit, configured to: when the data receiving unit receives the response data of the first network request by using the first network processing thread, shutting down the second network processing thread; and/or
    第二关闭单元,用于在所述数据接收单元通过所述第二网络处理线程接收到所述第二网络请求的响应数据时,关闭所述第一网络处理线程。a second closing unit, configured to close the first network processing thread when the data receiving unit receives the response data of the second network request by using the second network processing thread.
  12. 根据权利要求7至10任一项所述的网络请求装置,其特征在于,所述第一请求发送单元发送的第一网络请求为正常发起的主请求,且所述第一网络请求为非https请求以及非GET请求。The network requesting apparatus according to any one of claims 7 to 10, wherein the first network request sent by the first request sending unit is a normally initiated main request, and the first network request is a non-https Requests and non-GET requests.
  13. 一种网络波动性衡量方法,其特征在于,包括:A method for measuring network volatility, characterized by comprising:
    收集当前网络N次网络连接的连接建立时间,其中,N为自然数;Collecting the connection establishment time of the current network N times network connection, where N is a natural number;
    将收集到的所述收集的连接建立时间的最大值做均一化处理,得到当前网络的网络波动性衡量指标;The collected maximum value of the connection establishment time is uniformly processed to obtain a network volatility measurement index of the current network;
    根据当前网络的网络波动性衡量指标,确定当前网络的网络波动状态和对应的超时时间阈值。Determine the network fluctuation status of the current network and the corresponding timeout time threshold according to the network volatility measurement indicator of the current network.
  14. 根据权利要求13所述的网络波动性衡量方法,其特征在于,还包括:The method for measuring network volatility according to claim 13, further comprising:
    收集网络连接的连接建立时间和响应时间,得到所述连接建立时间和对应的所述响应时间的对应关系数据集;Collecting a connection establishment time and a response time of the network connection, and obtaining a correspondence data set of the connection establishment time and the corresponding response time;
    将对应关系数据集中的所有连接建立时间分为数个阶段,并将每个阶段中所述连接建立时间的最大值和最小值进行均一化处理;All connection establishment time in the correspondence data set is divided into several stages, and the maximum and minimum values of the connection establishment time in each stage are uniformly processed;
    将每个阶段的所述连接建立时间的最小均一化值至最大均一化值的范围确定为网络波动性衡量指标的指标范围;Determining, as a range of indicators of the network volatility measure, a range of the minimum uniformization value to the maximum uniformization value of the connection establishment time of each stage;
    根据网络波动性衡量指标的指标范围确定对应的网络波动状态和对应 的超时时间阈值。Determine the corresponding network fluctuation status and corresponding according to the indicator range of the network volatility measurement index Timeout threshold.
  15. 根据权利要求14所述的网络波动性衡量方法,其特征在于,还包括:The method for measuring network volatility according to claim 14, further comprising:
    将网络波动性衡量指标的指标范围、网络波动状态和超时时间阈值相对应的存储于数据库中。The metric range of the network volatility metric, the network fluctuation status, and the timeout threshold are stored in the database.
  16. 根据权利要求15所述的网络波动性衡量方法,其特征在于,还包括:根据当前网络的网络波动性衡量指标去数据库中查找对应的网络波动状态和超时时间阈值,用于确定当前网络的网络波动状态和对应的超时时间阈值。The method for measuring network volatility according to claim 15, further comprising: searching for a corresponding network fluctuation state and a timeout threshold according to a network volatility metric of the current network, and determining the network of the current network. The fluctuation state and the corresponding timeout threshold.
  17. 根据权利要求13至16任意一项所述的网络波动性衡量方法,其特征在于,还包括:The method for measuring network volatility according to any one of claims 13 to 16, further comprising:
    通过聚类算法将对应关系数据集中的所有连接建立时间分为数个阶段;The clustering algorithm divides all connection establishment time in the corresponding relational data set into several stages;
    根据所述连接建立时间和所述响应时间之间的对应关系数据集,通过累积分布函数建立每个阶段所述连接建立时间和所述响应时间的累积分布函数;And establishing, according to the correspondence data set between the connection establishment time and the response time, a cumulative distribution function of the connection establishment time and the response time in each phase by using a cumulative distribution function;
    根据所述连接建立时间和所述响应时间的累积分布函数,得出每个所述网络波动性衡量指标的指标范围内置信度较高的响应时间;Obtaining a response time with a high built-in reliability of the indicator range of each of the network volatility metrics according to the cumulative distribution function of the connection establishment time and the response time;
    将所述置信度较高的响应时间作为所述网络波动性衡量指标的指标范围内对应的网络波动状态下的超时时间阈值。The response time with higher confidence is used as the timeout threshold in the corresponding network fluctuation state in the indicator range of the network volatility metric.
  18. 一种网络波动性衡量装置,其特征在于,包括:A network volatility measuring device, comprising:
    数据采集单元,用于收集当前网络N次网络连接的连接建立时间,其中,N为自然数;a data collection unit, configured to collect connection establishment time of the current network N times network connection, where N is a natural number;
    网络波动性检测单元,用于根据所述数据采集单元收集的连接建立时间,检测并确定当前网络的网络波动性衡量指标;并根据所述当前网络的网络波动性衡量指标,确定当前网络的网络波动状态和对应的超时时间阈值。a network volatility detecting unit, configured to detect and determine a network volatility metric of the current network according to the connection establishment time collected by the data collecting unit, and determine a network of the current network according to the network volatility metric of the current network The fluctuation state and the corresponding timeout threshold.
  19. 根据权利要求18所述的网络波动性衡量装置,其特征在于,所述网络波动性检测单元包括: The network volatility measuring device according to claim 18, wherein the network volatility detecting unit comprises:
    数据分组单元,用于将收集到的连接建立时间和对应的响应时间建立对应的关系数据集,并将所述关系数据集中的连接建立时间分为数个阶段;a data grouping unit, configured to establish a corresponding relationship data set by the collected connection establishment time and the corresponding response time, and divide the connection establishment time in the relational data set into several stages;
    数据处理单元,通过所述数据处理单元对每个阶段中的最大值和最小值进行均一化处理,得到最大均一化值和最小均一化值,并将最小均一化值至最大均一化值的范围确定为网络波动性衡量指标的指标范围;a data processing unit, wherein the maximum value and the minimum value in each stage are homogenized by the data processing unit to obtain a maximum uniformization value and a minimum uniformization value, and the minimum uniformization value is to a range of the maximum uniformization value The range of indicators identified as metrics for network volatility;
    数据分析单元,根据网络波动性衡量指标的指标范围分析确定对应的网络波动状态和对应的超时时间阈值。The data analysis unit determines the corresponding network fluctuation state and the corresponding timeout time threshold according to the analysis of the indicator range of the network volatility measurement indicator.
  20. 一种终端,其特征在于,包括:A terminal, comprising:
    收发器,用于通过第一网络处理线程发送第一网络请求;a transceiver, configured to send, by using a first network processing thread, a first network request;
    处理器,用于确定当前网络的超时时间阈值;并判断收发器发送所述第一网络请求的时间是否超过所述超时时间阈值;a processor, configured to determine a timeout threshold of the current network; and determine whether the time that the transceiver sends the first network request exceeds the timeout threshold;
    所述收发器,还用于在处理器判定所述收发器发送所述第一网络请求的时间超过所述超时时间阈值时,若未接收到所述第一网络请求对应的响应数据,则通过第二网络处理线程发送第二网络请求;其中,所述第二网络请求与所述第一网络请求的内容相同;The transceiver is further configured to: when the processor determines that the time when the transceiver sends the first network request exceeds the timeout threshold, if the response data corresponding to the first network request is not received, The second network processing thread sends a second network request; wherein the second network request is the same as the content requested by the first network;
    所述收发器,还用于通过所述第一网络处理线程接收所述第一网络请求的响应数据,或通过所述第二网络处理线程接收所述第二网络请求的响应数据。The transceiver is further configured to receive, by the first network processing thread, response data of the first network request, or receive, by the second network processing thread, response data of the second network request.
  21. 根据权利要求20所述的终端,其特征在于,所述处理器确定当前网络的超时时间阈值包括:The terminal according to claim 20, wherein the determining, by the processor, a timeout threshold of the current network comprises:
    所述处理器确定当前网络的网络波动性衡量指标,并根据所述网络波动性衡量指标确定所述当前网络的超时时间阈值。The processor determines a network volatility metric of the current network, and determines a timeout threshold of the current network according to the network volatility metric.
  22. 根据权利要求21所述的终端,其特征在于,The terminal according to claim 21, characterized in that
    所述收发器,还用于收集当前N次网络连接的连接建立时间,其中,N为自然数;The transceiver is further configured to collect connection establishment time of the current N times network connection, where N is a natural number;
    所述处理器对所述收发器收集的所述连接建立时间的最大值做均一化处理,得到当前网络的网络波动性衡量指标。The processor performs a uniform processing on the maximum value of the connection establishment time collected by the transceiver to obtain a network volatility measurement indicator of the current network.
  23. 根据权利要求21所述的终端,其特征在于, The terminal according to claim 21, characterized in that
    所述处理器根据所述网络波动性衡量指标查询双请求动态策略规则表,得到当前网络的网络波动状态;以及与所述网络波动状态对应的所述超时时间阈值。The processor queries the dual request dynamic policy rule table according to the network volatility measurement indicator to obtain a network fluctuation state of the current network; and the timeout time threshold corresponding to the network fluctuation state.
  24. 根据权利要求20至23任一项所述的终端,其特征在于,A terminal according to any one of claims 20 to 23, characterized in that
    所述收发器,还用于通过所述第一网络处理线程接收到所述第一网络请求的响应数据;The transceiver is further configured to receive response data of the first network request by using the first network processing thread;
    所述处理器,还用于在所述收发器通过所述第一网络处理线程接收到所述第一网络请求的响应数据时,关闭所述第二网络处理线程;The processor is further configured to: when the transceiver receives the response data of the first network request by using the first network processing thread, shutting down the second network processing thread;
    or
    所述收发器,还用于通过所述第二网络处理线程接收到所述第二网络请求的响应数据;The transceiver is further configured to receive response data of the second network request by using the second network processing thread;
    所述处理器,还用于在所述收发器通过所述第二网络处理线程接收到所述第二网络请求的响应数据时,关闭所述第一网络处理线程。The processor is further configured to: when the transceiver receives the response data of the second network request by using the second network processing thread, shutting down the first network processing thread.
  25. 根据权利要求20至23任一项所述的终端,其特征在于,所述收发器发送的第一网络请求为正常发起的主请求,且为非https请求以及非GET请求的网络请求。The terminal according to any one of claims 20 to 23, wherein the first network request sent by the transceiver is a normally initiated primary request, and is a non-https request and a non-GET request network request.
  26. 一种计算机可读存储介质,其特征在于,包括计算机执行指令,以供计算机的处理器执行所述计算机执行指令时,所述计算机执行如权利要求1至16任一项所述的网络请求方法,或如权利要求13至17中任一项所述的网络波动性衡量方法。 A computer readable storage medium, comprising: a computer executing instruction, when the processor of a computer executes the computer to execute an instruction, the computer executing the network request method according to any one of claims 1 to Or the network volatility measuring method according to any one of claims 13 to 17.
PCT/CN2015/086350 2014-08-12 2015-08-07 Network request method, network fluctuation measurement method and apparatus, and terminal WO2016023442A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410395245.9 2014-08-12
CN201410395245.9A CN105451260B (en) 2014-08-12 2014-08-12 Network request method, network fluctuation measuring method and device

Publications (1)

Publication Number Publication Date
WO2016023442A1 true WO2016023442A1 (en) 2016-02-18

Family

ID=55303870

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/086350 WO2016023442A1 (en) 2014-08-12 2015-08-07 Network request method, network fluctuation measurement method and apparatus, and terminal

Country Status (2)

Country Link
CN (1) CN105451260B (en)
WO (1) WO2016023442A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110866157A (en) * 2018-08-27 2020-03-06 北京猎户星空科技有限公司 Robot response method and device and robot
CN112804769A (en) * 2021-02-25 2021-05-14 北京小米移动软件有限公司 Method, device and storage medium for connecting network
CN115022207A (en) * 2022-06-01 2022-09-06 山东云天安全技术有限公司 Network stability determination method and device, computer equipment and readable storage medium
US20220334980A1 (en) * 2021-04-15 2022-10-20 Apple Inc. Secure Storage of Datasets in a Thread Network Device

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107888634B (en) * 2016-09-29 2021-05-28 北京金山云网络技术有限公司 Data request method and device of distributed storage system
CN108134808B (en) * 2016-12-01 2021-06-11 阿里巴巴集团控股有限公司 Network request method and device
CN109150620A (en) * 2018-09-10 2019-01-04 盛科网络(苏州)有限公司 Link restoring method, controller and interchanger based on interchanger and controller
CN111245559B (en) * 2018-11-29 2023-04-18 阿里巴巴集团控股有限公司 Information determination method, information judgment method and device and computing equipment
CN111381951B (en) * 2020-03-06 2023-06-30 北京思特奇信息技术股份有限公司 Dirty data processing method, device and storage medium in system architecture
CN111629056B (en) * 2020-05-27 2023-04-07 浙江百世技术有限公司 Network request processing method and application
CN114726758B (en) * 2022-06-01 2022-11-04 山东云天安全技术有限公司 Industrial network abnormity determining method and device, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1758753A (en) * 2005-10-09 2006-04-12 南京邮电大学 Real-time multi-model radio video monitoring device and its control method
US20070072609A1 (en) * 2005-09-26 2007-03-29 Yi Qiao Cellular/WLAN hybrid-terminal handover techniques
CN101615197A (en) * 2009-07-30 2009-12-30 浙江大学 A kind of personalized network resource recommended method of connection speed Network Based
CN103036746A (en) * 2012-12-21 2013-04-10 中国科学院计算技术研究所 Passive measurement method and passive measurement system of web page responding time based on network intermediate point

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6862627B1 (en) * 2000-12-12 2005-03-01 Apple Computer, Inc. Method and system for preventing a timeout from reaching a network host
GB0302117D0 (en) * 2003-01-30 2003-03-05 Ibm Preemptive retransmission of buffered data in a network
US7437169B2 (en) * 2004-06-07 2008-10-14 Microsoft Corporation System and method for optimizing network communication in response to network conditions
CN101527659B (en) * 2009-04-15 2012-12-19 腾讯科技(深圳)有限公司 Method and system for monitoring data transmission, and network transmitting device
CN101610183B (en) * 2009-07-21 2011-05-11 杭州华三通信技术有限公司 Method and device for probing processing ability of hypertext transfer protocol server
CN101720125B (en) * 2009-11-18 2013-08-28 深圳市中兴移动通信有限公司 Method for processing overtime and return of AT command of wireless module
CN102457939A (en) * 2010-10-18 2012-05-16 宏碁股份有限公司 Mobile communication apparatus, system thereof and connecting line establishing method
CN102355327B (en) * 2011-08-26 2015-05-13 百度在线网络技术(北京)有限公司 Method, device and equipment for determining data transmission timeout duration
CN103052089A (en) * 2011-10-14 2013-04-17 腾讯科技(深圳)有限公司 Network detection method and network detection device for mobile terminal
CN103095434B (en) * 2011-10-27 2018-02-02 山东金佳园科技股份有限公司 A kind of data retransmission control method and device, terminal device
CN103929286A (en) * 2014-04-16 2014-07-16 厦门市美亚柏科信息股份有限公司 Data transmission control method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070072609A1 (en) * 2005-09-26 2007-03-29 Yi Qiao Cellular/WLAN hybrid-terminal handover techniques
CN1758753A (en) * 2005-10-09 2006-04-12 南京邮电大学 Real-time multi-model radio video monitoring device and its control method
CN101615197A (en) * 2009-07-30 2009-12-30 浙江大学 A kind of personalized network resource recommended method of connection speed Network Based
CN103036746A (en) * 2012-12-21 2013-04-10 中国科学院计算技术研究所 Passive measurement method and passive measurement system of web page responding time based on network intermediate point

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110866157A (en) * 2018-08-27 2020-03-06 北京猎户星空科技有限公司 Robot response method and device and robot
CN112804769A (en) * 2021-02-25 2021-05-14 北京小米移动软件有限公司 Method, device and storage medium for connecting network
CN112804769B (en) * 2021-02-25 2023-08-22 北京小米移动软件有限公司 Method, device and storage medium for connecting network
US20220334980A1 (en) * 2021-04-15 2022-10-20 Apple Inc. Secure Storage of Datasets in a Thread Network Device
US11720504B2 (en) * 2021-04-15 2023-08-08 Apple Inc. Secure storage of datasets in a thread network device
CN115022207A (en) * 2022-06-01 2022-09-06 山东云天安全技术有限公司 Network stability determination method and device, computer equipment and readable storage medium

Also Published As

Publication number Publication date
CN105451260B (en) 2019-12-20
CN105451260A (en) 2016-03-30

Similar Documents

Publication Publication Date Title
WO2016023442A1 (en) Network request method, network fluctuation measurement method and apparatus, and terminal
WO2021036512A1 (en) Method and apparatus for controlling smart home device
WO2022105269A1 (en) Live broadcast video pushing method and device
US20160315861A1 (en) System detection and flow control
US8531984B2 (en) Recording medium storing analysis program, analyzing method, and analyzing apparatus
WO2015183809A1 (en) Method and apparatus of prompting an update of an application
WO2017036394A1 (en) Wifi resource processing method and system
WO2021088174A1 (en) Transmission quality testing method, system and device
JP7437519B2 (en) Content distribution network processing method, device, electronic device, computer readable storage medium and computer program
US20160034861A1 (en) Method and apparatus of controlling network payment
JP5981036B2 (en) Automatic scanning action determination method and apparatus
CN106375150A (en) Disconnection control method and device for server
WO2021027777A1 (en) Terminal credibility identification method, apparatus and device, and computer readable storage medium
WO2014032563A1 (en) Transit-mode-based webpage accessing method, system, and crawler route server
US10044833B2 (en) Data processing method and apparatus used for terminal application
CN111562884A (en) Data storage method and device and electronic equipment
WO2017016293A1 (en) Method and device for wireless network connection
CN112596985B (en) IT asset detection method, device, equipment and medium
CN106412016A (en) Connection control method and device for server
WO2018214836A1 (en) Application identifier matching method, device, storage media and server
US11838193B1 (en) Real-time load limit measurement for a plurality of nodes
CN105163336A (en) Method and system for optimizing stability of wireless network
WO2021147487A1 (en) Data processing method and apparatus
CN114741266A (en) Page white screen duration determining method and device, electronic equipment and storage medium
CN111683012A (en) Information reporting method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15831306

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15831306

Country of ref document: EP

Kind code of ref document: A1