WO2021068973A1 - Data communication method and device employing application layer protocol - Google Patents

Data communication method and device employing application layer protocol Download PDF

Info

Publication number
WO2021068973A1
WO2021068973A1 PCT/CN2020/120468 CN2020120468W WO2021068973A1 WO 2021068973 A1 WO2021068973 A1 WO 2021068973A1 CN 2020120468 W CN2020120468 W CN 2020120468W WO 2021068973 A1 WO2021068973 A1 WO 2021068973A1
Authority
WO
WIPO (PCT)
Prior art keywords
channel
data
layer protocol
application layer
request
Prior art date
Application number
PCT/CN2020/120468
Other languages
French (fr)
Chinese (zh)
Inventor
单卫华
刘加财
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021068973A1 publication Critical patent/WO2021068973A1/en

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/14Session management
    • H04L67/141Setup of application sessions
    • 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
    • H04L67/63Routing a service request depending on the request content or context
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/30Definitions, standards or architectural aspects of layered protocol stacks
    • H04L69/32Architecture of open systems interconnection [OSI] 7-layer type protocol stacks, e.g. the interfaces between the data link level and the physical level
    • H04L69/322Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions
    • H04L69/329Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions in the application layer [OSI layer 7]

Definitions

  • This application relates to the field of computer technology, and in particular to a data communication method based on an application layer protocol, and a client, server, and service providing system that execute the method.
  • HTTP Take HTTP as an example.
  • TCP transmission control protocol
  • the HTTP client sends a network request to the HTTP server.
  • HTTP After receiving the network request, the server sends response information to the HTTP client according to the network request. Subsequently, the request ends, and the TCP connection established for the request is disconnected.
  • This scenario is also called a short connection.
  • the HTTP protocol also supports long connections, that is, multiple rounds of network requests and corresponding response messages are completed in one TCP connection, the communication efficiency between the client and the server is still insufficient.
  • This application provides a data communication method based on an application layer protocol, which improves the communication efficiency between application programs and network services.
  • the first aspect of this application provides a data communication method based on an application layer protocol, which includes: a channel management module on the client side and a channel management module on the server side between an application program running on the client side and a network service running on the server side Establish the first application layer protocol channel and the second application layer protocol channel; the client's protocol stack sends the request data generated by the application program to the network service through the first application layer protocol channel; after obtaining the request data, the network service according to The request data generates response data; the protocol stack of the server sends the response data to the application through the second application layer protocol channel; wherein, the first application layer protocol channel and the second application layer protocol channel are based on different Transport layer protocol connection.
  • the first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols, that is, in the process of establishing the first application layer protocol channel and the second application layer protocol channel, two different Transport layer protocol connection.
  • the data transmission of the application to the network service is not limited to the processing progress of the previous data, which improves the access efficiency of the application to the network service, and improves the connection between the application and the network service. Communication efficiency.
  • the application layer protocol is HTTP or HTTPS.
  • the client's protocol stack sends the subsequent request data generated by the application to the network service through the first application layer protocol channel, and the generation time of the subsequent request data is after the generation time of the request data .
  • the client's protocol stack sends the subsequent request data, it does not need to wait to receive the response data corresponding to the request data.
  • the request data is generated by an executor running in the application program, and the method further includes: the client generates a request data identification ID for the request data, and transmits it in the first application layer protocol channel The request data ID of each request data is different; the protocol stack of the client sends the request data and the request data ID to the network service through the first application layer protocol channel, where the request data and the request data ID are carried in The same message.
  • the method further includes: the server protocol stack sends the response data and the request data ID to the client through the same message through the second application layer protocol channel;
  • the client determines the executor according to the request data ID received from the second application layer protocol channel; the client sends the response data to the executor.
  • a request data ID is assigned to each request data, and the request data ID and response data are returned to the client together, so that the client can identify the target executor of the response data (the executor who generated the request data) according to the request data ID.
  • This allows the network service to process the request data more flexibly. No matter how the request data is processed in various orders, the response data generated by the network service can be accurately returned to the target executor.
  • the data processing pool of the server is the first An application layer protocol channel allocates the first space, and the second application layer protocol channel allocates the second space; the data processing pool of the server records the correspondence between the first space and the second space; the server will start from the first space
  • the request data received by an application layer protocol channel is stored in the first space; after the network service generates the response data, the data processing pool stores the response data in the second space according to the corresponding relationship of the record.
  • the server allocates an independent space for each application layer protocol channel.
  • the first space is used to store the request data sent by the first application layer protocol channel
  • the second space is used to store network services generated according to the request data in the first space.
  • the response data in the second space is sent to the client through the second application layer protocol channel. Allocate independent space for the two application layer protocol channels, which improves the server's management accuracy of the data transmitted in the application layer protocol channels.
  • the second aspect of the present application provides a service providing system, which includes at least one client and at least one server. At least one client and at least one server establish a connection through a communication network. There are applications running on each client, and the applications access the network services running on the server.
  • the client in the service providing system executes the method provided by the client in the method provided in the first aspect, and the client in the service providing system executes the method provided by the server in the method provided in the first aspect.
  • the third aspect of the present application provides a data communication method based on an application layer protocol executed by a client.
  • the method includes: a channel management module of the client generates a first channel establishment request message, the first channel establishment request message includes a first channel type field, and the first channel type field indicates establishment based on the first channel establishment request message
  • the first application layer protocol channel is the request type, and the first channel establishment request message is sent to the server
  • the channel management module of the client generates a second channel establishment request message, and the second channel establishment request message includes the second channel Type field, the second channel type field indicates that the second application layer protocol channel established based on the second channel establishment request message is a response type, and the second channel establishment request message is sent to the server;
  • the first The application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols;
  • the client's application program generates request data, and the client's protocol stack receives the request data, and then sends the request data through the first application layer protocol channel To the network service running on the
  • the method further includes: the client's data matching pool generates a request data ID for the request data; the client's protocol stack sends the request data and the request data ID to the request data through the first application layer protocol channel The network service; the client's protocol stack receives the response data corresponding to the request data and the request data ID through the second application layer protocol channel; the client's data matching pool is based on the request data ID received from the second application layer protocol channel , Determine the executor who generated the request data, and send the response data to the executor.
  • the fourth aspect of the present application provides a client, which executes any method provided in the third aspect when the client is running.
  • the client includes: a channel management module configured to generate a first channel establishment request, the first channel establishment request includes a first channel type field, and the first channel type field indicates a first application established based on the first channel establishment request
  • the layer protocol channel is the request type; a second channel establishment request is generated, the second channel establishment request includes a second channel type field, and the second channel type field indicates that the second application layer protocol channel established based on the second channel establishment request is Response type; wherein, the first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols.
  • the client further includes an application program for generating request data, and sending the request data to the protocol stack.
  • the client also includes a protocol stack for sending the first channel establishment request to the server; sending the second channel establishment request to the server; sending the request data to the server through the first application layer protocol channel A network service running on the computer; the response data corresponding to the request data is received through the second application layer protocol channel.
  • the client further includes: a data matching pool for generating a request data ID for the request data, and recording the correspondence between the executor who generated the request data and the request data ID;
  • the data ID is sent to the protocol stack.
  • the protocol stack is configured to send the request data and the request data ID to the network service through the first application layer protocol channel; receive the response data corresponding to the request data and the request data ID through the second application layer protocol channel;
  • the response data and the request data ID are sent to the data matching pool.
  • the data matching pool is also used to determine the executor who generated the request data according to the corresponding relationship of the record and the request data ID; and send the response data to the executor.
  • the fifth aspect of the present application provides a client, that is, a computer, including a processor and a memory.
  • the processor is configured to access instructions in the memory to execute any method provided in the third aspect.
  • the sixth aspect of the present application provides a non-transitory readable storage medium.
  • the instructions stored in the non-transitory readable storage medium are executed by a client, the client executes any of the instructions provided in the aforementioned third aspect. method.
  • Program instructions are stored in the storage medium.
  • the storage medium includes, but is not limited to, volatile memory, such as random access memory, and non-volatile memory, such as flash memory, hard disk drive (HDD), and solid state drive (SSD).
  • the seventh aspect of the present application provides a computer program product.
  • the client executes any of the methods provided in the foregoing third aspect.
  • the computer program product may be a software installation package.
  • the computer program product can be downloaded and the instructions contained in the computer program product can be executed on the client.
  • the eighth aspect of the present application provides a data communication method based on an application layer protocol executed by a server.
  • the method includes: the protocol stack of the server receives a first channel establishment request message, the first channel establishment request message includes a first channel type field, and the first channel type field indicates the establishment based on the first channel establishment request message.
  • the first application layer protocol channel is the request type.
  • the protocol stack of the server receives a second channel establishment request message, the second channel establishment request message includes a second channel type field, and the second channel type field indicates a second application layer established based on the second channel establishment request message
  • the protocol channel is a response type; wherein, the first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols.
  • the protocol stack of the server receives the request data through the first application layer protocol channel.
  • the network service of the server generates response data according to the request data.
  • the protocol stack of the server sends the response data to the application program that generates the request data through the second application layer protocol channel.
  • the method further includes: the protocol stack of the server receives the request data ID corresponding to the request data through the first application layer protocol channel. After generating the response data, the data processing pool of the server establishes the corresponding relationship between the response data and the request data ID. The protocol stack of the server sends the response data and the request data ID to the client that generates the request data through the second application layer protocol channel.
  • the data processing pool of the server allocates a first space for the first application layer protocol channel; and allocates a second space for the second application layer protocol channel.
  • the channel management module of the server records the correspondence between the first space and the second space.
  • the protocol stack of the server side stores the request data received from the first application layer protocol channel into the first space. According to the corresponding relationship of the record, the protocol stack of the server stores the response data in the second space.
  • the ninth aspect of the present application provides a server that executes any method provided in the eighth aspect when the server is running.
  • the server includes: a channel management module for receiving a first channel establishment request, the first channel establishment request includes a first channel type field, and the first channel type field indicates a first application established based on the first channel establishment request
  • the layer protocol channel is the request type; the second channel establishment request is received, the second channel establishment request includes a second channel type field, and the second channel type field indicates that the second application layer protocol channel established based on the second channel establishment request is Response type; wherein, the first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols.
  • the server also includes a protocol stack for receiving request data through the first application layer protocol channel.
  • the server also includes a network service, which is used to generate response data according to the request data, and send the response data to the protocol stack.
  • the protocol stack is also used to send the response data to the application program that generated the request data through the second application layer protocol channel.
  • the protocol stack is also used to receive the request data ID corresponding to the request data through the first application layer protocol channel; to send the response data and the request data through the second application layer protocol channel ID to the client that generated the requested data.
  • the server further includes a data processing pool for allocating a first space for the first application layer protocol channel and a second space for the second application layer protocol channel.
  • the channel management module is used to record the corresponding relationship between the first space and the second space.
  • the protocol stack is used to store the request data received from the first application layer protocol channel into the first space.
  • the channel management module is used to store the response data in the second space according to the corresponding relationship of the record.
  • the tenth aspect of the present application provides a server, that is, a computer, including a processor and a memory.
  • the processor is configured to access instructions in the memory to execute any method provided in the eighth aspect.
  • the eleventh aspect of the present application provides a non-transitory readable storage medium.
  • the server executes any of the aforementioned eighth aspects.
  • Program instructions are stored in the storage medium.
  • the storage medium includes, but is not limited to, volatile memory, such as random access memory, and non-volatile memory, such as flash memory, HDD, and SSD.
  • the twelfth aspect of the present application provides a computer program product.
  • the server executes any of the methods provided in the eighth aspect.
  • the computer program product may be a software installation package.
  • the computer program product can be downloaded and the instructions contained in the computer program product can be executed on the server.
  • Figure 1 is the architecture diagram of the service provision system provided by this application.
  • FIG. 2 is another architecture diagram of the service providing system provided by this application.
  • FIG. 3 is a schematic diagram of the protocol stack used by the client and server provided by this application.
  • Figure 4 is a schematic diagram of a channel establishment request message provided by this application.
  • FIG. 5 is a schematic diagram of a data transmission message provided by this application.
  • FIG. 6 is another schematic diagram of a channel establishment request message provided by this application.
  • FIG. 7 is another schematic diagram of the data transmission message provided by this application.
  • FIG. 8 is a schematic flowchart of the data communication method provided by this application.
  • FIG. 9 is a schematic diagram of the application layer protocol header included in the channel establishment request message provided by this application.
  • Figure 10 is a schematic diagram of the service providing system in the channel establishment process provided by this application.
  • FIG. 11 is a schematic diagram of the service providing system in the data transmission process provided by this application.
  • FIG. 12 is a schematic diagram of the service providing system in the data transmission process provided by this application.
  • FIG. 13 is a schematic diagram of the service providing system in the data transmission process provided by this application.
  • FIG. 14 is a schematic diagram of the service providing system in the data transmission process provided by this application.
  • FIG. 15 is a schematic diagram of application layer protocol request/response from the application perspective provided by this application.
  • FIG. 16 is a schematic diagram of the structure of the client provided by this application.
  • FIG 17 is a schematic diagram of the structure of the server provided by this application.
  • the service providing system includes at least one client and at least one server.
  • the client and the server are interconnected through a communication network, and the server provides a web service to the client.
  • the client can be, for example, a smart phone (smart phone), a personal digital assistant (personal digital assistant, PDA), a tablet computer, a laptop computer (laptop computer), a personal computer (PC), Servers and other equipment.
  • Common servers include personal computers or servers.
  • the communication network between the client and the server can be a wired communication network or a wireless communication network, for example: the fifth-generation mobile communication technology (5th-Generation, 5G) system, long term evolution (LTE) ) System, wireless fidelity (wireless fidelity, WiFi).
  • 5G fifth-generation mobile communication technology
  • LTE long term evolution
  • WiFi wireless fidelity
  • transaction per second refers to the number of requests that the service providing system can process per second, and can be used to measure the throughput of the service providing system.
  • At least one application program (application program 204 to application program 20N) is running on the client 200, and N is an integer greater than or equal to 4.
  • the executor of the application sends an application layer protocol request to at least one network service (network service 404 to network service 40M) running on the server 400, where N is an integer greater than or equal to 4 to request
  • the network service performs corresponding processing according to the request.
  • common processing types include POST, GET, PUT, etc.
  • the channel management module 203 running on the client 200 and the channel management module 403 running on the server 400 cooperate to establish a request channel and a response channel between the client 200 and the server 400.
  • the request channel and the response channel are two independent application layer protocol channels.
  • the request channel is used to transmit the application layer protocol request generated by the client 200 to the server 400
  • the response channel is used to transmit the application layer protocol response generated by the server 400 according to the application layer protocol request to the client 200.
  • the protocol stack 201, the data matching pool 202, and the channel management module 203 can be packaged into a software development kit (SDK), and the application program 20N manages the protocol stack 201, the data matching pool 202 or the channel Access to the module 203 is achieved by calling the application program interface (API) of the SDK.
  • SDK software development kit
  • API application program interface
  • the data processing pool 402 running on the server 400 is used to store multiple request data carried in the application layer protocol request and the identification ID of each request data, and to process the application layer protocol request for the network service in the application layer protocol response generated Each response data configuration ID.
  • the ID of a request data is the same as the ID of the response data generated based on the request data, that is, the ID corresponding to a certain request data carried in the application layer protocol request is also configured by the data processing pool 402 to the ID carried in the application layer protocol response The response data corresponding to the request data.
  • the data matching pool 202 running on the client 200 is used to allocate and record the ID of each request data carried in the application layer protocol request, so as to identify the response data corresponding to each request data.
  • Protocol stack 201 and protocol stack 401 include processing mechanisms related to multi-layer protocols.
  • the link layer protocol includes the processing mechanism of the link layer protocol
  • the network layer protocol includes the processing mechanism of the network layer protocol
  • the transport layer protocol includes the processing mechanism of the transport layer protocol
  • the application layer protocol includes the processing mechanism of the application layer protocol.
  • Each data transmission message carries at least one piece of data (request data or response data) and a request data ID.
  • the channel establishment request message used in the process of creating the request channel and the response channel is also encapsulated and generated layer by layer by the protocol stack 201.
  • Each application layer protocol request or each application layer protocol response is composed of a channel establishment request message and multiple data transmission messages.
  • the protocol stack 401 parses the message in the order of link layer protocol, network layer protocol, transport layer protocol, and application layer protocol to obtain the duplex channel protocol header and the duplex channel control carried in the body. Field.
  • Common link layer protocols include ethernet protocol
  • common network layer protocols include internet protocol
  • common transport layer protocols include TCP
  • common application layer protocols include HTTP and HTTPS.
  • Figures 6 and 7 show channel establishment request messages and data transmission messages based on common protocols.
  • FIG. 8 illustrates the data communication method 600 provided by the present application.
  • the method includes three parts, namely, a channel establishment part, a data transmission part, and a channel closing part.
  • the channel establishment part includes S600, S601, and S602, where S601 and S602 can be executed in any order.
  • the channel management module 203 sends a channel establishment request to the protocol stack 201.
  • the channel establishment request carries the duplex channel control field used to establish the request channel and the duplex channel control field of the response channel, the specific content of the duplex channel control field used to establish the request channel and the duplex channel control field of the response channel See the follow-up for details.
  • the channel management module 203 may also send the duplex channel control field for establishing the requested channel and the duplex channel control field for the response channel to the protocol stack 201 through two channel establishment requests, respectively.
  • the protocol stack 201 sends a channel establishment request message for establishing a request channel to the protocol stack 401.
  • the protocol stack 401 parses the channel establishment request message received in S601, and sends the parsed duplex channel control field to the channel management module 403.
  • the channel management module 203 and the channel management module 403 establish a request channel between the application 204 of the client 200 and the network service 404 of the server 400 according to the duplex channel control field, and the request channel is an application layer protocol channel.
  • the application layer protocol header includes the original field of the application layer protocol, and also includes the duplex channel control field carried in the channel establishment request.
  • the content other than the duplex channel control field in the channel establishment request message is encapsulated by the protocol stack 201.
  • the duplex channel control field includes the duplex channel ID and channel type.
  • the original field includes the request line and the request header, and the request line includes information such as the request method, uniform resource locator (URL), and protocol version.
  • the request method is usually POST, and the URL points to the web service 404.
  • the request header includes the Connection field and the Content-Type field, for example:
  • the duplex channel control field includes the Duplex-Channel-ID (duplex channel ID) field and the Duplex-Channel-Type (channel type) field, for example:
  • the channel management module 203 and the channel management module 403 also assign a channel ID (channel-ID) of 0 to the request channel, and record the corresponding relationship between the duplex channel ID and the channel ID. Take the mark as ⁇ 1, ⁇ 0,>> as an example, the ID of the duplex channel is 1 and the ID of the request channel of the duplex channel is 0.
  • the protocol stack 201 sends a channel establishment request message for establishing another request channel to the protocol stack 401.
  • the protocol stack 401 parses the channel establishment request message received in S602, and sends the parsed duplex channel control field to the channel management module 403.
  • the channel management module 203 and the channel management module 403 establish a response channel between the application 204 of the client 200 and the network service 404 of the server 400 according to the duplex channel control field, and the response channel is an application layer protocol channel.
  • the request channel established in S601 and the response channel established in S602 are two independent application layer protocol channels, which are independently embodied in that the two application layer protocol channels are connected based on different transport layer protocols. Taking the application layer protocol using HTTP and the transport layer using TCP as an example, the HTTP channel established in S601 and the HTTP channel established in S602 are based on different TCP connections.
  • An application layer protocol channel is based on a TCP connection and transmits application layer protocol requests/responses through multiple packets carrying the same transport layer protocol header, network layer protocol header, and link layer protocol header.
  • the sequence number of the transport layer protocol header of each message transmitted in an application layer protocol channel may be different.
  • the request channel established in S601 and the response channel established in S602 form a pair of duplex channels, that is, the request channel established in S601 transmits application layer protocol requests, and the response channel established in S602 transmits corresponding application layer protocol responses.
  • the application layer protocol header includes the original field of the application layer protocol, and also includes the duplex channel control field carried in the channel establishment request.
  • the content other than the duplex channel control field in the channel establishment request message is encapsulated by the protocol stack 201.
  • the duplex channel control field includes the duplex channel ID and channel type.
  • the original field includes the request line and the request header, the request line includes the request method, uniform resource locator (URL), the request method is usually POST, and the URL points to the web service 404 ;
  • the request header includes the Connection field and the Content-Type field, for example:
  • Connection field and the Content-Type field can also have other values, which are only examples here.
  • the duplex channel control field includes the Duplex-Channel-ID (duplex channel ID) field and the Duplex-Channel-Type (channel type) field, for example:
  • the channel management module 203 and the channel management module 403 also assign a channel ID (channel-ID) of 1 to the request channel, and record the corresponding relationship between the duplex channel ID and the channel ID. Take the record as ⁇ 1, ⁇ 0,1>> as an example to express that the duplex channel ID is 1, the request channel ID of the duplex channel is 0, and the response channel ID of the duplex channel is 1. As shown in Figure 10, after S601 and S602 are executed, a space is created for the request channel and the response channel in the data processing pool 402 to store the request data and the response data. The two spaces are marked as ⁇ 1, ⁇ 0>>, ⁇ 1, ⁇ 1>>.
  • the channel management module 203 also records the correspondence between the application 204 and the duplex channel ID 1 to determine the duplex channel ID belonging to the application 204 when the application 204 initiates a channel closing request, see S615 for details.
  • the channel management module 403 can record the 5-tuple (source/destination network protocol (IP) address, source/destination media access control (MAC) address, port number) carried in the channel establishment request message and Correspondence between duplex channel ID/channel ID. For example, the channel management module 403 records the correspondence between quintuple 0 and duplex channel ID 1/channel ID 0, and records the correspondence between quintuple 1 and duplex channel ID 1/channel ID 1. Then the channel management module 403 can determine that the duplex channel ID corresponding to the packet including the quintuple 1 is 1 and the channel ID is 1, and the channel management module 403 can determine the duplex channel ID corresponding to the packet including the quintuple 0 Is 1 and the channel ID is 0.
  • IP source/destination network protocol
  • MAC media access control
  • the channel management module 403 can determine the duplex channel ID and the corresponding channel ID corresponding to each message.
  • the five-tuple of the message can be parsed by the protocol stack 401 and sent to the channel management module 403.
  • the channel management module 403 may return a channel establishment success response through the request channel to indicate that the request channel is successfully established. Similarly, after S602, the channel management module 403 may return a channel establishment success response through the response channel to indicate that the response channel is successfully established.
  • the Connection field of the two channel establishment request messages sent in S601 and S602 needs to be keep-alive, so as to prevent the request channel and the response channel from being closed after the successful channel establishment response is returned to the client 200.
  • the execution of the above S600 is initiated by the application 204.
  • the application 204 initiates an application layer protocol request for the network service 404 for the first time or when the application 204 initializes an application layer protocol channel between the application 204 and the network service 404, the application 204 triggers the channel management module 203 to execute S600.
  • the application layer protocol channel between the application 204 and the network service 404 is established, the application 204 can transmit the request data to the network service 404, and the data transmission part includes S603 to S614.
  • S603 The executor of the application 204 generates request data, and sends the request data to the data matching pool 202.
  • the request data includes the processing type.
  • the request data may also include data blocks to be processed.
  • the processing type indicates the operation type of the network service.
  • the processing type may be new to instruct the network service 404 to store the data block to be processed after receiving the data block to be processed; for another example, the processing type may be replacement to instruct the network service 404 to receive the data to be processed Then, replace a certain data block with the data to be processed; for another example, the processing type can be delete to instruct the network service 404 to delete a certain data block.
  • the requested data may not contain the data to be processed Block;
  • the processing type may be access to instruct the network service 404 to return a certain data block to the application 204. In this case, the requested data may not include the data block to be processed.
  • the data matching pool 202 generates a corresponding request data ID for the request data, and stores the request data ID.
  • the solid-line box 0 in the data matching pool in FIG. 11 refers to the requested data ID 0.
  • the data matching pool 202 also records the correspondence between the executor who generated the requested data and the requested data ID.
  • the data matching pool 202 may notify the application program 204 to suspend the executor generating the requested data, and wait for the response data corresponding to the requested data to be returned. Other executors of the application 204 are not affected, and can continue to send request data to the data matching pool 202.
  • the data matching pool 202 sends the request data and the generated request data ID to the protocol stack 201.
  • the protocol stack 201 generates a data transmission message, and sends the generated data transmission message to the protocol stack 401 through the request channel.
  • the data transmission message is shown in FIG. 5 or FIG. 7, wherein the application layer protocol body carries the request data and the request data ID.
  • the request data ID 0 and the request data are sent to the protocol stack 401 through the request channel, and other parts of the data transmission message are omitted in FIG. 11.
  • the protocol stack 401 parses the data transmission message, and stores the parsed request data ID 0 and the request data in the space ⁇ 1, ⁇ 0>> opened up for the request channel in the data processing pool 402.
  • the protocol stack 401 can determine the data transmission message according to the content of the data transmission message (for example, a quintuple) in the process of parsing the data transmission message Corresponds to the request channel or response channel in which duplex channel. After determining the channel to which the data transmission message belongs, the protocol stack 401 may store the parsed request data ID and request data in the space corresponding to the channel to which the data transmission message belongs in the data processing pool 402.
  • the data transmission message for example, a quintuple
  • the network service 404 obtains the request data ID 0 and the request data from the space ⁇ 1, ⁇ 0>>.
  • S609 The network service 404 generates response data according to the request data.
  • the response data includes the processing information of the requested data, such as the timestamp of the requested data executed by the network service, and the type of the network service.
  • the response data may also include content such as the data block accessed according to the requested data, the length of the accessed data block, and so on.
  • the network service 404 stores the request data ID 0 and the response data in the data processing pool 402 to open up the space ⁇ 1, ⁇ 1>> for the response channel, as shown in FIG. 11.
  • the network service 404 accesses the channel management module 403 to obtain the corresponding relationship of the channel ID, and determines that the request data ID 0 obtained from the space corresponding to the channel ID 0 and the response data corresponding to the request data need to be sent to the space corresponding to the channel ID 1.
  • the network service 404 sends the request data ID 0 and the response data to the channel management module 403, and the channel management module 403 determines the request data ID 0 and the request data ID 0 and data obtained from the space corresponding to the channel ID 0 according to the recorded correspondence of the channel ID.
  • the response data corresponding to the request data needs to be sent to the space corresponding to the channel ID 1, and the channel management module 403 stores the request data ID 0 and the response data in the data processing pool 402.
  • the protocol stack 401 obtains the request data ID and response data from the space ⁇ 1, ⁇ 1>> in the data processor 402, and generates a data transmission message according to the obtained request data ID and response data.
  • the data transmission message generated in S611 is shown in FIG. 5 or FIG. 7, where the application layer protocol body carries the response data and the request data ID.
  • the request data ID 0 and the response data are sent to the protocol stack 201 through the response channel, and the other parts of the data transmission message are omitted.
  • the space opened by the data processing pool 402 is the requested data ID/request data and the requested data ID stored in the space ⁇ 1, ⁇ 0>> and ⁇ 1, ⁇ 1>> /Response data can be deleted to save the storage space of the server 400.
  • the protocol stack 401 sends the generated data transmission message to the protocol stack 201 through the response channel.
  • the protocol stack 401 In S612, the protocol stack 401 generates an application layer protocol response based on the application layer protocol request transmitted from the request channel, and returns the application layer protocol response to the protocol stack 201 through the response channel.
  • the application layer protocol response In addition to the data transmission message (carrying response data), the application layer protocol response should also include the application layer protocol header. Before the protocol stack 401 returns the first response data through the response channel, it should also return a message including the application layer protocol header to the protocol stack 201. Refer to FIG. 4 or FIG. 6 for the format of the message.
  • the application layer protocol header of the message carries the same duplex channel control field as the application layer protocol header of the channel establishment request message in S602, and also includes the original field of the application layer protocol.
  • the application layer carried by the message The original field of the protocol may be the same as the part of the channel establishment request message in S602. For details, refer to the type of application layer protocol. Taking the HTTP protocol as an example, the application layer protocol header carried in the message is the header of the HTTP response in FIG. 15.
  • the protocol stack 201 parses the data transmission message, and stores the parsed request data ID 0 and response data into the data matching pool 202, as shown in FIG. 13.
  • the data matching pool 202 determines that the destination of the response data is the executor of the request data generated in S603 through the correspondence between the executor and the request data ID recorded in S604, and sends the response data to the executor.
  • one request of the executor of the application 204 to the network service 404 is processed.
  • request data and response data are transmitted using different application layer protocol channels, they do not interfere with each other, that is, these two different application layer protocol channels form a pair of duplex channels.
  • the application 204 can continuously send request data through the request channel, and the next request data transmission does not need to wait for the reception of the response data corresponding to the previous request data, which improves the TPS of the service provision system and realizes This allows applications to have more efficient access to network services.
  • the application 204 generates request data 0 and request data P.
  • P is any integer greater than 0, that is, the application 204 may send other request data to the server between the request data 0 and the request data P 400.
  • the request data 0 and the request data P are generated, they are sent to the server 400 through the request channel, and there is no need to wait for the reception of any response data during the sending process of the request data 0 and the request data P.
  • the network service 404 can process the request data in any order, and the request data that cannot be processed temporarily can be cached in the data processing pool 402. As shown in FIG.
  • the response data P is generated before the response data 0, and the response data P can be sent back to the client 200 through the response channel first.
  • the existing HTTP connection technology is first-in-first-out (FIFO), that is, the request data first sent to the network service is processed first, and the request data that first arrives at the network service is not processed. Before the processing is completed, the subsequent request data cannot be processed.
  • FIFO first-in-first-out
  • the order in which the network service 404 processes the requested data may not be restricted by the FIFO, the processing mechanism is more flexible, and the degree of fineness of access control is improved.
  • the application program 204 sends a continuous survival through the request channel, and the length is not limited ( The number of data transmission messages is not limited) HTTP request (take HTTP request as an example, it can also be other application layer protocol requests).
  • the header of the HTTP request (response), that is, the aforementioned channel establishment request message, and the body of the HTTP request (response) is transmitted through one or more data transmission messages.
  • the application 204 receives a continuously alive HTTP response of unlimited length through the response channel. Load the duplex channel protocol of this solution on top of the existing application layer protocol.
  • S615 The application 204 sends a channel closing request to the channel management module 203.
  • the application program 204 determines that the executor running on it has no new request data to be sent to the network service 404, it sends a channel closing request to the channel management module 203.
  • the channel management module 203 After the channel management module 203 receives the channel closing request, if multiple duplex channels are established between the client 200 and the server 400, the channel management module 203 needs to follow the application 204 and the duplex channel ID recorded in the channel establishment section. The corresponding relationship between, the duplex channel ID 1 is carried in the channel closing request, and the channel closing request carrying this information is sent to the protocol stack 201.
  • the protocol stack 201 generates a channel close request message according to the channel close request, and sends the channel close request message to the protocol stack 401 through the request channel.
  • the channel closing request message also carries the channel closing identifier.
  • the channel close request message can carry a channel close identifier.
  • a pre-appointed special ID is used in the request data ID.
  • the ID is different from any request data ID, for example, -1.
  • the data part of the channel closing request message can carry the duplex channel ID.
  • the protocol stack 401 parses the channel close request message, and sends the duplex channel ID carried in the channel close request message to the channel management module 403.
  • the protocol stack 401 parses the channel close request message to obtain the channel close identifier and the duplex channel ID. Through the channel closing identifier, the protocol stack 401 determines that the function of the message is to close a certain duplex channel, so the protocol stack 401 sends the parsed duplex channel ID to the channel management module 403.
  • the channel management module 403 determines that all data in the space created for the duplex channel ID in the data processing pool 402 has been processed.
  • the channel management module 403 After the channel management module 403 obtains the ID of the duplex channel that needs to be closed, for example, duplex channel 1, it confirms whether the data in the space created for duplex channel 1 in the data processing pool 402 has been processed, and That is, is there any unprocessed request data in ⁇ 1, ⁇ 0>> and whether there is response data in ⁇ 1, ⁇ 1>> that has not been sent to the client 200.
  • the channel management module 403 waits for the preset time to confirm again Whether the data in the space created for duplex channel 1 in the data processing pool 402 has been processed until the network service 404 has processed all the request data and all the response data is sent to the client 200 (refer to S608 to S612). If there is no unprocessed request data in ⁇ 1, ⁇ 0>> and no response data in ⁇ 1, ⁇ 1>> that has not been sent to the client 200, the previous request data sent through duplex channel 1 and the corresponding The response data of has all been processed.
  • the application program cannot directly instruct the channel management module to close the duplex channel. Instead, the channel management module on the server side must determine that all data has been properly processed before the duplex channel can be officially closed.
  • S618 can also be replaced by an action in which the application 204 confirms that the response data corresponding to the request data sent by the executor running on it has been returned before S615. That is, when the application program 204 confirms that the response data corresponding to the request data sent by the executor running on it has been received, it executes S615, that is, sends a channel close request to the protocol stack 201. In this case, S618 is not required.
  • the channel management module 403 sends a channel closing response to the protocol stack 401.
  • the channel closing response carries the duplex channel ID and the channel closing identifier.
  • the protocol stack 401 generates a channel close response message according to the channel close response, and sends the channel close response message to the protocol stack 201 through the response channel.
  • the channel closing response message carries the duplex channel ID and the channel closing identifier.
  • the request data ID part can carry the channel closing identifier, such as a pre-appointed special ID, which is different from any request Data ID.
  • the data part of the channel closing response message can carry the duplex channel ID.
  • the channel management module 203 and the channel management module 403 close the channel 0 and the channel 1.
  • the specific closing method may adopt the method of closing the application layer protocol channel in the prior art.
  • the channel management module 403 may notify the data processing pool 402 to release the space created for the duplex channel 1 to save the storage resources of the server 400.
  • the channel management module 403 may also delete the previously recorded correspondence between the duplex channel ID 1 and the channel ID 0 and the channel ID 1.
  • the channel management module 203 can delete the previously recorded correspondence between the application 204 and the duplex channel ID 1, and the corresponding relationship between the duplex channel ID 1 and the channel ID 0 and the channel ID 1.
  • Figure 16 provides a client 800.
  • the client 800 includes a bus 803, a processor 801, a communication interface 802, and a memory 804.
  • the processor 801, the memory 804, and the communication interface 802 communicate through a bus 803.
  • the communication interface 802 is used to communicate with the outside, for example, sending a channel establishment request message or a data transmission message to the communication network.
  • the processor 801 may be a central processing unit (English: central processing unit, abbreviated: CPU).
  • the memory 804 may include a volatile memory (English: volatile memory), such as a random access memory (English: random access memory, abbreviation: RAM).
  • the memory 804 may also include a non-volatile memory (English: non-volatile memory), such as a read-only memory (English: read-only memory, abbreviation: ROM), flash memory, HDD or SSD.
  • the memory 804 stores executable instructions, and the processor 801 executes the executable instructions to execute the actions on the client side in the data communication method provided in FIG. 8. Specifically, the memory 804 stores executable instructions to run the aforementioned application program, channel management module, data matching pool, and protocol stack. The memory 804 may also include executable instructions required to run the client operating system.
  • the operating system can be LINUX TM , UNIX TM , WINDOWS TM etc.
  • FIG 17 provides a server 1000.
  • the server 1000 includes a bus 1003, a processor 1001, a communication interface 1002, and a memory 1004.
  • the processor 1001, the memory 1004, and the communication interface 1002 communicate through a bus 1003.
  • the communication interface 1002 is used for communicating with the outside, for example, receiving a channel establishment request message or a data transmission message from a communication network.
  • the processor 1001 may be a CPU.
  • the memory 1004 may include volatile memory, such as RAM.
  • the memory 1004 may also include non-volatile memory, such as ROM, flash memory, HDD or SSD.
  • the memory 1004 stores executable instructions, and the processor 1001 executes the executable instructions to execute the server side actions in the data communication method provided in FIG. 8. Specifically, the memory 1004 stores executable instructions to run the aforementioned network service, channel management module, data matching pool, and protocol stack. The memory 1004 may also include executable instructions required to run the server operating system.
  • the operating system can be LINUX TM , UNIX TM , WINDOWS TM etc.
  • the above-mentioned embodiments it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof.
  • software it can be implemented in the form of a computer program product in whole or in part.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instruction may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instruction may be transmitted from a website, computer, server, or data center through a cable (Such as coaxial cable, optical fiber, digital subscriber line or wireless (such as infrared, wireless, microwave, etc.) transmission to another website site, computer, server or data center.
  • the computer-readable storage medium can be accessed by a computer Any usable medium in the data storage device or a data storage device including one or more usable media integrated servers, data centers, etc.
  • the usable medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), Or semiconductor media (such as SSD) and so on.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Multimedia (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present application discloses a data communication method employing an application layer protocol. Two different application layer protocol channels are established between a client and a server. The client sends, via one of the application layer protocol channels, request data generated by an application to a network service of the server, and the server returns, via the other of the application layer protocol channels, response data generated by the network service to the application. Two independent application layer protocol channels are used to transmit request data and response data respectively, thus improving the efficiency of accessing network services for applications.

Description

一种基于应用层协议的数据通信方法及其装置Data communication method and device based on application layer protocol 技术领域Technical field
本申请涉及计算机技术领域,尤其涉及一种基于应用层协议的数据通信方法,以及执行该方法的客户端、服务端以及服务提供系统。This application relates to the field of computer technology, and in particular to a data communication method based on an application layer protocol, and a client, server, and service providing system that execute the method.
背景技术Background technique
大数据时代,随着网络服务的种类急速增长,每种网络服务的处理量也快递扩张。因此,传统的通过单个服务端来部署网络服务已经难以满足海量业务的需求。目前,主流的网络服务处理架构都是分布式的,由多个部署了网络服务的服务端来协同处理海量业务。在这种架构下,超文本传输协议(hypertest transfer protocol,HTTP)和超文本传输安全协议(hypertext transfer protocol secure,HTTPS)被设计用于不同服务端上运行的网络服务之间以及客户端和服务端之间的通信。In the era of big data, with the rapid growth of the types of network services, the processing capacity of each network service has also expanded. Therefore, the traditional deployment of network services through a single server has been difficult to meet the needs of massive services. At present, mainstream network service processing architectures are all distributed, with multiple servers deployed with network services cooperating to process massive amounts of business. Under this architecture, the Hypertest Transfer Protocol (HTTP) and Hypertext Transfer Protocol Secure (HTTPS) are designed to be used between network services running on different servers, as well as between clients and services. Communication between terminals.
以HTTP为例,常见的基于HTTP的通信流程中,在HTTP客户端与HTTP服务端之间建立传输控制协议(transmission control protocol,TCP)连接后,HTTP客户端向HTTP服务端发送网络请求,HTTP服务端接收网络请求后,根据网络请求向HTTP客户端发送响应信息。随后,该次请求结束,断开为该次请求建立的TCP连接,该场景也称之为短连接。虽然HTTP协议也支持长连接,也即在一次TCP连接中完成多轮网络请求和相应的响应信息,但客户端和服务端之间的通信效率仍然不足。Take HTTP as an example. In a common HTTP-based communication process, after a transmission control protocol (TCP) connection is established between the HTTP client and the HTTP server, the HTTP client sends a network request to the HTTP server. HTTP After receiving the network request, the server sends response information to the HTTP client according to the network request. Subsequently, the request ends, and the TCP connection established for the request is disconnected. This scenario is also called a short connection. Although the HTTP protocol also supports long connections, that is, multiple rounds of network requests and corresponding response messages are completed in one TCP connection, the communication efficiency between the client and the server is still insufficient.
发明内容Summary of the invention
本申请提供了一种基于应用层协议的数据通信方法,该方法提升了应用程序和网络服务之间的通信效率。This application provides a data communication method based on an application layer protocol, which improves the communication efficiency between application programs and network services.
本申请的第一方面提供了一种基于应用层协议的数据通信方法,包括:客户端的通道管理模块和服务端的通道管理模块在客户端上运行的应用程序和服务端上运行的网络服务之间建立第一应用层协议通道和第二应用层协议通道;客户端的协议栈通过该第一应用层协议通道发送该应用程序生成的请求数据至该网络服务;获取该请求数据后,该网络服务根据该请求数据生成响应数据;该服务端的协议栈通过该第二应用层协议通道将该响应数据发送至该应用程序;其中,该第一应用层协议通道和该第二应用层协议通道基于不同的传输层协议连接。该第一应用层协议通道和该第二应用层协议通道基于不同的传输层协议连接,也即第一应用层协议通道和该第二应用层协议通道的建立过程中,需要建立两个不同的传输层协议连接。The first aspect of this application provides a data communication method based on an application layer protocol, which includes: a channel management module on the client side and a channel management module on the server side between an application program running on the client side and a network service running on the server side Establish the first application layer protocol channel and the second application layer protocol channel; the client's protocol stack sends the request data generated by the application program to the network service through the first application layer protocol channel; after obtaining the request data, the network service according to The request data generates response data; the protocol stack of the server sends the response data to the application through the second application layer protocol channel; wherein, the first application layer protocol channel and the second application layer protocol channel are based on different Transport layer protocol connection. The first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols, that is, in the process of establishing the first application layer protocol channel and the second application layer protocol channel, two different Transport layer protocol connection.
通过两个不同的应用层协议通道,使得应用程序对网络服务的数据传输不必受限于在先数据的处理进度,提升了应用程序对网络服务的访问效率,提升了应用程序和网络服务之间的通信效率。Through two different application layer protocol channels, the data transmission of the application to the network service is not limited to the processing progress of the previous data, which improves the access efficiency of the application to the network service, and improves the connection between the application and the network service. Communication efficiency.
在一种可能的实现方式中,该应用层协议为HTTP或HTTPS。In a possible implementation, the application layer protocol is HTTP or HTTPS.
在一种可能的实现方式中,客户端的协议栈通过该第一应用层协议通道发送该应用程序生成的后续请求数据至该网络服务,该后续请求数据的生成时间在该请求数据的生成时间之后。客户端的协议栈发送该后续请求数据时,无须等待接收该请求数据对应的响应数据。In a possible implementation manner, the client's protocol stack sends the subsequent request data generated by the application to the network service through the first application layer protocol channel, and the generation time of the subsequent request data is after the generation time of the request data . When the client's protocol stack sends the subsequent request data, it does not need to wait to receive the response data corresponding to the request data.
在一种可能的实现方式中,该请求数据由该应用程序内运行的执行者生成,该方法还包括:该客户端为该请求数据生成请求数据标识ID,在第一应用层协议通道内传输的每个请求数据的请求数据ID不同;该客户端的协议栈通过该第一应用层协议通道发送该请求数据和该请求数据ID至该网络服务,其中,该请求数据和该请求数据ID携带于同一报文。In a possible implementation, the request data is generated by an executor running in the application program, and the method further includes: the client generates a request data identification ID for the request data, and transmits it in the first application layer protocol channel The request data ID of each request data is different; the protocol stack of the client sends the request data and the request data ID to the network service through the first application layer protocol channel, where the request data and the request data ID are carried in The same message.
该网络服务根据该请求数据生成响应数据后,该方法还包括:该服务端的协议栈通过该第二应用层协议通道将该响应数据和该请求数据ID通过同一报文发送至该客户端;该客户端根据从该第二应用层协议通道接收的该请求数据ID,确定该执行者;该客户端将该响应数据发送至该执行者。After the network service generates response data according to the request data, the method further includes: the server protocol stack sends the response data and the request data ID to the client through the same message through the second application layer protocol channel; The client determines the executor according to the request data ID received from the second application layer protocol channel; the client sends the response data to the executor.
为每个请求数据分配请求数据ID,并将该请求数据ID和响应数据一同返回至客户端,使得客户端能够根据请求数据ID识别响应数据的目标执行者(生成请求数据的执行者)。使得网络服务对请求数据的处理顺序可以更灵活,无论以各种顺序处理请求数据,网络服务生成的响应数据都可以被准确的返回给目标执行者。A request data ID is assigned to each request data, and the request data ID and response data are returned to the client together, so that the client can identify the target executor of the response data (the executor who generated the request data) according to the request data ID. This allows the network service to process the request data more flexibly. No matter how the request data is processed in various orders, the response data generated by the network service can be accurately returned to the target executor.
在一种可能的实现方式中,接收到建立第一应用层协议通道的通道建立请求报文和建立第二应用层协议通道的通道建立请求报文后,该服务端的数据处理池分别为该第一应用层协议通道分配第一空间,为该第二应用层协议通道分配第二空间;该服务端的数据处理池记录该第一空间和该第二空间的对应关系;该服务端将从该第一应用层协议通道接收的该请求数据存入该第一空间;在网络服务生成响应数据后,根据该记录的对应关系,该数据处理池将该响应数据存入该第二空间。In a possible implementation, after receiving the channel establishment request message for establishing the first application layer protocol channel and the channel establishment request message for establishing the second application layer protocol channel, the data processing pool of the server is the first An application layer protocol channel allocates the first space, and the second application layer protocol channel allocates the second space; the data processing pool of the server records the correspondence between the first space and the second space; the server will start from the first space The request data received by an application layer protocol channel is stored in the first space; after the network service generates the response data, the data processing pool stores the response data in the second space according to the corresponding relationship of the record.
服务端为每个应用层协议通道分配了独立的空间,第一空间用于存储第一应用层协议通道发送来的请求数据,第二空间用于存储网络服务根据第一空间内的请求数据生成的响应数据,第二空间内的响应数据通过第二应用层协议通道发送至客户端。为两个应用层协议通道分配独立的空间,提升了服务端对应用层协议通道内传输的数据的管理精度。The server allocates an independent space for each application layer protocol channel. The first space is used to store the request data sent by the first application layer protocol channel, and the second space is used to store network services generated according to the request data in the first space. The response data in the second space is sent to the client through the second application layer protocol channel. Allocate independent space for the two application layer protocol channels, which improves the server's management accuracy of the data transmitted in the application layer protocol channels.
本申请的第二方面,提供了一种服务提供系统,该系统包括至少一个客户端以及至少一个服务端。至少一个客户端和至少一个服务端通过通信网络建立连接。每个客户端上运行有应用程序,应用程序访问服务端上运行的网络服务。该服务提供系统中的客户端执行第一方面提供的方法中客户端执行的方法,该服务提供系统中的客户端执行第一方面提供的方法中服务端执行的方法。The second aspect of the present application provides a service providing system, which includes at least one client and at least one server. At least one client and at least one server establish a connection through a communication network. There are applications running on each client, and the applications access the network services running on the server. The client in the service providing system executes the method provided by the client in the method provided in the first aspect, and the client in the service providing system executes the method provided by the server in the method provided in the first aspect.
本申请的第三方面提供了一种客户端执行的基于应用层协议的数据通信方法。该方法包括:客户端的通道管理模块生成第一通道建立请求报文,该第一通道建立请求报文包括第一通道类型字段,该第一通道类型字段指示基于该第一通道建立请求报文建立的第一应用层协议通道为请求类型,发送该第一通道建立请求报文至服务端;客户端的通道管理模块生成第二通道建立请求报文,该第二通道建立请求报文包括第二通道类型字段,该第二通道类型字段指示基于该第二通道建立请求报文建立的第二应 用层协议通道为响应类型,发送该第二通道建立请求报文至该服务端;其中,该第一应用层协议通道和该第二应用层协议通道基于不同的传输层协议连接;客户端的应用程序生成请求数据,客户端的协议栈接收该请求数据后,通过该第一应用层协议通道发送该请求数据至该服务端上运行的网络服务,客户端的协议栈通过该第二应用层协议通道接收该请求数据对应的响应数据。The third aspect of the present application provides a data communication method based on an application layer protocol executed by a client. The method includes: a channel management module of the client generates a first channel establishment request message, the first channel establishment request message includes a first channel type field, and the first channel type field indicates establishment based on the first channel establishment request message The first application layer protocol channel is the request type, and the first channel establishment request message is sent to the server; the channel management module of the client generates a second channel establishment request message, and the second channel establishment request message includes the second channel Type field, the second channel type field indicates that the second application layer protocol channel established based on the second channel establishment request message is a response type, and the second channel establishment request message is sent to the server; wherein, the first The application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols; the client's application program generates request data, and the client's protocol stack receives the request data, and then sends the request data through the first application layer protocol channel To the network service running on the server, the client's protocol stack receives the response data corresponding to the request data through the second application layer protocol channel.
在一种可能的实现方式中,该方法还包括:客户端的数据匹配池为该请求数据生成请求数据ID;客户端的协议栈通过该第一应用层协议通道发送该请求数据和该请求数据ID至该网络服务;客户端的协议栈通过该第二应用层协议通道接收该请求数据对应的响应数据和该请求数据ID;客户端的数据匹配池根据从该第二应用层协议通道接收的该请求数据ID,确定生成该请求数据的执行者,将该响应数据发送至该执行者。In a possible implementation, the method further includes: the client's data matching pool generates a request data ID for the request data; the client's protocol stack sends the request data and the request data ID to the request data through the first application layer protocol channel The network service; the client's protocol stack receives the response data corresponding to the request data and the request data ID through the second application layer protocol channel; the client's data matching pool is based on the request data ID received from the second application layer protocol channel , Determine the executor who generated the request data, and send the response data to the executor.
本申请的第四方面,提供了一种客户端,该客户端运行时执行第三方面提供的任一方法。该客户端包括:通道管理模块,用于生成第一通道建立请求,该第一通道建立请求包括第一通道类型字段,该第一通道类型字段指示基于该第一通道建立请求建立的第一应用层协议通道为请求类型;生成第二通道建立请求,该第二通道建立请求包括第二通道类型字段,该第二通道类型字段指示基于该第二通道建立请求建立的第二应用层协议通道为响应类型;其中,该第一应用层协议通道和该第二应用层协议通道基于不同的传输层协议连接。可选的,该客户端还包括应用程序,用于生成请求数据,将该请求数据发送至协议栈。该客户端还包括协议栈,用于发送该第一通道建立请求至该服务端;发送该第二通道建立请求至该服务端;通过该第一应用层协议通道发送该请求数据至该服务端上运行的网络服务;通过该第二应用层协议通道接收该请求数据对应的响应数据。The fourth aspect of the present application provides a client, which executes any method provided in the third aspect when the client is running. The client includes: a channel management module configured to generate a first channel establishment request, the first channel establishment request includes a first channel type field, and the first channel type field indicates a first application established based on the first channel establishment request The layer protocol channel is the request type; a second channel establishment request is generated, the second channel establishment request includes a second channel type field, and the second channel type field indicates that the second application layer protocol channel established based on the second channel establishment request is Response type; wherein, the first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols. Optionally, the client further includes an application program for generating request data, and sending the request data to the protocol stack. The client also includes a protocol stack for sending the first channel establishment request to the server; sending the second channel establishment request to the server; sending the request data to the server through the first application layer protocol channel A network service running on the computer; the response data corresponding to the request data is received through the second application layer protocol channel.
在一种可能的实现方式中,该客户端还包括:数据匹配池,用于为该请求数据生成请求数据ID,记录生成该请求数据的执行者和该请求数据ID的对应关系;将该请求数据ID发送至该协议栈。该协议栈,用于通过该第一应用层协议通道发送该请求数据和该请求数据ID至该网络服务;通过该第二应用层协议通道接收该请求数据对应的响应数据和该请求数据ID;将该响应数据和该请求数据ID发送至该数据匹配池。该数据匹配池,还用于根据该记录的对应关系和该请求数据ID,确定生成该请求数据的执行者;将该响应数据发送至该执行者。In a possible implementation, the client further includes: a data matching pool for generating a request data ID for the request data, and recording the correspondence between the executor who generated the request data and the request data ID; The data ID is sent to the protocol stack. The protocol stack is configured to send the request data and the request data ID to the network service through the first application layer protocol channel; receive the response data corresponding to the request data and the request data ID through the second application layer protocol channel; The response data and the request data ID are sent to the data matching pool. The data matching pool is also used to determine the executor who generated the request data according to the corresponding relationship of the record and the request data ID; and send the response data to the executor.
本申请的第五方面提供了一种客户端,也即一种计算机,包括处理器和存储器。该处理器,用于访问该存储器中的指令执行第三方面提供的任一方法。The fifth aspect of the present application provides a client, that is, a computer, including a processor and a memory. The processor is configured to access instructions in the memory to execute any method provided in the third aspect.
本申请的第六方面提供了一种非瞬态的可读存储介质,该非瞬态的可读存储介质中存储的指令被客户端执行时,该客户端执行前述第三方面提供的任一方法。该存储介质中存储了程序指令。该存储介质包括但不限于易失性存储器,例如随机访问存储器,和非易失性存储器,例如快闪存储器、硬盘(hard disk drive,HDD)、固态硬盘(solid state drive,SSD)。The sixth aspect of the present application provides a non-transitory readable storage medium. When the instructions stored in the non-transitory readable storage medium are executed by a client, the client executes any of the instructions provided in the aforementioned third aspect. method. Program instructions are stored in the storage medium. The storage medium includes, but is not limited to, volatile memory, such as random access memory, and non-volatile memory, such as flash memory, hard disk drive (HDD), and solid state drive (SSD).
本申请的第七方面提供了一种计算机程序产品,该计算机程序产品包含的指令被客户端执行时,该客户端执行前述第三方面提供的任一方法。该计算机程序产品可以为一个软件安装包,在需要使用前述第三方面提供的任一方法的情况下,可以下载该计算机程序产品并在客户端上执行该计算机程序产品包含的指令。The seventh aspect of the present application provides a computer program product. When the instructions contained in the computer program product are executed by a client, the client executes any of the methods provided in the foregoing third aspect. The computer program product may be a software installation package. In the case where any method provided in the foregoing third aspect needs to be used, the computer program product can be downloaded and the instructions contained in the computer program product can be executed on the client.
本申请的第八方面提供了一种服务端执行的基于应用层协议的数据通信方法。该方法包括:服务端的协议栈接收第一通道建立请求报文,该第一通道建立请求报文包括第一通道类型字段,该第一通道类型字段指示基于该第一通道建立请求报文建立的第一应用层协议通道为请求类型。服务端的协议栈接收第二通道建立请求报文,该第二通道建立请求报文包括第二通道类型字段,该第二通道类型字段指示基于该第二通道建立请求报文建立的第二应用层协议通道为响应类型;其中,该第一应用层协议通道和该第二应用层协议通道基于不同的传输层协议连接。随后,服务端的协议栈通过该第一应用层协议通道接收请求数据。服务端的网络服务根据该请求数据,生成响应数据。服务端的协议栈通过该第二应用层协议通道发送该响应数据至生成该请求数据的应用程序。The eighth aspect of the present application provides a data communication method based on an application layer protocol executed by a server. The method includes: the protocol stack of the server receives a first channel establishment request message, the first channel establishment request message includes a first channel type field, and the first channel type field indicates the establishment based on the first channel establishment request message. The first application layer protocol channel is the request type. The protocol stack of the server receives a second channel establishment request message, the second channel establishment request message includes a second channel type field, and the second channel type field indicates a second application layer established based on the second channel establishment request message The protocol channel is a response type; wherein, the first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols. Subsequently, the protocol stack of the server receives the request data through the first application layer protocol channel. The network service of the server generates response data according to the request data. The protocol stack of the server sends the response data to the application program that generates the request data through the second application layer protocol channel.
在一种可能的实现方式中,该方法还包括:服务端的协议栈通过该第一应用层协议通道接收该请求数据对应的请求数据ID。生成该响应数据后,服务端的数据处理池建立该响应数据和该请求数据ID的对应关系。服务端的协议栈通过该第二应用层协议通道发送该响应数据和该请求数据ID至生成该请求数据的客户端。In a possible implementation manner, the method further includes: the protocol stack of the server receives the request data ID corresponding to the request data through the first application layer protocol channel. After generating the response data, the data processing pool of the server establishes the corresponding relationship between the response data and the request data ID. The protocol stack of the server sends the response data and the request data ID to the client that generates the request data through the second application layer protocol channel.
在一种可能的实现方式中,服务端的数据处理池为该第一应用层协议通道分配第一空间;为该第二应用层协议通道分配第二空间。服务端的通道管理模块记录该第一空间和该第二空间的对应关系。服务端的协议栈将从该第一应用层协议通道接收的该请求数据存入该第一空间。根据该记录的对应关系,服务端的协议栈将该响应数据存入该第二空间。In a possible implementation manner, the data processing pool of the server allocates a first space for the first application layer protocol channel; and allocates a second space for the second application layer protocol channel. The channel management module of the server records the correspondence between the first space and the second space. The protocol stack of the server side stores the request data received from the first application layer protocol channel into the first space. According to the corresponding relationship of the record, the protocol stack of the server stores the response data in the second space.
本申请的第九方面,提供了一种服务端,该服务端运行时执行第八方面提供的任一方法。该服务端包括:通道管理模块,用于接收第一通道建立请求,该第一通道建立请求包括第一通道类型字段,该第一通道类型字段指示基于该第一通道建立请求建立的第一应用层协议通道为请求类型;接收第二通道建立请求,该第二通道建立请求包括第二通道类型字段,该第二通道类型字段指示基于该第二通道建立请求建立的第二应用层协议通道为响应类型;其中,该第一应用层协议通道和该第二应用层协议通道基于不同的传输层协议连接。该服务端还包括协议栈,用于通过该第一应用层协议通道接收请求数据。可选的,该服务端还包括网络服务,用于根据该请求数据,生成响应数据,发送该响应数据至该协议栈。该协议栈,还用于通过该第二应用层协议通道发送该响应数据至生成该请求数据的应用程序。The ninth aspect of the present application provides a server that executes any method provided in the eighth aspect when the server is running. The server includes: a channel management module for receiving a first channel establishment request, the first channel establishment request includes a first channel type field, and the first channel type field indicates a first application established based on the first channel establishment request The layer protocol channel is the request type; the second channel establishment request is received, the second channel establishment request includes a second channel type field, and the second channel type field indicates that the second application layer protocol channel established based on the second channel establishment request is Response type; wherein, the first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols. The server also includes a protocol stack for receiving request data through the first application layer protocol channel. Optionally, the server also includes a network service, which is used to generate response data according to the request data, and send the response data to the protocol stack. The protocol stack is also used to send the response data to the application program that generated the request data through the second application layer protocol channel.
在一种可能的实现方式中,该协议栈,还用于通过该第一应用层协议通道接收该请求数据对应的请求数据ID;通过该第二应用层协议通道发送该响应数据和该请求数据ID至生成该请求数据的客户端。In a possible implementation, the protocol stack is also used to receive the request data ID corresponding to the request data through the first application layer protocol channel; to send the response data and the request data through the second application layer protocol channel ID to the client that generated the requested data.
在一种可能的实现方式中,该服务端还包括数据处理池,用于为该第一应用层协议通道分配第一空间,为该第二应用层协议通道分配第二空间。该通道管理模块,用于记录该第一空间和该第二空间的对应关系。该协议栈,用于将从该第一应用层协议通道接收的该请求数据存入该第一空间。该通道管理模块,用于根据该记录的对应关系,将该响应数据存入该第二空间。In a possible implementation manner, the server further includes a data processing pool for allocating a first space for the first application layer protocol channel and a second space for the second application layer protocol channel. The channel management module is used to record the corresponding relationship between the first space and the second space. The protocol stack is used to store the request data received from the first application layer protocol channel into the first space. The channel management module is used to store the response data in the second space according to the corresponding relationship of the record.
本申请的第十方面提供了一种服务端,也即一种计算机,包括处理器和存储器。该处理器,用于访问该存储器中的指令执行第八方面提供的任一方法。The tenth aspect of the present application provides a server, that is, a computer, including a processor and a memory. The processor is configured to access instructions in the memory to execute any method provided in the eighth aspect.
本申请的第十一方面提供了一种非瞬态的可读存储介质,该非瞬态的可读存储介质中存储的指令被服务端执行时,该服务端执行前述第八方面提供的任一方法。该存储介质中存储了程序指令。该存储介质包括但不限于易失性存储器,例如随机访问存储器,和非易失性存储器,例如快闪存储器、HDD、SSD。The eleventh aspect of the present application provides a non-transitory readable storage medium. When the instructions stored in the non-transitory readable storage medium are executed by a server, the server executes any of the aforementioned eighth aspects. One method. Program instructions are stored in the storage medium. The storage medium includes, but is not limited to, volatile memory, such as random access memory, and non-volatile memory, such as flash memory, HDD, and SSD.
本申请的第十二方面提供了一种计算机程序产品,该计算机程序产品包含的指令被服务端执行时,该服务端执行前述第八方面提供的任一方法。该计算机程序产品可以为一个软件安装包,在需要使用前述第八方面提供的任一方法的情况下,可以下载该计算机程序产品并在服务端上执行该计算机程序产品包含的指令。The twelfth aspect of the present application provides a computer program product. When the instructions contained in the computer program product are executed by a server, the server executes any of the methods provided in the eighth aspect. The computer program product may be a software installation package. In the case of using any method provided in the eighth aspect, the computer program product can be downloaded and the instructions contained in the computer program product can be executed on the server.
附图说明Description of the drawings
为了更清楚地说明本申请实施例的技术方法,下面将对实施例中所需要使用的附图作以简单地介绍。In order to explain the technical methods of the embodiments of the present application more clearly, the following will briefly introduce the drawings that need to be used in the embodiments.
图1为本申请提供的服务提供系统的架构图;Figure 1 is the architecture diagram of the service provision system provided by this application;
图2为本申请提供的服务提供系统的另一架构图;Figure 2 is another architecture diagram of the service providing system provided by this application;
图3为本申请提供的客户端和服务端使用的协议栈的示意图;Figure 3 is a schematic diagram of the protocol stack used by the client and server provided by this application;
图4为本申请提供的通道建立请求报文的示意图;Figure 4 is a schematic diagram of a channel establishment request message provided by this application;
图5为本申请提供的数据传输报文的示意图;Figure 5 is a schematic diagram of a data transmission message provided by this application;
图6为本申请提供的通道建立请求报文的另一示意图;FIG. 6 is another schematic diagram of a channel establishment request message provided by this application;
图7为本申请提供的数据传输报文的另一示意图;FIG. 7 is another schematic diagram of the data transmission message provided by this application;
图8为本申请提供的数据通信方法的流程示意图;FIG. 8 is a schematic flowchart of the data communication method provided by this application;
图9为本申请提供的本申请提供的通道建立请求报文包括的应用层协议头的示意图;9 is a schematic diagram of the application layer protocol header included in the channel establishment request message provided by this application;
图10为本申请提供的在通道建立过程中的服务提供系统的示意图;Figure 10 is a schematic diagram of the service providing system in the channel establishment process provided by this application;
图11为本申请提供的在数据传输过程中的服务提供系统的示意图;FIG. 11 is a schematic diagram of the service providing system in the data transmission process provided by this application;
图12为本申请提供的在数据传输过程中的服务提供系统的示意图;FIG. 12 is a schematic diagram of the service providing system in the data transmission process provided by this application;
图13为本申请提供的在数据传输过程中的服务提供系统的示意图;FIG. 13 is a schematic diagram of the service providing system in the data transmission process provided by this application;
图14为本申请提供的在数据传输过程中的服务提供系统的示意图;FIG. 14 is a schematic diagram of the service providing system in the data transmission process provided by this application;
图15为本申请提供的应用程序视角的应用层协议请求/响应的示意图;FIG. 15 is a schematic diagram of application layer protocol request/response from the application perspective provided by this application;
图16为本申请提供的客户端的结构示意图;FIG. 16 is a schematic diagram of the structure of the client provided by this application;
图17为本申请提供的服务端的结构示意图。Figure 17 is a schematic diagram of the structure of the server provided by this application.
具体实施方式Detailed ways
下面结合本申请实施例中的附图,对本申请实施例中的技术方法进行描述。本申请中各个“第一”、“第二”、“第n”之间不具有逻辑或时序上的依赖关系。The technical methods in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. In this application, there is no logical or sequential dependency among the "first", "second", and "nth".
本申请中,参考图1,服务提供系统包括至少一个客户端和至少一个服务端,客户端和服务端之间通过通信网络互连,服务端向客户端提供网络服务(web service)。 其中,其中,客户端可以是例如,智能电话(smart phone)、个人数字助理(personal digital assistant,PDA)、平板型电脑、膝上型电脑(laptop computer)、个人电脑(personal computer,PC)、服务器等设备。常见的服务端包括个人电脑或服务器。客户端和服务端之间的通信网络可以是有线的通信网络,也可以是无线的通信网络,例如:第五代移动通信技术(5th-Generation,5G)系统,长期演进(long term evolution,LTE)系统、无线保真(wireless fidelity,WiFi)。In this application, referring to FIG. 1, the service providing system includes at least one client and at least one server. The client and the server are interconnected through a communication network, and the server provides a web service to the client. Among them, the client can be, for example, a smart phone (smart phone), a personal digital assistant (personal digital assistant, PDA), a tablet computer, a laptop computer (laptop computer), a personal computer (PC), Servers and other equipment. Common servers include personal computers or servers. The communication network between the client and the server can be a wired communication network or a wireless communication network, for example: the fifth-generation mobile communication technology (5th-Generation, 5G) system, long term evolution (LTE) ) System, wireless fidelity (wireless fidelity, WiFi).
本申请中,每秒事务量(transaction per second,TPS),指代服务提供系统每秒能够处理的请求的数量,可以用于衡量服务提供系统的吞吐量。In this application, transaction per second (TPS) refers to the number of requests that the service providing system can process per second, and can be used to measure the throughput of the service providing system.
基于图2,进一步介绍服务提供系统中的客户端200和服务端400。客户端200上运行有至少一个应用程序(应用程序204至应用程序20N),N为大于或等于4的整数。每个应用程序内运行有至少一个执行者(actor),执行者可以是线程或者回调(callback)函数。应用程序在运行的过程中,应用程序的执行者向服务端400上运行的至少一个网络服务(网络服务404至网络服务40M)发出应用层协议请求,N为大于或等于4的整数,以请求网络服务根据请求进行对应的处理。以HTTP请求为例,常见的处理类型(请求方法)包括POST、GET、PUT等。Based on FIG. 2, the client 200 and the server 400 in the service providing system are further introduced. At least one application program (application program 204 to application program 20N) is running on the client 200, and N is an integer greater than or equal to 4. There is at least one actor running in each application, and the actor can be a thread or a callback function. While the application is running, the executor of the application sends an application layer protocol request to at least one network service (network service 404 to network service 40M) running on the server 400, where N is an integer greater than or equal to 4 to request The network service performs corresponding processing according to the request. Taking HTTP requests as an example, common processing types (request methods) include POST, GET, PUT, etc.
客户端200上运行的通道管理模块203和服务端400上运行的通道管理模块403配合建立客户端200和服务端400之间的请求通道和响应通道。请求通道和响应通道为独立的两个应用层协议通道。其中,请求通道用于传输客户端200生成的应用层协议请求至服务端400,响应通道用于传输服务端400根据应用层协议请求生成的应用层协议响应至客户端200。本申请提供的方案中,协议栈201、数据匹配池202和通道管理模块203可以封装成一个软件开发工具(software development kit,SDK),应用程序20N对协议栈201、数据匹配池202或者通道管理模块203的访问通过调用该SDK的应用程序接口(application program interface,API)来实现。The channel management module 203 running on the client 200 and the channel management module 403 running on the server 400 cooperate to establish a request channel and a response channel between the client 200 and the server 400. The request channel and the response channel are two independent application layer protocol channels. The request channel is used to transmit the application layer protocol request generated by the client 200 to the server 400, and the response channel is used to transmit the application layer protocol response generated by the server 400 according to the application layer protocol request to the client 200. In the solution provided in this application, the protocol stack 201, the data matching pool 202, and the channel management module 203 can be packaged into a software development kit (SDK), and the application program 20N manages the protocol stack 201, the data matching pool 202 or the channel Access to the module 203 is achieved by calling the application program interface (API) of the SDK.
服务端400上运行的数据处理池402用于存储应用层协议请求中携带的多个请求数据以及每个请求数据的标识ID,并为网络服务处理应用层协议请求后生成的应用层协议响应内的每个响应数据配置ID。一个请求数据的ID和基于该请求数据生成的响应数据的ID相同,即应用层协议请求中携带的某一请求数据对应的ID,也被数据处理池402配置给在应用层协议响应中携带的该请求数据对应的响应数据。客户端200上运行的数据匹配池202用于分配并记录应用层协议请求内携带的每个请求数据的ID,以此识别每个请求数据对应的响应数据。The data processing pool 402 running on the server 400 is used to store multiple request data carried in the application layer protocol request and the identification ID of each request data, and to process the application layer protocol request for the network service in the application layer protocol response generated Each response data configuration ID. The ID of a request data is the same as the ID of the response data generated based on the request data, that is, the ID corresponding to a certain request data carried in the application layer protocol request is also configured by the data processing pool 402 to the ID carried in the application layer protocol response The response data corresponding to the request data. The data matching pool 202 running on the client 200 is used to allocate and record the ID of each request data carried in the application layer protocol request, so as to identify the response data corresponding to each request data.
以下,通过图3介绍客户端200上运行的协议栈201和服务端400上运行的协议栈401。协议栈201和协议栈401内包括多层协议相关的处理机制。图3中,链路层协议包括链路层协议的处理机制,网络层协议包括网络层协议的处理机制,传输层协议包括传输层协议的处理机制,应用层协议包括应用层协议的处理机制。应用程序期望访问网络服务的情况下,应用程序生成多个请求数据,这多个请求数据在协议栈201中按照本申请提供的双工通道协议封装入应用层协议体后,进一步被依次添加传输层协议头、网络层协议头、链路层协议头,然后通过通信网络传输至协议栈401。图5示出了封装完毕的数据传输报文,每个数据传输报文携带了至少一个数据(请求数据或响应数据)和请求数据ID。Hereinafter, the protocol stack 201 running on the client 200 and the protocol stack 401 running on the server 400 are introduced through FIG. 3. Protocol stack 201 and protocol stack 401 include processing mechanisms related to multi-layer protocols. In Figure 3, the link layer protocol includes the processing mechanism of the link layer protocol, the network layer protocol includes the processing mechanism of the network layer protocol, the transport layer protocol includes the processing mechanism of the transport layer protocol, and the application layer protocol includes the processing mechanism of the application layer protocol. When the application program expects to access the network service, the application program generates multiple request data. After the multiple request data is encapsulated in the application layer protocol body according to the duplex channel protocol provided by this application in the protocol stack 201, it is further added and transmitted in sequence The layer protocol header, the network layer protocol header, and the link layer protocol header are then transmitted to the protocol stack 401 through the communication network. Figure 5 shows the encapsulated data transmission message. Each data transmission message carries at least one piece of data (request data or response data) and a request data ID.
与之类似的,如图4,在创建请求通道和响应通道的过程中使用的通道建立请求报文也通过协议栈201逐层封装生成。每个应用层协议请求或每个应用层协议响应由通道建立请求报文和多个数据传输报文构成。报文发送至服务端400后,协议栈401按照链路层协议、网络层协议、传输层协议、应用层协议的顺序解析报文,以获得双工通道协议头和体内携带的双工通道控制字段。Similarly, as shown in FIG. 4, the channel establishment request message used in the process of creating the request channel and the response channel is also encapsulated and generated layer by layer by the protocol stack 201. Each application layer protocol request or each application layer protocol response is composed of a channel establishment request message and multiple data transmission messages. After the message is sent to the server 400, the protocol stack 401 parses the message in the order of link layer protocol, network layer protocol, transport layer protocol, and application layer protocol to obtain the duplex channel protocol header and the duplex channel control carried in the body. Field.
常见的链路层协议包括以太网协议(ethernet protocol),常见的网络层协议包括互联网协议(internet protocol),常见的传输层协议包括TCP,常见的应用层协议包括HTTP、HTTPS。图6和图7示出了基于常见协议的通道建立请求报文和数据传输报文。Common link layer protocols include ethernet protocol, common network layer protocols include internet protocol, common transport layer protocols include TCP, and common application layer protocols include HTTP and HTTPS. Figures 6 and 7 show channel establishment request messages and data transmission messages based on common protocols.
图8介绍了本申请提供的数据通信方法600,该方法包括3个部分,即通道建立部分、数据传输部分和通道关闭部分。FIG. 8 illustrates the data communication method 600 provided by the present application. The method includes three parts, namely, a channel establishment part, a data transmission part, and a channel closing part.
首先,通道建立部分包括S600、S601和S602,其中,S601和S602可以以任意顺序执行。First, the channel establishment part includes S600, S601, and S602, where S601 and S602 can be executed in any order.
S600,通道管理模块203发送通道建立请求至协议栈201。该通道建立请求携带用于建立请求通道的双工通道控制字段和响应通道的双工通道控制字段,用于建立请求通道的双工通道控制字段的具体内容和响应通道的双工通道控制字段的具体内容见后续。S600: The channel management module 203 sends a channel establishment request to the protocol stack 201. The channel establishment request carries the duplex channel control field used to establish the request channel and the duplex channel control field of the response channel, the specific content of the duplex channel control field used to establish the request channel and the duplex channel control field of the response channel See the follow-up for details.
通道管理模块203也可以通过两个通道建立请求,分别发送用于建立请求通道的双工通道控制字段和响应通道的双工通道控制字段至协议栈201。The channel management module 203 may also send the duplex channel control field for establishing the requested channel and the duplex channel control field for the response channel to the protocol stack 201 through two channel establishment requests, respectively.
S601,协议栈201发送用于建立请求通道的通道建立请求报文至协议栈401。S601: The protocol stack 201 sends a channel establishment request message for establishing a request channel to the protocol stack 401.
S601后,协议栈401解析S601中接收的通道建立请求报文,将解析出的双工通道控制字段发送至通道管理模块403。通道管理模块203和通道管理模块403根据双工通道控制字段在客户端200的应用程序204和服务端400的网络服务404间建立请求通道,该请求通道为应用层协议通道。After S601, the protocol stack 401 parses the channel establishment request message received in S601, and sends the parsed duplex channel control field to the channel management module 403. The channel management module 203 and the channel management module 403 establish a request channel between the application 204 of the client 200 and the network service 404 of the server 400 according to the duplex channel control field, and the request channel is an application layer protocol channel.
通道建立请求报文参考图4和图6。具体的,如图9所示,应用层协议头内包括应用层协议的原始字段,还包括通道建立请求内携带的双工通道控制字段。通道建立请求报文中双工通道控制字段之外的内容为协议栈201封装的。双工通道控制字段包括双工通道ID和通道类型。以应用层协议为HTTP协议为例,原始字段包括请求行和请求头,请求行包括请求方法,统一资源定位器(uniform resource locator,URL),协议版本等信息。该请求方法常见为POST,该URL指向网络服务404。请求头包括Connection字段和Content-Type字段,例如:Refer to Figure 4 and Figure 6 for the channel establishment request message. Specifically, as shown in FIG. 9, the application layer protocol header includes the original field of the application layer protocol, and also includes the duplex channel control field carried in the channel establishment request. The content other than the duplex channel control field in the channel establishment request message is encapsulated by the protocol stack 201. The duplex channel control field includes the duplex channel ID and channel type. Taking the HTTP protocol as the application layer protocol as an example, the original field includes the request line and the request header, and the request line includes information such as the request method, uniform resource locator (URL), and protocol version. The request method is usually POST, and the URL points to the web service 404. The request header includes the Connection field and the Content-Type field, for example:
Connection:keep-aliveConnection:keep-alive
Content-Type:text/event-streamContent-Type:text/event-stream
双工通道控制字段包括Duplex-Channel-ID(双工通道ID)字段和Duplex-Channel-Type(通道类型)字段,例如:The duplex channel control field includes the Duplex-Channel-ID (duplex channel ID) field and the Duplex-Channel-Type (channel type) field, for example:
Duplex-Channel-ID:1Duplex-Channel-ID:1
Duplex-Channel-Type:requestDuplex-Channel-Type:request
通道管理模块203和通道管理模块403还为请求通道分配了通道ID(channel-ID) 为0,并记录双工通道ID和通道ID的对应关系。以记为<1,<0,>>为例,表达双工通道ID为1,该双工通道的请求通道的ID为0。The channel management module 203 and the channel management module 403 also assign a channel ID (channel-ID) of 0 to the request channel, and record the corresponding relationship between the duplex channel ID and the channel ID. Take the mark as <1,<0,>> as an example, the ID of the duplex channel is 1 and the ID of the request channel of the duplex channel is 0.
S602,协议栈201发送用于建立另一请求通道的通道建立请求报文至协议栈401。S602: The protocol stack 201 sends a channel establishment request message for establishing another request channel to the protocol stack 401.
S601后,协议栈401解析S602中接收的通道建立请求报文,将解析出的双工通道控制字段发送至通道管理模块403。通道管理模块203和通道管理模块403根据双工通道控制字段在客户端200的应用程序204和服务端400的网络服务404间建立响应通道,该响应通道为应用层协议通道。After S601, the protocol stack 401 parses the channel establishment request message received in S602, and sends the parsed duplex channel control field to the channel management module 403. The channel management module 203 and the channel management module 403 establish a response channel between the application 204 of the client 200 and the network service 404 of the server 400 according to the duplex channel control field, and the response channel is an application layer protocol channel.
S601中建立的请求通道和S602中建立的响应通道为两个独立的应用层协议通道,独立体现在两个应用层协议通道基于不同的传输层协议连接。以应用层协议采用HTTP且传输层采用TCP为例,S601中建立的HTTP通道和S602中建立的HTTP通道基于不同的TCP连接。The request channel established in S601 and the response channel established in S602 are two independent application layer protocol channels, which are independently embodied in that the two application layer protocol channels are connected based on different transport layer protocols. Taking the application layer protocol using HTTP and the transport layer using TCP as an example, the HTTP channel established in S601 and the HTTP channel established in S602 are based on different TCP connections.
一个应用层协议通道基于一个TCP连接,且通过多个携带相同传输层协议头、网络层协议头、链路层协议头的报文来传输应用层协议请求/响应。一个应用层协议通道内传输的各个报文的传输层协议头的序号(例如传输层协议采用TCP连接的情况下)可能不同。S601中建立的请求通道和S602中建立的响应通道组成一对双工通道,也即S601中建立的请求通道传输应用层协议请求,S602中建立的响应通道传输对应的应用层协议响应。An application layer protocol channel is based on a TCP connection and transmits application layer protocol requests/responses through multiple packets carrying the same transport layer protocol header, network layer protocol header, and link layer protocol header. The sequence number of the transport layer protocol header of each message transmitted in an application layer protocol channel (for example, when the transport layer protocol adopts a TCP connection) may be different. The request channel established in S601 and the response channel established in S602 form a pair of duplex channels, that is, the request channel established in S601 transmits application layer protocol requests, and the response channel established in S602 transmits corresponding application layer protocol responses.
与S601类似的,S602中采用的通道建立请求报文参考图4和图6。具体的,如图9所示,应用层协议头内包括应用层协议的原始字段,还包括通道建立请求内携带的双工通道控制字段。通道建立请求报文中双工通道控制字段之外的内容为协议栈201封装的。双工通道控制字段包括双工通道ID和通道类型。以应用层协议为HTTP协议为例,原始字段包括请求行和请求头,请求行包括请求方法,统一资源定位器(uniform resource locator,URL),该请求方法常见为POST,该URL指向网络服务404;请求头包括Connection字段和Content-Type字段,例如:Similar to S601, refer to Fig. 4 and Fig. 6 for the channel establishment request message used in S602. Specifically, as shown in FIG. 9, the application layer protocol header includes the original field of the application layer protocol, and also includes the duplex channel control field carried in the channel establishment request. The content other than the duplex channel control field in the channel establishment request message is encapsulated by the protocol stack 201. The duplex channel control field includes the duplex channel ID and channel type. Taking the HTTP protocol as the application layer protocol as an example, the original field includes the request line and the request header, the request line includes the request method, uniform resource locator (URL), the request method is usually POST, and the URL points to the web service 404 ; The request header includes the Connection field and the Content-Type field, for example:
Connection:keep-aliveConnection:keep-alive
Content-Type:text/event-streamContent-Type:text/event-stream
Connection字段和Content-Type字段还可以有其他取值,此处仅为实例。The Connection field and the Content-Type field can also have other values, which are only examples here.
双工通道控制字段包括Duplex-Channel-ID(双工通道ID)字段和Duplex-Channel-Type(通道类型)字段,例如:The duplex channel control field includes the Duplex-Channel-ID (duplex channel ID) field and the Duplex-Channel-Type (channel type) field, for example:
Duplex-Channel-ID:1Duplex-Channel-ID:1
Duplex-Channel-Type:responseDuplex-Channel-Type:response
通道管理模块203和通道管理模块403还为请求通道分配了通道ID(channel-ID)为1,并记录双工通道ID和通道ID的对应关系。以记为<1,<0,1>>为例,表达双工通道ID为1,该双工通道的请求通道的ID为0,该双工通道的响应通道的ID为1。如图10所示,S601和S602执行完毕后,数据处理池402内为请求通道和响应通道分别创建了一块空间用以存储请求数据以及响应数据,这两块空间分别被标记为<1,<0>>,<1,<1>>。通道管理模块203还记录了应用程序204和双工通道ID 1的对应关系,以在应用程序204发起通道关闭请求的时候,确定属于应用程序204的双工通道ID,具 体参见S615。The channel management module 203 and the channel management module 403 also assign a channel ID (channel-ID) of 1 to the request channel, and record the corresponding relationship between the duplex channel ID and the channel ID. Take the record as <1,<0,1>> as an example to express that the duplex channel ID is 1, the request channel ID of the duplex channel is 0, and the response channel ID of the duplex channel is 1. As shown in Figure 10, after S601 and S602 are executed, a space is created for the request channel and the response channel in the data processing pool 402 to store the request data and the response data. The two spaces are marked as <1,< 0>>, <1,<1>>. The channel management module 203 also records the correspondence between the application 204 and the duplex channel ID 1 to determine the duplex channel ID belonging to the application 204 when the application 204 initiates a channel closing request, see S615 for details.
通道管理模块403可以记录通道建立请求报文中携带的五元组(源/目的网络协议(internet protocol,IP)地址、源/目的媒体访问控制(media access control,MAC)地址、端口号)和双工通道ID/通道ID的对应关系。例如,通道管理模块403记录五元组0和双工通道ID 1/通道ID 0的对应关系,记录五元组1和双工通道ID 1/通道ID 1的对应关系。则通道管理模块403可以确定包括五元组1的报文对应的双工通道ID为1且通道ID为1,且通道管理模块403可以确定包括五元组0的报文对应的双工通道ID为1且通道ID为0。通过记录五元组和双工通道ID/通道ID的对应关系,通道管理模块403可以确定每一个报文对应的双工通道ID以及对应的通道ID。其中,报文的五元组可以由协议栈401解析得出并发送至通道管理模块403。The channel management module 403 can record the 5-tuple (source/destination network protocol (IP) address, source/destination media access control (MAC) address, port number) carried in the channel establishment request message and Correspondence between duplex channel ID/channel ID. For example, the channel management module 403 records the correspondence between quintuple 0 and duplex channel ID 1/channel ID 0, and records the correspondence between quintuple 1 and duplex channel ID 1/channel ID 1. Then the channel management module 403 can determine that the duplex channel ID corresponding to the packet including the quintuple 1 is 1 and the channel ID is 1, and the channel management module 403 can determine the duplex channel ID corresponding to the packet including the quintuple 0 Is 1 and the channel ID is 0. By recording the corresponding relationship between the quintuple and the duplex channel ID/channel ID, the channel management module 403 can determine the duplex channel ID and the corresponding channel ID corresponding to each message. The five-tuple of the message can be parsed by the protocol stack 401 and sent to the channel management module 403.
可选的,S601后,通道管理模块403可以通过请求通道返回通道建立成功响应,以指示请求通道建立成功。类似的,S602后,通道管理模块403可以通过响应通道返回通道建立成功响应,以指示响应通道建立成功。在此情况下,S601和S602中发出的两个通道请求建立报文的Connection字段需要为keep-alive,以免通道建立成功响应返回客户端200后请求通道和响应通道被关闭。Optionally, after S601, the channel management module 403 may return a channel establishment success response through the request channel to indicate that the request channel is successfully established. Similarly, after S602, the channel management module 403 may return a channel establishment success response through the response channel to indicate that the response channel is successfully established. In this case, the Connection field of the two channel establishment request messages sent in S601 and S602 needs to be keep-alive, so as to prevent the request channel and the response channel from being closed after the successful channel establishment response is returned to the client 200.
以上S600的执行,由应用程序204发起。应用程序204首次发起对网络服务404的应用层协议请求时或应用程序204初始化与网络服务404之间的应用层协议通道时,应用程序204触发通道管理模块203执行S600。The execution of the above S600 is initiated by the application 204. When the application 204 initiates an application layer protocol request for the network service 404 for the first time or when the application 204 initializes an application layer protocol channel between the application 204 and the network service 404, the application 204 triggers the channel management module 203 to execute S600.
S601和S602后,应用程序204与网络服务404之间的应用层协议通道建立完毕,应用程序204可以传输请求数据至网络服务404,数据传输部分包括S603至S614。After S601 and S602, the application layer protocol channel between the application 204 and the network service 404 is established, the application 204 can transmit the request data to the network service 404, and the data transmission part includes S603 to S614.
S603,应用程序204的执行者生成请求数据,将请求数据发送至数据匹配池202。S603: The executor of the application 204 generates request data, and sends the request data to the data matching pool 202.
该请求数据中包括处理类型。可选的,该请求数据还可以包括待处理的数据块。The request data includes the processing type. Optionally, the request data may also include data blocks to be processed.
其中,处理类型指示网络服务的操作类型。例如,处理类型可以是新增,以指示网络服务404接收该待处理的数据块后存储该待处理的数据块;再例如,处理类型可以是替换,以指示网络服务404接收该待处理的数据后,用该待处理的数据替换掉某一数据块;再例如,处理类型可以是删除,以指示网络服务404删除某一数据块,此种情况下,该请求数据可以不包含待处理的数据块;再例如,处理类型可以是访问,以指示网络服务404返回某一数据块至应用程序204,此种情况下,该请求数据可以不包含待处理的数据块。Among them, the processing type indicates the operation type of the network service. For example, the processing type may be new to instruct the network service 404 to store the data block to be processed after receiving the data block to be processed; for another example, the processing type may be replacement to instruct the network service 404 to receive the data to be processed Then, replace a certain data block with the data to be processed; for another example, the processing type can be delete to instruct the network service 404 to delete a certain data block. In this case, the requested data may not contain the data to be processed Block; For another example, the processing type may be access to instruct the network service 404 to return a certain data block to the application 204. In this case, the requested data may not include the data block to be processed.
S604,数据匹配池202为该请求数据生成对应的请求数据ID,存储该请求数据ID。S604: The data matching pool 202 generates a corresponding request data ID for the request data, and stores the request data ID.
如图11所示,图11内数据匹配池内实线方框0指代请求数据ID 0。数据匹配池202还记录生成该请求数据的执行者和该请求数据ID的对应关系。As shown in FIG. 11, the solid-line box 0 in the data matching pool in FIG. 11 refers to the requested data ID 0. The data matching pool 202 also records the correspondence between the executor who generated the requested data and the requested data ID.
S604后,数据匹配池202可以通知应用程序204挂起生成该请求数据的执行者,等待请求数据对应的响应数据的返回。应用程序204的其他执行者不受影响,可以继续发送请求数据至数据匹配池202。After S604, the data matching pool 202 may notify the application program 204 to suspend the executor generating the requested data, and wait for the response data corresponding to the requested data to be returned. Other executors of the application 204 are not affected, and can continue to send request data to the data matching pool 202.
S605,数据匹配池202将该请求数据和生成的请求数据ID发送至协议栈201。S605: The data matching pool 202 sends the request data and the generated request data ID to the protocol stack 201.
S606,协议栈201生成数据传输报文,将生成的数据传输报文通过请求通道发送至协议栈401。S606: The protocol stack 201 generates a data transmission message, and sends the generated data transmission message to the protocol stack 401 through the request channel.
该数据传输报文如图5或图7所示,其中,应用层协议体中携带了该请求数据和该请求数据ID。图11中请求数据ID 0和请求数据通过请求通道被发送至协议栈401,数据传输报文的其他部分在图11中略去。The data transmission message is shown in FIG. 5 or FIG. 7, wherein the application layer protocol body carries the request data and the request data ID. In FIG. 11, the request data ID 0 and the request data are sent to the protocol stack 401 through the request channel, and other parts of the data transmission message are omitted in FIG. 11.
S607,协议栈401解析该数据传输报文,将解析出来的请求数据ID 0和请求数据存入数据处理池402内为请求通道开辟的空间<1,<0>>。S607: The protocol stack 401 parses the data transmission message, and stores the parsed request data ID 0 and the request data in the space <1, <0>> opened up for the request channel in the data processing pool 402.
在服务提供系统中建立有多对双工通道的情况下,协议栈401在解析数据传输报文的过程中,依据数据传输报文的内容(例如,五元组)可以确定该数据传输报文对应于哪对双工通道中的请求通道或响应通道。在确定了该数据传输报文归属的通道后,协议栈401可以将解析出来的请求数据ID和请求数据存入数据处理池402中该数据传输报文归属的通道对应的空间中。When multiple pairs of duplex channels are established in the service providing system, the protocol stack 401 can determine the data transmission message according to the content of the data transmission message (for example, a quintuple) in the process of parsing the data transmission message Corresponds to the request channel or response channel in which duplex channel. After determining the channel to which the data transmission message belongs, the protocol stack 401 may store the parsed request data ID and request data in the space corresponding to the channel to which the data transmission message belongs in the data processing pool 402.
S608,网络服务404从空间<1,<0>>中获取请求数据ID 0和请求数据。S608: The network service 404 obtains the request data ID 0 and the request data from the space <1, <0>>.
S609,网络服务404根据该请求数据生成响应数据。S609: The network service 404 generates response data according to the request data.
响应数据包括本次请求数据的处理信息,例如网络服务执行本次请求数据的时间戳、网络服务的类型。当请求数据包括的处理类型为访问时,该响应数据还可以包括根据请求数据访问到的数据块,访问到的数据块的长度等内容。The response data includes the processing information of the requested data, such as the timestamp of the requested data executed by the network service, and the type of the network service. When the processing type included in the request data is access, the response data may also include content such as the data block accessed according to the requested data, the length of the accessed data block, and so on.
S610,网络服务404将请求数据ID 0和响应数据存入数据处理池402内为响应通道开辟的空间<1,<1>>,如图11所示。S610, the network service 404 stores the request data ID 0 and the response data in the data processing pool 402 to open up the space <1, <1>> for the response channel, as shown in FIG. 11.
网络服务404访问通道管理模块403获得通道ID的对应关系,确定从通道ID 0对应的空间内获取的请求数据ID 0和请求数据对应的响应数据需要被发送至通道ID 1对应的空间。或者,网络服务404将请求数据ID 0和响应数据发送至通道管理模块403,由通道管理模块403根据记录的通道ID的对应关系,确定从通道ID 0对应的空间内获取的请求数据ID 0和请求数据对应的响应数据需要被发送至通道ID 1对应的空间,由通道管理模块403将请求数据ID 0和响应数据存入数据处理池402内为响应通道开辟的空间<1,<1>>。The network service 404 accesses the channel management module 403 to obtain the corresponding relationship of the channel ID, and determines that the request data ID 0 obtained from the space corresponding to the channel ID 0 and the response data corresponding to the request data need to be sent to the space corresponding to the channel ID 1. Alternatively, the network service 404 sends the request data ID 0 and the response data to the channel management module 403, and the channel management module 403 determines the request data ID 0 and the request data ID 0 and data obtained from the space corresponding to the channel ID 0 according to the recorded correspondence of the channel ID. The response data corresponding to the request data needs to be sent to the space corresponding to the channel ID 1, and the channel management module 403 stores the request data ID 0 and the response data in the data processing pool 402. The space opened for the response channel <1, <1>> .
S611,协议栈401从数据处理器402中的空间<1,<1>>获取请求数据ID和响应数据,根据获取的请求数据ID和响应数据,生成数据传输报文。S611: The protocol stack 401 obtains the request data ID and response data from the space <1, <1>> in the data processor 402, and generates a data transmission message according to the obtained request data ID and response data.
S611中生成的数据传输报文如图5或图7所示,其中,应用层协议体中携带了该响应数据和该请求数据ID。图12中请求数据ID 0和响应数据通过响应通道被发送至协议栈201,数据传输报文的其他部分略去。The data transmission message generated in S611 is shown in FIG. 5 or FIG. 7, where the application layer protocol body carries the response data and the request data ID. In FIG. 12, the request data ID 0 and the response data are sent to the protocol stack 201 through the response channel, and the other parts of the data transmission message are omitted.
协议栈401生成了携带响应数据的数据传输报文后,数据处理池402开辟的空间<1,<0>>和<1,<1>>内存储的请求数据ID/请求数据以及请求数据ID/响应数据可以被删除,以节省服务端400的存储空间。After the protocol stack 401 generates the data transmission message carrying the response data, the space opened by the data processing pool 402 is the requested data ID/request data and the requested data ID stored in the space <1, <0>> and <1, <1>> /Response data can be deleted to save the storage space of the server 400.
S612,协议栈401将生成的数据传输报文通过响应通道发送至协议栈201。S612: The protocol stack 401 sends the generated data transmission message to the protocol stack 201 through the response channel.
S612即协议栈401基于请求通道传送来的应用层协议请求生成应用层协议响应,将应用层协议响应通过响应通道返回至协议栈201。应用层协议响应除了数据传输报文(携带响应数据)外,还应包括应用层协议头。协议栈401通过响应通道返回第一个响应数据之前,还应该返回包括应用层协议头的报文至协议栈201,该报文的格式参考图4或图6。该报文的应用层协议头中携带与S602中通道建立请求报文的应用层 协议头中携带的相同的双工通道控制字段,还包括应用层协议的原始字段,该报文携带的应用层协议的原始字段可能与S602中通道建立请求报文部分相同,具体参考应用层协议的类型。以HTTP协议为例,该报文携带的应用层协议头即图15中HTTP响应的头。In S612, the protocol stack 401 generates an application layer protocol response based on the application layer protocol request transmitted from the request channel, and returns the application layer protocol response to the protocol stack 201 through the response channel. In addition to the data transmission message (carrying response data), the application layer protocol response should also include the application layer protocol header. Before the protocol stack 401 returns the first response data through the response channel, it should also return a message including the application layer protocol header to the protocol stack 201. Refer to FIG. 4 or FIG. 6 for the format of the message. The application layer protocol header of the message carries the same duplex channel control field as the application layer protocol header of the channel establishment request message in S602, and also includes the original field of the application layer protocol. The application layer carried by the message The original field of the protocol may be the same as the part of the channel establishment request message in S602. For details, refer to the type of application layer protocol. Taking the HTTP protocol as an example, the application layer protocol header carried in the message is the header of the HTTP response in FIG. 15.
S613,协议栈201解析该数据传输报文,将解析出来的请求数据ID 0和响应数据存入数据匹配池202,如图13所示。S613: The protocol stack 201 parses the data transmission message, and stores the parsed request data ID 0 and response data into the data matching pool 202, as shown in FIG. 13.
S614,数据匹配池202通过S604中记录的执行者和请求数据ID的对应关系,确定该响应数据的目的地为S603中生成的请求数据的执行者,将响应数据发送至该执行者。S614: The data matching pool 202 determines that the destination of the response data is the executor of the request data generated in S603 through the correspondence between the executor and the request data ID recorded in S604, and sends the response data to the executor.
S614后,应用程序204的执行者对网络服务404的一次请求被处理完毕。该过程中由于请求数据和响应数据采用了不同的应用层协议通道来传输,互不干扰,也即这两个不同的应用层协议通道构成了一对双工通道。与现有的HTTP连接技术相比,应用程序204可以持续通过请求通道发送请求数据,下一请求数据的发送无须等待上一请求数据对应的响应数据的接收,提升了服务提供系统的TPS,实现了应用程序对网络服务更高效率的访问。After S614, one request of the executor of the application 204 to the network service 404 is processed. In this process, because request data and response data are transmitted using different application layer protocol channels, they do not interfere with each other, that is, these two different application layer protocol channels form a pair of duplex channels. Compared with the existing HTTP connection technology, the application 204 can continuously send request data through the request channel, and the next request data transmission does not need to wait for the reception of the response data corresponding to the previous request data, which improves the TPS of the service provision system and realizes This allows applications to have more efficient access to network services.
以图14为例,应用程序204生成了请求数据0和请求数据P,P为大于0的任意整数,也即应用程序204在请求数据0和请求数据P之间可能发送其他请求数据至服务端400。请求数据0和请求数据P被生成后,通过请求通道发送至服务端400,请求数据0和请求数据P的发送过程中无须等待任意响应数据的接收。服务端400在接收了请求数据0和请求数据P后,网络服务404可以以任意顺序处理请求数据,暂时无法处理的请求数据可以缓存在数据处理池402内。如图14中,响应数据P先于响应数据0生成,则响应数据P可以先通过响应通道发送回客户端200。与之对应的,现有的HTTP连接技术是先到先得(first in first out,FIFO),也即先发送至网络服务的请求数据先被处理,而在先到达网络服务的请求数据不被处理完毕前,后续的请求数据无法被处理。与之相对的,本申请提供的方法中,网络服务404处理请求数据的顺序可以不受FIFO的限制,处理机制更加灵活,提升访问控制的精细程度。Taking FIG. 14 as an example, the application 204 generates request data 0 and request data P. P is any integer greater than 0, that is, the application 204 may send other request data to the server between the request data 0 and the request data P 400. After the request data 0 and the request data P are generated, they are sent to the server 400 through the request channel, and there is no need to wait for the reception of any response data during the sending process of the request data 0 and the request data P. After the server 400 receives the request data 0 and the request data P, the network service 404 can process the request data in any order, and the request data that cannot be processed temporarily can be cached in the data processing pool 402. As shown in FIG. 14, the response data P is generated before the response data 0, and the response data P can be sent back to the client 200 through the response channel first. Correspondingly, the existing HTTP connection technology is first-in-first-out (FIFO), that is, the request data first sent to the network service is processed first, and the request data that first arrives at the network service is not processed. Before the processing is completed, the subsequent request data cannot be processed. In contrast, in the method provided by the present application, the order in which the network service 404 processes the requested data may not be restricted by the FIFO, the processing mechanism is more flexible, and the degree of fineness of access control is improved.
如图15所示,从应用程序204的角度来看,采用本申请提供的数据通信方法后,从通道建立到通道关闭之间,应用程序204通过请求通道发送了一个持续存活,长度不限(数据传输报文的数量不限)的HTTP请求(以HTTP请求为例,也可以是其他应用层协议请求)。该HTTP请求(响应)的头,也即前述通道建立请求报文,该HTTP请求(响应)的体通过一个或多个数据传输报文被传输。与之对应的,应用程序204通过响应通道接收了一个持续存活,长度不限的HTTP响应。将本方案的双工通道协议加载在现有的应用层协议之上,其一,可以借用现有的应用层协议通道的创建/关闭等管理流程,避免重复设计,其二,依赖现有的应用层协议通道的稳定性,能保证每个数据都能正确传输,其三,由于从应用程序的视角而言,发送/接收的仍然是应用层协议请求/响应,减少了应用程序的改动,适应性更强。As shown in Figure 15, from the perspective of the application program 204, after the data communication method provided by this application is adopted, from the channel establishment to the channel closing, the application program 204 sends a continuous survival through the request channel, and the length is not limited ( The number of data transmission messages is not limited) HTTP request (take HTTP request as an example, it can also be other application layer protocol requests). The header of the HTTP request (response), that is, the aforementioned channel establishment request message, and the body of the HTTP request (response) is transmitted through one or more data transmission messages. Correspondingly, the application 204 receives a continuously alive HTTP response of unlimited length through the response channel. Load the duplex channel protocol of this solution on top of the existing application layer protocol. First, you can borrow the existing application layer protocol channel creation/closing management process to avoid duplication of design. Second, rely on the existing application layer protocol. The stability of the application layer protocol channel can ensure that each data can be transmitted correctly. Third, from the perspective of the application program, what is sent/received is still the application layer protocol request/response, which reduces application changes. More adaptable.
S615及后续步骤后为通道关闭部分。After S615 and subsequent steps, it is the channel closing part.
S615,应用程序204发送通道关闭请求至通道管理模块203。S615: The application 204 sends a channel closing request to the channel management module 203.
应用程序204在确定其上运行的执行者无新的请求数据需要发送至网络服务404的情况下,发送通道关闭请求至通道管理模块203。When the application program 204 determines that the executor running on it has no new request data to be sent to the network service 404, it sends a channel closing request to the channel management module 203.
通道管理模块203接收到通道关闭请求后,如果客户端200和服务端400间建立了多个双工通道,通道管理模块203需要根据在通道建立部分中记录的应用程序204和双工通道ID 1的对应关系,在通道关闭请求中携带双工通道ID 1,并将携带了该信息的通道关闭请求发送至协议栈201。After the channel management module 203 receives the channel closing request, if multiple duplex channels are established between the client 200 and the server 400, the channel management module 203 needs to follow the application 204 and the duplex channel ID recorded in the channel establishment section. The corresponding relationship between, the duplex channel ID 1 is carried in the channel closing request, and the channel closing request carrying this information is sent to the protocol stack 201.
S616,协议栈201根据通道关闭请求生成通道关闭请求报文,并通过请求通道将通道关闭请求报文发送至协议栈401。S616: The protocol stack 201 generates a channel close request message according to the channel close request, and sends the channel close request message to the protocol stack 401 through the request channel.
通道关闭请求报文除了携带双工通道ID,还携带了通道关闭标识。通道关闭请求报文的结构,可以参考图5或图7中的数据传输报文,区别在于通道关闭请求报文可以携带通道关闭标识,例如在请求数据ID中采用预先约定的特殊ID,该特殊ID区别于任一请求数据ID,例如为-1。通道关闭请求报文的数据部分可以携带双工通道ID。In addition to the duplex channel ID, the channel closing request message also carries the channel closing identifier. For the structure of the channel close request message, please refer to the data transmission message in Figure 5 or Figure 7. The difference is that the channel close request message can carry a channel close identifier. For example, a pre-appointed special ID is used in the request data ID. The ID is different from any request data ID, for example, -1. The data part of the channel closing request message can carry the duplex channel ID.
S617,协议栈401解析该通道关闭请求报文,将通道关闭请求报文中携带的双工通道ID发送至通道管理模块403。S617: The protocol stack 401 parses the channel close request message, and sends the duplex channel ID carried in the channel close request message to the channel management module 403.
协议栈401对通道关闭请求报文进行解析,获得通道关闭标识和双工通道ID。通过通道关闭标识,协议栈401确定该报文的功能为关闭某一双工通道,因此协议栈401将解析出来的双工通道ID发送至通道管理模块403。The protocol stack 401 parses the channel close request message to obtain the channel close identifier and the duplex channel ID. Through the channel closing identifier, the protocol stack 401 determines that the function of the message is to close a certain duplex channel, so the protocol stack 401 sends the parsed duplex channel ID to the channel management module 403.
S618,通道管理模块403确定数据处理池402中为该双工通道ID创建的空间内全部数据处理完毕。S618: The channel management module 403 determines that all data in the space created for the duplex channel ID in the data processing pool 402 has been processed.
具体的,通道管理模块403在获取了需要关闭的双工通道ID,例如为双工通道1,后,确认数据处理池402中为双工通道1创建的空间内的数据是否被处理完毕,也即<1,<0>>内有没有未被处理的请求数据且<1,<1>>内有没有未被发送至客户端200的响应数据。如果<1,<0>>内有未被处理的请求数据或者<1,<1>>内有未被发送至客户端200的响应数据,那么通道管理模块403等待预设的时长后再次确认数据处理池402中为双工通道1创建的空间内的数据是否被处理完毕,直到网络服务404处理完毕全部请求数据且全部响应数据被发送至客户端200(参考S608至S612)。如果<1,<0>>内没有未被处理的请求数据且<1,<1>>内没有未被发送至客户端200的响应数据,则之前通过双工通道1发送的请求数据以及对应的响应数据已经全部处理完毕。采用本申请提供的数据通信方法的情况下,可能出现应用程序生成请求数据的速度快于网络服务处理请求数据的速度的情况。因此不能由应用程序直接指示通道管理模块关闭双工通道,而是需要由服务端的通道管理模块确定全部数据都被妥善处理完毕后,才能正式关闭双工通道。Specifically, after the channel management module 403 obtains the ID of the duplex channel that needs to be closed, for example, duplex channel 1, it confirms whether the data in the space created for duplex channel 1 in the data processing pool 402 has been processed, and That is, is there any unprocessed request data in <1,<0>> and whether there is response data in <1,<1>> that has not been sent to the client 200. If there is unprocessed request data in <1,<0>> or response data in <1,<1>> that has not been sent to the client 200, the channel management module 403 waits for the preset time to confirm again Whether the data in the space created for duplex channel 1 in the data processing pool 402 has been processed until the network service 404 has processed all the request data and all the response data is sent to the client 200 (refer to S608 to S612). If there is no unprocessed request data in <1,<0>> and no response data in <1,<1>> that has not been sent to the client 200, the previous request data sent through duplex channel 1 and the corresponding The response data of has all been processed. In the case of using the data communication method provided by this application, it may happen that the speed at which the application generates the requested data is faster than the speed at which the network service processes the requested data. Therefore, the application program cannot directly instruct the channel management module to close the duplex channel. Instead, the channel management module on the server side must determine that all data has been properly processed before the duplex channel can be officially closed.
可选的,S618也可以由S615之前,应用程序204确认其上运行的执行者发送的请求数据对应的响应数据都已经返回的动作来替代。也即,应用程序204确认其上运行的执行者发送的请求数据对应的响应数据都已经被接收的情况下,执行S615,即发送通道关闭请求至协议栈201,此种情况下无须执行S618。Optionally, S618 can also be replaced by an action in which the application 204 confirms that the response data corresponding to the request data sent by the executor running on it has been returned before S615. That is, when the application program 204 confirms that the response data corresponding to the request data sent by the executor running on it has been received, it executes S615, that is, sends a channel close request to the protocol stack 201. In this case, S618 is not required.
S619,通道管理模块403发送通道关闭响应至协议栈401。通道关闭响应中携带双工通道ID以及通道关闭标识。S619: The channel management module 403 sends a channel closing response to the protocol stack 401. The channel closing response carries the duplex channel ID and the channel closing identifier.
S620,协议栈401根据通道关闭响应生成通道关闭响应报文,并通过响应通道将通道关闭响应报文发送至协议栈201。S620: The protocol stack 401 generates a channel close response message according to the channel close response, and sends the channel close response message to the protocol stack 201 through the response channel.
通道关闭响应报文中携带双工通道ID以及通道关闭标识。通道关闭响应报文的结构,可以参考图5或图7中的数据传输报文,区别在于请求数据ID部分可以携带通道关闭标识,例如采用预先约定的特殊ID,该特殊ID区别于任一请求数据ID。通道关闭响应报文的数据部分可以携带双工通道ID。The channel closing response message carries the duplex channel ID and the channel closing identifier. For the structure of the channel closing response message, please refer to the data transmission message in Figure 5 or Figure 7. The difference is that the request data ID part can carry the channel closing identifier, such as a pre-appointed special ID, which is different from any request Data ID. The data part of the channel closing response message can carry the duplex channel ID.
S620后,通道管理模块203和通道管理模块403关闭通道0和通道1,具体的关闭方法可以采用现有技术中关闭应用层协议通道的方法。After S620, the channel management module 203 and the channel management module 403 close the channel 0 and the channel 1. The specific closing method may adopt the method of closing the application layer protocol channel in the prior art.
S618后,通道管理模块403可以通知数据处理池402释放为双工通道1创建的空间以节省服务端400的存储资源。通道管理模块403还可以删除之前记录的双工通道ID 1和通道ID 0和通道ID 1的对应关系。S620后,通道管理模块203可以删除之前记录的应用程序204和双工通道ID 1以及双工通道ID 1和通道ID 0和通道ID 1的对应关系。After S618, the channel management module 403 may notify the data processing pool 402 to release the space created for the duplex channel 1 to save the storage resources of the server 400. The channel management module 403 may also delete the previously recorded correspondence between the duplex channel ID 1 and the channel ID 0 and the channel ID 1. After S620, the channel management module 203 can delete the previously recorded correspondence between the application 204 and the duplex channel ID 1, and the corresponding relationship between the duplex channel ID 1 and the channel ID 0 and the channel ID 1.
图16提供了一种客户端800。客户端800包括总线803、处理器801、通信接口802和存储器804。处理器801、存储器804和通信接口802之间通过总线803通信。通信接口802用于与外部通信,例如发送通道建立请求报文或数据传输报文至通信网络。Figure 16 provides a client 800. The client 800 includes a bus 803, a processor 801, a communication interface 802, and a memory 804. The processor 801, the memory 804, and the communication interface 802 communicate through a bus 803. The communication interface 802 is used to communicate with the outside, for example, sending a channel establishment request message or a data transmission message to the communication network.
其中,处理器801可以为中央处理器(英文:central processing unit,缩写:CPU)。存储器804可以包括易失性存储器(英文:volatile memory),例如随机存取存储器(英文:random access memory,缩写:RAM)。存储器804还可以包括非易失性存储器(英文:non-volatile memory),例如只读存储器(英文:read-only memory,缩写:ROM),快闪存储器,HDD或SSD。The processor 801 may be a central processing unit (English: central processing unit, abbreviated: CPU). The memory 804 may include a volatile memory (English: volatile memory), such as a random access memory (English: random access memory, abbreviation: RAM). The memory 804 may also include a non-volatile memory (English: non-volatile memory), such as a read-only memory (English: read-only memory, abbreviation: ROM), flash memory, HDD or SSD.
存储器804中存储有可执行指令,处理器801执行该可执行指令以执行前述图8提供的数据通信方法中客户端侧的动作。具体的,存储器804中存储可执行指令,以运行前述应用程序、通道管理模块、数据匹配池和协议栈。存储器804还可以包括运行客户端操作系统所需的可执行指令。操作系统可以为LINUX TM,UNIX TM,WINDOWS TM等。 The memory 804 stores executable instructions, and the processor 801 executes the executable instructions to execute the actions on the client side in the data communication method provided in FIG. 8. Specifically, the memory 804 stores executable instructions to run the aforementioned application program, channel management module, data matching pool, and protocol stack. The memory 804 may also include executable instructions required to run the client operating system. The operating system can be LINUX TM , UNIX TM , WINDOWS TM etc.
图17提供了一种服务端1000。服务端1000包括总线1003、处理器1001、通信接口1002和存储器1004。处理器1001、存储器1004和通信接口1002之间通过总线1003通信。通信接口1002用于与外部通信,例如从通信网络接收通道建立请求报文或数据传输报文。Figure 17 provides a server 1000. The server 1000 includes a bus 1003, a processor 1001, a communication interface 1002, and a memory 1004. The processor 1001, the memory 1004, and the communication interface 1002 communicate through a bus 1003. The communication interface 1002 is used for communicating with the outside, for example, receiving a channel establishment request message or a data transmission message from a communication network.
其中,处理器1001可以为CPU。存储器1004可以包括易失性存储器,例如RAM。存储器1004还可以包括非易失性存储器,例如ROM,快闪存储器,HDD或SSD。Wherein, the processor 1001 may be a CPU. The memory 1004 may include volatile memory, such as RAM. The memory 1004 may also include non-volatile memory, such as ROM, flash memory, HDD or SSD.
存储器1004中存储有可执行指令,处理器1001执行该可执行指令以执行前述图8提供的数据通信方法中服务端侧的动作。具体的,存储器1004中存储可执行指令,以运行前述网络服务、通道管理模块、数据匹配池和协议栈。存储器1004还可以包括运行服务端操作系统所需的可执行指令。操作系统可以为LINUX TM,UNIX TM,WINDOWS TM等。 The memory 1004 stores executable instructions, and the processor 1001 executes the executable instructions to execute the server side actions in the data communication method provided in FIG. 8. Specifically, the memory 1004 stores executable instructions to run the aforementioned network service, channel management module, data matching pool, and protocol stack. The memory 1004 may also include executable instructions required to run the server operating system. The operating system can be LINUX TM , UNIX TM , WINDOWS TM etc.
上述各个附图对应的流程的描述各有侧重,某个流程中没有详述的部分,可以参见其他流程的相关描述。The descriptions of the processes corresponding to each of the above drawings have their respective focuses. For parts that are not detailed in a certain process, please refer to the related descriptions of other processes.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行该计算机程序指令时,全部或部分地产生按照本发明实施例该的流程或功能。该计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。该计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,该计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如SSD)等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented by software, it can be implemented in the form of a computer program product in whole or in part. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions according to the embodiments of the present invention are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instruction may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction may be transmitted from a website, computer, server, or data center through a cable (Such as coaxial cable, optical fiber, digital subscriber line or wireless (such as infrared, wireless, microwave, etc.) transmission to another website site, computer, server or data center. The computer-readable storage medium can be accessed by a computer Any usable medium in the data storage device or a data storage device including one or more usable media integrated servers, data centers, etc. The usable medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), Or semiconductor media (such as SSD) and so on.

Claims (19)

  1. 一种基于应用层协议的数据通信方法,其特征在于,包括:A data communication method based on an application layer protocol, characterized in that it comprises:
    在客户端上运行的应用程序和服务端上运行的网络服务之间建立第一应用层协议通道和第二应用层协议通道;Establish a first application layer protocol channel and a second application layer protocol channel between the application running on the client and the network service running on the server;
    通过所述第一应用层协议通道发送所述应用程序生成的请求数据至所述网络服务;Sending the request data generated by the application program to the network service through the first application layer protocol channel;
    所述网络服务根据所述请求数据生成响应数据;The network service generates response data according to the request data;
    通过所述第二应用层协议通道将所述响应数据发送至所述应用程序;Sending the response data to the application through the second application layer protocol channel;
    其中,所述第一应用层协议通道和所述第二应用层协议通道基于不同的传输层协议连接。Wherein, the first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols.
  2. 如权利要求1所述的数据通信方法,其特征在于,所述请求数据由所述应用程序内运行的执行者生成,所述方法还包括:The data communication method according to claim 1, wherein the request data is generated by an executor running in the application program, and the method further comprises:
    所述客户端为所述请求数据生成请求数据标识ID;The client generates a request data identification ID for the request data;
    通过所述第一应用层协议通道发送所述请求数据ID至所述网络服务;Sending the request data ID to the network service through the first application layer protocol channel;
    所述网络服务根据所述请求数据生成响应数据后,所述方法还包括:After the network service generates response data according to the request data, the method further includes:
    通过所述第二应用层协议通道将所述请求数据ID发送至所述客户端;Sending the request data ID to the client through the second application layer protocol channel;
    所述客户端根据从所述第二应用层协议通道接收的所述请求数据ID,确定所述执行者;The client determines the executor according to the request data ID received from the second application layer protocol channel;
    所述客户端将所述响应数据发送至所述执行者。The client sends the response data to the executor.
  3. 如权利要求1或2所述的数据通信方法,其特征在于,所述方法还包括:3. The data communication method according to claim 1 or 2, wherein the method further comprises:
    在所述服务端为所述第一应用层协议通道分配第一空间,为所述第二应用层协议通道分配第二空间;Allocating a first space for the first application layer protocol channel on the server side, and allocating a second space for the second application layer protocol channel;
    记录所述第一空间和所述第二空间的对应关系;Record the correspondence between the first space and the second space;
    所述服务端将从所述第一应用层协议通道接收的所述请求数据存入所述第一空间;Storing, by the server, the request data received from the first application layer protocol channel in the first space;
    根据所述记录的对应关系,所述服务端将所述网络服务生成的所述响应数据存入所述第二空间。According to the recorded correspondence relationship, the server stores the response data generated by the network service in the second space.
  4. 一种基于应用层协议的数据通信方法,其特征在于,包括:A data communication method based on an application layer protocol, characterized in that it comprises:
    生成第一通道建立请求报文,所述第一通道建立请求报文包括第一通道类型字段,所述第一通道类型字段指示基于所述第一通道建立请求报文建立的第一应用层协议通道为请求类型;A first channel establishment request message is generated, the first channel establishment request message includes a first channel type field, and the first channel type field indicates a first application layer protocol established based on the first channel establishment request message The channel is the request type;
    发送所述第一通道建立请求报文至服务端;Sending the first channel establishment request message to the server;
    生成第二通道建立请求报文,所述第二通道建立请求报文包括第二通道类型字段,所述第二通道类型字段指示基于所述第二通道建立请求报文建立的第二应用层协议通道为响应类型;A second channel establishment request message is generated, the second channel establishment request message includes a second channel type field, and the second channel type field indicates a second application layer protocol established based on the second channel establishment request message The channel is the response type;
    其中,所述第一应用层协议通道和所述第二应用层协议通道基于不同的传输层协议连接;Wherein, the first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols;
    发送所述第二通道建立请求报文至所述服务端;Sending the second channel establishment request message to the server;
    通过所述第一应用层协议通道发送应用程序生成的请求数据至所述服务端上运行的网络服务;Sending the request data generated by the application program to the network service running on the server through the first application layer protocol channel;
    通过所述第二应用层协议通道接收所述请求数据对应的响应数据。Receiving response data corresponding to the request data through the second application layer protocol channel.
  5. 如权利要求4所述的数据通信方法,其特征在于,所述方法还包括:The data communication method according to claim 4, wherein the method further comprises:
    为所述请求数据生成请求数据ID;Generating a request data ID for the request data;
    通过所述第一应用层协议通道发送所述请求数据ID至所述网络服务;Sending the request data ID to the network service through the first application layer protocol channel;
    通过所述第二应用层协议通道接收所述请求数据ID;Receiving the request data ID through the second application layer protocol channel;
    根据从所述第二应用层协议通道接收的所述请求数据ID,确定生成所述请求数据的执行者;Determine the executor who generates the requested data according to the request data ID received from the second application layer protocol channel;
    将所述响应数据发送至所述执行者。The response data is sent to the executor.
  6. 一种客户端,其特征在于,包括:A client, characterized in that it includes:
    通道管理模块,用于生成第一通道建立请求,所述第一通道建立请求包括第一通道类型字段,所述第一通道类型字段指示基于所述第一通道建立请求建立的第一应用层协议通道为请求类型;生成第二通道建立请求,所述第二通道建立请求包括第二通道类型字段,所述第二通道类型字段指示基于所述第二通道建立请求建立的第二应用层协议通道为响应类型;其中,所述第一应用层协议通道和所述第二应用层协议通道基于不同的传输层协议连接;The channel management module is configured to generate a first channel establishment request, the first channel establishment request includes a first channel type field, and the first channel type field indicates a first application layer protocol established based on the first channel establishment request The channel is a request type; a second channel establishment request is generated, the second channel establishment request includes a second channel type field, and the second channel type field indicates a second application layer protocol channel established based on the second channel establishment request Is a response type; wherein the first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols;
    协议栈,用于发送所述第一通道建立请求至所述服务端;发送所述第二通道建立请求至所述服务端;通过所述第一应用层协议通道发送应用程序生成的请求数据至所述服务端上运行的网络服务;通过所述第二应用层协议通道接收所述请求数据对应的响应数据。The protocol stack is used to send the first channel establishment request to the server; send the second channel establishment request to the server; send the request data generated by the application program to the server through the first application layer protocol channel A network service running on the server; receiving response data corresponding to the request data through the second application layer protocol channel.
  7. 如权利要求6所述的客户端,其特征在于,The client according to claim 6, wherein:
    数据匹配池,用于为所述请求数据生成请求数据ID,记录生成所述请求数据的执行者和所述请求数据ID的对应关系;将所述请求数据ID发送至所述协议栈;The data matching pool is used to generate a request data ID for the request data, record the correspondence between the executor who generated the request data and the request data ID; send the request data ID to the protocol stack;
    所述协议栈,用于通过所述第一应用层协议通道发送所述请求数据和所述请求数据ID至所述网络服务;通过所述第二应用层协议通道接收所述请求数据对应的响应数据和所述请求数据ID;将所述响应数据和所述请求数据ID发送至所述数据匹配池;The protocol stack is configured to send the request data and the request data ID to the network service through the first application layer protocol channel; receive the response corresponding to the request data through the second application layer protocol channel Data and the requested data ID; sending the response data and the requested data ID to the data matching pool;
    所述数据匹配池,还用于根据所述记录的对应关系和所述请求数据ID,确定生成所述请求数据的执行者;将所述响应数据发送至所述执行者。The data matching pool is also used to determine the executor who generated the requested data according to the correspondence between the records and the requested data ID; and send the response data to the executor.
  8. 一种客户端,其特征在于,包括处理器和存储器,所述处理器执行存储器中的指令执行权利要求4或5所述的方法。A client is characterized by comprising a processor and a memory, and the processor executes instructions in the memory to execute the method according to claim 4 or 5.
  9. 一种非瞬态的可读存储介质,其特征在于,所述非瞬态的可读存储介质中存储的指令被客户端执行时,所述客户端执行权利要求4或5所述的方法。A non-transitory readable storage medium, wherein when the instructions stored in the non-transitory readable storage medium are executed by a client, the client executes the method according to claim 4 or 5.
  10. 一种计算机程序产品,其特征在于,所述计算机程序产品包含的指令被客户端执行时,所述客户端执行权利要求4或5所述的方法。A computer program product, wherein when the instructions contained in the computer program product are executed by a client, the client executes the method according to claim 4 or 5.
  11. 一种基于应用层协议的数据通信方法,其特征在于,包括:A data communication method based on an application layer protocol, characterized in that it comprises:
    接收第一通道建立请求报文,所述第一通道建立请求报文包括第一通道类型字段,所述第一通道类型字段指示基于所述第一通道建立请求报文建立的第一应用层协议通道为请求类型;Receive a first channel establishment request message, where the first channel establishment request message includes a first channel type field, and the first channel type field indicates a first application layer protocol established based on the first channel establishment request message The channel is the request type;
    接收第二通道建立请求报文,所述第二通道建立请求报文包括第二通道类型字段,所述第二通道类型字段指示基于所述第二通道建立请求报文建立的第二应用层协议通道为响应类型;A second channel establishment request message is received, the second channel establishment request message includes a second channel type field, and the second channel type field indicates a second application layer protocol established based on the second channel establishment request message The channel is the response type;
    其中,所述第一应用层协议通道和所述第二应用层协议通道基于不同的传输层协议连接;Wherein, the first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols;
    通过所述第一应用层协议通道接收请求数据;Receiving request data through the first application layer protocol channel;
    通过所述第二应用层协议通道发送所述请求数据对应的响应数据至生成所述请求数据的应用程序。The response data corresponding to the request data is sent to the application program that generates the request data through the second application layer protocol channel.
  12. 如权利要求11的数据通信方法,其特征在于,还包括:The data communication method of claim 11, further comprising:
    通过所述第一应用层协议通道接收所述请求数据对应的请求数据ID;Receiving the request data ID corresponding to the request data through the first application layer protocol channel;
    生成所述响应数据后,所述方法还包括:After generating the response data, the method further includes:
    通过所述第二应用层协议通道发送所述请求数据ID至生成所述请求数据的客户端。Sending the request data ID to the client that generates the request data through the second application layer protocol channel.
  13. 如权利要求11或12的数据通信方法,其特征在于,还包括:The data communication method according to claim 11 or 12, further comprising:
    为所述第一应用层协议通道分配第一空间;Allocating a first space for the first application layer protocol channel;
    为所述第二应用层协议通道分配第二空间;Allocating a second space for the second application layer protocol channel;
    记录所述第一空间和所述第二空间的对应关系;Record the correspondence between the first space and the second space;
    将从所述第一应用层协议通道接收的所述请求数据存入所述第一空间;Storing the request data received from the first application layer protocol channel in the first space;
    根据所述记录的对应关系,将所述响应数据存入所述第二空间。According to the recorded correspondence relationship, the response data is stored in the second space.
  14. 一种服务端,其特征在于,包括:A server, which is characterized in that it includes:
    通道管理模块,用于接收第一通道建立请求,所述第一通道建立请求包括第一通道类型字段,所述第一通道类型字段指示基于所述第一通道建立请求建立的第一应用层协议通道为请求类型;接收第二通道建立请求,所述第二通道建立请求包括第二通道类型字段,所述第二通道类型字段指示基于所述第二通道建立请求建立的第二应用层协议通道为响应类型;其中,所述第一应用层协议通道和所述第二应用层协议通道基于不同的传输层协议连接;The channel management module is configured to receive a first channel establishment request, where the first channel establishment request includes a first channel type field, and the first channel type field indicates a first application layer protocol established based on the first channel establishment request The channel is a request type; a second channel establishment request is received, the second channel establishment request includes a second channel type field, and the second channel type field indicates a second application layer protocol channel established based on the second channel establishment request Is a response type; wherein the first application layer protocol channel and the second application layer protocol channel are connected based on different transport layer protocols;
    协议栈,用于通过所述第一应用层协议通道接收请求数据;通过所述第二应用层协议通道发送所述请求数据对应的响应数据至生成所述请求数据的应用程序。The protocol stack is configured to receive request data through the first application layer protocol channel; and send response data corresponding to the request data to the application program that generates the request data through the second application layer protocol channel.
  15. 如权利要求14所述的服务端,其特征在于,包括:The server according to claim 14, characterized in that it comprises:
    所述协议栈,还用于通过所述第一应用层协议通道接收所述请求数据对应的请求数据ID;通过所述第二应用层协议通道发送所述响应数据和所述请求数据ID至生成所述请求数据的客户端。The protocol stack is further configured to receive the request data ID corresponding to the request data through the first application layer protocol channel; and send the response data and the request data ID to generate the request data through the second application layer protocol channel. The client requesting data.
  16. 如权利要求14或15所述的服务端,其特征在于,还包括:The server according to claim 14 or 15, characterized in that it further comprises:
    数据处理池,用于为所述第一应用层协议通道分配第一空间,为所述第二应用层协议通道分配第二空间;A data processing pool, configured to allocate a first space for the first application layer protocol channel, and allocate a second space for the second application layer protocol channel;
    所述协议栈,用于将从所述第一应用层协议通道接收的所述请求数据存入所述第一空间;The protocol stack is configured to store the request data received from the first application layer protocol channel in the first space;
    所述通道管理模块,用于记录所述第一空间和所述第二空间的对应关系,根据所述记录的对应关系,将所述响应数据存入所述第二空间。The channel management module is configured to record the corresponding relationship between the first space and the second space, and store the response data in the second space according to the recorded corresponding relationship.
  17. 一种服务端,其特征在于,包括处理器和存储器,所述处理器执行存储器中的指令执行权利要求11至13任一所述的方法。A server is characterized by comprising a processor and a memory, and the processor executes instructions in the memory to execute the method according to any one of claims 11 to 13.
  18. 一种非瞬态的可读存储介质,其特征在于,所述非瞬态的可读存储介质中存 储的指令被服务端执行时,所述服务端执行权利要求11至13任一所述的方法。A non-transitory readable storage medium, wherein when the instructions stored in the non-transitory readable storage medium are executed by a server, the server executes any one of claims 11 to 13 method.
  19. 一种计算机程序产品,其特征在于,所述计算机程序产品包含的指令被服务端执行时,所述服务端执行权利要求11至13任一所述的方法。A computer program product, characterized in that, when the instructions contained in the computer program product are executed by a server, the server executes the method according to any one of claims 11 to 13.
PCT/CN2020/120468 2019-10-12 2020-10-12 Data communication method and device employing application layer protocol WO2021068973A1 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN201910968860.7 2019-10-12
CN201910968860 2019-10-12
CN201911039001.6A CN112653656B (en) 2019-10-12 2019-10-29 Data communication method and device based on application layer protocol
CN201911039001.6 2019-10-29

Publications (1)

Publication Number Publication Date
WO2021068973A1 true WO2021068973A1 (en) 2021-04-15

Family

ID=75343245

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/120468 WO2021068973A1 (en) 2019-10-12 2020-10-12 Data communication method and device employing application layer protocol

Country Status (2)

Country Link
CN (1) CN112653656B (en)
WO (1) WO2021068973A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113726904A (en) * 2021-09-03 2021-11-30 杭州安恒信息技术股份有限公司 Server proxy method, device, equipment and computer readable storage medium
CN114615358A (en) * 2022-03-07 2022-06-10 广东工业大学 Simulation method of intelligent electronic device, electronic device and storage medium
CN114928597A (en) * 2022-05-20 2022-08-19 中国联合网络通信集团有限公司 Data transmission method, device and equipment

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113727056B (en) * 2021-08-30 2023-09-22 聚好看科技股份有限公司 Management method and server for data transmission connection
CN114221995B (en) * 2021-11-11 2024-04-09 中国建设银行股份有限公司 Service calling method and device and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104243281A (en) * 2014-08-20 2014-12-24 北京比邻在线信息技术有限公司 Voice communication method based on mobile Internet
US20150058203A1 (en) * 2013-08-22 2015-02-26 Ebay Inc Systems and methods for payment authorization using full-duplex communication from browser
CN106161130A (en) * 2015-04-14 2016-11-23 阿里巴巴集团控股有限公司 The performance monitoring device of sing on web Socket agreement, system and method

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2884997A1 (en) * 2005-04-25 2006-10-27 Thomson Licensing Sa Multi-line connection establishing method for digital data packet e.g. video data, communication, involves establishing communication tunnel between modem and gateway using connection and connected to remote network
EP1909191B1 (en) * 2006-10-02 2011-09-14 Sun Microsystems France S.A. Method and system for transmitting data over a network
US8249100B2 (en) * 2008-09-25 2012-08-21 Siemens Industry, Inc. Method and arrangement for providing duplex communications between a client application and a service using an http request/reply channel
CN103516673A (en) * 2012-06-21 2014-01-15 腾讯科技(深圳)有限公司 Network data communication method, network data communication system, network data communication client and network data communication server
CN103595714A (en) * 2013-11-08 2014-02-19 福建省视通光电网络有限公司 Method using WEB service channel to achieve data transmission
CN105847275A (en) * 2016-04-29 2016-08-10 掌赢信息科技(上海)有限公司 Data transmission channel creating method, system and server
CN109088918B (en) * 2018-07-18 2021-09-21 创新先进技术有限公司 Interaction method, client device and server device
CN109246085B (en) * 2018-08-15 2021-06-15 腾讯科技(深圳)有限公司 Anonymous network access method, client, system, server and medium
CN109922053A (en) * 2019-02-22 2019-06-21 北京三快在线科技有限公司 Data transmission method, device, electronic equipment and readable storage medium storing program for executing

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150058203A1 (en) * 2013-08-22 2015-02-26 Ebay Inc Systems and methods for payment authorization using full-duplex communication from browser
CN104243281A (en) * 2014-08-20 2014-12-24 北京比邻在线信息技术有限公司 Voice communication method based on mobile Internet
CN106161130A (en) * 2015-04-14 2016-11-23 阿里巴巴集团控股有限公司 The performance monitoring device of sing on web Socket agreement, system and method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113726904A (en) * 2021-09-03 2021-11-30 杭州安恒信息技术股份有限公司 Server proxy method, device, equipment and computer readable storage medium
CN114615358A (en) * 2022-03-07 2022-06-10 广东工业大学 Simulation method of intelligent electronic device, electronic device and storage medium
CN114615358B (en) * 2022-03-07 2022-09-02 广东工业大学 Simulation method of intelligent electronic device, electronic device and storage medium
CN114928597A (en) * 2022-05-20 2022-08-19 中国联合网络通信集团有限公司 Data transmission method, device and equipment
CN114928597B (en) * 2022-05-20 2023-07-25 中国联合网络通信集团有限公司 Data transmission method, device and equipment

Also Published As

Publication number Publication date
CN112653656B (en) 2022-06-07
CN112653656A (en) 2021-04-13

Similar Documents

Publication Publication Date Title
WO2021068973A1 (en) Data communication method and device employing application layer protocol
US10708360B2 (en) Method for transport agnostic communication between internet of things client and broker
US9246819B1 (en) System and method for performing message-based load balancing
US8996657B2 (en) Systems and methods for multiplexing network channels
US8898336B2 (en) Content conversion system and content conversion server
WO2023005773A1 (en) Message forwarding method and apparatus based on remote direct data storage, and network card and device
US20030061355A1 (en) Systems and methods for establishing quasi-persistent HTTP connections
US20160191600A1 (en) Methods and systems for an end-to-end solution to deliver content in a network
US9794354B1 (en) System and method for communication between networked applications
WO2024037296A1 (en) Protocol family-based quic data transmission method and device
US20240069977A1 (en) Data transmission method and data transmission server
WO2021063028A1 (en) Method and apparatus for providing network service for service, and computing device
WO2021083284A1 (en) Load balancing method and apparatus, medium and device
CN110417632B (en) Network communication method, system and server
CN113810349B (en) Data transmission method, device, computer equipment and storage medium
JP2018536356A (en) System and method for supporting context-aware content requests in an information-oriented network
Moreira et al. Next generation of microservices for the 5G Service‐Based Architecture
US20160191296A1 (en) Methods and systems for an end-to-end solution to deliver content in a network
US11064021B2 (en) Method, device and computer program product for managing network system
US9582561B2 (en) Size-based data synchronization
US20180241849A1 (en) On-demand startup of offline servers and connection routing
Krawiec et al. Survey on technologies for enabling real-time communication in the web of things
CN116708597B (en) Data processing method and device
US20130054691A1 (en) Flexible rule based multi-protocol peer-to-peer caching
WO2017005118A1 (en) Method, device, terminal and server for maintaining communication connection

Legal Events

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

Ref document number: 20875052

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20875052

Country of ref document: EP

Kind code of ref document: A1