CN108111599B - Data request method and system under unstable network environment - Google Patents
Data request method and system under unstable network environment Download PDFInfo
- Publication number
- CN108111599B CN108111599B CN201711372764.3A CN201711372764A CN108111599B CN 108111599 B CN108111599 B CN 108111599B CN 201711372764 A CN201711372764 A CN 201711372764A CN 108111599 B CN108111599 B CN 108111599B
- Authority
- CN
- China
- Prior art keywords
- server
- request
- server node
- preset
- circular queue
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention relates to a data request method and a system under an unstable network environment, wherein the method comprises the following steps: when a user inputs request data, selecting a server node according to the weight value proportion of each server in a server cluster, and sending a data request to the server node; and when the return result of the server node is not received after the preset request duration is exceeded, reducing the weight value corresponding to the server node by a preset value. The invention selects the servers with high connection power to connect by acquiring the weight value of each server in the server cluster, selecting the server nodes according to the weight value proportion of each server, connecting the server nodes, and reducing the weight value corresponding to the server nodes with failed connection, thereby providing the success rate of data request connection.
Description
Technical Field
The invention relates to the technical field of aviation data request, in particular to a data request method and a data request system under an unstable network environment.
Background
Currently, the traditional client-server model, in which a dedicated stream is established between each requesting client and the server, has limited scalability mainly due to the heavy server load and limited network bandwidth on the server side. Recently, peer-to-peer networks (P2P) have become increasingly popular for many scalable applications, such as sharing streams and files among users on a global scale.
However, the mobile network is unstable under certain environments, and the client is very easy to disconnect the network; if the user needs to request data from a foreign server, the connection time is over due to unstable networks of the domestic server and the foreign server and frequent jitter, so that the stability of the data interaction service is affected.
Disclosure of Invention
To address the deficiencies of the prior art, at least one embodiment of the present invention provides a data request method in an unstable network environment, comprising:
s1, selecting a server node according to the weight ratio of each server in the server cluster, and sending a data request to the server node;
and S2, when the return result of the server node is not received after the preset request duration is exceeded, reducing the weight value corresponding to the server node by a preset value.
Based on the above technical solutions, the embodiments of the present invention may be further improved as follows.
Optionally, the S1 specifically includes:
s11, when a user inputs request data, determining the data request according to the request data, and copying the data request to obtain multiple to-be-sent requests;
s12, placing the request to be sent in a circular queue, wherein the circular queue comprises m circular grids, the circular queue moves upwards one grid per second for reading, and when the circular grids circulate m times, the number of layers of the circular queue is added by 1, wherein m is a preset constant;
s13, sending a data request to the server node, operating the circular queue, and judging whether a result returned by the server node is received or not when the circular queue reads the request to be sent;
s14, when a result returned by the server node is received, discarding the request to be sent; and when the return result of the service node is not received, sending the request to be sent to the server node.
Optionally, the S11 specifically includes:
copying the data request to obtain n +1 parts of requests to be sent;
wherein n satisfies X + Y ^ n < Y, wherein X is preset early warning duration, Y is preset request duration, and X is less than Y; y is a preset constant.
Optionally, the S12 specifically includes:
the placement position of the (n + 1) th pending request in the circular queue is determined by the following formula:
CYC=(t+X)/m+1;LOC=(t+X)%m;
wherein, CYC is an integer and represents the number of layers of the pending requests placed in the circular queue; LOC represents the number of grids for the pending request to be placed in the ring queue, t is the running time of the ring queue, and t is X + y ^ n;
and placing the (n + 1) th pending request in the LOC grid of the CYC layer of the circular queue.
Optionally, in S1, selecting a server node according to the weight ratio of each server in the server cluster specifically includes:
accumulating the weight values of all the servers in the server cluster to obtain a weight base number, and dividing the weight values of the servers by the weight base number to obtain the selection probability of the servers;
and randomly selecting a server as the server node according to the selection probability of each server in the server cluster.
The embodiment of the present invention further provides a data request system in an unstable network environment, including: a user server and a server cluster; the user server includes: the connection selection module, the sending module and the storage module;
the user server is used for creating a data request;
the connection selection module is used for acquiring the weight value of each server in the server cluster in the storage module and selecting a server node according to the weight value proportion of each server in the server cluster;
the sending module is used for sending the data request to the server node;
the user server is further configured to determine whether a result returned by the server node is not received after the preset request duration is exceeded, and reduce the weight value corresponding to the server node stored in the storage module by a preset value when the result returned by the server node is not received after the preset request duration is exceeded.
Optionally, the user server further includes: a circular queue; the circular queue comprises m circular grids, the circular queue moves upwards one grid per second for reading, and the number of layers of the circular queue is added with 1 after the circular grids circulate m times, wherein m is a preset constant.
Optionally, the user server further includes: the data request copying module is used for copying the data request to obtain n +1 to-be-sent requests;
wherein n satisfies X + Y ^ n < Y, wherein X is preset early warning duration, Y is preset request duration, and X is less than Y; y is a preset constant.
Optionally, the user server is specifically configured to place the (n + 1) th pending request in a first LOC grid of a CYC layer of the circular queue;
the placement position of the (n + 1) th pending request in the circular queue is determined by the following formula:
CYC=(t+X)/m+1;LOC=(t+X)%m;
wherein, CYC is an integer and represents the number of layers of the pending requests placed in the circular queue; LOC represents the number of grids that the pending request is placed in the ring queue, t is the running time of the ring queue, and t ═ X + y ^ n.
Optionally, the connection selection module is specifically configured to accumulate the weight values of the servers in the server cluster to obtain a weight base, and divide the weight values of the servers by the weight base to obtain the selection probability of the servers; and randomly selecting a server as the server node according to the selection probability of each server in the server cluster.
Compared with the prior art, the technical scheme of the invention has the following advantages: the invention selects the servers with high connection power to connect by acquiring the weight value of each server in the server cluster, selecting the server nodes according to the weight value proportion of each server, connecting the server nodes, and reducing the weight value corresponding to the server nodes with failed connection, thereby providing the success rate of data request connection.
Drawings
Fig. 1 is a schematic flow chart of a data requesting method in an unstable network environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a data requesting method in an unstable network environment according to another embodiment of the present invention;
FIG. 3 is a flowchart illustrating a data requesting method in an unstable network environment according to another embodiment of the present invention;
fig. 4 is a schematic structural diagram of a data request system in an unstable network environment according to yet another embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
As shown in fig. 1, a data request method in an unstable network environment according to an embodiment of the present invention includes:
s11, when a user inputs request data, selecting a server node according to the weight ratio of each server in the server cluster, and sending a data request to the server node;
and S12, when the preset request duration is exceeded and the returned result of the server node is not received, reducing the weight value corresponding to the server node by a preset value.
In the above embodiment, when request data input by a user is received, a server is selected as a server node according to the weight value of each server in the server cluster, a data request is sent to the server node, the server node is requested to return corresponding data, when the server node does not have a feedback result after exceeding a preset time, it can be judged that the server node does not receive the data request and does not feed back corresponding data due to network fluctuation or other connection reasons, and the weight value of the server node is reduced, so that the selection probability of the server node in the next data request is reduced.
As shown in fig. 2, another embodiment of the present invention provides a data requesting method in an unstable network environment, including:
s211, when a user inputs request data, determining a data request according to the request data, and copying the data request to obtain a plurality of requests to be sent;
s212, placing the request to be sent in a circular queue, wherein the circular queue comprises m circular grids, the circular queue moves upwards one grid per second for reading, and the number of layers of the circular queue is added by 1 after the circular grids circulate m times, wherein m is a preset constant;
s213, sending a data request to the server node, operating a circular queue, and judging whether a result returned by the server node is received or not when the circular queue reads a request to be sent;
s214, when a result returned by the server node is received, discarding the request to be sent, because the server node returns the result at the moment, stopping the ring queue or eliminating the request to be sent in the ring queue, and avoiding sending the request to be sent to the server node again; when a return result of the service node is not received, sending a request to be sent to the server node;
and S22, when the preset request duration is exceeded and the returned result of the server node is not received, reducing the weight value corresponding to the server node by a preset value.
In the above embodiment, when sending a data request to a server node, multiple copies of the data request are copied, the to-be-sent request obtained by copying is placed in an annular queue, and the annular queue is operated, when the annular queue reads the to-be-sent request one by one, whether the server node feeds back data is judged, if the server node feeds back the data, the to-be-sent request does not need to be sent to the server node, if the server node does not feed back the data, the to-be-sent request needs to be sent to the server node again, the probability that the server node receives the request is increased, the retry purpose at millisecond level is achieved through the mechanism, and the hit probability under the condition that the network environment is unstable is increased.
In this embodiment, S11 specifically includes:
copying the data request to obtain n +1 parts of requests to be sent;
wherein n satisfies X + Y ^ n < Y, wherein X is preset early warning duration, Y is preset request duration, and X is less than Y; y is a preset constant.
In this embodiment, S12 specifically includes:
the placement position of the (n + 1) th pending request in the circular queue is determined by the following formula:
CYC=(t+X)/m+1;LOC=(t+X)%m;
wherein, CYC is an integer and represents the number of layers of the pending requests placed in the circular queue; LOC represents the number of grids for placing the pending requests in the ring queue, t is the running time of the ring queue, and t is X + y ^ n; m is the number of grids of the circular queue,
the (n + 1) th pending request is placed in the LOC cell of the CYC level of the circular queue.
In the above embodiment, a strategy for placing the to-be-sent request in the circular queue is provided, the time for reading the to-be-sent request by the circular queue increases exponentially, when the connection network of the server node fluctuates and cannot be recovered in a short time, the to-be-sent request is sent to the server node at a high frequency, effective feedback cannot be obtained, and the time interval between sending of two times of the to-be-sent requests can be prolonged, and the effectiveness of the to-be-sent requests can be improved.
As shown in fig. 3, another embodiment of the present invention provides a data requesting method in an unstable network environment, including:
s311, accumulating the weight values of all the servers in the server cluster to obtain a weight base number, and dividing the weight values of the servers by the weight base number to obtain the selection probability of the servers;
s312, randomly selecting a server as a server node according to the selection probability of each server in the server cluster, and sending a data request to the server node;
and S32, when the preset request duration is exceeded and the returned result of the server node is not received, reducing the weight value corresponding to the server node by a preset value.
In the above embodiment, the servers are selected as the server nodes according to the weight values of the servers in the server cluster according to the proportion of the weight values, so that the probability that a server with a higher weight value is selected is higher, the weight value of the server node is reduced when the server node does not feed back a result, the selection probability of the server node is reduced in real time when a data request is performed next time, through the above strategy, the selection probability of each server approaches a fixed value, and the probability that the server node feeds back a result is higher, the probability that the server node is selected is also higher, thereby avoiding the situation that one server is repeatedly selected as the server node.
As shown in fig. 4, an embodiment of the present invention further provides a schematic structural diagram of a data request system in an unstable network environment, where the schematic structural diagram includes: a user server and a server cluster; the user server includes: the device comprises a data input module, a connection selection module, a sending module and a storage module;
the data input module is used for receiving request data input by a user;
the user server is used for creating a data request according to the request data input by the user;
the user server further comprises: the data request copying module is used for copying the data request to obtain n +1 to-be-sent requests;
wherein n satisfies X + Y ^ n < Y, wherein X is preset early warning duration, Y is preset request duration, and X is less than Y; y is a preset constant.
The connection selection module is used for acquiring the weight value of each server in the server cluster in the storage module and selecting a server node according to the weight value proportion of each server in the server cluster;
specifically, the connection selection module accumulates the weight values of the servers in the server cluster to obtain a weight base number, and divides the weight values of the servers by the weight base number to obtain the selection probability of the servers; and randomly selecting the server as a server node according to the selection probability of each server in the server cluster.
The sending module is used for sending a data request to the server node;
and the user server is also used for judging whether the preset request duration is exceeded or not and the returned result of the server node is not received, and reducing the weight value corresponding to the server node stored in the storage module by a preset value when the preset request duration is exceeded and the returned result of the server node is not received.
The user server further comprises: a circular queue; the circular queue comprises m circulating grids, the circular queue moves upwards one grid per second for reading, and the number of layers of the circular queue is added with 1 after the circulating grids circulate m times, wherein m is a preset constant;
the user server is specifically used for placing the (n + 1) th to-be-sent request in the LOC grid of the CYC layer of the circular queue;
the placement position of the (n + 1) th pending request in the circular queue is determined by the following formula:
CYC=(t+X)/m+1;LOC=(t+X)%m;
wherein, CYC is an integer and represents the number of layers of the pending requests placed in the circular queue; LOC represents the number of grids for pending requests placed in the ring queue, t is the run time of the ring queue, and t ═ X + y ^ n.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (4)
1. A data request method in an unstable network environment, comprising:
s1, selecting a server node according to the weight ratio of each server in the server cluster, and sending a data request to the server node;
s2, when the return result of the server node is not received after the preset request duration is exceeded, reducing the weight value corresponding to the server node by a preset value;
the S1 specifically includes:
s11, when a user inputs request data, determining the data request according to the request data, and copying the data request to obtain multiple to-be-sent requests;
s12, placing the request to be sent in a circular queue, wherein the circular queue comprises m circular grids, the circular queue moves upwards one grid per second for reading, and when the circular grids circulate m times, the number of layers of the circular queue is added by 1, wherein m is a preset constant;
s13, sending a data request to the server node, operating the circular queue, and judging whether a result returned by the server node is received or not when the circular queue reads the request to be sent;
s14, when a result returned by the server node is received, discarding the request to be sent; when a return result of the server node is not received, the request to be sent is sent to the server node;
wherein, the S11 specifically includes:
copying the data request to obtain n +1 parts of requests to be sent;
wherein n satisfies X + Y ^ n < Y, wherein X is preset early warning duration, Y is preset request duration, and X is less than Y; y is a preset constant;
wherein, the S12 specifically includes:
the placement position of the (n + 1) th pending request in the circular queue is determined by the following formula:
CYC=(t+X)/m+1;LOC=(t+X)%m;
wherein, CYC is an integer and represents the number of layers of the pending requests placed in the circular queue; LOC represents the number of grids for the pending request to be placed in the ring queue, t is the running time of the ring queue, and t is X + y ^ n;
and placing the (n + 1) th pending request in the LOC grid of the CYC layer of the circular queue.
2. The method according to claim 1, wherein the step S1 of selecting the server node according to the weight ratio of each server in the server cluster specifically includes:
accumulating the weight values of all the servers in the server cluster to obtain a weight base number, and dividing the weight values of the servers by the weight base number to obtain the selection probability of the servers;
and randomly selecting a server as the server node according to the selection probability of each server in the server cluster.
3. A data request system in an unstable network environment, comprising: a user server and a server cluster; the user server includes: the connection selection module, the sending module and the storage module;
the user server is used for creating a data request;
the connection selection module is used for acquiring the weight value of each server in the server cluster in the storage module and selecting a server node according to the weight value proportion of each server in the server cluster;
the sending module is used for sending the data request to the server node;
the user server is further configured to determine whether a result returned by the server node is not received after the preset request duration is exceeded, and reduce the weight value corresponding to the server node stored in the storage module by a preset value when the result returned by the server node is not received after the preset request duration is exceeded;
the user server further comprises: a circular queue; the circular queue comprises m circular grids, the circular queue moves upwards one grid per second for reading, and the number of layers of the circular queue is added with 1 after the circular grids circulate m times, wherein m is a preset constant;
the user server further comprises: the data request copying module is used for copying the data request to obtain n +1 to-be-sent requests;
wherein n satisfies X + Y ^ n < Y, wherein X is preset early warning duration, Y is preset request duration, and X is less than Y; y is a preset constant;
the user server is specifically configured to place the (n + 1) th pending request in a first LOC grid of a CYC layer of the circular queue;
the placement position of the (n + 1) th pending request in the circular queue is determined by the following formula:
CYC=(t+X)/m+1;LOC=(t+X)%m;
wherein, CYC is an integer and represents the number of layers of the pending requests placed in the circular queue; LOC represents the number of grids that the pending request is placed in the ring queue, t is the running time of the ring queue, and t ═ X + y ^ n.
4. The system according to claim 3, wherein the connection selection module is specifically configured to accumulate the weight values of the servers in the server cluster to obtain a weight base, and divide the weight values of the servers by the weight base to obtain the selection probability of the servers; and randomly selecting a server as the server node according to the selection probability of each server in the server cluster.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711372764.3A CN108111599B (en) | 2017-12-19 | 2017-12-19 | Data request method and system under unstable network environment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711372764.3A CN108111599B (en) | 2017-12-19 | 2017-12-19 | Data request method and system under unstable network environment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108111599A CN108111599A (en) | 2018-06-01 |
CN108111599B true CN108111599B (en) | 2021-01-05 |
Family
ID=62211152
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711372764.3A Active CN108111599B (en) | 2017-12-19 | 2017-12-19 | Data request method and system under unstable network environment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108111599B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104767776A (en) * | 2014-01-07 | 2015-07-08 | 腾讯科技(深圳)有限公司 | Real-time network routing adjustment method, device and system |
WO2017020669A1 (en) * | 2015-07-31 | 2017-02-09 | 华为技术有限公司 | Method and device for authenticating identity of node in distributed system |
CN106936926A (en) * | 2017-04-18 | 2017-07-07 | 广州华多网络科技有限公司 | Access the method and system of back end |
CN107169756A (en) * | 2017-05-10 | 2017-09-15 | 北京凤凰理理它信息技术有限公司 | Payment channel distribution method, device, storage medium and payment route system |
-
2017
- 2017-12-19 CN CN201711372764.3A patent/CN108111599B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104767776A (en) * | 2014-01-07 | 2015-07-08 | 腾讯科技(深圳)有限公司 | Real-time network routing adjustment method, device and system |
WO2017020669A1 (en) * | 2015-07-31 | 2017-02-09 | 华为技术有限公司 | Method and device for authenticating identity of node in distributed system |
CN106936926A (en) * | 2017-04-18 | 2017-07-07 | 广州华多网络科技有限公司 | Access the method and system of back end |
CN107169756A (en) * | 2017-05-10 | 2017-09-15 | 北京凤凰理理它信息技术有限公司 | Payment channel distribution method, device, storage medium and payment route system |
Also Published As
Publication number | Publication date |
---|---|
CN108111599A (en) | 2018-06-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11290381B2 (en) | Method and system for transmitting data resource acquisition request | |
US10404790B2 (en) | HTTP scheduling system and method of content delivery network | |
JP6018182B2 (en) | Send category information | |
CN101136911B (en) | Method to download files using P2P technique and P2P download system | |
CN103179217B (en) | A kind of load-balancing method for WEB application server farm and device | |
WO2023050901A1 (en) | Load balancing method and apparatus, device, computer storage medium and program | |
JP2010204876A (en) | Distributed system | |
CN113811013B (en) | Cluster capacity dynamic adjustment method, device, storage medium and communication system | |
CN107317764B (en) | Traffic load balancing method, system, device and computer readable storage medium | |
CN108111599B (en) | Data request method and system under unstable network environment | |
JP2009122981A (en) | Cache allocation method | |
TWI489889B (en) | Method and system for controlling flow of content delivery network and peer to peer network | |
Kawakami et al. | A delivery method considering communication loads for sensor data stream with different collection cycles | |
CN111930710A (en) | Method for distributing big data content | |
CN106790354B (en) | Communication method and device for preventing data congestion | |
CN105634932B (en) | Message pushing method, device, system and computer readable storage medium | |
US20120137017A1 (en) | System and method for controlling server usage in peer-to-peer (p2p) based streaming service | |
CN112468310A (en) | Streaming media cluster node management method and device and storage medium | |
US9071954B2 (en) | Wireless optimized content delivery network | |
CN110636104B (en) | Resource request method, electronic device and storage medium | |
CN113396573B (en) | Migration of computing services | |
Kumar et al. | BMAQR: balanced multi attribute QoS aware replication in HDFS | |
CN114500663B (en) | Scheduling method, device, equipment and storage medium of content distribution network equipment | |
Rong et al. | BitTorrent in a dynamic resource adapting peer-to-peer network | |
Muhammad et al. | Efficient mutual exclusion in peer-to-peer systems |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |