Movatterモバイル変換


[0]ホーム

URL:


CN104468594B - The method, apparatus and system of a kind of request of data - Google Patents

The method, apparatus and system of a kind of request of data
Download PDF

Info

Publication number
CN104468594B
CN104468594BCN201410776946.7ACN201410776946ACN104468594BCN 104468594 BCN104468594 BCN 104468594BCN 201410776946 ACN201410776946 ACN 201410776946ACN 104468594 BCN104468594 BCN 104468594B
Authority
CN
China
Prior art keywords
data
communication connection
request
client
data request
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
Application number
CN201410776946.7A
Other languages
Chinese (zh)
Other versions
CN104468594A (en
Inventor
王院生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qax Technology Group Inc
Original Assignee
Beijing Qianxin Technology Co Ltd
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 Beijing Qianxin Technology Co LtdfiledCriticalBeijing Qianxin Technology Co Ltd
Priority to CN201410776946.7ApriorityCriticalpatent/CN104468594B/en
Publication of CN104468594ApublicationCriticalpatent/CN104468594A/en
Application grantedgrantedCritical
Publication of CN104468594BpublicationCriticalpatent/CN104468594B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本发明公开了一种数据请求的方法、装置及系统,涉及互联网技术领域,能够解决HTTP连接的并发数受限的问题。本发明的方法,包括:建立一条通信连接;通过通信连接接收客户端上报的数据请求;在对数据请求进行响应前,通过通信连接继续接收同一客户端或不同客户端上报的其他数据请求;对不同的数据请求分别进行响应,并下发对应不同数据请求的数据内容。本发明适用于HTTP协议下进行数据请求的场景中。

The invention discloses a data request method, device and system, relates to the technical field of the Internet, and can solve the problem of limited concurrent numbers of HTTP connections. The method of the present invention includes: establishing a communication connection; receiving the data request reported by the client through the communication connection; before responding to the data request, continuing to receive other data requests reported by the same client or different clients through the communication connection; Respond to different data requests separately, and deliver data content corresponding to different data requests. The present invention is applicable to the scene of data request under the HTTP protocol.

Description

Translated fromChinese
一种数据请求的方法、装置及系统Method, device and system for data request

技术领域technical field

本发明涉及互联网技术领域,尤其涉及一种数据请求的方法、装置及系统。The present invention relates to the technical field of the Internet, in particular to a data request method, device and system.

背景技术Background technique

HTTP(Hypertext Transfer Protocol,超文本传送协议)是一种可以通过因特网传送万维网文档的数据的协议,其特点在于HTTP是一种请求/响应型的协议,即当客户端向服务器发送数据请求时,会建立一条HTTP连接,服务器通过该HTTP连接接收客户端发送的数据请求并向客户端返回对应的数据内容。客户端在获得服务器的响应后释放该HTTP连接,从而完成一次数据请求任务。当再次发送数据请求时,则需要客户端与服务器之间重新建立HTTP连接。HTTP (Hypertext Transfer Protocol, Hypertext Transfer Protocol) is a protocol that can transmit data of World Wide Web documents through the Internet. It is characterized in that HTTP is a request/response protocol, that is, when the client sends a data request to the server, An HTTP connection will be established through which the server receives the data request sent by the client and returns the corresponding data content to the client. The client releases the HTTP connection after obtaining the server's response, thus completing a data request task. When the data request is sent again, an HTTP connection needs to be re-established between the client and the server.

在上述数据请求的过程中,客户端每次在进行数据请求时都需要建立/释放一次HTTP连接,HTTP连接的建立过于频繁。对此,现有技术中还提供了另一种HTTP连接的建立方式,即HTTP长连接。HTTP连接长连接在得到响应后并不释放,客户端可以基于该连接继续发送请求,由此可以减少客户端建立HTTP连接的次数。In the process of the above data request, the client needs to establish/release an HTTP connection every time it makes a data request, and the HTTP connection is established too frequently. In this regard, another method for establishing an HTTP connection is provided in the prior art, that is, an HTTP persistent connection. The HTTP connection persistent connection is not released after receiving a response, and the client can continue to send requests based on the connection, thereby reducing the number of times the client establishes an HTTP connection.

但是,HTTP长连接也存在一定的问题,主要在于:HTTP连接数与客户端的数量是对应的,因此当局域网中的客户端数量较多时,服务器需要保持的连接数量也会较多。通常情况下,网络内HTTP连接的并发数会有一定的限制,例如,对于WINDOWS系统而言,一般情况下,只允许同时建立1024条HTTP连接,在网络优化后也仅能建立7000条HTTP连接;而对于LINUX系统而言,虽然其支持的并发数能够达到20000条,但是也具有一个并发数上限,并不能无限提高并发数。随着局域网规模的不断扩大,有限的并发数愈发无法满足急剧增长的客户端数量,特别是对于多级局域网而言,客户端与中继之间、中继与服务器之间的连接都需要建立HTTP连接,由此一来,局域网内可用的连接数量将会更加紧张。However, HTTP persistent connections also have certain problems, mainly because the number of HTTP connections corresponds to the number of clients. Therefore, when the number of clients in the local area network is large, the number of connections that the server needs to maintain will also be large. Under normal circumstances, the number of concurrent HTTP connections in the network will be limited. For example, for WINDOWS systems, under normal circumstances, only 1024 HTTP connections are allowed to be established at the same time, and only 7000 HTTP connections can be established after network optimization ; As for the LINUX system, although the number of concurrency it supports can reach 20,000, it also has an upper limit of the number of concurrency, and the number of concurrency cannot be increased infinitely. With the continuous expansion of the scale of the LAN, the limited number of concurrency is increasingly unable to meet the rapidly increasing number of clients, especially for multi-level LANs, the connections between clients and relays, and between relays and servers need to An HTTP connection is established, and as a result, the number of connections available on the LAN will be even tighter.

发明内容Contents of the invention

鉴于上述问题,本发明提出的一种数据请求的方法、装置及系统,能够解决HTTP连接的并发数受限的问题。In view of the above problems, a data request method, device and system proposed by the present invention can solve the problem of limited number of concurrent HTTP connections.

为解决上述技术问题,第一方面,本发明提供了一种数据请求的方法,该方法包括:In order to solve the above-mentioned technical problems, in a first aspect, the present invention provides a method for data request, the method comprising:

建立一条通信连接;Establish a communication connection;

通过所述通信连接接收客户端上报的数据请求;receiving the data request reported by the client through the communication connection;

在对所述数据请求进行响应前,通过所述通信连接继续接收同一客户端或不同客户端上报的其他数据请求;Before responding to the data request, continue to receive other data requests reported by the same client or different clients through the communication connection;

对不同的数据请求分别进行响应,并下发对应不同数据请求的数据内容。Respond to different data requests separately, and deliver the data content corresponding to different data requests.

第二方面,本发明提供了一种数据请求的装置,该装置包括:In a second aspect, the present invention provides a data request device, which includes:

建立单元,用于建立一条通信连接;An establishment unit, configured to establish a communication connection;

接收单元,用于通过所述建立单元建立的所述通信连接接收客户端上报的数据请求;a receiving unit, configured to receive the data request reported by the client through the communication connection established by the establishing unit;

所述接收单元,还用于在对所述数据请求进行响应前,通过所述通信连接继续接收同一客户端或不同客户端上报的其他数据请求;The receiving unit is further configured to continue to receive other data requests reported by the same client or different clients through the communication connection before responding to the data request;

响应单元,用于对所述接收单元接收的不同的数据请求分别进行响应,并下发对应不同数据请求的数据内容。The response unit is configured to respectively respond to different data requests received by the receiving unit, and issue data contents corresponding to different data requests.

第三方面,本发明提供了一种数据请求的系统,该系统包括:客户端、服务器;其中所述服务器包含如第二方面所述的装置;In a third aspect, the present invention provides a data request system, the system includes: a client, a server; wherein the server includes the device as described in the second aspect;

所述客户端,用于:The client for:

与所述服务器建立一条通信连接;establishing a communication connection with the server;

通过所述通信连接向所述服务器上报数据请求,reporting a data request to the server through the communication connection,

在获得所述服务器的响应之前,通过所述通信连接继续向所述服务器上报其他数据请求;Before obtaining a response from the server, continue to report other data requests to the server through the communication connection;

通过所述通信连接接收所述服务器下发的对应不同数据请求的数据内容。The data content corresponding to different data requests issued by the server is received through the communication connection.

借由上述技术方案,本发明提供的数据请求的方法、装置及系统,能够在不同客户端向服务器发送数据请求时,服务器只与客户端建立一条通信连接,通过该通信连接可以接收不同的数据请求,并且对上一个数据请求的响应并不影响对下一个数据请求的接收,即可以边进行响应边接收新的数据请求。与现有技术中需要客户端与服务器之间建立一一对应的通信连接相比,本发明中,在客户端与服务器之间只建立一条通信连接,不同客户端均可以通过该通信连接完成与服务器之间的数据交互,从而达到多路复用的效果,而无需考虑并发数的问题,进而解决了现有技术中通信连接的并发数受限的情况。By means of the above technical solution, the data request method, device and system provided by the present invention can, when different clients send data requests to the server, the server only establishes a communication connection with the client, through which different data can be received. request, and the response to the previous data request does not affect the reception of the next data request, that is, a new data request can be received while responding. Compared with the need to establish a one-to-one communication connection between the client and the server in the prior art, in the present invention, only one communication connection is established between the client and the server, and different clients can communicate with each other through this communication connection. The data exchange between the servers achieves the effect of multiplexing without considering the problem of the number of concurrency, thereby solving the situation that the number of concurrency of communication connections is limited in the prior art.

上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the specific embodiments of the present invention are enumerated below.

附图说明Description of drawings

通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating a preferred embodiment and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same components. In the attached picture:

图1示出了一种数据请求的方法的流程图;Fig. 1 shows a flow chart of a method for data request;

图2示出了另一种数据请求的方法的流程图;Fig. 2 shows the flowchart of another method for data request;

图3示出了一种数据帧的结构示意图;Fig. 3 shows a schematic structural diagram of a data frame;

图4示出了一种建立通信连接的结构示意图;FIG. 4 shows a schematic structural diagram of establishing a communication connection;

图5示出了另一种建立通信连接的结构示意图;FIG. 5 shows another schematic structural diagram of establishing a communication connection;

图6示出了一种数据请求的装置的结构示意图;FIG. 6 shows a schematic structural diagram of a device for data request;

图7示出了另一种数据请求的装置的结构示意图;FIG. 7 shows a schematic structural diagram of another device for data request;

图8示出了一种数据请求的系统的结构示意图。Fig. 8 shows a schematic structural diagram of a data request system.

具体实施方式Detailed ways

下面将参照附图更详细地描述本发明的示例性实施例。虽然附图中显示了本发明的示例性实施例,然而应当理解,可以以各种形式实现本发明而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本发明,并且能够将本发明的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the invention may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.

本发明实施例提供了一种数据请求的方法,本发明可以应用于客户端与服务器组成的系统中,下面以服务器侧为执行主体进行说明,如图1所示,该方法包括:The embodiment of the present invention provides a data request method. The present invention can be applied to a system composed of a client and a server. The server side is used as the execution subject for description below. As shown in FIG. 1 , the method includes:

101、服务器建立一条通信连接。101. The server establishes a communication connection.

其中,服务器与不同的客户端建立一条通信连接,该通信连接可以为HTTP(Hypertext Transfer Protocol,超文本传送协议)连接。Wherein, the server establishes a communication connection with different clients, and the communication connection may be an HTTP (Hypertext Transfer Protocol, hypertext transfer protocol) connection.

示例性的,局域网中有5个客户端,分别为客户端1、客户端2、客户端3、客户端4和客户端5,在5个客户端与服务器之间建立一条通信连接A,5个客户端中的每个客户端均可以通过通信连接A与服务器进行通信,即5个客户端共用通信连接A。Exemplarily, there are 5 clients in the local area network, namely client 1, client 2, client 3, client 4 and client 5, and a communication connection A, 5 is established between the 5 clients and the server. Each of the clients can communicate with the server through the communication connection A, that is, the communication connection A is shared by the five clients.

102、服务器通过通信连接接收客户端上报的数据请求。102. The server receives the data request reported by the client through the communication connection.

其中,所有的客户端可以位于一个终端中,也可以位于不同的终端中。该终端可以为台式计算机、笔记本等。例如,有5个客户端,分别为客户端1、客户端2、客户端3、客户端4和客户端5,其中,客户端1和客户端2均位于终端1中,客户端3和客户端5均位于终端2中,客户端4位于终端3中。Wherein, all clients may be located in one terminal, or may be located in different terminals. The terminal can be a desktop computer, a notebook, and the like. For example, there are 5 clients, namely Client 1, Client 2, Client 3, Client 4 and Client 5, where Client 1 and Client 2 are located in Terminal 1, Client 3 and Client Client 5 is located in Terminal 2, and Client 4 is located in Terminal 3.

需要说明的是,数据请求中包含有请求的来源信息、请求的具体对象以及请求的校验信息等等。例如,数据请求中请求的来源信息为位于终端1中的客户端1,请求的具体对象为一个链接:http://www.google.com,校验信息为X。It should be noted that the data request includes the source information of the request, the specific object of the request, verification information of the request, and the like. For example, the source information requested in the data request is client 1 located in terminal 1, the specific object of the request is a link: http://www.google.com, and the verification information is X.

103、服务器在对数据请求进行响应前,通过通信连接继续接收同一客户端或不同客户端上报的其他数据请求。103. Before responding to the data request, the server continues to receive other data requests reported by the same client or different clients through the communication connection.

其中,服务器对数据请求的响应并不影响对其他数据请求的接收,服务器可以在对已接收的数据请求进行响应前,接收其他数据请求,并且该数据请求并不对客户端进行限定,即可以与上一个数据请求同属一个客户端,也可以属于不同的客户端。Among them, the server's response to the data request does not affect the reception of other data requests, the server can receive other data requests before responding to the received data request, and the data request does not limit the client, that is, it can communicate with The last data request belongs to the same client, or it can belong to different clients.

例如,当前,服务器接收的数据请求为客户端1的数据请求1,则在未对数据请求1进行响应时,服务器便可以接收客户端1的数据请求2,或者接收客户端2的数据请求1。For example, currently, the data request received by the server is the data request 1 of the client 1, and the server can receive the data request 2 of the client 1 or the data request 1 of the client 2 when there is no response to the data request 1 .

104、服务器对不同的数据请求分别进行响应,并下发对应不同数据请求的数据内容。104. The server responds to different data requests respectively, and delivers data content corresponding to different data requests.

其中,在服务器向客户端回复数据请求的响应时,可以将携带数据请求的数据内容的响应信息发送给客户端。Wherein, when the server replies a data request response to the client, it may send the response information carrying the data content of the data request to the client.

在步骤103中提到,可以在对上一个数据请求进行响应前,接收其他数据请求,在实际应用中,可以一边对上一个数据请求进行响应,一边接收下一个数据请求。例如,服务器向客户端1发送响应1的同时,可以接收客户端2的数据请求1。It is mentioned in step 103 that other data requests may be received before responding to the previous data request. In practical applications, the next data request may be received while responding to the previous data request. For example, the server may receive data request 1 from client 2 while sending response 1 to client 1.

此外,还可以先接收第一批数据请求,再对第一批数据请求中的不同数据请求分别进行响应,并且在对第一批数据请求进行响应的同时,还可以接收第二批数据请求。例如,当前服务器接收的数据请求为客户端1的数据请求1、数据请求2,客户端2的数据请求1,以及客户端3的数据请求1,则分别对其进行响应,同时可以依次接收客户端2发送的数据请求2,客户端4发送的数据请求1。In addition, the first batch of data requests may be received first, and then different data requests in the first batch of data requests may be responded to separately, and the second batch of data requests may also be received while responding to the first batch of data requests. For example, if the data requests currently received by the server are data request 1, data request 2 from client 1, data request 1 from client 2, and data request 1 from client 3, they will respond to them respectively, and at the same time, they can receive client requests one by one. Data request 2 sent by client 2, and data request 1 sent by client 4.

需要说明的是,服务器对不同数据请求进行响应的实际原则是以接收数据请求的先后顺序为依据,分别对其进行响应。例如,服务器按顺序接收的数据请求依次为客户端2的第3个数据请求、客户端4的第1个数据请求、客户端1的第5个数据请求和客户端10的第8个数据请求,因此服务器对接收的4个数据请求的响应顺序也为客户端2的第3个数据请求、客户端4的第1个数据请求、客户端1的第5个数据请求和客户端10的第8个数据请求。It should be noted that the actual principle for the server to respond to different data requests is based on the sequence in which the data requests are received, and respond to them respectively. For example, the data requests received by the server in sequence are the third data request from client 2, the first data request from client 4, the fifth data request from client 1, and the eighth data request from client 10. , so the response order of the server to the received 4 data requests is also the third data request of client 2, the first data request of client 4, the fifth data request of client 1 and the first data request of client 10 8 data requests.

本发明实施例提供的数据请求的方法,能够在不同客户端向服务器发送数据请求时,服务器只与客户端建立一条通信连接,通过该通信连接可以接收不同的数据请求,并且对上一个数据请求的响应并不影响对下一个数据请求的接收,即可以边进行响应边接收新的数据请求。与现有技术中需要客户端与服务器之间建立一一对应的通信连接相比,本发明中,在客户端与服务器之间只建立一条通信连接,不同客户端均可以通过该通信连接完成与服务器之间的数据交互,从而达到多路复用的效果,而无需考虑并发数的问题,进而解决了现有技术中通信连接的并发数受限的情况。The data request method provided by the embodiment of the present invention can, when different clients send data requests to the server, the server only establishes a communication connection with the client, through which different data requests can be received, and the previous data request The response does not affect the reception of the next data request, that is, a new data request can be received while responding. Compared with the need to establish a one-to-one communication connection between the client and the server in the prior art, in the present invention, only one communication connection is established between the client and the server, and different clients can communicate with each other through this communication connection. The data exchange between the servers achieves the effect of multiplexing without considering the problem of the number of concurrency, thereby solving the situation that the number of concurrency of communication connections is limited in the prior art.

进一步的,作为对图1所示方法的细化及扩展,本发明的另一个实施例还提供了一种数据请求的方法,如图2所示,该方法包括:Further, as a refinement and extension of the method shown in Figure 1, another embodiment of the present invention also provides a data request method, as shown in Figure 2, the method includes:

201、服务器建立一条通信连接。201. The server establishes a communication connection.

本步骤的实现方式与图1中步骤101的实现方式相同,此处不再赘述。The implementation of this step is the same as the implementation of step 101 in FIG. 1 , and will not be repeated here.

202、服务器通过通信连接接收客户端上报的数据请求。202. The server receives the data request reported by the client through the communication connection.

数据请求携带用于请求数据的数据帧,该数据帧记录有请求来源、请求序号、数据位和校验位。其中,请求来源用于对上报数据请求的客户端进行标记;请求序号用于对数据请求进行标记;数据位用于对数据请求的具体请求对象进行标记,该请求对象可以为一个链接地址,也可以为其他信息;校验位用于记录数据请求的校验值,当服务器接收到数据请求后,计算出相应的校验值,并与数据请求中记录的校验值进行比较,若相同,则服务器接收到的数据请求正确,若不相同,则服务器接收到的数据请求错误。The data request carries a data frame for requesting data, and the data frame records the request source, request serial number, data bits and check bits. Among them, the request source is used to mark the client that reported the data request; the request serial number is used to mark the data request; the data bit is used to mark the specific request object of the data request, and the request object can be a link address, or It can be other information; the check digit is used to record the check value of the data request. When the server receives the data request, it calculates the corresponding check value and compares it with the check value recorded in the data request. If they are the same, Then the data request received by the server is correct, if not, the data request received by the server is wrong.

示例性的,图3为客户端12向服务器发送的第45个数据请求中的数据帧的具体表现形式。其中,数据位中记录有链接http://www.google.com。第45个数据请求的校验位为X,当服务器接收到该数据请求时,会对数据请求中携带的数据帧中的内容进行计算而得出校验值Y,将Y与X进行比较,若X=Y,则接收的数据请求正确,若X≠Y,则接收的数据请求错误。Exemplarily, FIG. 3 is a specific representation of the data frame in the 45th data request sent by the client 12 to the server. Wherein, a link http://www.google.com is recorded in the data bit. The check digit of the 45th data request is X. When the server receives the data request, it will calculate the content in the data frame carried in the data request to obtain the check value Y, and compare Y with X. If X=Y, the received data request is correct, and if X≠Y, the received data request is wrong.

需要说明的是,服务器与客户端两侧计算校验值的使用方法相同,基于数据请求的字段内容计算校验值,如果数据请求在客户端与服务器两侧字段内容没有变化,那么两侧计算出的校验值应当相同,所以我们可以通过这种机制防止数据请求在向服务器上报的过程中被篡改。It should be noted that the method of calculating the verification value on both sides of the server and the client is the same, and the verification value is calculated based on the field content of the data request. The check values should be the same, so we can use this mechanism to prevent the data request from being tampered with in the process of reporting to the server.

本步骤中,通过在数据帧中记录数据请求的请求来源和请求序号,可以对数据请求做唯一的标识,从而可以保证服务器对不同的数据请求作出与之对应的响应,向正确的客户端反馈数据内容,进而避免串包现象发生;通过在数据帧中记录校验值,可以在保证数据请求传输正确的情况下,对数据请求进行响应,由此防止第三方对客户端上报的数据请求进行篡改。In this step, by recording the request source and request sequence number of the data request in the data frame, the data request can be uniquely identified, thereby ensuring that the server responds to different data requests and feeds back to the correct client Data content, thereby avoiding the occurrence of packet strings; by recording the check value in the data frame, it is possible to respond to the data request under the condition of ensuring that the data request is transmitted correctly, thereby preventing the third party from modifying the data request reported by the client. tamper.

进一步的,服务器在向客户端下发数据内容时,也可以根据数据内容的属性信息(如名称、大小、版本等)计算出一个新的校验值,并将其与数据内容一同下发给客户端,由客户端来验证该数据内容是否在下发过程中被窜改。其中,客户端验证数据内容是否被窜改的验证机制与前述验证机制相同,在此不再赘述。Furthermore, when the server sends the data content to the client, it can also calculate a new check value according to the attribute information (such as name, size, version, etc.) of the data content, and send it to the client together with the data content. The client, the client shall verify whether the data content has been tampered with during the sending process. Wherein, the verification mechanism for the client to verify whether the data content has been tampered with is the same as the aforementioned verification mechanism, and will not be repeated here.

203、服务器在对数据请求进行响应前,通过通信连接继续接收同一客户端或不同客户端上报的其他数据请求。203. Before responding to the data request, the server continues to receive other data requests reported by the same client or different clients through the communication connection.

本步骤的实现方式与图1中步骤103的实现方式相同,此处不再赘述。The implementation of this step is the same as the implementation of step 103 in FIG. 1 , and will not be repeated here.

现有技术中,当服务器接收到数据请求时,就会对其进行响应,即每接收到一个数据请求就会响应一次,从而存在服务器响应频繁的现象,进而频繁占用服务器的资源。因此,可选的,为了解决服务器响应频繁的问题,本实施例提供了另一种数据请求响应的方案,具体实现方式如步骤204至步骤205:In the prior art, when the server receives a data request, it will respond to it, that is, it will respond once every time a data request is received, so there is a phenomenon that the server responds frequently, and then frequently occupies the resources of the server. Therefore, optionally, in order to solve the problem of frequent server responses, this embodiment provides another data request response solution, and the specific implementation method is as follows from step 204 to step 205:

204、服务器对接收的数据请求划分批次。204. The server divides the received data requests into batches.

可选的,本步骤中对接收到的数据请求进行批次的划分可以采用以下两种方式。Optionally, the batch division of the received data requests in this step may adopt the following two methods.

方式一:method one:

按照预设的字段长度对不断上报的数据请求进行截取,将总数据长度不超过字段长度的多个数据请求划分到同一批次。The continuously reported data requests are intercepted according to the preset field length, and multiple data requests whose total data length does not exceed the field length are divided into the same batch.

其中,服务器不断接收相同或不同客户端上报的数据请求,若接收到的数据请求的总数据长度大于或等于预设的字段长度,则截取部分数据请求,使其在均为完整的数据请求的前提下,总数据长度小于或等于预设的字段长度,并将其划分为同一批次的数据请求。Among them, the server continuously receives data requests reported by the same or different clients. If the total data length of the received data requests is greater than or equal to the preset field length, some data requests are intercepted so that they are all complete data requests. On the premise that the total data length is less than or equal to the preset field length, it is divided into the same batch of data requests.

示例性的,当前,服务器接收到5个数据请求,其中,数据请求1的数据长度为250,数据请求2的数据长度为240,数据请求3的数据长度为256,数据请求4的数据长度为238,数据请求5的数据长度为255,所以5个数据请求的总数据长度为1239,数据请求1到数据请求4的总数据长度为984,而预设的字段长度为1000,所以将数据请求1到数据请求4划分为同一批次,将数据请求5划分为下一个批次。Exemplarily, currently, the server receives 5 data requests, wherein the data length of data request 1 is 250, the data length of data request 2 is 240, the data length of data request 3 is 256, and the data length of data request 4 is 238, the data length of data request 5 is 255, so the total data length of 5 data requests is 1239, the total data length of data request 1 to data request 4 is 984, and the preset field length is 1000, so the data request Data requests 1 to 4 are divided into the same batch, and data request 5 is divided into the next batch.

方式二:Method 2:

按照预设帧数对不断上报的数据请求进行截取,将与预设帧数数量相同的数据帧所对应的多个数据请求划分到同一批次。The continuously reported data requests are intercepted according to the preset number of frames, and multiple data requests corresponding to the data frames with the same number of preset frames are divided into the same batch.

其中,一个数据请求对应一个数据帧。服务器不断接收数据请求,当接收的数据请求的个数与预设帧数相同时,将当前所接收的数据请求划分为同一批次的数据请求,而将下一批与预设帧数相同的多个数据请求划分为下一批次的数据请求。Among them, one data request corresponds to one data frame. The server continues to receive data requests. When the number of received data requests is the same as the preset number of frames, the currently received data requests are divided into the same batch of data requests, and the next batch of data requests with the same number of preset frames is divided into Multiple data requests are divided into the next batch of data requests.

例如,预设帧数为10,若当前接收到的数据请求的个数为10,则将已接收的10个数据请求划分到同一批次,而之后接收的第11个数据请求至第20个数据请求则划分到下一批次,依次采取该方法进行批次的划分。For example, the preset number of frames is 10, if the number of currently received data requests is 10, then the 10 received data requests will be divided into the same batch, and the 11th data request received later will go to the 20th The data request is divided into the next batch, and this method is adopted in turn to divide the batches.

205、服务器按批次集中响应数据请求,并下发对应不同数据请求的数据内容。205. The server collectively responds to the data requests in batches, and delivers data content corresponding to different data requests.

其中,当服务器所接收的数据请求的总数据长度未达到预设的字段长度,或者所接收的数据请求的个数未达到预设帧数时,继续接收之后的数据请求,直至满足上述条件,将当前批次的划分完成时,才对该批次的数据请求进行集中响应,并向该批次的数据请求对应的客户端发送对应的数据内容。Wherein, when the total data length of the data request received by the server does not reach the preset field length, or the number of received data requests does not reach the preset frame number, continue to receive subsequent data requests until the above conditions are met, When the division of the current batch is completed, the data request of the batch is responded to collectively, and the corresponding data content is sent to the client corresponding to the data request of the batch.

以数据帧的划分方式为例进行具体说明:Take the division method of the data frame as an example for specific explanation:

已知预设帧数为15,当前服务器接收的数据请求的个数为13,则此时服务器不对已接收的13个数据请求进行响应,而是继续等待,直至接收到15个数据请求,才进行集中响应,并下发对应的数据请求的数据内容。It is known that the preset number of frames is 15, and the number of data requests currently received by the server is 13. At this time, the server does not respond to the received 13 data requests, but continues to wait until 15 data requests are received. Make a centralized response and deliver the data content of the corresponding data request.

需要说明的是,与图1中响应不同数据请求的先后机制相类似的,本实施例中,服务器对不同批次数据请求的响应顺序由各批次上报的先后顺序来决定。It should be noted that, similar to the sequence mechanism for responding to different data requests in FIG. 1 , in this embodiment, the order in which the server responds to different batches of data requests is determined by the order in which each batch is reported.

在实际应用中,在以上方法实施例的基础上,为了进一步加快数据请求传送的速度,还可以在已建立的通信连接的基础上,再建立至少一条通信连接,建立完成后,所有的通信连接并发执行任务。其中,进一步建立的至少一条通信连接与已建立的通信连接的具体相同的功能。In practical applications, on the basis of the above method embodiments, in order to further speed up the transmission of data requests, at least one communication connection can be established on the basis of the established communication connections. After the establishment is completed, all communication connections Execute tasks concurrently. Wherein, the further established at least one communication connection has the same function as the established communication connection.

需要说明的是,进一步建立的至少一条通信连接的数量是有限的。进一步建立至少一条通信连接时,需要使得通信连接的总数与服务器的CPU(Central Processing Unit,中央处理器)的核数相同。It should be noted that the number of at least one further established communication connection is limited. When further establishing at least one communication connection, it is necessary to make the total number of communication connections equal to the number of cores of a CPU (Central Processing Unit, central processing unit) of the server.

例如,如图4所示,CPU的核数为4,则在客户端与服务器之间可以建立4条通信连接,其中,假设客户端的个数为40,通信连接1是客户端1至客户端10共用的一条连接,通信连接2是客户端11至客户端20共用的一条连接,通信连接3是客户端21至客户端30共用的一条连接,通信连接4是客户端31至客户端40共用的一条连接。For example, as shown in Figure 4, the number of cores of the CPU is 4, then 4 communication connections can be established between the client and the server, wherein, assuming that the number of clients is 40, communication connection 1 is from client 1 to 10, communication connection 2 is a connection shared by client 11 to client 20, communication connection 3 is a connection shared by client 21 to client 30, and communication connection 4 is shared by client 31 to client 40 of a connection.

实际应用中,当本实施例的方案应用于nginx系统中时,也可以直接将通信连接的数量设定为与nginx模块的进程数相同的数量。这是由于,在nginx系统中,当nginx启动时,会按照CPU的核数建立进程,即建立与CPU核数相同的进程。因此,在nginx系统中,也可以直接将通信连接的数量设置为nginx进程的数量,其效果与前述按照CPU数量建立通信连接的效果相同。In practical applications, when the solution of this embodiment is applied to the nginx system, the number of communication connections can also be directly set to be the same as the number of processes of the nginx module. This is because, in the nginx system, when nginx starts, processes will be created according to the number of CPU cores, that is, processes with the same number of CPU cores will be created. Therefore, in the nginx system, the number of communication connections can also be directly set to the number of nginx processes, and the effect is the same as the aforementioned effect of establishing communication connections according to the number of CPUs.

此外,以上所述方法实施例不仅可以应用于客户端与服务器直接通过网络进行数据交互的场景中,还可以应用于具有中继场景中,例如,在客户端与服务器之间有个二级中心,该二级中心用于管理所有的客户端,并与服务器之间进行通信。又如,在局域网内,设置了一个代理服务器,则用户通过客户端访问服务器时,需要知道代理服务器的地址、端口等详细资料,从而通过代理服务器才可以访问服务器。In addition, the method embodiments described above can be applied not only to the scenario where the client and the server directly exchange data through the network, but also to the scenario with relays, for example, there is a secondary center between the client and the server , the secondary center is used to manage all clients and communicate with the server. For another example, if a proxy server is set in the local area network, when the user accesses the server through the client, he needs to know the address, port and other details of the proxy server, so that he can access the server through the proxy server.

示例性的,如图5所示,在客户端与服务器之间有个代理服务器,则在客户端与代理服务器之间建立一条通信连接,在代理服务器与服务器之间建立一条通信连接,不同客户端通过共用两条通信连接,便可以完成与服务器之间的数据交互。Exemplary, as shown in Figure 5, there is a proxy server between the client and the server, then a communication connection is established between the client and the proxy server, and a communication connection is established between the proxy server and the server. The terminal can complete the data interaction with the server by sharing two communication connections.

需要说明的是,上述场景中,也可以建立与CPU核数或nginx的进程数相同的少数几条通信连接,在此不作限定。It should be noted that, in the above scenario, a few communication connections that are equal to the number of CPU cores or the number of nginx processes can also be established, which is not limited here.

现有技术中,由于客户端与服务器之间建立一一对应的通信连接,所以当客户端与服务器之间增加中继时,则通信连接需要成倍的增加,使得服务器需要维护的并发数更多,而本实施例只是在客户端与中继中间、中继与服务器之间分别建立少数的通信连接,从而避免了并发数受限的问题。In the prior art, since a one-to-one communication connection is established between the client and the server, when a relay is added between the client and the server, the communication connection needs to be multiplied, so that the number of concurrency that the server needs to maintain is even greater. However, this embodiment only establishes a small number of communication connections between the client and the relay, and between the relay and the server, thereby avoiding the problem of limited concurrency.

进一步的,作为对上述各方法实施例的实现,在本发明的另一个实施例中,还提供了一种数据请求的装置,如图6所示,该装置包括:建立单元31、接收单元32、响应单元33。其中,Further, as an implementation of the above method embodiments, in another embodiment of the present invention, a device for data request is also provided, as shown in FIG. 6 , the device includes: an establishment unit 31, a receiving unit 32 , the response unit 33 . in,

建立单元31,用于建立一条通信连接;Establishing unit 31, configured to establish a communication connection;

接收单元32,用于通过建立单元31建立的通信连接接收客户端上报的数据请求;The receiving unit 32 is configured to receive the data request reported by the client through the communication connection established by the establishing unit 31;

接收单元32,还用于在对数据请求进行响应前,通过通信连接继续接收同一客户端或不同客户端上报的其他数据请求;The receiving unit 32 is further configured to continue to receive other data requests reported by the same client or different clients through the communication connection before responding to the data request;

响应单元33,用于对接收单元32接收的不同的数据请求分别进行响应,并下发对应不同数据请求的数据内容。The response unit 33 is configured to respectively respond to different data requests received by the receiving unit 32, and deliver data content corresponding to different data requests.

进一步的,接收单元32接收的数据请求携带用于请求数据的数据帧,数据帧记录有请求来源、请求序号、数据位和校验位;Further, the data request received by the receiving unit 32 carries a data frame for requesting data, and the data frame records a request source, a request serial number, a data bit and a check bit;

其中,请求来源用于对上报数据请求的客户端进行标记;Among them, the request source is used to mark the client that reports the data request;

请求序号用于对数据请求进行标记;The request sequence number is used to mark the data request;

数据位用于对数据请求的具体请求对象进行标记;The data bit is used to mark the specific request object of the data request;

校验位用于记录数据请求的校验值。The check digit is used to record the check value of the data request.

进一步的,如图7所示,响应单元33,包括:Further, as shown in Figure 7, the response unit 33 includes:

划分模块331,用于对接收的数据请求划分批次;A division module 331, configured to divide the received data request into batches;

响应模块332,用于按划分模块331划分的批次集中响应数据请求。The response module 332 is configured to collectively respond to the data request according to the batches divided by the division module 331 .

进一步的,划分模块331,用于按照预设的字段长度对不断上报的数据请求进行截取,将总数据长度不超过字段长度的多个数据请求划分到同一批次。Further, the dividing module 331 is configured to intercept the continuously reported data requests according to the preset field length, and divide multiple data requests whose total data length does not exceed the field length into the same batch.

进一步的,划分模块331,用于按照预设帧数对不断上报的数据请求进行截取,将与预设帧数数量相同的数据帧所对应的多个数据请求划分到同一批次;Further, the division module 331 is configured to intercept the continuously reported data requests according to the preset number of frames, and divide multiple data requests corresponding to the data frames with the same number of preset frames into the same batch;

其中,一个数据请求对应一个数据帧。Among them, one data request corresponds to one data frame.

进一步的,建立单元31,还用于进一步建立至少一条通信连接,至少一条通信连接具有与建立单元31建立的通信连接相同的功能。Further, the establishment unit 31 is further configured to further establish at least one communication connection, and the at least one communication connection has the same function as the communication connection established by the establishment unit 31 .

进一步的,建立单元31,用于建立至少一条通信连接,使得通信连接总数与中央处理器CPU的核数相同。Further, the establishment unit 31 is configured to establish at least one communication connection, so that the total number of communication connections is the same as the number of cores of the central processing unit CPU.

进一步的,建立单元31,用于建立至少一条通信连接,使得通信连接总数与nginx的进程数量相同。Further, the establishment unit 31 is configured to establish at least one communication connection, so that the total number of communication connections is the same as the number of nginx processes.

进一步的,建立单元31建立的通信连接为超文本传送协议HTTP连接。Further, the communication connection established by the establishing unit 31 is a hypertext transfer protocol HTTP connection.

本发明实施例提供的数据请求的装置,能够在不同客户端向服务器发送数据请求时,服务器只与客户端建立一条通信连接,通过该通信连接可以接收不同的数据请求,并且对上一个数据请求的响应并不影响对下一个数据请求的接收,即可以边进行响应边接收新的数据请求。与现有技术中需要客户端与服务器之间建立一一对应的通信连接相比,本发明中,在客户端与服务器之间只建立一条通信连接,不同客户端均可以通过该通信连接完成与服务器之间的数据交互,从而达到多路复用的效果,而无需考虑并发数的问题,进而解决了现有技术中通信连接的并发数受限的情况。The data request device provided by the embodiment of the present invention can, when different clients send data requests to the server, the server only establishes one communication connection with the client, through which different data requests can be received, and the previous data request The response does not affect the reception of the next data request, that is, a new data request can be received while responding. Compared with the need to establish a one-to-one communication connection between the client and the server in the prior art, in the present invention, only one communication connection is established between the client and the server, and different clients can communicate with each other through this communication connection. The data exchange between the servers achieves the effect of multiplexing without considering the problem of the number of concurrency, thereby solving the situation that the number of concurrency of communication connections is limited in the prior art.

通过在数据帧中记录数据请求的请求来源和请求序号,可以对数据请求做唯一的标识,从而可以保证服务器对不同的数据请求作出与之对应的响应,向正确的客户端反馈数据内容,进而避免串包现象发生;通过在数据帧中记录校验值,可以在保证数据请求传输正确的情况下,对数据请求进行响应,由此防止第三方对客户端上报的数据请求进行篡改。By recording the request source and request serial number of the data request in the data frame, the data request can be uniquely identified, so that the server can make corresponding responses to different data requests, and feed back the data content to the correct client. Avoid the occurrence of packet strings; by recording the check value in the data frame, it is possible to respond to the data request while ensuring that the data request is transmitted correctly, thereby preventing third parties from tampering with the data request reported by the client.

现有技术中,由于客户端与服务器之间建立一一对应的通信连接,所以当客户端与服务器之间增加中继时,则通信连接需要成倍的增加,使得服务器需要维护的并发数更多,而本实施例只是在客户端与中继中间、中继与服务器之间分别建立少数的通信连接,从而避免了并发数受限的问题。In the prior art, since a one-to-one communication connection is established between the client and the server, when a relay is added between the client and the server, the communication connection needs to be multiplied, so that the number of concurrency that the server needs to maintain is even greater. However, this embodiment only establishes a small number of communication connections between the client and the relay, and between the relay and the server, thereby avoiding the problem of limited concurrency.

进一步的,在本发明的另一个实施例中,还提供了一种数据请求的系统,如图8所示,系统包括:客户端41、服务器42;其中服务器42包含图6至图7的装置;Further, in another embodiment of the present invention, a data request system is also provided, as shown in FIG. 8 , the system includes: a client 41 and a server 42; wherein the server 42 includes the devices shown in FIG. 6 to FIG. 7 ;

客户端41,用于:Client 41 for:

与服务器42建立一条通信连接;Establish a communication connection with server 42;

通过通信连接向服务器42上报数据请求,Report data request to server 42 through communication connection,

在获得服务器42的响应之前,通过通信连接继续向服务器42上报其他数据请求;Before obtaining the response of server 42, continue to report other data requests to server 42 through communication connection;

通过通信连接接收服务器42下发的对应不同数据请求的数据内容。The data content corresponding to different data requests issued by the server 42 is received through the communication connection.

本发明实施例提供的数据请求的系统,能够在不同客户端向服务器发送数据请求时,服务器只与客户端建立一条通信连接,通过该通信连接可以接收不同的数据请求,并且对上一个数据请求的响应并不影响对下一个数据请求的接收,即可以边进行响应边接收新的数据请求。与现有技术中需要客户端与服务器之间建立一一对应的通信连接相比,本发明中,在客户端与服务器之间只建立一条通信连接,不同客户端均可以通过该通信连接完成与服务器之间的数据交互,从而达到多路复用的效果,而无需考虑并发数的问题,进而解决了现有技术中通信连接的并发数受限的情况。In the data request system provided by the embodiment of the present invention, when different clients send data requests to the server, the server only establishes a communication connection with the client, through which different data requests can be received, and the previous data request The response does not affect the reception of the next data request, that is, a new data request can be received while responding. Compared with the need to establish a one-to-one communication connection between the client and the server in the prior art, in the present invention, only one communication connection is established between the client and the server, and different clients can communicate with each other through this communication connection. The data exchange between the servers achieves the effect of multiplexing without considering the problem of the number of concurrency, thereby solving the situation that the number of concurrency of communication connections is limited in the prior art.

通过在数据帧中记录数据请求的请求来源和请求序号,可以对数据请求做唯一的标识,从而可以保证服务器对不同的数据请求作出与之对应的响应,向正确的客户端反馈数据内容,进而避免串包现象发生;通过在数据帧中记录校验值,可以在保证数据请求传输正确的情况下,对数据请求进行响应,由此防止第三方对客户端上报的数据请求进行篡改。By recording the request source and request serial number of the data request in the data frame, the data request can be uniquely identified, so that the server can make corresponding responses to different data requests, and feed back the data content to the correct client. Avoid the occurrence of packet strings; by recording the check value in the data frame, it is possible to respond to the data request while ensuring that the data request is transmitted correctly, thereby preventing third parties from tampering with the data request reported by the client.

现有技术中,由于客户端与服务器之间建立一一对应的通信连接,所以当客户端与服务器之间增加中继时,则通信连接需要成倍的增加,使得服务器需要维护的并发数更多,而本实施例只是在客户端与中继中间、中继与服务器之间分别建立少数的通信连接,从而避免了并发数受限的问题。In the prior art, since a one-to-one communication connection is established between the client and the server, when a relay is added between the client and the server, the communication connection needs to be multiplied, so that the number of concurrency that the server needs to maintain is even greater. However, this embodiment only establishes a small number of communication connections between the client and the relay, and between the relay and the server, thereby avoiding the problem of limited concurrency.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the foregoing embodiments, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.

可以理解的是,上述方法及装置中的相关特征可以相互参考。另外,上述实施例中的“第一”、“第二”等是用于区分各实施例,而并不代表各实施例的优劣。It can be understood that related features in the above methods and devices can refer to each other. In addition, "first", "second" and so on in the above embodiments are used to distinguish each embodiment, and do not represent the advantages and disadvantages of each embodiment.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.

在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other device. Various generic systems can also be used with the teachings based on this. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not specific to any particular programming language. It should be understood that various programming languages can be used to implement the content of the present invention described herein, and the above description of specific languages is for disclosing the best mode of the present invention.

在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.

类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, in order to streamline this disclosure and to facilitate an understanding of one or more of the various inventive aspects, various features of the invention are sometimes grouped together in a single embodiment, figure, or its description. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.

本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method or method so disclosed may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.

此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will understand that although some embodiments described herein include some features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention. and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.

本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的一种网络通讯的方法、装置及系统中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all of the components in a network communication method, device, and system according to an embodiment of the present invention Or full functionality. The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.

应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.

Claims (13)

Translated fromChinese
1.一种数据请求的方法,其特征在于,所述方法包括:1. A method for data request, characterized in that the method comprises:建立一条通信连接;Establish a communication connection;通过所述通信连接接收客户端上报的数据请求;receiving the data request reported by the client through the communication connection;在对所述数据请求进行响应前,通过所述通信连接继续接收同一客户端或不同客户端上报的其他数据请求;Before responding to the data request, continue to receive other data requests reported by the same client or different clients through the communication connection;对不同的数据请求分别进行响应,并下发对应不同数据请求的数据内容;Respond to different data requests separately, and issue the data content corresponding to different data requests;所述对不同的数据请求分别进行响应,包括:Responding to different data requests respectively includes:对接收的数据请求划分批次;Divide batches of received data requests;按所述批次集中响应数据请求;Respond to data requests collectively in said batches;所述对接收的数据请求划分批次,包括:The batching of the received data request includes:按照预设的字段长度对不断上报的数据请求进行截取,将总数据长度不超过所述字段长度的多个数据请求划分到同一批次;Intercept the continuously reported data requests according to the preset field length, and divide multiple data requests whose total data length does not exceed the field length into the same batch;或者,按照预设帧数对不断上报的数据请求进行截取,将与所述预设帧数数量相同的数据帧所对应的多个数据请求划分到同一批次;其中,一个数据请求对应一个数据帧。Alternatively, the continuously reported data requests are intercepted according to the preset number of frames, and multiple data requests corresponding to the data frames with the same number of preset frames are divided into the same batch; wherein, one data request corresponds to one data frame.2.根据权利要求1所述的方法,其特征在于,所述数据请求携带用于请求数据的数据帧,所述数据帧记录有请求来源、请求序号、数据位和校验位;2. The method according to claim 1, wherein the data request carries a data frame for requesting data, and the data frame records a request source, a request serial number, a data bit and a check bit;其中,所述请求来源用于对上报所述数据请求的客户端进行标记;Wherein, the request source is used to mark the client reporting the data request;所述请求序号用于对所述数据请求进行标记;The request sequence number is used to mark the data request;所述数据位用于对所述数据请求的具体请求对象进行标记;The data bit is used to mark the specific request object of the data request;所述校验位用于记录所述数据请求的校验值。The check digit is used to record the check value of the data request.3.根据权利要求1所述的方法,其特征在于,所述方法进一步包括:3. The method according to claim 1, wherein the method further comprises:除所述通信连接以外,进一步建立至少一条通信连接,所述至少一条通信连接具有与所述通信连接相同的功能。In addition to the communication connection, at least one communication connection is further established, and the at least one communication connection has the same function as the communication connection.4.根据权利要求3所述的方法,其特征在于,所述进一步建立至少一条通信连接,包括:4. The method according to claim 3, wherein said further establishing at least one communication connection comprises:建立至少一条通信连接,使得通信连接总数与中央处理器CPU的核数相同。At least one communication connection is established, so that the total number of communication connections is the same as the number of cores of the central processing unit CPU.5.根据权利要求4所述的方法,其特征在于,所述建立至少一条通信连接,使得通信连接总数与中央处理器CPU的核数相同,包括:5. The method according to claim 4, wherein said setting up at least one communication connection makes the total number of communication connections the same as the number of cores of the central processing unit CPU, comprising:建立至少一条通信连接,使得通信连接总数与nginx的进程数量相同。Establish at least one communication connection, so that the total number of communication connections is the same as the number of nginx processes.6.根据权利要求1至权利要求5中任一项所述的方法,其特征在于,所述通信连接为超文本传送协议HTTP连接。6. The method according to any one of claims 1 to 5, wherein the communication connection is a hypertext transfer protocol (HTTP) connection.7.一种数据请求的装置,其特征在于,所述装置包括:7. A device for data request, characterized in that the device comprises:建立单元,用于建立一条通信连接;An establishment unit, configured to establish a communication connection;接收单元,用于通过所述建立单元建立的所述通信连接接收客户端上报的数据请求;a receiving unit, configured to receive the data request reported by the client through the communication connection established by the establishing unit;所述接收单元,还用于在对所述数据请求进行响应前,通过所述通信连接继续接收同一客户端或不同客户端上报的其他数据请求;The receiving unit is further configured to continue to receive other data requests reported by the same client or different clients through the communication connection before responding to the data request;响应单元,用于对所述接收单元接收的不同的数据请求分别进行响应,并下发对应不同数据请求的数据内容;a response unit, configured to respectively respond to different data requests received by the receiving unit, and issue data content corresponding to different data requests;所述响应单元,包括:The response unit includes:划分模块,用于对接收的数据请求划分批次;具体用于按照预设的字段长度对不断上报的数据请求进行截取,将总数据长度不超过所述字段长度的多个数据请求划分到同一批次;或者按照预设帧数对不断上报的数据请求进行截取,将与所述预设帧数数量相同的数据帧所对应的多个数据请求划分到同一批次;其中,一个数据请求对应一个数据帧;The division module is used to divide the received data requests into batches; specifically, it is used to intercept the continuously reported data requests according to the preset field length, and divide multiple data requests whose total data length does not exceed the field length into the same batches; or intercept the continuously reported data requests according to the preset number of frames, and divide multiple data requests corresponding to the data frames with the same number of preset frames into the same batch; wherein, one data request corresponds to a data frame;响应模块,用于按所述划分模块划分的批次集中响应数据请求。A response module, configured to collectively respond to data requests in batches divided by the division module.8.根据权利要求7所述的装置,其特征在于,所述接收单元接收的所述数据请求携带用于请求数据的数据帧,所述数据帧记录有请求来源、请求序号、数据位和校验位;8. The device according to claim 7, wherein the data request received by the receiving unit carries a data frame for requesting data, and the data frame records a request source, a request sequence number, a data bit, and a checksum. check position;其中,所述请求来源用于对上报所述数据请求的客户端进行标记;Wherein, the request source is used to mark the client reporting the data request;所述请求序号用于对所述数据请求进行标记;The request sequence number is used to mark the data request;所述数据位用于对所述数据请求的具体请求对象进行标记;The data bit is used to mark the specific request object of the data request;所述校验位用于记录所述数据请求的校验值。The check digit is used to record the check value of the data request.9.根据权利要求7所述的装置,其特征在于,所述装置进一步包括:9. The device according to claim 7, wherein the device further comprises:所述建立单元,还用于进一步建立至少一条通信连接,所述至少一条通信连接具有与所述建立单元建立的所述通信连接相同的功能。The establishing unit is further configured to further establish at least one communication connection, and the at least one communication connection has the same function as the communication connection established by the establishing unit.10.根据权利要求9所述的装置,其特征在于,所述建立单元,用于建立至少一条通信连接,使得通信连接总数与中央处理器CPU的核数相同。10. The device according to claim 9, wherein the establishment unit is configured to establish at least one communication connection, so that the total number of communication connections is the same as the number of cores of the central processing unit (CPU).11.根据权利要求10所述的装置,其特征在于,所述建立单元,用于建立至少一条通信连接,使得通信连接总数与nginx的进程数量相同。11. The device according to claim 10, wherein the establishment unit is configured to establish at least one communication connection, so that the total number of communication connections is the same as the number of nginx processes.12.根据权利要求7至权利要求11中任一项所述的装置,其特征在于,所述建立单元建立的通信连接为超文本传送协议HTTP连接。12. The device according to any one of claims 7 to 11, wherein the communication connection established by the establishment unit is a hypertext transfer protocol (HTTP) connection.13.一种数据请求的系统,其特征在于,所述系统包括:客户端、服务器;其中所述服务器包含如权利要求7至权利要求12中任一项所述的装置;13. A data request system, characterized in that the system comprises: a client, a server; wherein the server comprises the device according to any one of claims 7 to 12;所述客户端,用于:The client for:与所述服务器建立一条通信连接;establishing a communication connection with the server;通过所述通信连接向所述服务器上报数据请求;reporting a data request to the server through the communication connection;在获得所述服务器的响应之前,通过所述通信连接继续向所述服务器上报其他数据请求;Before obtaining a response from the server, continue to report other data requests to the server through the communication connection;通过所述通信连接接收所述服务器下发的对应不同数据请求的数据内容。The data content corresponding to different data requests issued by the server is received through the communication connection.
CN201410776946.7A2014-12-152014-12-15The method, apparatus and system of a kind of request of dataActiveCN104468594B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201410776946.7ACN104468594B (en)2014-12-152014-12-15The method, apparatus and system of a kind of request of data

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201410776946.7ACN104468594B (en)2014-12-152014-12-15The method, apparatus and system of a kind of request of data

Publications (2)

Publication NumberPublication Date
CN104468594A CN104468594A (en)2015-03-25
CN104468594Btrue CN104468594B (en)2018-04-27

Family

ID=52913966

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201410776946.7AActiveCN104468594B (en)2014-12-152014-12-15The method, apparatus and system of a kind of request of data

Country Status (1)

CountryLink
CN (1)CN104468594B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106330833A (en)*2015-06-292017-01-11中兴通讯股份有限公司 Communication method, client and server based on Internet content adaptation protocol
CN105450730A (en)*2015-11-052016-03-30北京奇虎科技有限公司Method and apparatus for processing request from client
CN108491278B (en)*2018-03-132020-09-18网宿科技股份有限公司Method and network device for processing service data
CN109327511B (en)2018-09-182021-05-28网宿科技股份有限公司 A data request method and server based on HTTP protocol
CN109639811B (en)*2018-12-212022-01-25北京金山云网络技术有限公司Data transmission method, data storage method, device, server and storage medium
CN111694873B (en)*2020-06-102023-10-27腾讯科技(深圳)有限公司Virtual resource package processing method and device and database server

Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101193113A (en)*2006-11-292008-06-04国际商业机器公司Content response and content request method and content responder and content requester
CN101796491A (en)*2005-05-042010-08-04文丘里无线有限公司Improve the method and apparatus of HTTP performance on the long delay link
CN102387206A (en)*2011-10-202012-03-21镇江睿泰信息科技有限公司Synthesis method and system of concurrent request of Web service
CN102685204A (en)*2011-03-172012-09-19华为技术有限公司 Method and device for data resource transmission
CN102932352A (en)*2012-11-022013-02-13北京奇虎科技有限公司 The method of communicating with the client and the server
CN103064778A (en)*2011-10-202013-04-24阿里巴巴集团控股有限公司Method, device and system of server performances testing

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US7305697B2 (en)*2001-02-022007-12-04Opentv, Inc.Service gateway for interactive television
CN104202399A (en)*2014-09-052014-12-10国家电网公司 A Data Service Scheduling Method Based on Request Buffer Pool

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101796491A (en)*2005-05-042010-08-04文丘里无线有限公司Improve the method and apparatus of HTTP performance on the long delay link
CN101193113A (en)*2006-11-292008-06-04国际商业机器公司Content response and content request method and content responder and content requester
CN102685204A (en)*2011-03-172012-09-19华为技术有限公司 Method and device for data resource transmission
CN102387206A (en)*2011-10-202012-03-21镇江睿泰信息科技有限公司Synthesis method and system of concurrent request of Web service
CN103064778A (en)*2011-10-202013-04-24阿里巴巴集团控股有限公司Method, device and system of server performances testing
CN102932352A (en)*2012-11-022013-02-13北京奇虎科技有限公司 The method of communicating with the client and the server

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《Hypertext Transfer Protocol Http/1.1》;J.C.Mogul等;《RFC2616》;19990630;第30页 8.1.2.2*

Also Published As

Publication numberPublication date
CN104468594A (en)2015-03-25

Similar Documents

PublicationPublication DateTitle
CN104468594B (en)The method, apparatus and system of a kind of request of data
CN102932352B (en) The method of communicating with the client and the server
CN104486291B (en)Establish the method, apparatus and system of connection
WO2018006872A1 (en)Method and device for scheduling interface of hybrid cloud
CN102904903B (en)Communication system and communication means
JP2016538655A5 (en)
CN103475654B (en)Network path optimization method, equipment and network system
US20160127450A1 (en)Method and apparatus for accelerating data transmission in a network communication system
RU2007148416A (en) UNITED ARCHITECTURE FOR REMOTE NETWORK ACCESS
CN105657000A (en)Message transmission method and device
CN105376173A (en)Sending window flow control method and terminal
CN103533080A (en)Dispatching method and device for LVS (Linux virtual server)
WO2019090997A1 (en)Data acquisition method and device, computer device and storage medium
CN104125303B (en)Reading and writing data requesting method, client and system
CN106506601B (en)Data transmission method and device
WO2014179950A1 (en)File uploading method, client, and server
JP5304674B2 (en) Data conversion apparatus, data conversion method and program
CN107451092A (en)A kind of data transmission system based on IB networks
CN103685501A (en)Data processing method, device and system
CN111404842A (en)Data transmission method, device and computer storage medium
US11223689B1 (en)Methods for multipath transmission control protocol (MPTCP) based session migration and devices thereof
CN103942277A (en)Method and device for downloading file in browsers and browsers
CN104301423B (en)A kind of method, apparatus and system sending heartbeat message
WO2015062390A1 (en)Virtual machine migration method, device and system
CN106911739B (en)Information distribution method and device

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
SE01Entry into force of request for substantive examination
C41Transfer of patent application or patent right or utility model
TA01Transfer of patent application right

Effective date of registration:20161116

Address after:100015 Chaoyang District Road, Jiuxianqiao, No. 10, building No. 3, floor 15, floor 17, 1701-26,

Applicant after:BEIJING QIANXIN TECHNOLOGY Co.,Ltd.

Address before:100088 Beijing city Xicheng District xinjiekouwai Street 28, block D room 112 (Desheng Park)

Applicant before:BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Applicant before:Qizhi software (Beijing) Co.,Ltd.

GR01Patent grant
GR01Patent grant
CP03Change of name, title or address
CP03Change of name, title or address

Address after:100088 Building 3 332, 102, 28 Xinjiekouwai Street, Xicheng District, Beijing

Patentee after:QAX Technology Group Inc.

Address before:100015 Jiuxianqiao Chaoyang District Beijing Road No. 10, building 15, floor 17, layer 1701-26, 3

Patentee before:BEIJING QIANXIN TECHNOLOGY Co.,Ltd.


[8]ページ先頭

©2009-2025 Movatter.jp