CN116155971A - Multiplexing network data transmission method and system based on TCP - Google Patents

Multiplexing network data transmission method and system based on TCP Download PDF

Info

Publication number
CN116155971A
CN116155971A CN202310099710.3A CN202310099710A CN116155971A CN 116155971 A CN116155971 A CN 116155971A CN 202310099710 A CN202310099710 A CN 202310099710A CN 116155971 A CN116155971 A CN 116155971A
Authority
CN
China
Prior art keywords
channel
data packet
tcp
request
advertisement request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310099710.3A
Other languages
Chinese (zh)
Inventor
张富
方友松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baixun Information Technology Shanghai Co ltd
Original Assignee
Baixun Information Technology Shanghai Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Baixun Information Technology Shanghai Co ltd filed Critical Baixun Information Technology Shanghai Co ltd
Priority to CN202310099710.3A priority Critical patent/CN116155971A/en
Publication of CN116155971A publication Critical patent/CN116155971A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • 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]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a multiplexing network data transmission method and system based on TCP, comprising the following steps: the method is applied to the gateway server and comprises the following steps: receiving an advertisement request sent by a user and acquiring a data packet containing the advertisement request; acquiring a TCP connection object with the shortest total request queue; acquiring a channel object with the shortest request queue in a channel linked list corresponding to the TCP connection object; obtaining a channel ID corresponding to the channel object and writing the channel ID into a data packet of the advertisement request; determining an MTP data packet according to the data packet of the advertisement request written in the channel ID, and sending the MTP data packet to a back-end server; the invention has the following beneficial effects: the invention can process concurrency on the same TCP connection, effectively eliminates the multiple network interaction cost of establishing/destroying a plurality of TCP connections, reduces the time consumption of service request processing, and improves the throughput efficiency of the system as a whole.

Description

Multiplexing network data transmission method and system based on TCP
Technical Field
The invention relates to the technical field of network transmission, in particular to a multiplexing network data transmission method and system based on TCP.
Background
On new media mainly comprising mobile phone APP, online website and online display screen, billions of advertisement display opportunities are generated, the advertisement flows are collected into an online system which becomes an internet advertisement flow transaction platform, the system collects the flows of media resources of all parties, and a large number of upstream demand parties and advertisers are docked; the traffic transaction platform is used for an online centralized traffic market of traffic, hundreds of millions of traffic is sold to a demand party efficiently through a computer system platform, in order to support huge traffic transaction, the platform system is designed by a micro service architecture, each micro service is called by a TCP protocol to realize the mutual cooperation on service logic, so that the complete service request flow is realized, in a typical advertising traffic platform back-end system, network communication among each micro service adopts TCP (Transmission Control Protocol) protocol or an application layer protocol (such as HTTP protocol) based on the TCP protocol, and the transmission protocol has the following typical characteristics: based on the flow: the network data is streaming, not itself containing logical boundaries of data packets; connection oriented: network data is transmitted over a TCP connection path, which is implemented by the protocol (referred to as a TCP connection); reliable communication: the reliability of the network communication channel (TCP connection) is responsible for the TCP protocol (operating system kernel implementation), and the upper layer application does not need to care and only needs to be responsible for the service logic of the upper layer application.
The Internet is constructed based on a TCP/IP protocol, and the above-mentioned classical TCP-based data transmission manner satisfies most network data transmission functions in the Internet, but when the system is in a large-flow and large-concurrency application scenario, there are some disadvantages that the system needs to be further optimized for a specific application scenario, only one logic request/response can be transmitted at the same time by the same TCP connection, and for a high-concurrency Internet back-end service, multiple TCP connections need to be established simultaneously to realize simultaneous transmission and processing of multiple service requests, and the reason is as follows: the TCP protocol is a streaming full duplex communication, which means that a requestor can initiate multiple requests at the same time, and that a responder can send multiple responses back at the same time, and the order in which the requests arrive at the server and the order in which the responses arrive at the client are not necessarily in the order of sending them, so in general, on a single TCP connection, one request needs to be sent out until a corresponding complete response is received, a second request needs to be sent out, and it is attempted to send out multiple requests at the same time, and after a response is subsequently received, it will not be clear which request the current response belongs to, and in general, in order to implement the concurrent request/response, multiple TCP connections must be created at the same time.
This causes several problems: 1. because the connection handle resources of the server operating system are limited, when the TCP connection in the system reaches a certain number, new connection cannot be created; 2. the establishment and destruction of the TCP connection require 3 handshakes and 4 hands between the client and the server to confirm, the process is time-consuming and consumes computing resources, and delay time for processing service requests is prolonged for frequently establishing/destroying the network connection; 3. according to the design of the TCP protocol, the termination of a TCP connection is required to undergo a waiting period of 2MSL in the end, which lasts for several minutes or more, for the reliability of the protocol, during which the TCP connection resources are not recovered from the system, and in a highly concurrent system, frequent connection establishment/termination may result in a large number of zombie connections in the state, thus creating the problem of item 1, and the core reason of the above problems is that in the conventional communication manner, a plurality of requests/responses cannot be executed in parallel on a popular single http1.X connection based on TCP, and a concurrent capability needs to be created to create a plurality of TCP connections, and the limited nature of the TCP connection as a resource further brings about the derived problem.
Disclosure of Invention
In view of the above-mentioned drawbacks of the prior art, an object of the present invention is to provide a method and a system for transmitting data in a multiplexing network based on TCP, which are used for solving the problem that multiple concurrent request/response capabilities cannot be performed simultaneously on a single TCP connection in the prior art.
The embodiment of the invention provides a multiplexing network data transmission method based on TCP, which is applied to a gateway server and comprises the following steps: receiving an advertisement request sent by a user and acquiring a data packet containing the advertisement request; acquiring a TCP connection object with the shortest total request queue; acquiring a channel object with the shortest request queue in a channel linked list corresponding to the TCP connection object; obtaining a channel ID corresponding to the channel object and writing the channel ID into a data packet of the advertisement request; and determining an MTP data packet according to the data packet of the advertisement request after writing the channel ID, and sending the MTP data packet to a back-end server.
The embodiment of the invention also provides a multiplexing network data transmission device based on TCP, which is internally provided with a gateway server and comprises: the receiving module is used for receiving an advertisement request sent by a user and acquiring a data packet containing the advertisement request; the acquisition module is used for: acquiring a TCP connection object with the shortest total request queue, acquiring a channel object with the shortest request queue in a channel linked list corresponding to the TCP connection object, acquiring a channel ID corresponding to the channel object, and writing the channel ID into a data packet of the advertisement request; and the determining module is used for determining an MTP data packet according to the data packet of the advertisement request written in the channel ID and sending the MTP data packet to the back-end server.
The embodiment of the invention also provides a multiplexing network data transmission system based on TCP, which comprises at least one gateway server and a plurality of back-end servers, wherein the back-end servers are respectively connected with the gateway servers; wherein the gateway server comprises a TCP-based multiplexed network data transmission device.
The embodiment of the invention also provides a terminal, which comprises: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a TCP-based multiplexed network data transmission method as described above.
Embodiments of the present invention also provide a computer readable storage medium storing a computer program which, when executed by a processor, implements a TCP-based multiplexed network data transmission method as described above.
Compared with the prior art, the embodiment of the invention has the main differences and effects that: the method and the device can simultaneously carry out a plurality of concurrent requests or responses on a single TCP connection, reduce the TCP connection handle number of an operating system under the same network flow load, and effectively relieve the problem that the operating system cannot establish more new connections due to the limitation of handle resource number by acquiring the channel ID of the channel object with the shortest request queue in the channel chain table corresponding to the TCP connection object with the shortest total request queue, writing the channel ID into the data packet of the advertisement request, generating an MTP data packet according to the data packet of the advertisement request after writing the channel ID and then sending the MTP data packet to a back-end server; and the concurrency can be processed on the same TCP connection, so that the multiple network interaction cost of establishing/destroying a plurality of TCP connections is effectively eliminated, the time consumption of service request processing is reduced, and the throughput efficiency of the system is improved as a whole.
As a further improvement, the channel ID includes a TCP connection quad and a self-increment sequence, and the TCP connection quad includes a local IP, a local PORT, a remote IP, and a remote PORT, where a channel with a self-increment of number 0 is a special channel.
As a further improvement, the number 0 channel is automatically established after the gateway server establishes a TCP connection with the backend service, wherein the automatic establishment is performed without negotiating through a request response.
As a further improvement, before the receiving the advertisement request sent by the user and acquiring the data packet containing the advertisement request, the method comprises: generating a data packet containing a channel establishing instruction of a new channel ID to be established, and sending the data packet to a back-end server through a No. 0 channel; receiving a response after the successful establishment of the back-end server, and establishing a channel object corresponding to the new channel ID according to the response; and forming a channel linked list in the TCP connection object according to the N times of established channel objects.
According to the scheme, the data packet containing the channel establishing instruction of the new channel ID to be established is sent to the back-end server, then the response of the back-end server after the channel establishment is successful is received, the channel object corresponding to the new channel ID is established according to the response, and finally the channel linked list in the TCP connection object is formed according to the N channel objects established, so that the aim of establishing a plurality of channel objects on a single TCP connection is fulfilled.
As a further improvement, after the MTP data packet is sent to the backend server, the method further includes: and receiving a response corresponding to the advertisement traffic sent from the back-end server, and returning the response to the user.
As a further improvement, after said receiving a response corresponding to said advertisement traffic from the backend server and returning said response to the user, comprising: and sending a data packet of a channel deleting instruction to a back-end server on a channel to be terminated currently, and simultaneously moving the channel out of a channel linked list and releasing a channel object.
According to the scheme, the data packet of the channel deleting instruction is sent to the back-end server on the channel to be terminated at present, and meanwhile, the channel is moved out of the channel linked list and the channel object is released, so that bot connection generated by frequent TCP connection establishment/termination in the system can be reduced, kernel resource consumption is reduced, and the connection number capacity of the system is improved.
Drawings
Fig. 1 is a flowchart of a method for data transmission of a TCP-based multiplexed network in a first embodiment of the present invention;
fig. 2 is a flowchart of a method for data transmission of a TCP-based multiplexed network in a second embodiment of the invention;
fig. 3 is a schematic diagram of a TCP-based multiplexed network data transmission apparatus in a third embodiment of the present invention;
fig. 4 is a schematic diagram of a data transmission system of a TCP-based multiplexing network in a fourth embodiment of the invention;
fig. 5 is a schematic view of an electronic device in a fifth embodiment of the invention;
FIG. 6 is a schematic diagram of a request queue and a response queue of the MTP protocol of the present invention;
FIG. 7 is a schematic diagram of the format of an MTP protocol packet according to the present invention;
FIG. 8 is a flow diagram of an overall implementation of the present invention;
fig. 9 is a schematic diagram of a complete MTP protocol in the present invention.
Detailed Description
Other advantages and effects of the present invention will become apparent to those skilled in the art from the following disclosure, which describes the embodiments of the present invention with reference to specific examples. The invention may be practiced or carried out in other embodiments that depart from the specific details, and the details of the present description may be modified or varied from the spirit and scope of the present invention. It should be noted that the following embodiments and features in the embodiments may be combined with each other without conflict.
It should be noted that the illustrations provided in the following embodiments merely illustrate the basic concept of the present invention by way of illustration, and only the components related to the present invention are shown in the drawings and are not drawn according to the number, shape and size of the components in actual implementation, and the form, number and proportion of the components in actual implementation may be arbitrarily changed, and the layout of the components may be more complicated.
A first embodiment of the present invention relates to a TCP-based multiplexed network data transmission method. The flow is shown in fig. 1, and is specifically as follows:
step 101, receiving an advertisement request sent by a user and acquiring a data packet containing the advertisement request;
specifically, the user uses the terminal device to send the advertisement request to the gateway server.
Step 102, the TCP connection object with the shortest total request queue is obtained.
Specifically, on a single TCP connection, a request is sent, and a second request needs to be sent after a corresponding complete response is received, so that each single TCP connection has an advertisement request queue, the length of the advertisement request queue on each TCP connection is determined, and the TCP connection object with the shortest total request queue can be obtained according to the determination result.
Step 103, obtaining the channel object with the shortest request queue in the channel linked list corresponding to the TCP connection object.
Specifically, each TCP connection has N channel objects, where N is greater than or equal to 1 and N is a positive integer, where N channel objects form a channel linked list on each TCP connection, each channel object has a channel ID corresponding to the channel object, each channel object has a plurality of advertisement requests to be transmitted, the plurality of advertisement requests to be transmitted form an advertisement request queue, the length of the advertisement request queue on each channel object is determined, and a channel object with the shortest request queue in the channel linked list can be obtained according to the determination result, see fig. 6 specifically.
Step 104, obtaining the channel ID corresponding to the channel object and writing the channel ID into the data packet of the advertisement request.
Specifically, the channel ID includes a TCP connection quad and a self-increasing sequence, the TCP connection quad includes a local IP, a local PORT, a remote IP, and a remote PORT, where a channel with a self-increasing value of 0 is a special channel, the 0 channel is automatically established after the gateway server establishes a TCP connection with the back-end service, and the automatic establishment is performed without negotiating through a request response.
In practical application, the channel ID: TCP connection quad (local IP: local PORT/remote IP: remote PORT) +self-increasing sequence number, such as: 192.168.0.1:1234:46.123.211.6:8008-0;192.168.0.1:1234:46.123.211.6:8008-1;192.168.0.1:1234:46.123.211.6:8008-2 …;192.168.0.1:1234:46.123.211.6:8008-12 …; the self-added value is that the number 0 channel is a special channel, each TCP connection has a number 0 channel, and the default special channel is used for some special functions.
Step 105, determining an MTP data packet according to the data packet of the advertisement request written in the channel ID, and sending the MTP data packet to the back-end server.
In practical application, a user initiates an advertisement request on a terminal device, receives the advertisement request sent by the user and obtains a data packet containing the advertisement request, then obtains a channel object with the shortest request queue in a channel linked list corresponding to a TCP connection object with the shortest total request queue, writes a channel ID corresponding to the channel object into the data packet of the advertisement request, generates an MTP data packet by the data packet of the advertisement request after writing the channel ID, sends the MTP data packet to a rear end server on the channel, after receiving the MTP data packet containing the advertisement request, the rear end server analyzes the MTP data packet containing the advertisement request, analyzes the channel ID and the advertisement request, processes the advertisement request and generates a response corresponding to the advertisement request, and finally the rear end server sends the MTP data packet containing the advertisement request and an MTP traffic packet containing the response to a gateway server on the channel, wherein the MTP data packet containing the advertisement request and the MTP traffic packet containing the response refer to a first byte frame 1 in the left side of FIG. 7, and the byte frame 1 byte of the left side in FIG. 7: 0 represents a request first frame, and the request is not completed; 1 represents a request first frame, and the request is completed; 2 represents that the request for the subsequent frame is incomplete; 3 represents requesting a subsequent frame, the request being completed; 4 represents a response first frame, and the response is incomplete; 5 represents a response first frame, and the response is completed; 6 represents that the response is not completed in the subsequent frame; 7 represents response subsequent frames, response is completed; 8 closing the connection.
Further, the advertisement request enters the gateway server, the Internet traffic adopts the standard HTTP1.1 protocol, then the request distribution service of the traffic portal distributes traffic (advertisement request) to each back-end service processing server, the distribution process includes adapting the data of the HTTP1.1 protocol to be a "multiplexing transmission protocol" (MTP-Multiplexing Transport Protocol), interacting with the back-end server through the MTP protocol and obtaining a response result, re-adapting the response result to be an HTTP1.1 protocol response to the user, the specific flow is shown in fig. 8, wherein the details of the MTP protocol flow are that after the HTTP1.1 advertisement request enters, firstly, an idle channel (the shortest request queue length of the channel is obtained from the MTP channel pool (channel chain table)), and the mapping relation between the external advertisement request ID and the MTP-ID is bound, then the external request is written into the channel, after the response of the back-end server is waited, the external connection is obtained according to the mapping relation between the external request ID and the MTP-ID, and the external connection is written back to the MTP-ID, and the whole technical scheme is shown in fig. 9.
According to the method and the device, the channel ID of the channel object with the shortest request queue in the channel linked list corresponding to the TCP connection object with the shortest request queue can be obtained, the channel ID is written into the data packet of the advertisement request, the MTP data packet is generated according to the data packet of the advertisement request after the channel ID is written, and then the MTP data packet is sent to the back-end server, so that multiple concurrent requests or responses can be simultaneously carried out on a single TCP connection. And the concurrency can be processed on the same TCP connection, so that the multiple network interaction cost of establishing/destroying a plurality of TCP connections is effectively eliminated, the time consumption of service request processing is reduced, and the throughput efficiency of the system is improved as a whole.
A second embodiment of the present invention relates to a method for transmitting data in a multiplexed network based on TCP, and the second embodiment is a detailed discussion of the whole first embodiment, and mainly the detailed discussion is that: in a second embodiment of the present invention, an embodiment is specified that discusses the specific process of setting up and deleting individual channels on individual TCP connections.
Referring to fig. 2, the present embodiment includes the following steps, which are described as follows:
step 201, a data packet containing a channel establishing instruction of a new channel ID to be established is generated, and the data packet is sent to a back-end server through a channel No. 0.
Step 202, receiving a response from the backend server after the establishment is successful, and establishing a channel object corresponding to the new channel ID according to the response.
And 203, forming a channel linked list in the TCP connection object according to the N times of established channel objects.
In practical application, the gateway server establishes a plurality of TCP connections with the back-end service in advance, each TCP connection has a number 0 channel, the number 0 channel is automatically established after the TCP connection between the gateway server and the back-end service is established, negotiation is not required through request response, and the following two URI (identification) paths are agreed as instructions for establishing the channels: sys/new_channel: establishing a channel and/sys/delete_channel: deleting a channel, generating a latest channel ID by a gateway server, sending a/sys/new_channel data packet to a back-end server through a No. 0 channel, wherein the data of the data packet contains an ID value of a new channel to be established, after the back-end server receives the/sys/new_channel data packet, establishing a new channel object by the received new channel ID, adding the new channel object into a channel linked list for storage, responding to the gateway server to tell that the channel establishment is successful, and after the gateway server receives a response of the successful channel establishment, locally establishing a channel object related to the new channel ID, and adding the channel object into the channel linked list.
Steps 204 to 208 are similar to steps 101 to 105 in the first embodiment, and are not described here again.
Step 209, receiving a response corresponding to the advertisement traffic from the back-end server, and returning the response to the user.
Step 210, send the data packet of the channel deleting instruction to the back-end server on the channel to be terminated currently, and at the same time, move out the channel in the channel linked list and release the channel object.
In practical application, the gateway server sends the/sys/delete_channel data packet to the back-end server, and simultaneously moves out the current channel from the local channel linked list and releases the object, after the back-end server receives the/sys/delete_channel data packet, the gateway server finds the channel to be destroyed from the channel linked list, moves out the linked list and releases the channel object, wherein the interactive data of the destroyed channel occurs on the channel to be destroyed at present instead of the channel number 0, thus ensuring that the data before the channel is processed.
According to the method, a data packet containing a channel establishing instruction of a new channel ID to be established is sent to a back-end server, then a response after the back-end server is successfully established is received, a channel object corresponding to the new channel ID is established according to the response, and finally a channel linked list in the TCP connection object is formed according to the N channel objects established, so that the aim of establishing a plurality of channel objects on a single TCP connection is fulfilled; the method can also reduce the bot connection generated by frequent TCP connection establishment/termination in the system by sending a data packet of a channel deleting instruction to a back-end server on a channel to be terminated at present and simultaneously moving out the channel in a channel linked list and releasing a channel object, thereby reducing the consumption of kernel resources and improving the connection number capacity of the system.
A third embodiment of the present invention relates to a TCP-based multiplexing network data transmission apparatus, referring to fig. 3, comprising:
the receiving module is used for receiving the advertisement request sent by the user and acquiring a data packet containing the advertisement request;
the acquisition module is used for: acquiring a TCP connection object with the shortest total request queue, acquiring a channel object with the shortest request queue in a channel linked list corresponding to the TCP connection object, acquiring a channel ID corresponding to the channel object, and writing the channel ID into a data packet of an advertisement request;
and the determining module is used for determining the MTP data packet according to the data packet of the advertisement request written in the channel ID and sending the MTP data packet to the back-end server.
It is to be noted that this embodiment is a system example corresponding to the first embodiment, and can be implemented in cooperation with the first embodiment. The related technical details mentioned in the first embodiment are still valid in this embodiment, and in order to reduce repetition, a detailed description is omitted here. Accordingly, the related art details mentioned in the present embodiment can also be applied to the first embodiment.
It should be noted that each module in this embodiment is a logic module, and in practical application, one logic unit may be one physical unit, or may be a part of one physical unit, or may be implemented by a combination of multiple physical units. In addition, in order to highlight the innovative part of the present invention, units that are not so close to solving the technical problem presented by the present invention are not introduced in the present embodiment, but this does not indicate that other units are not present in the present embodiment.
A fourth embodiment of the present invention relates to a TCP-based multiplexing network data transmission system, referring to fig. 4, including at least one gateway server and a plurality of back-end servers, where the plurality of back-end servers are respectively connected to the gateway server; the gateway server comprises a multiplexing network data transmission device based on TCP, the back-end server is mainly responsible for analyzing the MTP data packet containing the advertisement request after receiving the MTP data packet containing the advertisement request, analyzing a channel ID and the advertisement request, processing the advertisement request and generating a response corresponding to the advertisement request, generating a response MTP data packet containing the response according to the response and the channel ID, and finally transmitting the MTP data packet containing the response to the gateway server on the channel; the back-end server is also responsible for establishing a new channel object by using the received new channel ID after the back-end server receives the/sys/new_channel data packet, wherein the object comprises information such as a request/response data packet queue and the like, adding the new channel object into a channel linked list for storage, and responding to the gateway server to tell that the channel establishment is successful; the back-end server is also responsible for finding the channel to be destroyed from the channel linked list after receiving the/sys/delete_channel data packet, removing the linked list and releasing the channel object.
A fifth embodiment of the present invention relates to a terminal, referring to fig. 5, including:
at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the TCP-based multiplexed network data transmission method as described above.
Where the memory and the processor are connected by a bus, the bus may comprise any number of interconnected buses and bridges, the buses connecting the various circuits of the one or more processors and the memory together. The bus may also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art, and therefore, will not be described any further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or may be a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor is transmitted over the wireless medium via the antenna, which further receives the data and transmits the data to the processor.
The processor is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And memory may be used to store data used by the processor in performing operations.
A sixth embodiment of the present invention relates to a computer readable storage medium storing a computer program which, when executed by a processor, implements the above-described method embodiments.
That is, it will be understood by those skilled in the art that all or part of the steps in implementing the methods of the embodiments described above may be implemented by a program stored in a storage medium, where the program includes several instructions for causing a device (which may be a single-chip microcomputer, a chip or the like) or a processor (processor) to perform all or part of the steps in the methods of the embodiments described herein. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In summary, the invention can reduce the TCP connection handle number of the operating system under the same network traffic load, and effectively alleviate the problem that the operating system cannot establish more new connections due to the limitation of the handle resource number; the method can also process concurrency on the same TCP connection, effectively eliminates the multiple network interaction cost of establishing/destroying a plurality of TCP connections, reduces the time consumption of service request processing, and improves the throughput efficiency of the system as a whole; the invention also reduces the bot connection generated by frequent TCP connection establishment/termination in the system, thereby reducing the consumption of kernel resources and improving the connection number capacity of the system. Therefore, the invention effectively overcomes various defects in the prior art and has high industrial utilization value.
The above embodiments are merely illustrative of the principles of the present invention and its effectiveness, and are not intended to limit the invention. Modifications and variations may be made to the above-described embodiments by those skilled in the art without departing from the spirit and scope of the invention. Accordingly, it is intended that all equivalent modifications and variations of the invention be covered by the claims, which are within the ordinary skill of the art, be within the spirit and scope of the present disclosure.

Claims (10)

1. A multiplexing network data transmission method based on TCP, which is applied to a gateway server, comprising the following steps:
receiving an advertisement request sent by a user and acquiring a data packet containing the advertisement request;
acquiring a TCP connection object with the shortest total request queue;
acquiring a channel object with the shortest request queue in a channel linked list corresponding to the TCP connection object;
obtaining a channel ID corresponding to the channel object and writing the channel ID into a data packet of the advertisement request;
and determining an MTP data packet according to the data packet of the advertisement request after writing the channel ID, and sending the MTP data packet to a back-end server.
2. A method for data transmission over a TCP-based multiplexed network according to claim 1, wherein: the channel ID comprises a TCP connection quad and a self-increment sequence, wherein the TCP connection quad comprises a local IP, a local PORT, a remote IP and a remote PORT, and a channel with the self-increment number of 0 is a special channel.
3. A method for data transmission over a TCP-based multiplexed network according to claim 2, wherein: the No. 0 channel is automatically established after the gateway server establishes TCP connection with the back-end service, wherein the automatic establishment is carried out without negotiation through request response.
4. A method of data transmission in a TCP-based multiplexed network according to claim 3, wherein: before receiving an advertisement request sent by a user and acquiring a data packet containing the advertisement request, the method comprises the following steps:
generating a data packet containing a channel establishing instruction of a new channel ID to be established, and sending the data packet to a back-end server through a No. 0 channel;
receiving a response after the successful establishment of the back-end server, and establishing a channel object corresponding to the new channel ID according to the response;
and forming a channel linked list in the TCP connection object according to the N times of established channel objects.
5. A method for data transmission over a TCP-based multiplexed network according to claim 1, wherein: after the MTP data packet is sent to the back-end server, the method further includes:
and receiving a response corresponding to the advertisement traffic sent from the back-end server, and returning the response to the user.
6. A method of TCP-based multiplexed network data transmission according to claim 5, wherein: after receiving a response from the backend server corresponding to the advertisement traffic and returning the response to the user, the method comprises:
and sending a data packet of a channel deleting instruction to a back-end server on a channel to be terminated currently, and simultaneously moving the channel out of a channel linked list and releasing a channel object.
7. A TCP-based multiplexed network data transmission apparatus, characterized in that: a built-in gateway server comprising:
the receiving module is used for receiving an advertisement request sent by a user and acquiring a data packet containing the advertisement request;
the acquisition module is used for: acquiring a TCP connection object with the shortest total request queue, acquiring a channel object with the shortest request queue in a channel linked list corresponding to the TCP connection object, acquiring a channel ID corresponding to the channel object, and writing the channel ID into a data packet of the advertisement request;
and the determining module is used for determining an MTP data packet according to the data packet of the advertisement request written in the channel ID and sending the MTP data packet to the back-end server.
8. A TCP-based multiplexed network data transmission system, characterized by: the system comprises at least one gateway server and a plurality of back-end servers, wherein the back-end servers are respectively connected with the gateway server;
wherein said gateway server comprises the TCP-based multiplexed network data transmission apparatus of claim 7.
9. A terminal, comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a TCP-based multiplexed network data transmission method according to any one of claims 1 to 6.
10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements a TCP-based multiplexed network data transmission method according to any one of claims 1 to 6.
CN202310099710.3A 2023-02-08 2023-02-08 Multiplexing network data transmission method and system based on TCP Pending CN116155971A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310099710.3A CN116155971A (en) 2023-02-08 2023-02-08 Multiplexing network data transmission method and system based on TCP

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310099710.3A CN116155971A (en) 2023-02-08 2023-02-08 Multiplexing network data transmission method and system based on TCP

Publications (1)

Publication Number Publication Date
CN116155971A true CN116155971A (en) 2023-05-23

Family

ID=86350307

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310099710.3A Pending CN116155971A (en) 2023-02-08 2023-02-08 Multiplexing network data transmission method and system based on TCP

Country Status (1)

Country Link
CN (1) CN116155971A (en)

Similar Documents

Publication Publication Date Title
JP7112919B2 (en) Smart device task processing method and device
CN110300050A (en) Information push method, device, computer equipment and storage medium
US9537786B2 (en) Method, device, and system for information processing based on distributed buses
US8069251B2 (en) System and/or method for client-driven server load distribution
US9774651B2 (en) Method and apparatus for rapid data distribution
CN109152094B (en) Wireless network connection method for terminal
CN108055311B (en) HTTP asynchronous request method, device, server, terminal and storage medium
US10609125B2 (en) Method and system for transmitting communication data
CN102904959A (en) Network accelerating method and gateway
CN103139157A (en) Network communication method based on socket, device and system
CN108156223A (en) A kind of accurate supplying system of message based on websocket and method
CN102594886B (en) Method and device for direct communication between browsers, and communication system
CN109327511A (en) A kind of data request method and server based on http protocol
CN113259415B (en) Network message processing method and device and network server
CN114124929A (en) Cross-network data processing method and device
CN112689012A (en) Cross-network proxy communication method and device
CN106686635B (en) Data transmission method and device based on control and configuration protocol of wireless access point
WO2024067529A1 (en) Rdma-based link establishment method and apparatus, and device and storage medium
CN111131470B (en) Terminal device, data processing method thereof and data processing system
CN113259408A (en) Data transmission method and system
JP2009157786A (en) Message transmission control method, message transmission control device, and message transmission control program
CN116155971A (en) Multiplexing network data transmission method and system based on TCP
CN113810264B (en) Information transmission method, device, electronic equipment and storage medium
Chika et al. Financial stock application using websocket in Real Time Application
CN111477229B (en) Voice recognition request processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination