WO2017185631A1 - 一种数据下载方法及设备 - Google Patents

一种数据下载方法及设备 Download PDF

Info

Publication number
WO2017185631A1
WO2017185631A1 PCT/CN2016/100414 CN2016100414W WO2017185631A1 WO 2017185631 A1 WO2017185631 A1 WO 2017185631A1 CN 2016100414 W CN2016100414 W CN 2016100414W WO 2017185631 A1 WO2017185631 A1 WO 2017185631A1
Authority
WO
WIPO (PCT)
Prior art keywords
server
data
servers
client
processing device
Prior art date
Application number
PCT/CN2016/100414
Other languages
English (en)
French (fr)
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 WO2017185631A1 publication Critical patent/WO2017185631A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Definitions

  • the present application relates to the field of digital processing technologies, and in particular, to a data download method and device.
  • Nginx (Engine x) is a lightweight web server/reverse proxy server and email (IMAP/POP3) proxy server with high stability, rich feature set, sample configuration files and low system resource consumption. It is widely used in large portals and search engines, so that each client can get the required data from the corresponding server through Nginx.
  • FIG. 1 is a schematic diagram of an architecture of the Nginx.
  • the client obtains the running state information of the user through the Nginx.
  • the health table is obtained, and the server A, the server B, and the server C can be used.
  • a health table is provided for the client, and the health tables stored in the three servers are the same.
  • the Nginx After the Nginx receives the health table acquisition request sent by the client, the Nginx obtains the user's health table from the server A according to a preset rule, such as random or in a fixed selection order, and then Nginx proceeds to Server A sends the command. If server A fails, it cannot be obtained. At this time, Nginx needs to wait for 10s, obtain the user's health table from server B or server C, and finally return the health table to the client.
  • a preset rule such as random or in a fixed selection order
  • Nginx when the server communicating with Nginx fails, Nginx will be forced to wait for a preset duration, such as 10s, thereby causing the Nginx request processing to be inefficient.
  • the present invention provides a data downloading method and device for solving the defect that the Nginx has low request processing efficiency when the server is faulty in the prior art, and improves the request processing efficiency of the client data processing device.
  • an embodiment of the present application provides a data downloading method, including:
  • the client data processing device determines N servers in a normal state from the M servers, where M is an integer greater than or equal to 1, and N is an integer less than or equal to M;
  • the client data processing device obtains a data request sent by the client for obtaining the first data
  • the client data processing device determines a first server from the N servers;
  • the client data processing device acquires the first data from the first server and sends the first data to the client.
  • the embodiment of the present application further provides a data downloading device, including:
  • a state determining module configured to determine N servers in a normal state from the M servers, where M is an integer greater than or equal to 1, and N is an integer less than or equal to M;
  • a receiving module configured to obtain a data request sent by the client for obtaining the first data
  • a server determining module configured to determine a first server from the N servers based on the data request
  • a data obtaining module configured to acquire the first data from the first server, and send the first data to the client.
  • the embodiment of the present application further provides a data downloading device, including:
  • a memory for storing instructions
  • processor coupled to the memory for executing the instructions to perform the following steps when the instructions are executed:
  • N servers in a normal state from M servers, where M is an integer greater than or equal to 1, and N is an integer less than or equal to M;
  • an embodiment of the present application provides a non-transitory storage medium, wherein the non-transitory storage medium is used to store a computer program, and the computer program includes instructions for executing the foregoing data download method.
  • an embodiment of the present application provides a computer program product, characterized in that:
  • the computer program product includes instructions for performing the aforementioned data download method.
  • the client data processing device can detect the working state of each server communicating with the server in real time, thereby determining the server in a normal state, thereby, when the client data
  • the processing device receives the data request sent by the client, it automatically obtains the data required by the client from the server in the normal state, and detects the current state of each server in real time, thereby avoiding the failure of the server providing the data.
  • the request processing efficiency of the client data processing device due to the need to wait is low, and the request processing efficiency of the client data processing device is improved.
  • 1 is a schematic diagram of the architecture of Nginx in the prior art
  • FIG. 2 is a flow chart of an embodiment of a data downloading method of the present application
  • step 101 is a flowchart of a specific implementation manner of step 101 in the data downloading method embodiment of the present application.
  • FIG. 4A is a schematic structural diagram of a first embodiment of a data downloading device according to the present application.
  • 4B is a schematic structural diagram of a second embodiment of a data downloading device according to the present application.
  • FIG. 5 is a schematic structural diagram of a data download device according to Embodiment 3 of the present application.
  • FIG. 2 is a flowchart of a data downloading method according to an embodiment of the present invention.
  • the method includes:
  • the client data processing device determines N in the normal state from the M servers. a server, wherein M is an integer greater than or equal to 1, and N is an integer less than or equal to M;
  • Step 102 The client data processing device obtains a data request sent by a client for obtaining first data.
  • the client data processing device determines a first server from the N servers;
  • the client data processing device acquires the first data from the first server, and sends the first data to the client.
  • the client data processing device may specifically be an Nginx device, or another device capable of providing HTTP and reverse proxy server functions.
  • Nginx device or another device capable of providing HTTP and reverse proxy server functions.
  • other electronic devices integrated with Nginx device functions may be used in this embodiment.
  • the data downloading method in the embodiment of the present invention will be described in detail by taking the client data processing device as an Nginx device as an example.
  • server A, server B, and server C are respectively three web servers, and the corresponding server addresses are assumed to be: server A: 192.168.1.17; server B: 192.168.1.18; server C: 192.168.1.19.
  • Server A, Server B, and Server C store all the data of the client, such as the application data of the client, the running status data of the client, etc., so that when the client needs to acquire some data, the Nginx device can be from three. Any one of the servers can be obtained.
  • the first data that the client needs to obtain is the health table data as an example for description.
  • step 101 is performed first, that is, the client data processing device determines N servers in a normal state from the M servers, where M is an integer greater than or equal to 1, N Is an integer less than or equal to M.
  • step 101 is as follows:
  • the client data processing device sends a verification request to each of the M servers.
  • the client data processing device receives M response information sent by the M servers.
  • the client data processing device determines N servers in a normal state from the M servers.
  • the Nginx device needs to detect the working status of Server A, Server B, and Server C in real time to determine whether there is a server failure, and thus Nginx
  • the device needs to send authentication requests to three servers separately.
  • the verification request may be specifically an http request.
  • other types of requests may be used, which are not limited in the embodiment of the present invention.
  • the Nginx device sends an http request to three servers.
  • the Nginx can be sent by broadcast, or the http request can be sent to three servers according to the address of each server.
  • a preset interval such as 10s or 20s, may be preset, so that the Nginx device can send an authentication request to the three servers at the preset interval, so that each server can be obtained in real time.
  • the working state can also save the energy consumption of the Nginx device to the greatest extent.
  • the preset interval duration can be determined according to actual usage conditions, and those skilled in the art can also obtain the working state of each server in real time by other means.
  • the three servers After receiving the http request sent by the Nginx device, the three servers will feed back the response information to the Nginx device, where the response message includes a response code to the http request.
  • the Nginx device extracts the response code in the response information, and pre-stores the judgment condition in the Nginx device. For example, when the response code is 200, it is determined that the corresponding server is in the normal state. Status, otherwise, determine if the server is abnormal or has failed. If the Nginx device obtains the response codes sent by the three servers, the response codes are: server A: 201; server B: 200; server C: 200, because 201 ⁇ 200, thereby determining that server B and server C are in the current time. In normal state, server A has an exception.
  • the Nginx device needs to update the judgment result of each server's working state in real time according to the response code fed back by each server at the next moment.
  • the Nginx device can also judge the working state of the server only once. For example, when the server connects to the Nginx device to form a server system, it sends an authentication request to the server. When the verification result is obtained, the verification result is stored.
  • the working state of the server is not limited in the embodiment of the present invention.
  • step 101 the method in the embodiment of the present invention performs step 102, that is, the client data processing device obtains a data request sent by the client for obtaining the first data.
  • the Nginx device when the client needs to obtain its health table data, the Nginx device will receive the URL (Uniform Resource Locator) information sent by the client, and the information contained in the URL information indicates that the client needs The file name of the data content. Then, the Nginx device extracts the part of the URL information used to characterize the file name, and determines that the data requested by the client is healthy. Table data.
  • URL Uniform Resource Locator
  • the Nginx device receives the health table data request information sent by the client when determining the working state of each server. At this time, the Nginx device also needs to first determine the working state of each server. The health table data request information sent by the client is processed to ensure that the Nginx device can obtain data from the server in a normal state every time, thereby improving the hit rate of the Nginx device.
  • step 103 that is, based on the data request, the client data processing device determines the first server from the N servers.
  • the specific implementation manners of the step 103 are various. In the embodiment of the present invention, the following two situations are mainly described:
  • step 103 includes:
  • the client data processing device acquires a hash value of the data request
  • the client data processing device determines a first server corresponding to the hash value from the N servers.
  • the Nginx device when the Nginx device determines that the data requested by the client is the health table data, in order to further improve the access hit ratio of the Nginx device, the Nginx device can perform the URL information sent by the client.
  • a hash value is a unique and extremely compact numerical representation of a piece of data. It is a resin obtained by logical operations based on the data of the contents of the file. The hash values obtained by different files are different, even if the file content has only one letter or character. Different, the corresponding hash values are different, so you can use hash values to verify that multiple messages are the same.
  • the typical hash algorithm includes the MD2, the MD4, the MD5, the SHA-1, and the like, which are not described in the embodiment of the present invention.
  • the Nginx device calculates the hash value of the URL information sent by the client, it can calculate a score according to the IP address of the server and the hash value of the URL information. Therefore, the server with the highest score is determined as the server that obtains the health table data. For example, the Nginx device determines that the servers in the normal state are Server B and Server C, respectively, so that the server B score is 100 according to the IP value of the server B and the hash value of the URL, and the IP value of the server C and the URL are The value of the server B is calculated to be 80, and it is determined that the server B is the first server.
  • the first data acquisition device acquires the first from the first server After the data is sent to the client, the method further includes:
  • the client data processing device establishes a first correspondence between the hash value and the first server, and stores the first correspondence in the client data processing device.
  • the Nginx device determines that the health table data is obtained from the server B
  • the Nginx device establishes a correspondence between the hash value of the client's health table request information and the server address, such as: hash.
  • the value 10:192.168.1.18 is stored in the memory of the Nginx device. In this way, when the Nginx device detects the request information for obtaining the same hash value next time, it is directly acquired from the server B, thereby reducing the calculation amount of the Nginx device and increasing the rate of data acquisition.
  • step 103 includes:
  • the client data processing device acquires a preset rule
  • the client data processing device determines, from the N servers, a first server that satisfies the preset rule.
  • the first server that obtains the health table data is determined according to the preset rule stored in the Nginx device. For example, if the preset rule is random, the Nginx device randomly selects one server from the server B and the server C as the first server, for example, determining that the server B is the first server; or the preset rule is: determining The server with a small load at the current time is the first server. At this time, the Nginx device needs to obtain the current load of the server B and the server C.
  • the server B is determined to be the first server; or the preset rule is To:
  • the first server is determined in the order A>B>C.
  • the server B is automatically determined to be the first server according to the preset setting order.
  • step 104 that is, the client data processing device acquires the first data from the first server, and sends the first data to The client.
  • the Nginx device determines that the server B is the first server
  • the URL information sent by the client is sent to the server B
  • the server B obtains the health table data corresponding to the client
  • Feeding the health table data to the Nginx device The health table data is sent to the client through the Nginx device, and the client downloads the health table data.
  • the second embodiment of the present invention provides a data downloading device, which may be an Nginx device, or provide other functions of HTTP and reverse proxy servers.
  • the device includes: a state determining module 10, a receiving module 20, a server determining module 30, and a data obtaining module 40, and the state determining module 10, the receiving module 20, the server determining module 30, and the data in the second embodiment of the present invention.
  • the obtaining module 40 can implement related functional units through a hardware processor, wherein:
  • the state determining module 10 is configured to determine N servers in a normal state from the M servers, where M is an integer greater than or equal to 1, and N is an integer less than or equal to M;
  • the receiving module 20 is configured to obtain a data request sent by the client for obtaining the first data.
  • a server determining module 30, configured to determine, according to the data request, a first server from the N servers;
  • the data obtaining module 40 is configured to acquire the first data from the first server, and send the first data to the client.
  • the state determining module 10 is specifically configured to:
  • N servers in a normal state are determined from the M servers.
  • the data downloading device sends a verification request to the three servers through the state determining module 10, such as http.
  • the request and the like, and then the server in the normal state of the server A, the server B, and the server C are determined according to the response code in the feedback information of each server.
  • server determining module 30 is specifically described in the following two main implementation manners:
  • the server determining module 30 is specifically configured to:
  • a first server corresponding to the hash value is determined from the N servers based on the hash value.
  • the data downloading device calculates a hash value of the URL information by using the server determining module 30, and according to the IP address and the URL information of each server.
  • the hash value calculates the score for each server, so that the server with the highest score is determined to acquire the first server.
  • the data downloading device further includes: a storage module 50, configured to establish and store the hash value and the first server. The first correspondence.
  • the storage module 50 may be a memory in the data downloading device, or may be a new memory that is separately set in the data downloading device, which is not limited in the embodiment of the present invention.
  • the storage module 50 stores the correspondence between the current hash value and the IP address of the first server, such that when the data downloading device is next time When receiving the information with the same hash value, the data can be directly obtained through the corresponding server, thereby improving the data acquisition rate.
  • the server determining module 30 is specifically configured to:
  • a first server that satisfies the preset rule is determined from the N servers.
  • the data downloading device After the data downloading device receives the URL information sent by the client, the data downloading device directly determines the first server according to the pre-stored rules in the memory, such as randomly selecting, or selecting according to a specified order.
  • a client data processing device such as an Nginx device detects the working status of each server in communication with each other in real time, thereby determining a server in a normal state, thereby, when the client processes data.
  • the device receives the data request sent by the client, it automatically obtains the data required by the client from the server in the normal state, and detects the current state of each server in real time, thereby avoiding when the server providing the data fails.
  • the request processing efficiency of the client data processing device due to the need to wait is low, and the request processing efficiency of the client data processing device is improved.
  • FIG. 5 is a schematic structural diagram of a data downloading device according to Embodiment 3 of the present invention, and data downloading
  • the device includes a bus 501 and a memory 502 that respectively connects the bus 501 and a processor 503.
  • the memory 502 is configured to store an instruction
  • the processor 503 is configured to execute the instruction to perform the following steps: determining, from the M servers, N servers in a normal state, where M is greater than or equal to An integer of 1, N is an integer less than or equal to M; obtaining a data request sent by the client for obtaining the first data; and determining, according to the data request, the first server from the N servers;
  • a server acquires the first data and sends the first data to the client.
  • the processor 503 is specifically configured to:
  • N servers in a normal state are determined from the M servers.
  • the processor 503 is specifically configured to:
  • a first server corresponding to the hash value is determined from the N servers based on the hash value.
  • the processor 503 is specifically configured to:
  • a first server that satisfies the preset rule is determined from the N servers.
  • the processor 503 is further configured to:
  • Embodiment 4 of the present invention provides a non-transitory storage medium for storing a computer program, the computer program comprising instructions for executing the foregoing data download method.
  • the computer program can be set to:
  • N servers in a normal state are determined from the M servers.
  • the computer program can be set to:
  • a first server corresponding to the hash value is determined from the N servers based on the hash value.
  • the computer program can be set to:
  • a first server that satisfies the preset rule is determined from the N servers.
  • the computer program is further configured to:
  • Embodiment 5 of the present invention provides a computer program product, characterized in that the computer program product comprises instructions for executing the aforementioned data downloading method.
  • the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, 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 deliberate labor.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本申请实施例提供一种数据下载方法及设备。该方法为:客户端数据处理设备从M个服务器中确定处于正常状态的N个服务器,其中,M为大于等于1的整数,N为小于等于M的整数;所述客户端数据处理设备获得客户端发送的用于获得第一数据的数据请求;基于所述数据请求,所述客户端数据处理设备从所述N个服务器中确定出第一服务器;所述客户端数据处理设备从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端,从而提高客户端数据处理设备的请求处理效率。

Description

一种数据下载方法及设备
本申请要求在2016年04月25日提交中国专利局、申请号为201610264262.8、发明名称为“一种数据下载方法及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及数字处理技术领域,尤其涉及一种数据下载方法及设备。
背景技术
Nginx(Engine x)是一款轻量级的Web服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,其具有高稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而被广泛应用到大型的入口网站及搜索引擎中,以使各个客户端能够通过Nginx从相应的服务器中获取所需数据。
在现有技术中,请参考图1,为Nginx的一种架构示意图,以客户端通过Nginx获取该用户的设备运行状态信息,如获取健康表为例,服务器A、服务器B及服务器C都可以为客户端提供健康表,且,三个服务器中存储的健康表相同。当Nginx接收到客户端发送的健康表获取请求后,则根据一预设规则,如随机或者按照固定的选择顺序,从三个服务器中确定从服务器A中获取用户的健康表,然后Nginx便向服务器A发送指令。若服务器A发生故障,则无法获取,此时,Nginx需要等待10s后,从服务器B或者服务器C中获取用户的健康表,最后将健康表返回客户端。
可见,在现有技术中,当与Nginx通信的服务器发生故障时,Nginx将被迫等待一预设时长,如10s,从而造成Nginx的请求处理效率低下。
发明内容
本申请提供一种数据下载方法及设备,用以解决现有技术中Nginx在服务器发生故障时存在的请求处理效率低下的缺陷,实现提高客户端数据处理设备的请求处理效率。
第一方面,本申请实施例提供一种数据下载方法,包括:
客户端数据处理设备从M个服务器中确定处于正常状态的N个服务器,其中,M为大于等于1的整数,N为小于等于M的整数;
所述客户端数据处理设备获得客户端发送的用于获得第一数据的数据请求;
基于所述数据请求,所述客户端数据处理设备从所述N个服务器中确定出第一服务器;
所述客户端数据处理设备从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端。
第二方面,本申请实施例还提供了一种数据下载设备,包括:
状态确定模块,用于从M个服务器中确定处于正常状态的N个服务器,其中,M为大于等于1的整数,N为小于等于M的整数;
接收模块,用于获得客户端发送的用于获得第一数据的数据请求;
服务器确定模块,用于基于所述数据请求,从所述N个服务器中确定出第一服务器;
数据获取模块,用于从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端。
第三方面,本申请实施例还提供了一种数据下载设备,其特征在于,包括:
存储器,用于存储指令;
处理器,与所述存储器相连,用于执行所述指令,以在执行所述指令时执行如下步骤:
从M个服务器中确定处于正常状态的N个服务器,其中,M为大于等于1的整数,N为小于等于M的整数;
获得客户端发送的用于获得第一数据的数据请求;
基于所述数据请求,从所述N个服务器中确定出第一服务器;
从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端。
第四方面,本申请实施例提供一种非暂态存储介质,其特征在于,所述非暂态存储介质用于存储计算机程序,所述计算机程序包括用于执行前述数据下载方法的指令。
第五方面,本申请实施例提供一种计算机程序产品,其特征在于,所 述计算机程序产品包括用于执行前述数据下载方法的指令。
本申请实施例提供的数据下载方法及设备,客户端数据处理设备,如Nginx设备,会实时检测与之通信的各个服务器的工作状态,从而确定出处于正常状态的服务器,从而,当客户端数据处理设备接收到由客户端发送的数据请求时,便会自动从处于正常状态的服务器中获取客户端所需的数据,通过实时检测各个服务器的当前状态,避免了当提供数据的服务器发生故障时,客户端数据处理设备由于需要等待而造成的请求处理效率低下,实现了提高客户端数据处理设备的请求处理效率。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为现有技术中Nginx的架构示意图;
图2为本申请数据下载方法实施例流程图;
图3为本申请数据下载方法实施例中步骤101的具体实现方式流程图;
图4A为本申请数据下载设备实施例第一种结构示意图;
图4B为本申请数据下载设备实施例第二种结构示意图;
图5为本申请实施例三提供的一种数据下载设备的结构示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
实施例一
请参考图2,为本发明实施例中提供的一种数据下载方法的流程图,所述方法包括:
101:客户端数据处理设备从M个服务器中确定处于正常状态的N个 服务器,其中,M为大于等于1的整数,N为小于等于M的整数;
102:所述客户端数据处理设备获得客户端发送的用于获得第一数据的数据请求;
103:基于所述数据请求,所述客户端数据处理设备从所述N个服务器中确定出第一服务器;
104:所述客户端数据处理设备从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端。
在具体实施过程中,所述客户端数据处理设备具体可以是Nginx设备,或者其他能够提供HTTP和反向代理服务器功能的设备,当然,也可以是其他集成有Nginx设备功能的电子设备,在本发明实施例中不作限制。在本发明实施例中,将以所述客户端数据处理设备为Nginx设备为例,来对本发明实施例中的数据下载方法进行详细的描述。
以图1所述的Nginx架构为例,服务器A、服务器B及服务器C分别为三个web服务器,假设其对应的服务器地址分别为:服务器A:192.168.1.17;服务器B:192.168.1.18;服务器C:192.168.1.19。服务器A、服务器B及服务器C中存储有客户端的所有数据,如,客户端的各个应用程序数据,客户端的运行状态数据等,从而,当客户端需要获取某种数据时,Nginx设备可以从三个服务器中的任意一个获取即可。在本发明实施例中,以客户端需要获取的第一数据为健康表数据为例来进行说明。
在采用本发明实施例中的方法下载数据时,首先执行步骤101,即:客户端数据处理设备从M个服务器中确定处于正常状态的N个服务器,其中,M为大于等于1的整数,N为小于等于M的整数。
在本发明实施例中,请参考图3,步骤101的具体实现方式如下:
1011:所述客户端数据处理设备向所述M个服务器中每个服务器发送验证请求;
1012:所述客户端数据处理设备接收由所述M个服务器发送的M个响应信息;
1013:基于所述M个响应信息,所述客户端数据处理设备从所述M个服务器中确定出处于正常状态的N个服务器。
在具体实施过程中,沿用上述例子,Nginx设备需要实时检测服务器A、服务器B及服务器C的工作状态,判断是否有服务器发生故障,从而Nginx 设备需要分别向三个服务器发送验证请求。所述验证请求具体可以是http请求,当然,也可以是其他类型的请求,在本发明实施例中不作限制。
以Nginx设备向三个服务器发送http请求为例,Nginx可以采用广播方式发送,也可以根据各个服务器的地址,分别向三个服务器发送http请求。为了节省Nginx设备的能耗,可以预先设定一预设间隔,如10s或者20s等,从而Nginx设备可以以所述预设间隔向三个服务器发送验证请求,这样,既能保证实时获取各个服务器的工作状态,也能最大程度节省Nginx设备的能耗,当然,所述预设间隔时长可以根据实际使用情况进行确定,本领域技术人员也可以采用其他的方式实时获取各个服务器的工作状态。
当三个服务器分别接收到Nginx设备发送的http请求后,将会向Nginx设备反馈响应信息,所述响应信息中包含有对http请求的响应码。当Nginx设备接收到三个服务器发送的响应信息后,便提取所述响应信息中的响应码,在Nginx设备中预先存储判断条件,如,当响应码为200时,则确定对应的服务器处于正常状态,否则,确定服务器异常或发生故障。若Nginx设备获取三个服务器发送的响应信息中的响应码分别为:服务器A:201;服务器B:200;服务器C:200,由于201≠200,从而确定出服务器B及服务器C在当前时刻内处于正常状态,服务器A发生异常。
由于各个服务器的工作状态可能会不断发生变化,因此,Nginx设备需要根据下一时刻由各个服务器反馈的响应码实时更新对各个服务器工作状态的判断结果。
当然,Nginx设备也可以对服务器的工作状态只进行一次判断,如,当服务器连接到Nginx设备组成服务器系统中时,便向服务器发送验证请求,当获取验证结果后,便将所述验证结果存储在Nginx设备中,以表征该服务器的工作状态,在本发明实施例中不作限制。
在执行完成步骤101之后,本发明实施例中的方法便执行步骤102,即:所述客户端数据处理设备获得客户端发送的用于获得第一数据的数据请求。
在具体实施过程中,当客户端需要获取其健康表数据时,Nginx设备将会接收到由客户端发送的URL(统一资源定位符)信息,所述URL信息中包含的信息指出客户端需要的数据内容的文件名,然后,Nginx设备提取URL信息中用于表征文件名的部分,确定出客户端请求获取的数据为健康 表数据。
当然,不可避免的存在如下情况:Nginx设备在确定各个服务器的工作状态时,接收到由客户端发送的健康表数据请求信息,此时,Nginx设备也需要先确定出各个服务器的工作状态后,再对客户端发送的健康表数据请求信息进行处理,从而确保Nginx设备每次都能从处于正常状态的服务器中获取数据,提高Nginx设备的命中率。
在执行完成步骤102之后,本发明实施例中的方法便执行步骤103,即:基于所述数据请求,所述客户端数据处理设备从所述N个服务器中确定出第一服务器。
在具体实施过程中,步骤103的具体实现方式有多种,在本发明实施例中主要以如下两种情况进行说明:
第一种方式,步骤103包括:
所述客户端数据处理设备获取所述数据请求的哈希值;
基于所述哈希值,所述客户端数据处理设备从所述N个服务器中确定与所述哈希值对应的第一服务器。
在具体实施过程中,沿用上述例子,当Nginx设备确定出客户端请求获取的数据为健康表数据后,为了进一步提高Nginx设备的访问命中率,Nginx设备便可以对客户端发送的URL信息进行哈希值计算的处理。哈希值是一段数据唯一且极其紧凑的数值表示形式,是根据文件的内容的数据通过逻辑运算得到的树脂,不同的文件得到的哈希值是不同的,即使文件内容只有一个字母或者字符的不同,相应的哈希值都不相同,因此,可以通过哈希值来验证多个消息是否相同。典型的哈希算法包括MD2、MD4、MD5和SHA-1等,在本发明实施例中不再赘述。
以客户端发送的URL信息的哈希值为10为例,当Nginx设备计算出客户端发送的URL信息的哈希值之后,可以根据服务器的IP地址及URL信息的哈希值计算出一个分数,从而将分数最高的服务器确定为获取健康表数据的服务器。如,Nginx设备确定出处于正常状态的服务器分别为服务器B和服务器C,从而根据服务器B的IP值和URL的哈希值计算出服务器B的分数为100,服务器C的IP值与URL的哈希值计算出服务器B的分数为80,进而确定出服务器B为第一服务器。
相应地,在所述客户端数据处理设备从所述第一服务器获取所述第一 数据,并将所述第一数据发送至所述客户端之后,所述方法还包括:
所述客户端数据处理设备建立所述哈希值与所述第一服务器的第一对应关系,并将所述第一对应关系存储在所述客户端数据处理设备中。
在具体实施过程中,沿用上述例子,当Nginx设备确定出从服务器B中获取健康表数据后,Nginx设备便建立客户端的健康表请求信息的哈希值与服务器地址的对应关系,如:哈希值10:192.168.1.18,存储在Nginx设备的存储器中。这样,当Nginx设备下次检测到获取同样哈希值的请求信息时,便直接从服务器B中获取,从而减少了Nginx设备的计算量且提高了数据获取的速率。
第二种方式,步骤103包括:
所述客户端数据处理设备获取一预设规则;
所述客户端数据处理设备从所述N个服务器中确定满足所述预设规则的第一服务器。
在具体实施过程中,沿用上述例子,当Nginx设备确定出客户端请求获取的数据为健康表数据后,便根据存储在Nginx设备中的预设规则确定获取健康表数据的第一服务器。如,所述预设规则为随机时,则Nginx设备便从服务器B和服务器C中随机选择一个服务器作为第一服务器,如确定服务器B为第一服务器;或者,所述预设规则为:确定当前时刻负载小的服务器为第一服务器。这时,Nginx设备需要获取服务器B和服务器C的当前负载量,如服务器B的负载量为20,服务器C的负载量为30,则确定服务器B为第一服务器;或者,所述预设规则为:第一服务器的确定顺序为A>B>C。此时,由于服务器A处于异常状态,则自动根据预设设定的顺序确定出服务器B为第一服务器。
当然,本领域技术人员也可以根据实际使用需求设定其他的规则,在本发明实施例中不作限制。
在执行完成步骤103之后,本发明实施例中的方法便执行步骤104,即:所述客户端数据处理设备从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端。
在具体实施过程中,沿用上述例子,当Nginx设备确定出服务器B为第一服务器后,便将客户端发送的URL信息发送至服务器B,由服务器B获取与客户端对应的健康表数据,并将所述健康表数据反馈至Nginx设备, 并通过Nginx设备将健康表数据发送至客户端,完成了客户端对健康表数据的下载过程。
实施例二
基于与本发明实施例一相同的发明构思,请参考图4A-图4B,本发明实施例二提供一种数据下载设备,所述设备可以为Nginx设备,或者其他提供HTTP和反向代理服务器功能的设备,所述设备包括:状态确定模块10、接收模块20、服务器确定模块30以及数据获取模块40,而且本发明实施例二中的状态确定模块10、接收模块20、服务器确定模块30以及数据获取模块40可以通过硬件处理器(hardware processor)来实现相关功能单元,其中:
状态确定模块10,用于从M个服务器中确定处于正常状态的N个服务器,其中,M为大于等于1的整数,N为小于等于M的整数;
接收模块20,用于获得客户端发送的用于获得第一数据的数据请求;
服务器确定模块30,用于基于所述数据请求,从所述N个服务器中确定出第一服务器;
数据获取模块40,用于从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端。
在本发明实施例二中,状态确定模块10具体用于:
向所述M个服务器中每个服务器发送验证请求;
接收由所述M个服务器发送的M个响应信息;
基于所述M个响应信息,从所述M个服务器中确定出处于正常状态的N个服务器。
具体而言,若与所述数据下载设备通信的服务器分比为服务器A、服务器B及服务器C时,所述数据下载设备则通过状态确定模块10,向上述三个服务器发送验证请求,如http请求等,然后根据各个服务器的反馈信息中的响应码,确定出服务器A、服务器B及服务器C中处于正常状态的服务器,具体可参阅对应的方法实施例中的具体说明,这里不再赘述。
在本发明实施例二中,服务器确定模块30具体以如下两种主要实现方式进行说明:
第一种方式,服务器确定模块30具体用于:
获取所述数据请求的哈希值;
基于所述哈希值,从所述N个服务器中确定与所述哈希值对应的第一服务器。
具体而言,当所述数据下载设备接收到客户端发送的URL信息后,所述数据下载设备便通过服务器确定模块30计算URL信息的哈希值,并根据各个服务器的IP地址及URL信息的哈希值计算出每个服务器的分数,从而将分数最高的服务器确定为获取第一服务器。具体可参阅对应的方法实施例中的具体说明,这里不再赘述。
相应地,如图4A所示,当服务器确定模块30为上述实现方式时,所述数据下载设备中还包括有:存储模块50,用于建立并存储所述哈希值与所述第一服务器的第一对应关系。
具体而言,存储模块50具体可以是所述数据下载设备中的存储器,也可以是在所述数据下载设备中另外设置的新的存储器,在本发明实施例中不作限制。当服务器确定模块30确定与当前哈希值对应的第一服务器之后,存储模块50便将当前哈希值与第一服务器的IP地址的对应关系存储起来,这样,当所述数据下载设备下次接收到具有相同哈希值的信息时,便可以直接通过对应的服务器获取数据,提高数据获取速率。
第二种方式,服务器确定模块30具体用于:
获取一预设规则;
从所述N个服务器中确定满足所述预设规则的第一服务器。
具体而言,当所述数据下载设备接收到客户端发送的URL信息后,所述数据下载设备便直接根据存储器中预存的规则确定第一服务器,如随机选择,或者按照指定顺序选择等。
综上所述,本发明实施例中,客户端数据处理设备,如Nginx设备,会实时检测与之通信的各个服务器的工作状态,从而确定出处于正常状态的服务器,从而,当客户端数据处理设备接收到由客户端发送的数据请求时,便会自动从处于正常状态的服务器中获取客户端所需的数据,通过实时检测各个服务器的当前状态,避免了当提供数据的服务器发生故障时,客户端数据处理设备由于需要等待而造成的请求处理效率低下,实现了提高客户端数据处理设备的请求处理效率。
实施例三
图5为本发明实施例三提供的数据下载设备的结构示意图,数据下载 设备包括:总线501以及分别连接总线501的存储器502以及处理器503。其中,存储器502用于存储指令;处理器503用于执行所述指令,以在执行所述指令时执行如下步骤:从M个服务器中确定处于正常状态的N个服务器,其中,M为大于等于1的整数,N为小于等于M的整数;获得客户端发送的用于获得第一数据的数据请求;基于所述数据请求,从所述N个服务器中确定出第一服务器;从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端。
可选的,处理器503具体用于:
向所述M个服务器中每个服务器发送验证请求;
接收由所述M个服务器发送的M个响应信息;
基于所述M个响应信息,从所述M个服务器中确定出处于正常状态的N个服务器。
可选的,处理器503具体用于:
获取所述数据请求的哈希值;
基于所述哈希值,从所述N个服务器中确定与所述哈希值对应的第一服务器。
可选的,处理器503具体用于:
获取一预设规则;
从所述N个服务器中确定满足所述预设规则的第一服务器。
可选的,在从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端之后,处理器503还用于:
建立所述哈希值与所述第一服务器的第一对应关系,并将所述第一对应关系存储在所述客户端数据处理设备中。
实施例四
本发明实施例四提供一种非暂态存储介质,所述非暂态存储介质用于存储计算机程序,所述计算机程序包括用于执行前述数据下载方法的指令。
具体地,所述计算机程序可设置为:
向所述M个服务器中每个服务器发送验证请求;
接收由所述M个服务器发送的M个响应信息;
基于所述M个响应信息,从所述M个服务器中确定出处于正常状态的N个服务器。
具体地,所述计算机程序可设置为:
获取所述数据请求的哈希值;
基于所述哈希值,从所述N个服务器中确定与所述哈希值对应的第一服务器。
具体地,所述计算机程序可设置为:
获取一预设规则;
从所述N个服务器中确定满足所述预设规则的第一服务器。
具体地,在根据所述计算机程序,从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端之后,所述计算机程序还设置为:
建立所述哈希值与所述第一服务器的第一对应关系,并将所述第一对应关系存储在所述客户端数据处理设备中。
实施例五
本发明实施例五提供一种计算机程序产品,其特征在于,所述计算机程序产品包括用于执行前述数据下载方法的指令。
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不 使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims (13)

  1. 一种数据下载方法,应用于客户端数据处理设备,其特征在于,包括:
    所述客户端数据处理设备从M个服务器中确定处于正常状态的N个服务器,其中,M为大于等于1的整数,N为小于等于M的整数;
    所述客户端数据处理设备获得客户端发送的用于获得第一数据的数据请求;
    基于所述数据请求,所述客户端数据处理设备从所述N个服务器中确定出第一服务器;
    所述客户端数据处理设备从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端。
  2. 根据权利要求1所述的方法,其特征在于,所述客户端数据处理设备从M个服务器中确定处于正常状态的N个服务器,包括:
    所述客户端数据处理设备向所述M个服务器中每个服务器发送验证请求;
    所述客户端数据处理设备接收由所述M个服务器发送的M个响应信息;
    基于所述M个响应信息,所述客户端数据处理设备从所述M个服务器中确定出处于正常状态的N个服务器。
  3. 根据权利要求2所述的方法,其特征在于,所述基于所述数据请求,所述客户端数据处理设备从所述N个服务器中确定出第一服务器,包括:
    所述客户端数据处理设备获取所述数据请求的哈希值;
    基于所述哈希值,所述客户端数据处理设备从所述N个服务器中确定与所述哈希值对应的第一服务器。
  4. 根据权利要求2所述的方法,其特征在于,所述基于所述数据请求,所述客户端数据处理设备从所述N个服务器中确定出第一服务器,包括:
    所述客户端数据处理设备获取一预设规则;
    所述客户端数据处理设备从所述N个服务器中确定满足所述预设规则的第一服务器。
  5. 根据权利要求3所述的方法,其特征在于,在所述客户端数据处理设备从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述 客户端之后,所述方法还包括:
    所述客户端数据处理设备建立所述哈希值与所述第一服务器的第一对应关系,并将所述第一对应关系存储在所述客户端数据处理设备中。
  6. 一种数据下载设备,其特征在于,包括:
    状态确定模块,用于从M个服务器中确定处于正常状态的N个服务器,其中,M为大于等于1的整数,N为小于等于M的整数;
    接收模块,用于获得客户端发送的用于获得第一数据的数据请求;
    服务器确定模块,用于基于所述数据请求,从所述N个服务器中确定出第一服务器;
    数据获取模块,用于从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端。
  7. 根据权利要求6所述的设备,其特征在于,所述状态确定模块具体用于:
    向所述M个服务器中每个服务器发送验证请求;
    接收由所述M个服务器发送的M个响应信息;
    基于所述M个响应信息,从所述M个服务器中确定出处于正常状态的N个服务器。
  8. 根据权利要求7所述的设备,其特征在于,所述服务器确定模块具体用于:
    获取所述数据请求的哈希值;
    基于所述哈希值,从所述N个服务器中确定与所述哈希值对应的第一服务器。
  9. 根据权利要求7所述的设备,其特征在于,所述服务器确定模块具体用于:
    获取一预设规则;
    从所述N个服务器中确定满足所述预设规则的第一服务器。
  10. 根据权利要求8所述的设备,其特征在于,所述设备还包括:
    存储模块,用于建立并存储所述哈希值与所述第一服务器的第一对应关系。
  11. 一种数据下载设备,其特征在于,包括:
    存储器,用于存储指令;
    处理器,与所述存储器相连,用于执行所述指令,以在执行所述指令时执行如下步骤:
    从M个服务器中确定处于正常状态的N个服务器,其中,M为大于等于1的整数,N为小于等于M的整数;
    获得客户端发送的用于获得第一数据的数据请求;
    基于所述数据请求,从所述N个服务器中确定出第一服务器;
    从所述第一服务器获取所述第一数据,并将所述第一数据发送至所述客户端。
  12. 一种非暂态存储介质,其特征在于,所述非暂态存储介质用于存储计算机程序,所述计算机程序包括用于执行权利要求1至5任一项所述的方法的指令。
  13. 一种计算机程序产品,其特征在于,所述计算机程序产品包括用于执行权利要求1至5任一项所述的方法的指令。
PCT/CN2016/100414 2016-04-25 2016-09-27 一种数据下载方法及设备 WO2017185631A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610264262.8 2016-04-25
CN201610264262.8A CN105978939A (zh) 2016-04-25 2016-04-25 一种数据下载方法及设备

Publications (1)

Publication Number Publication Date
WO2017185631A1 true WO2017185631A1 (zh) 2017-11-02

Family

ID=56994809

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/100414 WO2017185631A1 (zh) 2016-04-25 2016-09-27 一种数据下载方法及设备

Country Status (2)

Country Link
CN (1) CN105978939A (zh)
WO (1) WO2017185631A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106790289A (zh) * 2017-03-07 2017-05-31 北京搜狐新媒体信息技术有限公司 一种基于Nginx服务器的动态负载处理方法及系统
CN106953758A (zh) * 2017-03-20 2017-07-14 北京搜狐新媒体信息技术有限公司 一种基于Nginx服务器的动态配置管理方法及系统
CN109558246A (zh) * 2018-12-04 2019-04-02 北京字节跳动网络技术有限公司 一种负载均衡方法、装置、电子设备及存储介质
CN111131188A (zh) * 2019-12-09 2020-05-08 北京海益同展信息科技有限公司 通信连接方法及服务器、客户端、存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102571959A (zh) * 2012-01-11 2012-07-11 北京奇虎科技有限公司 一种数据下载系统及方法
CN103442030A (zh) * 2013-07-31 2013-12-11 北京京东尚科信息技术有限公司 发送和处理业务请求信息的方法和系统以及客户端装置
WO2014093704A1 (en) * 2012-12-13 2014-06-19 Qualcomm Incorporated Loading a re-directed web resource on a web browser of a client device in a communications system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110078666A1 (en) * 2009-05-26 2011-03-31 University Of California System and Method for Reproducing Device Program Execution
CN102137165B (zh) * 2011-04-22 2013-04-10 南京邮电大学 一种基于对等网络的阿瑞斯索引系统的实现方法
CN102790799B (zh) * 2012-06-05 2015-01-21 电子科技大学 一种基于云安全服务的资源下载方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102571959A (zh) * 2012-01-11 2012-07-11 北京奇虎科技有限公司 一种数据下载系统及方法
WO2014093704A1 (en) * 2012-12-13 2014-06-19 Qualcomm Incorporated Loading a re-directed web resource on a web browser of a client device in a communications system
CN103442030A (zh) * 2013-07-31 2013-12-11 北京京东尚科信息技术有限公司 发送和处理业务请求信息的方法和系统以及客户端装置

Also Published As

Publication number Publication date
CN105978939A (zh) 2016-09-28

Similar Documents

Publication Publication Date Title
US11755371B1 (en) Data intake and query system with distributed data acquisition, indexing and search
CN107483627B (zh) 一种文件分发、下载方法、分发服务器、客户端及系统
CN108566290B (zh) 服务配置管理方法、系统、存储介质和服务器
WO2017185631A1 (zh) 一种数据下载方法及设备
CN109586969B (zh) 内容分发网络容灾方法、装置、计算机设备及存储介质
US9282141B2 (en) Method and system for loading file in webgame
US11190576B2 (en) File distribution and download method, distribution server, client terminal and system
CN110519409B (zh) 域名动态配置方法、装置、设备及存储介质
CN110661829B (zh) 文件下载方法及装置、客户端和计算机可读存储介质
CN106027644B (zh) 一种业务的校验方法及系统
CN106453460B (zh) 一种文件分发方法、装置和系统
WO2016023345A1 (zh) 灰度升级的方法及装置
US20140019957A1 (en) Method, apparatus, and system for sharing software among terminals
CN105227610A (zh) 一种文件上传、保存方法及装置
CN105743945A (zh) 基于切换下载源的文件下载方法及系统
US9438666B2 (en) Method and system for resource download
GB2507037A (en) Software application discovery using variable frequency file system scanning
CN112039718A (zh) 升级状态检测方法、服务端、设备及存储介质
CN107547468B (zh) 网络协议切换装置、方法及终端
CN110943876B (zh) Url状态检测方法、装置、设备和系统
CN111698281B (zh) 一种资源下载方法、装置、电子设备及存储介质
CN111147585B (zh) 设备升级方法、装置、存储介质及系统
CN106803830B (zh) 识别上网终端的方法、装置和系统、及uim卡
CN109302446B (zh) 跨平台访问方法、装置、电子设备及存储介质
CN106911749B (zh) 通知用户上下线的方法和装置

Legal Events

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

Ref country code: DE

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

Ref document number: 16900140

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 16900140

Country of ref document: EP

Kind code of ref document: A1